karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Dutertry (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KARAF-3774) Client script does not read user from users.properties
Date Thu, 11 Jun 2015 12:53:00 GMT
Nicolas Dutertry created KARAF-3774:
---------------------------------------

             Summary: 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


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)

Mime
View raw message