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-462 Enhance kadmin to support add random key principal.
Date Fri, 20 Nov 2015 08:03:49 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 675d5c06f -> c7b42ba52


DIRKRB-462 Enhance kadmin to support add random key principal.


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

Branch: refs/heads/master
Commit: c7b42ba52bfe746e1efceac7f2b147a28a487c16
Parents: 675d5c0
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Fri Nov 20 16:10:10 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Fri Nov 20 16:10:10 2015 +0800

----------------------------------------------------------------------
 .../kadmin/command/AddPrincipalCommand.java     | 38 ++++++++++++--------
 1 file changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/c7b42ba5/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
index 90e9b16..f19d65c 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
@@ -71,22 +71,32 @@ public class AddPrincipalCommand extends KadminCommand {
             return;
         }
         String principal = commands[commands.length - 1];
-        String password;
-        if (kOptions.contains(KadminOption.PW)) {
-            password = kOptions.getStringOption(KadminOption.PW);
-        } else {
-            password = getPassword(principal);
-        }
 
-        if (password == null) {
-            return;
-        }
+        if (kOptions.contains(KadminOption.RANDKEY)) {
+            try {
+                getKadmin().addPrincipal(principal, kOptions);
+            } catch (KrbException e) {
+                System.err.println("Fail to add principal \"" + principal + "\"." + e.getMessage());
+            }
+        } else {
 
-        try {
-            getKadmin().addPrincipal(principal, password, kOptions);
-            System.out.println("Principal \"" + principal + "\" created.");
-        } catch (KrbException e) {
-            System.err.println("Fail to add principal \"" + principal + "\"." + e.getMessage());
+            String password;
+            if (kOptions.contains(KadminOption.PW)) {
+                password = kOptions.getStringOption(KadminOption.PW);
+            } else {
+                password = getPassword(principal);
+            }
+
+            if (password == null) {
+                return;
+            }
+
+            try {
+                getKadmin().addPrincipal(principal, password, kOptions);
+                System.out.println("Principal \"" + principal + "\" created.");
+            } catch (KrbException e) {
+                System.err.println("Fail to add principal \"" + principal + "\"." + e.getMessage());
+            }
         }
     }
 


Mime
View raw message