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-391 Fix throw KrbException problem when authentication fails. Contributed by Yaning.
Date Thu, 06 Aug 2015 07:52:46 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 60c85faff -> c04d154e7


DIRKRB-391 Fix throw KrbException problem when authentication fails. Contributed by Yaning.


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

Branch: refs/heads/master
Commit: c04d154e79a20a5bd5fc012a8221662709f28746
Parents: 60c85fa
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Thu Aug 6 15:58:33 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Thu Aug 6 15:58:33 2015 +0800

----------------------------------------------------------------------
 .../kerby/kerberos/tool/kinit/KinitTool.java    | 25 ++++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/c04d154e/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
index 896a1e4..7f31e48 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
@@ -101,7 +101,7 @@ public class KinitTool {
     }
 
     private static void requestTicket(String principal,
-                                      KOptions ktOptions) throws Exception {
+                                      KOptions ktOptions) {
         ktOptions.add(KinitOption.CLIENT_PRINCIPAL, principal);
 
         File confDir = null;
@@ -118,12 +118,19 @@ public class KinitTool {
             ktOptions.add(KinitOption.USER_PASSWD, password);
         }
 
-        KrbClient krbClient = getClient(confDir);
-        TgtTicket tgt = krbClient.requestTgtWithOptions(
-                ToolUtil.convertOptions(ktOptions));
+        KrbClient krbClient = null;
+        try {
+            krbClient = getClient(confDir);
+        } catch (KrbException e) {
+            e.printStackTrace();
+        }
 
-        if (tgt == null) {
-            System.err.println("Requesting TGT failed.");
+        TgtTicket tgt;
+        try {
+            tgt = krbClient.requestTgtWithOptions(
+                    ToolUtil.convertOptions(ktOptions));
+        } catch (KrbException e) {
+            System.err.println("Authentication failed");
             return;
         }
 
@@ -137,7 +144,11 @@ public class KinitTool {
             ccacheFile = new File(SysUtil.getTempDir(), ccacheName);
         }
 
-        krbClient.storeTicket(tgt, ccacheFile);
+        try {
+            krbClient.storeTicket(tgt, ccacheFile);
+        } catch (KrbException e) {
+            e.printStackTrace();
+        }
         System.out.println("Successfully requested and stored ticket in "
                 + ccacheFile.getAbsolutePath());
     }


Mime
View raw message