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-683 - Support "-q" (query) option for the Kadmin script
Date Mon, 08 Jan 2018 14:34:55 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk ec9de35b7 -> 5c613f306


DIRKRB-683 - Support "-q" (query) option for the Kadmin script


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

Branch: refs/heads/trunk
Commit: 5c613f3068777c13d175c0ba7978056ddc3549e9
Parents: ec9de35
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Jan 8 14:34:42 2018 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Jan 8 14:34:42 2018 +0000

----------------------------------------------------------------------
 kerby-dist/kdc-dist/bin/kadmin.sh               |  5 +----
 .../kerb/admin/kadmin/KadminOption.java         |  1 +
 .../kerby/kerberos/tool/kadmin/KadminTool.java  | 22 +++++++++++++-------
 3 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5c613f30/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 5769c2e..8e54b2b 100644
--- a/kerby-dist/kdc-dist/bin/kadmin.sh
+++ b/kerby-dist/kdc-dist/bin/kadmin.sh
@@ -17,16 +17,13 @@
 # limitations under the License.
 
 DEBUG=
-args=
 for var in $*; do
   if [ X"$var" = X"-D" ]; then
     DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y"
-  else
-    args="$args $var"
   fi
 done
 
 java $DEBUG \
 -classpath target/lib/*:. \
 -DKERBY_LOGFILE=kadmin \
-org.apache.kerby.kerberos.tool.kadmin.KadminTool $args
+org.apache.kerby.kerberos.tool.kadmin.KadminTool "$@"

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5c613f30/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/KadminOption.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/KadminOption.java
b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/KadminOption.java
index f6caa87..b414436 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/KadminOption.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/KadminOption.java
@@ -37,6 +37,7 @@ public enum KadminOption implements KOption {
     KEYSALTLIST(new KOptionInfo("-e", "key saltlist", KOptionType.STR)),
     K(new KOptionInfo("-k", "keytab file path", KOptionType.STR)),
     KEYTAB(new KOptionInfo("-keytab", "keytab file path", KOptionType.STR)),
+    QUERY(new KOptionInfo("-q", "query", KOptionType.STR)),
     CCACHE(new KOptionInfo("-c", "credentials cache", KOptionType.FILE));
 
     private final KOptionInfo optionInfo;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5c613f30/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 72f6491..bc3b2e1 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
@@ -244,16 +244,22 @@ public class KadminTool {
             printUsage("No credentials cache file or keytab file for authentication.");
         }
 
-        System.out.print(PROMPT + ": ");
+        // Execute any query that was specified and exit
+        if (kOptions.contains(KadminOption.QUERY)) {
+            String query = kOptions.getStringOption(KadminOption.QUERY);
+            execute(kadmin, query);
+        } else {
+            System.out.print(PROMPT + ": ");
 
-        try (Scanner scanner = new Scanner(System.in, "UTF-8")) {
-            String input = scanner.nextLine();
+            try (Scanner scanner = new Scanner(System.in, "UTF-8")) {
+                String input = scanner.nextLine();
 
-            while (!(input.equals("quit") || input.equals("exit")
-                    || input.equals("q"))) {
-                execute(kadmin, input);
-                System.out.print(PROMPT + ": ");
-                input = scanner.nextLine();
+                while (!(input.equals("quit") || input.equals("exit")
+                        || input.equals("q"))) {
+                    execute(kadmin, input);
+                    System.out.print(PROMPT + ": ");
+                    input = scanner.nextLine();
+                }
             }
         }
     }


Mime
View raw message