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: Do not exit after kdc started and add some logs.
Date Mon, 10 Aug 2015 02:35:15 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master b26f031c1 -> 1aa698808


Do not exit after kdc started and add some logs.


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

Branch: refs/heads/master
Commit: 1aa698808e1f2d0d35097713c8abfe5e573e087a
Parents: b26f031
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Mon Aug 10 10:40:44 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Mon Aug 10 10:40:44 2015 +0800

----------------------------------------------------------------------
 .../identitybackend/LdapIdentityBackend.java    |  1 +
 .../ZookeeperIdentityBackend.java               |  2 +-
 .../kerby/kerberos/kdc/KerbyKdcServer.java      |  1 -
 .../kerby/kerberos/kerb/admin/Kadmin.java       | 20 ++++++++++++++++----
 .../kerby/kerberos/kerb/client/KrbHandler.java  |  3 ++-
 5 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1aa69880/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
index 27ccc40..3c9c39e 100644
--- a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
+++ b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
@@ -126,6 +126,7 @@ public class LdapIdentityBackend extends AbstractIdentityBackend {
             LOG.error("Failed to close connection with LDAP", e);
             throw new KrbException("Failed to close connection with LDAP", e);
         }
+         LOG.info("closed connection with LDAP.");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1aa69880/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
b/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
index 0abc413..a85476f 100644
--- a/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
+++ b/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
@@ -87,7 +87,7 @@ public class ZookeeperIdentityBackend extends AbstractIdentityBackend {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        LOG.info("Zookeeper stopped.");
+        LOG.info("Zookeeper session closed.");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1aa69880/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java b/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
index c04c45f..70c87d9 100644
--- a/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
+++ b/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
@@ -86,6 +86,5 @@ public class KerbyKdcServer extends KdcServer {
 
         server.start();
         System.out.println("KDC started.");
-        System.exit(0);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1aa69880/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
index 9901450..b838892 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
@@ -32,6 +32,8 @@ import org.apache.kerby.kerberos.kerb.server.KdcSetting;
 import org.apache.kerby.kerberos.kerb.server.KdcUtil;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
 import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -46,6 +48,8 @@ import java.util.regex.PatternSyntaxException;
  * Server side admin facilities.
  */
 public class Kadmin {
+    private static final Logger LOG = LoggerFactory.getLogger(Kadmin.class);
+
     private final KdcSetting kdcSetting;
     private final IdentityBackend backend;
 
@@ -117,8 +121,12 @@ public class Kadmin {
     public void checkBuiltinPrincipals() throws KrbException {
         String tgsPrincipal = getTgsPrincipal();
         String kadminPrincipal = getKadminPrincipal();
-        if (backend.getIdentity(tgsPrincipal) == null || backend.getIdentity(kadminPrincipal)
== null) {
-            throw new KrbException("The built-in principals do not exist in backend, please
run the kdcinit tool.");
+        if (backend.getIdentity(tgsPrincipal) == null
+            || backend.getIdentity(kadminPrincipal) == null) {
+            String errorMsg = "The built-in principals do not exist in backend,"
+                + " please run the kdcinit tool.";
+            LOG.error(errorMsg);
+            throw new KrbException(errorMsg);
         }
     }
 
@@ -130,14 +138,18 @@ public class Kadmin {
         if (backend.getIdentity(tgsPrincipal) == null) {
             addPrincipal(tgsPrincipal);
         } else {
-            throw new KrbException("The tgs principal already exists in backend.");
+            String errorMsg = "The tgs principal already exists in backend.";
+            LOG.error(errorMsg);
+            throw new KrbException(errorMsg);
         }
 
         String kadminPrincipal = getKadminPrincipal();
         if (backend.getIdentity(kadminPrincipal) == null) {
             addPrincipal(kadminPrincipal);
         } else {
-            throw new KrbException("The kadmin principal already exists in backend.");
+            String errorMsg = "The kadmin principal already exists in backend.";
+            LOG.error(errorMsg);
+            throw new KrbException(errorMsg);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1aa69880/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
index 8dd9f13..4191265 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
@@ -111,7 +111,7 @@ public abstract class KrbHandler {
             kdcRequest.processResponse((KdcRep) kdcRep);
         } else if (messageType == KrbMessageType.KRB_ERROR) {
             KrbError error = (KrbError) kdcRep;
-            LOG.info("KDC server responsed with message: "
+            LOG.info("KDC server response with message: "
                     + error.getErrorCode().getMessage());
             if (error.getErrorCode() == KrbErrorCode.KDC_ERR_PREAUTH_REQUIRED) {
                 MethodData methodData = KrbCodec.decode(error.getEdata(), MethodData.class);
@@ -131,6 +131,7 @@ public abstract class KrbHandler {
                 kdcRequest.setPreauthRequired(true);
                 kdcRequest.resetPrequthContxt();
                 handleRequest(kdcRequest);
+                LOG.info("Retry with the new kdc request including pre-authentication.");
             }
         }
     }


Mime
View raw message