You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2016/08/22 09:30:34 UTC
[36/50] [abbrv] karaf git commit: [KARAF-3859]bin/client script
should go in interactive way to prompt the password when the -u option is
used
[KARAF-3859]bin/client script should go in interactive way to prompt the password when the -u option is used
(cherry picked from commit 3c308312f166b69772ae9a3da28891b1e7547043)
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/8ab40e4b
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/8ab40e4b
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/8ab40e4b
Branch: refs/heads/master
Commit: 8ab40e4b31b88ee8fe6a77959c15572126458d6b
Parents: 6b95590
Author: Freeman Fang <fr...@gmail.com>
Authored: Wed Aug 17 14:30:14 2016 +0800
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Mon Aug 22 11:29:21 2016 +0200
----------------------------------------------------------------------
.../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/8ab40e4b/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));
+ }
}
}