directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject directory-kerby git commit: Debug option and usage fixup for the tools
Date Sun, 09 Aug 2015 00:30:29 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 3abac0273 -> 1a1fa0e24


Debug option and usage fixup for the tools


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

Branch: refs/heads/master
Commit: 1a1fa0e24b1999f93219ce045b0554aec6508414
Parents: 3abac02
Author: drankye <kai.zheng@intel.com>
Authored: Sun Aug 9 08:30:13 2015 +0800
Committer: Drankye <drankye@gmail.com>
Committed: Sun Aug 9 08:30:13 2015 +0800

----------------------------------------------------------------------
 kerby-dist/kdc-dist/bin/kadmin.cmd              |  2 +-
 kerby-dist/kdc-dist/bin/kadmin.sh               |  2 +-
 kerby-dist/kdc-dist/bin/kdcinit.cmd             |  2 +-
 kerby-dist/kdc-dist/bin/kdcinit.sh              |  2 +-
 kerby-dist/tool-dist/bin/kinit.cmd              |  2 +-
 kerby-dist/tool-dist/bin/kinit.sh               |  2 +-
 kerby-dist/tool-dist/bin/klist.cmd              |  2 +-
 kerby-dist/tool-dist/bin/klist.sh               |  2 +-
 .../kerby/kerberos/kdc/KerbyKdcServer.java      | 12 ++-
 .../kerby/kerberos/tool/kinit/KinitTool.java    | 80 ++++++++++----------
 .../kerby/kerberos/tool/klist/KlistTool.java    | 42 +++++-----
 .../kerby/kerberos/tool/kadmin/KadminTool.java  | 10 ++-
 .../kerberos/tool/kdcinit/KdcInitTool.java      | 15 ++--
 13 files changed, 95 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/kdc-dist/bin/kadmin.cmd
----------------------------------------------------------------------
diff --git a/kerby-dist/kdc-dist/bin/kadmin.cmd b/kerby-dist/kdc-dist/bin/kadmin.cmd
index 64ebaef..bd8820e 100644
--- a/kerby-dist/kdc-dist/bin/kadmin.cmd
+++ b/kerby-dist/kdc-dist/bin/kadmin.cmd
@@ -21,7 +21,7 @@ set DEBUG=
 set args=%*
 for %%a in (%*) do (
   if -D == %%a (
-    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n
+    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y
     set args=%args:-D=%
   )
 )

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/kdc-dist/bin/kadmin.sh
----------------------------------------------------------------------
diff --git a/kerby-dist/kdc-dist/bin/kadmin.sh b/kerby-dist/kdc-dist/bin/kadmin.sh
index eabadb3..7c22f82 100644
--- a/kerby-dist/kdc-dist/bin/kadmin.sh
+++ b/kerby-dist/kdc-dist/bin/kadmin.sh
@@ -21,7 +21,7 @@ DEBUG=
 args=
 for var in $*; do
   if [ $var == "-D" ]; then
-    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n"
+    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y"
   else
     args="$args $var"
   fi

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/kdc-dist/bin/kdcinit.cmd
----------------------------------------------------------------------
diff --git a/kerby-dist/kdc-dist/bin/kdcinit.cmd b/kerby-dist/kdc-dist/bin/kdcinit.cmd
index 18930f1..5fec076 100644
--- a/kerby-dist/kdc-dist/bin/kdcinit.cmd
+++ b/kerby-dist/kdc-dist/bin/kdcinit.cmd
@@ -21,7 +21,7 @@ set DEBUG=
 set args=%*
 for %%a in (%*) do (
   if -D == %%a (
-    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,suspend=n
+    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,suspend=y
     set args=%args:-D=%
   )
 )

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/kdc-dist/bin/kdcinit.sh
----------------------------------------------------------------------
diff --git a/kerby-dist/kdc-dist/bin/kdcinit.sh b/kerby-dist/kdc-dist/bin/kdcinit.sh
index 5434256..8681112 100644
--- a/kerby-dist/kdc-dist/bin/kdcinit.sh
+++ b/kerby-dist/kdc-dist/bin/kdcinit.sh
@@ -21,7 +21,7 @@ DEBUG=
 args=
 for var in $*; do
   if [ $var == "-D" ]; then
-    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,suspend=n"
+    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,suspend=y"
   else
     args="$args $var"
   fi

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/tool-dist/bin/kinit.cmd
----------------------------------------------------------------------
diff --git a/kerby-dist/tool-dist/bin/kinit.cmd b/kerby-dist/tool-dist/bin/kinit.cmd
index e290f43..0aa91aa 100644
--- a/kerby-dist/tool-dist/bin/kinit.cmd
+++ b/kerby-dist/tool-dist/bin/kinit.cmd
@@ -21,7 +21,7 @@ set DEBUG=
 set args=%*
 for %%a in (%*) do (
   if -D == %%a (
-    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=n
+    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=y
     set args=%args:-D=%
   )
 )

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/tool-dist/bin/kinit.sh
----------------------------------------------------------------------
diff --git a/kerby-dist/tool-dist/bin/kinit.sh b/kerby-dist/tool-dist/bin/kinit.sh
index a5a0fdb..8ad3f31 100644
--- a/kerby-dist/tool-dist/bin/kinit.sh
+++ b/kerby-dist/tool-dist/bin/kinit.sh
@@ -21,7 +21,7 @@ DEBUG=
 args=
 for var in $*; do
   if [ $var == "-D" ]; then
-    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=n"
+    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=y"
   else
     args="$args $var"
   fi

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/tool-dist/bin/klist.cmd
----------------------------------------------------------------------
diff --git a/kerby-dist/tool-dist/bin/klist.cmd b/kerby-dist/tool-dist/bin/klist.cmd
index 33c1006..768e054 100644
--- a/kerby-dist/tool-dist/bin/klist.cmd
+++ b/kerby-dist/tool-dist/bin/klist.cmd
@@ -21,7 +21,7 @@ set DEBUG=
 set args=%*
 for %%a in (%*) do (
   if -D == %%a (
-    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8004,server=y,suspend=n
+    set DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8004,server=y,suspend=y
     set args=%args:-D=%
   )
 )

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-dist/tool-dist/bin/klist.sh
----------------------------------------------------------------------
diff --git a/kerby-dist/tool-dist/bin/klist.sh b/kerby-dist/tool-dist/bin/klist.sh
index 7f14ae0..a81de88 100644
--- a/kerby-dist/tool-dist/bin/klist.sh
+++ b/kerby-dist/tool-dist/bin/klist.sh
@@ -21,7 +21,7 @@ DEBUG=
 args=
 for var in $*; do
   if [ $var == "-D" ]; then
-    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8004,server=y,suspend=n"
+    DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8004,server=y,suspend=y"
   else
     args="$args $var"
   fi

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/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 720e393..9207b9f 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
@@ -23,6 +23,7 @@ import org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.Kadmin;
 import org.apache.kerby.kerberos.kerb.server.KdcServer;
+import org.apache.kerby.util.OSUtil;
 
 import java.io.File;
 
@@ -48,9 +49,11 @@ public class KerbyKdcServer extends KdcServer {
         kadmin.checkBuiltinPrincipals();
     }
 
-    private static final String USAGE = "Usage: sh bin/start-kdc.sh [conf-dir] [working-dir]
\n"
-        + "\tExample:\n"
-        + "\t\tsh bin/start-kdc.sh conf /tmp\n";
+    private static  final String USAGE = OSUtil.isWindows() ?
+            "Usage: bin/start-kdc.cmd" : "Usage: sh bin/start-kdc.sh"
+            + " [conf-dir] [working-dir] \n"
+            + "\tExample:\n"
+            + "\t\tsh bin/start-kdc.sh conf runtime\n";
 
     public static void main(String[] args) throws KrbException {
         if (args.length != 3) {
@@ -78,10 +81,11 @@ public class KerbyKdcServer extends KdcServer {
             server.init();
         } catch (KrbException e) {
             System.err.println("Errors occurred when start kdc server:  " + e.getMessage());
-            return;
+            System.exit(4);
         }
 
         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/1a1fa0e2/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 7f31e48..6b89402 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
@@ -26,6 +26,7 @@ import org.apache.kerby.kerberos.kerb.client.KrbClient;
 import org.apache.kerby.kerberos.kerb.client.KrbOption;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.apache.kerby.kerberos.tool.ToolUtil;
+import org.apache.kerby.util.OSUtil;
 import org.apache.kerby.util.SysUtil;
 
 import java.io.Console;
@@ -38,38 +39,39 @@ import java.util.Scanner;
  */
 public class KinitTool {
 
-    private static final String USAGE =
-            "Usage: sh bin/kinit.sh [-conf conf_dir] [-V] [-l lifetime] [-s start_time]\n"
-                    + "\t\t[-r renewable_life] [-f | -F] [-p | -P] -n [-a | -A] [-C] [-E]\n"
-                    + "\t\t[-v] [-R] [-k [-i|-t keytab_file]] [-c cachename]\n"
-                    + "\t\t[-S service_name] [-T ticket_armor_cache]\n"
-                    + "\t\t[-X <attribute>[=<value>]] <principal>\n\n"
-                    + "\tDESCRIPTION:\n"
-                    + "\t\tkinit obtains and caches an initial ticket-granting ticket for
principal.\n\n"
-                    + "\tOPTIONS:\n"
-                    + "\t\t-V verbose\n"
-                    + "\t\t-l lifetime\n"
-                    + "\t\t--s start time\n"
-                    + "\t\t-r renewable lifetime\n"
-                    + "\t\t-f forwardable\n"
-                    + "\t\t-F not forwardable\n"
-                    + "\t\t-p proxiable\n"
-                    + "\t\t-P not proxiable\n"
-                    + "\t\t-n anonymous\n"
-                    + "\t\t-a include addresses\n"
-                    + "\t\t-A do not include addresses\n"
-                    + "\t\t-v validate\n"
-                    + "\t\t-R renew\n"
-                    + "\t\t-C canonicalize\n"
-                    + "\t\t-E client is enterprise principal name\n"
-                    + "\t\t-k use keytab\n"
-                    + "\t\t-i use default client keytab (with -k)\n"
-                    + "\t\t-t filename of keytab to use\n"
-                    + "\t\t-c Kerberos 5 cache name\n"
-                    + "\t\t-S service\n"
-                    + "\t\t-T armor credential cache\n"
-                    + "\t\t-X <attribute>[=<value>]\n"
-                    + "\n";
+    private static final String USAGE = OSUtil.isWindows() ?
+            "Usage: bin/kinit.cmd" : "Usage: sh bin/kinit.sh"
+            + " [-conf conf_dir] [-V] [-l lifetime] [-s start_time]\n"
+            + "\t\t[-r renewable_life] [-f | -F] [-p | -P] -n [-a | -A] [-C] [-E]\n"
+            + "\t\t[-v] [-R] [-k [-i|-t keytab_file]] [-c cachename]\n"
+            + "\t\t[-S service_name] [-T ticket_armor_cache]\n"
+            + "\t\t[-X <attribute>[=<value>]] <principal>\n\n"
+            + "\tDESCRIPTION:\n"
+            + "\t\tkinit obtains and caches an initial ticket-granting ticket for principal.\n\n"
+            + "\tOPTIONS:\n"
+            + "\t\t-V verbose\n"
+            + "\t\t-l lifetime\n"
+            + "\t\t--s start time\n"
+            + "\t\t-r renewable lifetime\n"
+            + "\t\t-f forwardable\n"
+            + "\t\t-F not forwardable\n"
+            + "\t\t-p proxiable\n"
+            + "\t\t-P not proxiable\n"
+            + "\t\t-n anonymous\n"
+            + "\t\t-a include addresses\n"
+            + "\t\t-A do not include addresses\n"
+            + "\t\t-v validate\n"
+            + "\t\t-R renew\n"
+            + "\t\t-C canonicalize\n"
+            + "\t\t-E client is enterprise principal name\n"
+            + "\t\t-k use keytab\n"
+            + "\t\t-i use default client keytab (with -k)\n"
+            + "\t\t-t filename of keytab to use\n"
+            + "\t\t-c Kerberos 5 cache name\n"
+            + "\t\t-S service\n"
+            + "\t\t-T armor credential cache\n"
+            + "\t\t-X <attribute>[=<value>]\n"
+            + "\n";
 
 
     private static void printUsage(String error) {
@@ -122,16 +124,17 @@ public class KinitTool {
         try {
             krbClient = getClient(confDir);
         } catch (KrbException e) {
-            e.printStackTrace();
+            System.err.println("Create krbClient failed: " + e.getMessage());
+            System.exit(1);
         }
 
-        TgtTicket tgt;
+        TgtTicket tgt = null;
         try {
             tgt = krbClient.requestTgtWithOptions(
                     ToolUtil.convertOptions(ktOptions));
         } catch (KrbException e) {
-            System.err.println("Authentication failed");
-            return;
+            System.err.println("Authentication failed: " + e.getMessage());
+            System.exit(1);
         }
 
         File ccacheFile;
@@ -147,7 +150,8 @@ public class KinitTool {
         try {
             krbClient.storeTicket(tgt, ccacheFile);
         } catch (KrbException e) {
-            e.printStackTrace();
+            System.err.println("Store ticket failed: " + e.getMessage());
+            System.exit(1);
         }
         System.out.println("Successfully requested and stored ticket in "
                 + ccacheFile.getAbsolutePath());
@@ -207,7 +211,7 @@ public class KinitTool {
             printUsage("No principal is specified");
         }
 
-        KinitTool.requestTicket(principal, ktOptions);
+        requestTicket(principal, ktOptions);
         System.exit(0);
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/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 6e57359..9725e87 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
@@ -27,6 +27,7 @@ import org.apache.kerby.kerberos.kerb.keytab.Keytab;
 import org.apache.kerby.kerberos.kerb.keytab.KeytabEntry;
 import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.util.HexUtil;
+import org.apache.kerby.util.OSUtil;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -42,26 +43,27 @@ import java.util.List;
  */
 public class KlistTool {
 
-    private static  final String USAGE =
-            "Usage: sh bin/klist.sh [-e] [-V] [[-c] [-l] [-A] [-d] [-f] [-s] "
-                    + "[-a [-n]]] [-k [-t] [-K]] [name]\n"
-                    + "\t-c specifies credentials cache\n"
-                    + "\t-k specifies keytab\n"
-                    + "\t   (Default is credentials cache)\n"
-                    + "\t-i uses default client keytab if no name given\n"
-                    + "\t-l lists credential caches in collection\n"
-                    + "\t-A shows content of all credential caches\n"
-                    + "\t-e shows the encryption type\n"
-                    + "\t-V shows the Kerberos version and exits\n"
-                    + "\toptions for credential caches:\n"
-                    + "\t\t-d shows the submitted authorization data types\n"
-                    + "\t\t-f shows credentials flags\n"
-                    + "\t\t-s sets exit status based on valid tgt existence\n"
-                    + "\t\t-a displays the address list\n"
-                    + "\t\t\t-n do not reverse-resolve\n"
-                    + "\toptions for keytabs:\n"
-                    + "\t\t-t shows keytab entry timestamps\n"
-                    + "\t\t-K shows keytab entry keys\n";
+    private static  final String USAGE = OSUtil.isWindows() ?
+            "Usage: bin/klist.cmd" : "Usage: sh bin/klist.sh"
+            + " [-e] [-V] [[-c] [-l] [-A] [-d] [-f] [-s] "
+            + "[-a [-n]]] [-k [-t] [-K]] [name]\n"
+            + "\t-c specifies credentials cache\n"
+            + "\t-k specifies keytab\n"
+            + "\t   (Default is credentials cache)\n"
+            + "\t-i uses default client keytab if no name given\n"
+            + "\t-l lists credential caches in collection\n"
+            + "\t-A shows content of all credential caches\n"
+            + "\t-e shows the encryption type\n"
+            + "\t-V shows the Kerberos version and exits\n"
+            + "\toptions for credential caches:\n"
+            + "\t\t-d shows the submitted authorization data types\n"
+            + "\t\t-f shows credentials flags\n"
+            + "\t\t-s sets exit status based on valid tgt existence\n"
+            + "\t\t-a displays the address list\n"
+            + "\t\t\t-n do not reverse-resolve\n"
+            + "\toptions for keytabs:\n"
+            + "\t\t-t shows keytab entry timestamps\n"
+            + "\t\t-K shows keytab entry keys\n";
 
     // option "-k" hava a optional parameter, "/etc/krb5.keytab" if not specified
     private static String keytabFilePath = null;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/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 1f5f955..d453225 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
@@ -33,6 +33,7 @@ import org.apache.kerby.kerberos.tool.kadmin.command.KeytabRemoveCommand;
 import org.apache.kerby.kerberos.tool.kadmin.command.ListPrincipalCommand;
 import org.apache.kerby.kerberos.tool.kadmin.command.ModifyPrincipalCommand;
 import org.apache.kerby.kerberos.tool.kadmin.command.RenamePrincipalCommand;
+import org.apache.kerby.util.OSUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -86,8 +87,9 @@ public class KadminTool {
             + "list_requests, lr, ?     List available requests.\n"
             + "quit, exit, q            Exit program.";
 
-    private static final String USAGE =
-        "Usage: sh bin/kadmin.sh [conf-dir] [-c cache_name]|[-k keytab]\n"
+    private static  final String USAGE = OSUtil.isWindows() ?
+            "Usage: bin/kadmin.cmd" : "Usage: sh bin/kadmin.sh"
+            + " [conf-dir] [-c cache_name]|[-k keytab]\n"
             + "\tExample:\n"
             + "\t\tsh bin/kadmin.sh conf -k /home/admin.keytab\n";
 
@@ -209,7 +211,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)) {
@@ -222,7 +224,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 {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1a1fa0e2/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
index f194ce2..c2d1e68 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.tool.kdcinit;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.Kadmin;
+import org.apache.kerby.util.OSUtil;
 
 import java.io.File;
 
@@ -31,10 +32,12 @@ public class KdcInitTool {
     private Kadmin kadmin;
     private static File keytabFile;
 
-    private static final String USAGE = "Usage: kdcinit [conf-dir] [output-keytab]\n"
-        + "\tThis tool initializes KDC backend and should only be performed the first time,\n"
-        + "\tand the output keytab should be carefully kept to administrate/kadmin KDC later.\nExample:\n"
-        + "\t\tbin/kdcinit.sh conf /home/admin.keytab\n";
+    private static  final String USAGE = OSUtil.isWindows() ?
+            "Usage: bin/kdcinit.cmd" : "Usage: sh bin/kdcinit.sh"
+            + " [conf-dir] [output-keytab]\n"
+            + "\tThis tool initializes KDC backend and should only be performed the first
time,\n"
+            + "\tand the output keytab should be carefully kept to administrate/kadmin KDC
later.\nExample:\n"
+            + "\t\tbin/kdcinit.sh conf /home/admin.keytab\n";
 
     void initKdc(File confDir) throws KrbException {
         kadmin = new Kadmin(confDir);
@@ -81,8 +84,8 @@ public class KdcInitTool {
         try {
             kdcInitTool.initKdc(confDir);
         } catch (KrbException e) {
-          System.err.println("Errors occurred when init the kdc " + e.getMessage());
-          System.exit(1);
+            System.err.println("Errors occurred when init the kdc " + e.getMessage());
+            System.exit(1);
         }
 
         System.out.println("Finished initializing the KDC backend");


Mime
View raw message