Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.0.3
-
None
-
None
-
Windows 7
Description
The script client.bat should pick up user/password from file users.properties when option "-u" is missing.
But instead of reading "karaf" entry, it reads "_g_\:admingroup" as the user.
Thus we have the following output :
>client.bat Logging in as _g_:admingroup
The issue comes the following code in class org.apache.karaf.client.ClientConfig :
Properties usersCfg = loadProps(new File(System.getProperty("karaf.etc") + "/users.properties")); if (!usersCfg.isEmpty()) { if (user == null) { user = (String) usersCfg.keySet().iterator().next(); } password = (String) usersCfg.getProperty(user); if (password != null && password.contains(ROLE_DELIMITER)) { password = password.substring(0, password.indexOf(ROLE_DELIMITER)); } }
It should be replaced by :
Properties usersCfg = loadProps(new File(System.getProperty("karaf.etc") + "/users.properties")); if (!usersCfg.isEmpty()) { if (user == null) { Set keys = usersCfg.keySet(); for (Object key : keys) { String s = (String)key; if(s != null && !s.startsWith("_g_")) { user = s; break; } } } if(user != null) { password = (String) usersCfg.getProperty(user); if (password != null && password.contains(ROLE_DELIMITER)) { password = password.substring(0, password.indexOf(ROLE_DELIMITER)); } } }