mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
30.42.2006 7108ca0f3c0f50b238af68d678ab87a6bf0bf8e7
opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -41,6 +41,7 @@
import org.opends.server.protocols.asn1.ASN1Writer;
import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp;
import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.protocols.ldap.UnbindRequestProtocolOp;
@@ -175,6 +176,7 @@
    StringArgument    authzID;
    StringArgument    bindDN;
    StringArgument    bindPW;
    StringArgument    controlStr;
    StringArgument    currentPW;
    StringArgument    ldapHost;
    StringArgument    newPW;
@@ -319,6 +321,13 @@
      argParser.addArgument(sslTrustStorePINFile);
      controlStr =
           new StringArgument("control", 'J', "control", false, true, true,
                    "{controloid[:criticality[:value|::b64value|:<fileurl]]}",
                    null, null, MSGID_DESCRIPTION_CONTROLS);
      argParser.addArgument(controlStr);
      showUsage = new BooleanArgument("help", 'H', "help",
                                      MSGID_LDAPPWMOD_DESCRIPTION_USAGE);
      argParser.addArgument(showUsage);
@@ -479,6 +488,26 @@
    }
    // If a control string was provided, then decode the requested controls.
    ArrayList<LDAPControl> controls = new ArrayList<LDAPControl>();
    if(controlStr.isPresent())
    {
      for (String ctrlString : controlStr.getValues())
      {
        LDAPControl ctrl = LDAPToolUtils.getControl(ctrlString, err);
        if(ctrl == null)
        {
          int    msgID   = MSGID_TOOL_INVALID_CONTROL_STRING;
          String message = getMessage(msgID, ctrlString);
          err.println(wrapText(message, MAX_LINE_WIDTH));
          err.println(argParser.getUsage());
          return 1;
        }
        controls.add(ctrl);
      }
    }
    // Perform a basic Directory Server bootstrap if appropriate.
    if (initializeServer)
    {
@@ -604,7 +633,8 @@
         new ExtendedRequestProtocolOp(OID_PASSWORD_MODIFY_REQUEST,
                                       requestValue);
    LDAPMessage requestMessage =
         new LDAPMessage(nextMessageID.getAndIncrement(), extendedRequest);
         new LDAPMessage(nextMessageID.getAndIncrement(), extendedRequest,
                         controls);
    // Send the request to the server and read the response.