You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2015/06/11 15:43:00 UTC

[jira] [Updated] (KARAF-3774) Client script does not read user from users.properties

     [ https://issues.apache.org/jira/browse/KARAF-3774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated KARAF-3774:
----------------------------------------
    Fix Version/s: 3.0.4

> Client script does not read user from users.properties
> ------------------------------------------------------
>
>                 Key: KARAF-3774
>                 URL: https://issues.apache.org/jira/browse/KARAF-3774
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 3.0.3
>         Environment: Windows 7
>            Reporter: Nicolas Dutertry
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 3.0.4
>
>
> 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 :
> {code}
> >client.bat
> Logging in as _g_:admingroup
> {code}
> The issue comes the following code in class org.apache.karaf.client.ClientConfig :
> {code:java}
> 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));
>     }
> }
> {code}
> It should be replaced by :
> {code:java}
> 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));
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)