directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-641 Implement kinit -k -i. Contributed by Lin Zeng.
Date Wed, 02 Aug 2017 05:19:06 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/1.0.x-fixes 7e50956a8 -> 69708a379


DIRKRB-641 Implement kinit -k -i. Contributed by Lin Zeng.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/69708a37
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/69708a37
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/69708a37

Branch: refs/heads/1.0.x-fixes
Commit: 69708a3790ca53780f4e4f32d30850b3b462364a
Parents: 7e50956
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Wed Aug 2 13:17:22 2017 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Wed Aug 2 13:18:43 2017 +0800

----------------------------------------------------------------------
 .../apache/kerby/kerberos/kerb/client/KrbOption.java   |  2 +-
 .../kerb/client/request/AsRequestWithKeytab.java       | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/69708a37/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbOption.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbOption.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbOption.java
index 61e6cd4..91de491 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbOption.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbOption.java
@@ -61,7 +61,7 @@ public enum KrbOption implements KOption {
     USER_PASSWD(new KOptionInfo("user-passwd", "User plain password")),
 
     USE_KEYTAB(new KOptionInfo("-k", "use keytab")),
-    USE_DFT_KEYTAB(new KOptionInfo("use-dft-keytab", "use default client keytab (with -k)")),
+    USE_DFT_KEYTAB(new KOptionInfo("-i", "use default client keytab (with -k)")),
     KEYTAB_FILE(new KOptionInfo("-t", "filename of keytab to use",
         KOptionType.FILE)),
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/69708a37/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequestWithKeytab.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequestWithKeytab.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequestWithKeytab.java
index b6d1653..7726a26 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequestWithKeytab.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequestWithKeytab.java
@@ -46,6 +46,19 @@ public class AsRequestWithKeytab extends AsRequest {
             keytabFile = kOptions.getFileOption(KrbOption.KEYTAB_FILE);
         }
 
+        if (kOptions.contains(KrbOption.USE_DFT_KEYTAB)) {
+            final String clientKeytabEnv = System.getenv("KRB5_CLIENT_KTNAME");
+            final String clientKeytabDft = getContext().getConfig().getString(
+                "default_client_keytab_name");
+            if (clientKeytabEnv != null) {
+                keytabFile = new File(clientKeytabEnv);
+            } else if (clientKeytabDft != null) {
+                keytabFile = new File(clientKeytabDft);
+            } else {
+                System.err.println("Default client keytab file not found.");
+            }
+        }
+
         Keytab keytab = null;
         try {
             keytab =  Keytab.loadKeytab(keytabFile);


Mime
View raw message