directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject directory-kerby git commit: DIRKRB-666 - NPE if klist.sh is called on an empty cache
Date Fri, 03 Nov 2017 11:24:31 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk 45bbe2afe -> fcaf33ec9


DIRKRB-666 - NPE if klist.sh is called on an empty cache


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

Branch: refs/heads/trunk
Commit: fcaf33ec988747471c990f3d8109e5907745df76
Parents: 45bbe2a
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Nov 3 11:17:55 2017 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Nov 3 11:17:55 2017 +0000

----------------------------------------------------------------------
 .../kerby/kerberos/kdc/KerbyKdcServer.java      |  6 ++--
 .../kerby/kerberos/tool/klist/KlistTool.java    | 29 ++++++++++----------
 .../kerby/kerberos/tool/kadmin/KadminTool.java  |  4 +--
 3 files changed, 19 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/fcaf33ec/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 d315751..df7caa6 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
@@ -83,7 +83,7 @@ public class KerbyKdcServer extends KdcServer {
         try {
             server.init();
         } catch (KrbException e) {
-            System.err.println("Errors occurred when start kdc server:  " + e.getMessage());
+            System.err.println("Errors occurred when starting the kdc server:  " + e.getMessage());
             System.exit(4);
         }
 
@@ -91,8 +91,8 @@ public class KerbyKdcServer extends KdcServer {
             server.start();
             System.out.println("KDC started.");
         } catch (KrbException e) {
-            System.err.println("Errors occurred when start kdc server:  " + e.getMessage());
+            System.err.println("Errors occurred when starting the kdc server:  " + e.getMessage());
             System.exit(5);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/fcaf33ec/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
index 6103da0..560bfac 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
@@ -85,7 +85,6 @@ public class KlistTool {
 
     private static int printCredentialCacheInfo(KOptions klOptions) {
         CredentialCache cc = new CredentialCache();
-        List<Credential> credentials;
         InputStream cis = null;
         String fileName;
 
@@ -109,25 +108,25 @@ public class KlistTool {
             }
         }
 
-        if (cc != null) {
-            credentials = cc.getCredentials();
+        List<Credential> credentials = cc.getCredentials();
 
-            System.out.println("Ticket cache: " + fileName);
+        System.out.println("Ticket cache: " + fileName);
+        if (cc.getPrimaryPrincipal() != null) {
             System.out.println("Default principal: " + cc.getPrimaryPrincipal().getName());
+        }
 
-            if (credentials.isEmpty()) {
-                System.out.println("No credential has been cached.");
-            } else {
-                DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if (credentials.isEmpty()) {
+            System.out.println("No credential has been cached.");
+        } else {
+            DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-                System.out.println("Valid starting\t\tExpires\t\t\tService principal");
+            System.out.println("Valid starting\t\tExpires\t\t\tService principal");
 
-                for (Credential crd : credentials) {
-                    System.out.println(df.format(crd.getStartTime().getTime()) + "\t"
-                        + df.format(crd.getEndTime().getTime()) + "\t"
-                        + crd.getServerName() + "\n"
-                        + "\t" + "renew until" + "\t" + df.format(crd.getRenewTill().getTime()));
-                }
+            for (Credential crd : credentials) {
+                System.out.println(df.format(crd.getStartTime().getTime()) + "\t"
+                    + df.format(crd.getEndTime().getTime()) + "\t"
+                    + crd.getServerName() + "\n"
+                    + "\t" + "renew until" + "\t" + df.format(crd.getRenewTill().getTime()));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/fcaf33ec/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
index 42e70b6..72f6491 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
@@ -224,7 +224,7 @@ public class KadminTool {
                 AuthUtil.loginUsingTicketCache(kadminPrincipal, ccFile);
             } catch (LoginException e) {
                 System.err.println("Could not login with: " + kadminPrincipal
-                        + e.getMessage());
+                        + " " + e.getMessage());
                 return;
             }
         } else if (kOptions.contains(KadminOption.K)) {
@@ -237,7 +237,7 @@ public class KadminTool {
                 AuthUtil.loginUsingKeytab(kadminPrincipal, keyTabFile);
             } catch (LoginException e) {
                 System.err.println("Could not login with: " + kadminPrincipal
-                        + e.getMessage());
+                        + " " + e.getMessage());
                 return;
             }
         } else {


Mime
View raw message