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-564 Implement Add_Principal (by principal name) in Remote Kadmin. Contributed by Yan.
Date Fri, 06 May 2016 08:14:31 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/kadmin-remote 083e04591 -> 89e538089


DIRKRB-564 Implement Add_Principal (by principal name) in Remote Kadmin. Contributed by Yan.


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

Branch: refs/heads/kadmin-remote
Commit: 89e53808919daf60ecb59502b31ea06136759807
Parents: 083e045
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Fri May 6 16:19:02 2016 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Fri May 6 16:19:02 2016 +0800

----------------------------------------------------------------------
 .../kerb/admin/server/AdminServerInit.java      | 25 ++----------
 .../kerb/admin/server/kadmin/AdminServer.java   | 37 ++++++++++++------
 .../admin/server/kadmin/AdminServerHandler.java | 16 +++++++-
 .../admin/server/kadmin/AdminServerImpl.java    | 39 +++++++++++++------
 .../admin/server/kadmin/AdminServerSetting.java | 40 +++++++++++++-------
 .../admin/server/kadmin/AdminServerUtil.java    | 33 +++++++++++++---
 .../kerberos/kerb/admin/RemoteAdminTool.java    |  3 +-
 .../admin/kadmin/local/LocalKadminImpl.java     |  4 +-
 .../admin/kadmin/remote/RemoteKadminImpl.java   |  2 +-
 9 files changed, 128 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/AdminServerInit.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/AdminServerInit.java
b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/AdminServerInit.java
index 26157c1..d090ae9 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/AdminServerInit.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/AdminServerInit.java
@@ -23,7 +23,6 @@ package org.apache.kerby.kerberos.kerb.admin.server;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.AdminServer;
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.AdminServerConfig;
-import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
 import org.apache.kerby.util.OSUtil;
 
 import java.io.File;
@@ -36,7 +35,7 @@ public class AdminServerInit {
         + "\t\t"
         + (OSUtil.isWindows()
         ? "bin\\adminServer.cmd" : "sh bin/adminServer.sh")
-        + " conf\\adminServer.conf\n";
+        + " conf\n";
 
     public static void main(String[] args) throws Exception {
 
@@ -46,25 +45,9 @@ public class AdminServerInit {
         }
 
         String confDirPath = args[0];
-        File serverConfFile = new File(confDirPath);
+        AdminServer adminServer = new AdminServer(new File(confDirPath));
+        AdminServerConfig adminServerConfig = adminServer.getAdminServerConfig();
 
-        if (!serverConfFile.exists()) {
-            System.err.println("Invalid or not exist conf");
-            System.exit(2);
-        }
-
-        /**
-         * Below two lines cannot be used in jar.
-         * Because url is not hierarchical
-         */
-        //URL serverConfFileUrl = AdminServerInit.class.getResource("/adminServer.conf");
-        //File serverConfFile = new File(serverConfFileUrl.toURI());
-        AdminServerConfig adminServerConfig = new AdminServerConfig();
-        adminServerConfig.addKrb5Config(serverConfFile);
-
-        BackendConfig backendConfig = new BackendConfig();
-
-        AdminServer adminServer = new AdminServer(adminServerConfig, backendConfig);
         adminServer.setAdminHost(adminServerConfig.getAdminHost());
         adminServer.setAllowTcp(true);
         adminServer.setAllowUdp(false);
@@ -74,7 +57,7 @@ public class AdminServerInit {
             adminServer.init();
         } catch (KrbException e) {
             System.err.println("Errors occurred when start admin server:  " + e.getMessage());
-            System.exit(3);
+            System.exit(2);
         }
         adminServer.start();
         System.out.println("Admin server started!");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServer.java
b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServer.java
index 7f40e7f..d48f1be 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServer.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServer.java
@@ -25,39 +25,47 @@ import org.apache.kerby.kerberos.kerb.admin.server.kadmin.impl.DefaultInternalAd
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.impl.InternalAdminServer;
 import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
 import org.apache.kerby.kerberos.kerb.identity.backend.IdentityBackend;
+import org.apache.kerby.kerberos.kerb.server.KdcConfig;
 
 import java.io.File;
 
 /**
  * The implemented Kerberos admin admin API.
+ * We add the KdcConfig as a member variable to AdminServer,
+ * In order to make it easy to use LocalKadminImpl.
+ * The Kdc Config of corresponding KDC can be read from ConfDir.
  */
 public class AdminServer {
     private final AdminServerConfig adminServerConfig;
     private final BackendConfig backendConfig;
+    private final KdcConfig kdcConfig;
     private final AdminServerSetting adminServerSetting;
     private final KOptions startupOptions;
 
     private InternalAdminServer innerAdminServer;
 
     /**
-     * Constructor passing both kdcConfig and backendConfig.
-     * @param kdcConfig The kdc config
+     * Constructor passing adminServerConfig, kdcConfig and backendConfig.
+     * @param adminServerConfig The admin server config
      * @param backendConfig The backend config
+     * @param kdcConfig The kdc config
      * @throws KrbException e
      */
-    public AdminServer(AdminServerConfig kdcConfig,
-                     BackendConfig backendConfig) throws KrbException {
-        this.adminServerConfig = kdcConfig;
+    public AdminServer(AdminServerConfig adminServerConfig,
+                     BackendConfig backendConfig, KdcConfig kdcConfig) throws KrbException
{
+        this.adminServerConfig = adminServerConfig;
+        this.kdcConfig = kdcConfig;
         this.backendConfig = backendConfig;
         startupOptions = new KOptions();
         adminServerSetting = new AdminServerSetting(startupOptions,
-            kdcConfig, backendConfig);
+            adminServerConfig, kdcConfig, backendConfig);
     }
 
     /**
-     * Constructor given confDir where 'kdc.conf' and 'backend.conf' should be
-     * available.
-     * kdc.conf, that contains kdc admin related items.
+     * Constructor given confDir where 'adminServer.conf', 'kdc.conf' and
+     * 'backend.conf' should be available.
+     * adminServer.conf that contains adminServer related items.
+     * kdc.conf, that contains kdc related items.
      * backend.conf, that contains identity backend related items.
      *
      * @param confDir The conf dir
@@ -71,6 +79,12 @@ public class AdminServer {
         }
         this.adminServerConfig = tmpAdminServerConfig;
 
+        KdcConfig tmpKdcConfig = AdminServerUtil.getKdcConfig(confDir);
+        if (tmpKdcConfig == null) {
+            tmpKdcConfig = new KdcConfig();
+        }
+        this.kdcConfig = tmpKdcConfig;
+
         BackendConfig tmpBackendConfig = AdminServerUtil.getBackendConfig(confDir);
         if (tmpBackendConfig == null) {
             tmpBackendConfig = new BackendConfig();
@@ -80,7 +94,7 @@ public class AdminServer {
 
         startupOptions = new KOptions();
         adminServerSetting = new AdminServerSetting(startupOptions,
-            adminServerConfig, backendConfig);
+            adminServerConfig, kdcConfig, backendConfig);
     }
 
     /**
@@ -89,9 +103,10 @@ public class AdminServer {
     public AdminServer() {
         adminServerConfig = new AdminServerConfig();
         backendConfig = new BackendConfig();
+        kdcConfig = new KdcConfig();
         startupOptions = new KOptions();
         adminServerSetting = new AdminServerSetting(startupOptions,
-            adminServerConfig, backendConfig);
+            adminServerConfig, kdcConfig, backendConfig);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
index 6f7dde0..4f81328 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
@@ -19,6 +19,8 @@
  */
 package org.apache.kerby.kerberos.kerb.admin.server.kadmin;
 
+import org.apache.kerby.kerberos.kerb.admin.kadmin.local.LocalKadmin;
+import org.apache.kerby.kerberos.kerb.admin.kadmin.local.LocalKadminImpl;
 import org.apache.kerby.kerberos.kerb.admin.tool.AddPrincipalRep;
 import org.apache.kerby.kerberos.kerb.admin.tool.AdminMessageCode;
 import org.apache.kerby.kerberos.kerb.admin.tool.KadminCode;
@@ -73,8 +75,18 @@ public class AdminServerHandler {
         System.out.println("realm: " + principal[1]);
 
         /**Add principal to backend here*/
-        //LocalKadmin localKadmin = new LocalKadminImpl(adminServerContext.getAdminServerSetting());
-        //localKadmin.addPrincipal(principal[0]);
+        LocalKadmin localKadmin = new LocalKadminImpl(adminServerContext.getAdminServerSetting());
+        try {
+            localKadmin.addPrincipal(principal[0]);
+        } catch (KrbException e) {
+            String error = "principal already exist!";
+            System.out.println(error);
+            AdminMessage errorMessage = new AddPrincipalRep();
+            XdrString xdrMessage = new XdrString(error);
+            errorMessage.setMessageBuffer(ByteBuffer.wrap(xdrMessage.encode()));
+            ByteBuffer response = KadminCode.encodeMessage(errorMessage);
+            return response;
+        }
 
         String message = "add principal of " + principal[0];
         //content to reply remain to construct

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerImpl.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerImpl.java
b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerImpl.java
index ecb61e8..d873323 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerImpl.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerImpl.java
@@ -25,6 +25,7 @@ import org.apache.kerby.kerberos.kerb.admin.server.kadmin.impl.DefaultInternalAd
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.impl.InternalAdminServer;
 import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
 import org.apache.kerby.kerberos.kerb.identity.backend.IdentityBackend;
+import org.apache.kerby.kerberos.kerb.server.KdcConfig;
 import org.apache.kerby.kerberos.kerb.server.KdcServerOption;
 import org.apache.kerby.kerberos.kerb.server.KdcUtil;
 
@@ -34,25 +35,30 @@ import java.io.File;
  * The implemented Kerberos Server API.
  */
 public class AdminServerImpl {
-    private final AdminServerConfig kdcConfig;
+    private final AdminServerConfig adminServerConfig;
+    private final KdcConfig kdcConfig;
     private final BackendConfig backendConfig;
-    private final AdminServerSetting kdcSetting;
+    private final AdminServerSetting adminServerSetting;
     private final KOptions startupOptions;
 
     private InternalAdminServer innerKdc;
 
     /**
-     * Constructor passing both kdcConfig and backendConfig.
+     * Constructor passing both adminServerConfig and backendConfig.
+     * @param adminServerConfig The adminServer config
      * @param kdcConfig The kdc config
      * @param backendConfig The backend config
      * @throws KrbException e
      */
-    public AdminServerImpl(AdminServerConfig kdcConfig,
+    public AdminServerImpl(AdminServerConfig adminServerConfig,
+                           KdcConfig kdcConfig,
                            BackendConfig backendConfig) throws KrbException {
+        this.adminServerConfig = adminServerConfig;
         this.kdcConfig = kdcConfig;
         this.backendConfig = backendConfig;
         startupOptions = new KOptions();
-        kdcSetting = new AdminServerSetting(startupOptions, kdcConfig, backendConfig);
+        adminServerSetting = new AdminServerSetting(startupOptions, adminServerConfig,
+            kdcConfig, backendConfig);
     }
 
     /**
@@ -69,7 +75,13 @@ public class AdminServerImpl {
         if (tmpAdminServerConfig == null) {
             tmpAdminServerConfig = new AdminServerConfig();
         }
-        this.kdcConfig = tmpAdminServerConfig;
+        this.adminServerConfig = tmpAdminServerConfig;
+
+        KdcConfig tmpKdcConfig = AdminServerUtil.getKdcConfig(confDir);
+        if (tmpKdcConfig == null) {
+            tmpKdcConfig = new KdcConfig();
+        }
+        this.kdcConfig = tmpKdcConfig;
 
         BackendConfig tmpBackendConfig = KdcUtil.getBackendConfig(confDir);
         if (tmpBackendConfig == null) {
@@ -79,17 +91,20 @@ public class AdminServerImpl {
         this.backendConfig = tmpBackendConfig;
 
         startupOptions = new KOptions();
-        kdcSetting = new AdminServerSetting(startupOptions, kdcConfig, backendConfig);
+        adminServerSetting = new AdminServerSetting(startupOptions, adminServerConfig,
+            kdcConfig, backendConfig);
     }
 
     /**
      * Default constructor.
      */
     public AdminServerImpl() {
-        kdcConfig = new AdminServerConfig();
+        adminServerConfig = new AdminServerConfig();
+        kdcConfig = new KdcConfig();
         backendConfig = new BackendConfig();
         startupOptions = new KOptions();
-        kdcSetting = new AdminServerSetting(startupOptions, kdcConfig, backendConfig);
+        adminServerSetting = new AdminServerSetting(startupOptions, adminServerConfig,
+            kdcConfig, backendConfig);
     }
 
     /**
@@ -176,7 +191,7 @@ public class AdminServerImpl {
      * @return setting
      */
     public AdminServerSetting getAdminServerSetting() {
-        return kdcSetting;
+        return adminServerSetting;
     }
 
     /**
@@ -184,7 +199,7 @@ public class AdminServerImpl {
      * @return AdminServerConfig
      */
     public AdminServerConfig getAdminServerConfig() {
-        return kdcConfig;
+        return adminServerConfig;
     }
 
     /**
@@ -217,7 +232,7 @@ public class AdminServerImpl {
             innerKdc = (InternalAdminServer) startupOptions.getOptionValue(
                     KdcServerOption.INNER_KDC_IMPL);
         } else {
-            innerKdc = new DefaultInternalAdminServerImpl(kdcSetting);
+            innerKdc = new DefaultInternalAdminServerImpl(adminServerSetting);
         }
 
         innerKdc.init();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerSetting.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerSetting.java
b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerSetting.java
index 62a99fb..a8dba48 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerSetting.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerSetting.java
@@ -31,25 +31,29 @@ import org.apache.kerby.kerberos.kerb.server.ServerSetting;
 public class AdminServerSetting implements ServerSetting {
     private final KOptions startupOptions;
     private final AdminServerConfig adminServerConfig;
+    private final KdcConfig kdcConfig;
     private final BackendConfig backendConfig;
 
     /**
      * AdminServerSetting constructor
      * @param startupOptions startup options
-     * @param config admin configuration
+     * @param adminServerConfig admin configuration
+     * @param kdcConfig kdc configuration
      * @param backendConfig backend configuration
      */
     public AdminServerSetting(KOptions startupOptions,
-                              AdminServerConfig config, 
+                              AdminServerConfig adminServerConfig,
+                              KdcConfig kdcConfig,
                               BackendConfig backendConfig) {
         this.startupOptions = startupOptions;
-        this.adminServerConfig = config;
+        this.adminServerConfig = adminServerConfig;
+        this.kdcConfig = kdcConfig;
         this.backendConfig = backendConfig;
     }
 
     public AdminServerSetting(AdminServerConfig adminServerConfig, 
-                              BackendConfig backendConfig) {
-        this(new KOptions(), adminServerConfig, backendConfig);
+                              BackendConfig backendConfig, KdcConfig kdcConfig) {
+        this(new KOptions(), adminServerConfig, kdcConfig, backendConfig);
     }
 
     /**
@@ -60,17 +64,25 @@ public class AdminServerSetting implements ServerSetting {
         return adminServerConfig;
     }
 
-  @Override
-  public String getKdcRealm() {
-    return null;
-  }
+    /**
+     * Get the realm of KDC of Admin Server.
+     * @return the realm of KDC
+     */
+    @Override
+    public String getKdcRealm() {
+         return kdcConfig.getKdcRealm();
+    }
 
-  @Override
-  public KdcConfig getKdcConfig() {
-    return null;
-  }
+    /**
+     * Get the KDC config of Admin server.
+     * @return the KDC configuration
+     */
+    @Override
+    public KdcConfig getKdcConfig() {
+        return kdcConfig;
+    }
 
-  /**
+    /**
      * Get the backend config.
      * @return backend configuration
      */

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerUtil.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerUtil.java
b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerUtil.java
index cda74bc..bd70cc9 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerUtil.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerUtil.java
@@ -23,6 +23,7 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
 import org.apache.kerby.kerberos.kerb.identity.backend.IdentityBackend;
 import org.apache.kerby.kerberos.kerb.identity.backend.MemoryIdentityBackend;
+import org.apache.kerby.kerberos.kerb.server.KdcConfig;
 import org.apache.kerby.kerberos.kerb.transport.TransportPair;
 
 import java.io.File;
@@ -37,22 +38,44 @@ public final class AdminServerUtil {
     private AdminServerUtil() { }
 
     /**
+     * Get adminServer configuration
+     * @param confDir configuration directory
+     * @return adminServer configuration
+     * @throws KrbException e.
+     */
+    public static AdminServerConfig getAdminServerConfig(File confDir) throws KrbException
{
+        File adminServerConfFile = new File(confDir, "adminServer.conf");
+        if (adminServerConfFile.exists()) {
+            AdminServerConfig adminServerConfig = new AdminServerConfig();
+            try {
+                adminServerConfig.addKrb5Config(adminServerConfFile);
+            } catch (IOException e) {
+                throw new KrbException("Can not load the adminServer configuration file "
+                        + adminServerConfFile.getAbsolutePath());
+            }
+            return adminServerConfig;
+        }
+
+        return null;
+    }
+
+    /**
      * Get kdc configuration
      * @param confDir configuration directory
      * @return kdc configuration
      * @throws KrbException e.
      */
-    public static AdminServerConfig getAdminServerConfig(File confDir) throws KrbException
{
+    public static KdcConfig getKdcConfig(File confDir) throws KrbException {
         File kdcConfFile = new File(confDir, "kdc.conf");
         if (kdcConfFile.exists()) {
-            AdminServerConfig adminServerConfig = new AdminServerConfig();
+            KdcConfig kdcConfig = new KdcConfig();
             try {
-                adminServerConfig.addKrb5Config(kdcConfFile);
+                kdcConfig.addKrb5Config(kdcConfFile);
             } catch (IOException e) {
                 throw new KrbException("Can not load the kdc configuration file "
-                        + kdcConfFile.getAbsolutePath());
+                    + kdcConfFile.getAbsolutePath());
             }
-            return adminServerConfig;
+            return kdcConfig;
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/RemoteAdminTool.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/RemoteAdminTool.java
b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/RemoteAdminTool.java
index 6f7965e..9faf8fd 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/RemoteAdminTool.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/RemoteAdminTool.java
@@ -76,7 +76,7 @@ public class RemoteAdminTool {
         try (Scanner scanner = new Scanner(System.in, "UTF-8")) {
             String input = scanner.nextLine();
 
-            while (!input.equals("quit") || !input.equals("exit") || !input.equals("q"))
{
+            while (!(input.equals("quit") || input.equals("exit") || input.equals("q")))
{
                 excute(adminClient, input);
                 input = scanner.nextLine();
             }
@@ -98,7 +98,6 @@ public class RemoteAdminTool {
                 String adminRealm = adminClient.getAdminConfig().getAdminRealm();
                 String clientPrincipal = temp[1] + "@" + adminRealm;
                 adminClient.requestAddPrincial(clientPrincipal);
-                System.out.println("add remote principal success.");
             }
 
         } else {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/local/LocalKadminImpl.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/local/LocalKadminImpl.java
b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/local/LocalKadminImpl.java
index 8eb197b..657ad6d 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/local/LocalKadminImpl.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/local/LocalKadminImpl.java
@@ -185,9 +185,7 @@ public class LocalKadminImpl implements LocalKadmin {
         principal = fixPrincipal(principal);
         KrbIdentity identity = AdminHelper.createIdentity(principal, kOptions);
         List<EncryptionKey> keys = EncryptionUtil.generateKeys(
-                getKdcConfig().getEncryptionTypes()); //null point. because KDC is not started.
It's OK
-        // not getAdminServerConfig()?
-        // not. adminserver calls addPrincipal, and the local kadmin will interact with backend,
which is KDC
+                getKdcConfig().getEncryptionTypes());
         identity.addKeys(keys);
         backend.addIdentity(identity);
         System.out.println("add backend success"); //delete

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/89e53808/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/RemoteKadminImpl.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/RemoteKadminImpl.java
b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/RemoteKadminImpl.java
index ad8022e..e74567b 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/RemoteKadminImpl.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/RemoteKadminImpl.java
@@ -71,7 +71,7 @@ public class RemoteKadminImpl implements Kadmin {
 
 
     @Override
-    public String getKadminPrincipal() { //think again. can be this easy?
+    public String getKadminPrincipal() {
         String name = innerClient.getSetting().getAdminConfig().getAdminHost();
         return name;
     }


Mime
View raw message