directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] directory-kerby git commit: DIRKRB-683 - Support "-q" (query) option for the Kadmin script
Date Fri, 12 Jan 2018 10:09:08 GMT
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/1296f52d
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/1296f52d
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/1296f52d

Branch: refs/heads/1.1.x-fixes
Commit: 1296f52d81a291418b8dc1892e40ee26008b8f32
Parents: 83c2933
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Jan 8 14:34:42 2018 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Jan 12 10:03:40 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/1296f52d/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/1296f52d/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/1296f52d/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