Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3774

Client script does not read user from users.properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.3
    • 3.0.4
    • 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));
              }
          }
      }
      

      Attachments

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            nicolas.dutertry Nicolas Dutertry
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: