karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject karaf git commit: [KARAF-3859]bin/client script should go in interactive way to prompt the password when the -u option is used
Date Wed, 17 Aug 2016 06:30:33 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x 5894748ff -> 3c308312f


[KARAF-3859]bin/client script should go in interactive way to prompt the password when the
-u option is used


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/3c308312
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/3c308312
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/3c308312

Branch: refs/heads/karaf-4.0.x
Commit: 3c308312f166b69772ae9a3da28891b1e7547043
Parents: 5894748
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Wed Aug 17 14:30:14 2016 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Wed Aug 17 14:30:14 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/karaf/client/ClientConfig.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/3c308312/client/src/main/java/org/apache/karaf/client/ClientConfig.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/ClientConfig.java b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
index 995ee01..72bd0d4 100644
--- a/client/src/main/java/org/apache/karaf/client/ClientConfig.java
+++ b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
@@ -46,6 +46,7 @@ public class ClientConfig {
     private String file = null;
     private String keyFile = null;
     private String command;
+    private boolean interactiveMode = false;
 
     public ClientConfig(String[] args) throws IOException {
         Properties shellCfg = loadProps(new File(System.getProperty("karaf.etc"), "org.apache.karaf.shell.cfg"));
@@ -98,6 +99,8 @@ public class ClientConfig {
                         System.exit(1);
                     } else {
                         user = args[i];
+                        interactiveMode = true;
+                        password = null;//get chance to input the password with interactive
way
                     }
                 } else if (args[i].equals("-v")) {
                     level++;
@@ -180,9 +183,13 @@ public class ClientConfig {
                     user = (String) users.iterator().next();
                 }
             }
-            password = (String) usersCfg.getProperty(user);
-            if (password != null && password.contains(ROLE_DELIMITER)) {
-                password = password.substring(0, password.indexOf(ROLE_DELIMITER));
+            if (interactiveMode) {
+                password = null;
+            } else {
+                password = (String) usersCfg.getProperty(user);
+                if (password != null && password.contains(ROLE_DELIMITER)) {
+                    password = password.substring(0, password.indexOf(ROLE_DELIMITER));
+                }
             }
         }
 


Mime
View raw message