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

Jean-Noël Rouvignac
12.10.2016 e55031aae085330b0d7b841d40cb1064c6c15867
opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
@@ -558,8 +558,8 @@
     *            The UID to be used to generate the DN.
     * @return The DN of the administrator for the given UID.
     */
    public static String getAdministratorDN(String uid) {
        return RDN.valueOf("cn=" + uid) + ",cn=Administrators, cn=admin data";
    public static DN getAdministratorDN(String uid) {
        return DN.valueOf(RDN.valueOf("cn=" + uid) + ",cn=Administrators, cn=admin data");
    }
    /**
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
@@ -94,7 +94,7 @@
   * @throws NamingException
   *           If an error occurs
   */
  public ConnectionWrapper(String ldapUrl, Type connectionType, String bindDn, String bindPwd, int connectTimeout,
  public ConnectionWrapper(String ldapUrl, Type connectionType, DN bindDn, String bindPwd, int connectTimeout,
      TrustManager trustManager) throws NamingException
  {
    this(toHostPort(ldapUrl), connectionType, bindDn, bindPwd, connectTimeout, trustManager, null);
@@ -140,7 +140,7 @@
   * @throws NamingException
   *           If an error occurs
   */
  public ConnectionWrapper(HostPort hostPort, Type connectionType, String bindDn, String bindPwd, int connectTimeout,
  public ConnectionWrapper(HostPort hostPort, Type connectionType, DN bindDn, String bindPwd, int connectTimeout,
      TrustManager trustManager) throws NamingException
  {
    this(hostPort, connectionType, bindDn, bindPwd, connectTimeout, trustManager, null);
@@ -156,7 +156,7 @@
   */
  public ConnectionWrapper(ConnectionWrapper other) throws NamingException
  {
    this(other.hostPort, other.connectionType, other.bindDn.toString(), other.bindPwd, other.connectTimeout,
    this(other.hostPort, other.connectionType, other.bindDn, other.bindPwd, other.connectTimeout,
        other.trustManager, other.keyManager);
  }
@@ -180,12 +180,12 @@
   * @throws NamingException
   *           If an error occurs
   */
  public ConnectionWrapper(HostPort hostPort, PreferredConnection.Type connectionType, String bindDn, String bindPwd,
  public ConnectionWrapper(HostPort hostPort, PreferredConnection.Type connectionType, DN bindDn, String bindPwd,
      int connectTimeout, TrustManager trustManager, KeyManager keyManager) throws NamingException
  {
    this.hostPort = hostPort;
    this.connectionType = connectionType;
    this.bindDn = DN.valueOf(bindDn);
    this.bindDn = bindDn;
    this.bindPwd = bindPwd;
    this.connectTimeout = connectTimeout;
    this.trustManager = trustManager;
@@ -197,7 +197,7 @@
    connection = buildConnection();
  }
  private static Options toOptions(Type connectionType, String bindDn, String bindPwd, long connectTimeout,
  private static Options toOptions(Type connectionType, DN bindDn, String bindPwd, long connectTimeout,
      TrustManager trustManager, KeyManager keyManager) throws NamingException
  {
    final boolean isStartTls = START_TLS.equals(connectionType);
@@ -211,7 +211,7 @@
             .set(SSL_USE_STARTTLS, isStartTls);
    }
    SimpleBindRequest request = bindDn != null && bindPwd != null
        ? newSimpleBindRequest(bindDn, bindPwd.toCharArray())
        ? newSimpleBindRequest(bindDn.toString(), bindPwd.toCharArray())
        : newSimpleBindRequest(); // anonymous bind
    options.set(AUTHN_BIND_REQUEST, request);
    return options;
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
@@ -217,7 +217,7 @@
    {
      lastLdapUrl = connection.getLDAPURL();
      ConnectionWrapper conn =
          new ConnectionWrapper(lastLdapUrl, connection.getType(), dn.toString(), pwd, timeout, trustManager);
          new ConnectionWrapper(lastLdapUrl, connection.getType(), dn, pwd, timeout, trustManager);
      if (conn.getLdapContext() != null)
      {
        return conn;
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/LDAPConnectionPool.java
@@ -394,7 +394,7 @@
  {
    final HostPort hostPort = new HostPort(ldapUrl.getHost(), ldapUrl.getPort());
    final Type connectiontype = isSecureLDAPUrl(ldapUrl) ? LDAPS : LDAP;
    return new ConnectionWrapper(hostPort, connectiontype, ar.dn.toString(), ar.password,
    return new ConnectionWrapper(hostPort, connectiontype, ar.dn, ar.password,
        getConnectTimeout(), getTrustManager(), getKeyManager());
  }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -40,6 +40,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.ConfigurationFramework;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.DN;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.guitools.controlpanel.browser.IconPool;
@@ -102,7 +103,7 @@
  private String ldapsURL;
  private String adminConnectorURL;
  private String localAdminConnectorURL;
  private String lastWorkingBindDN;
  private DN lastWorkingBindDN;
  private String lastWorkingBindPwd;
  private String lastRemoteHostName;
  private String lastRemoteAdministrationURL;
@@ -297,7 +298,7 @@
    this.connWrapper = connWrapper;
    if (connWrapper != null)
    {
      lastWorkingBindDN = connWrapper.getBindDn().toString();
      lastWorkingBindDN = connWrapper.getBindDn();
      lastWorkingBindPwd = connWrapper.getBindPassword();
      lastRemoteHostName = connWrapper.getHostPort().getHost();
      lastRemoteAdministrationURL = connWrapper.getLdapUrl();
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
@@ -1197,8 +1197,7 @@
          {
            if (getInfo().getUserDataDirContext() == null)
            {
              ConnectionWrapper connUserData =
                  createUserDataDirContext(conn.getBindDn().toString(), conn.getBindPassword());
              ConnectionWrapper connUserData = createUserDataDirContext(conn.getBindDn(), conn.getBindPassword());
              getInfo().setUserDataDirContext(connUserData);
            }
            final NamingException[] fNe = { null };
@@ -1412,7 +1411,7 @@
   * @throws ConfigReadException
   *           if an error occurs reading the configuration.
   */
  private ConnectionWrapper createUserDataDirContext(final String bindDN, final String bindPassword)
  private ConnectionWrapper createUserDataDirContext(final DN bindDN, final String bindPassword)
      throws NamingException, IOException, ConfigReadException
  {
    createdUserDataConn = null;
@@ -1529,7 +1528,7 @@
   * @param bindPassword
   *          the bind password.
   */
  private void handleCertificateException(UserDataCertificateException ce, String bindDN, String bindPassword)
  private void handleCertificateException(UserDataCertificateException ce, DN bindDN, String bindPassword)
      throws NamingException, IOException, ConfigReadException
  {
    CertificateDialog dlg = new CertificateDialog(null, ce);
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -538,16 +538,18 @@
          ConnectionWrapper conn = null;
          try
          {
            DN bindDn = DN.valueOf(dn.getText());
            String bindPwd = String.valueOf(pwd.getPassword());
            if (isLocal)
            {
              usedUrl = info.getAdminConnectorURL();
              conn = Utilities.getAdminDirContext(info, dn.getText(), String.valueOf(pwd.getPassword()));
              conn = Utilities.getAdminDirContext(info, bindDn, bindPwd);
            }
            else
            {
              HostPort hostPort = new HostPort(hostName.getText().trim(), Integer.valueOf(port.getText().trim()));
              usedUrl = ConnectionUtils.getLDAPUrl(hostPort, true);
              conn = new ConnectionWrapper(hostPort, LDAPS, dn.getText(), String.valueOf(pwd.getPassword()),
              conn = new ConnectionWrapper(hostPort, LDAPS, bindDn, bindPwd,
                  info.getConnectTimeout(), info.getTrustManager());
              checkVersion(conn);
            }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LoginPanel.java
@@ -35,6 +35,7 @@
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.guitools.controlpanel.datamodel.ConfigReadException;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.util.BackgroundTask;
import org.opends.guitools.controlpanel.util.Utilities;
@@ -185,29 +186,11 @@
          ConnectionWrapper conn = null;
          try
          {
            usedUrl = getInfo().getAdminConnectorURL();
            conn = Utilities.getAdminDirContext(getInfo(), dn.getText(), String.valueOf(pwd.getPassword()));
            ControlPanelInfo info = getInfo();
            usedUrl = info.getAdminConnectorURL();
            conn = Utilities.getAdminDirContext(info, DN.valueOf(dn.getText()), String.valueOf(pwd.getPassword()));
            if (getInfo().getConnection() != null)
            {
              try
              {
                getInfo().getConnection().close();
              }
              catch (Throwable t)
              {
              }
            }
            if (getInfo().getUserDataDirContext() != null)
            {
              try
              {
                getInfo().getUserDataDirContext().close();
              }
              catch (Throwable t)
              {
              }
            }
            org.forgerock.util.Utils.closeSilently(info.getConnection(), info.getUserDataDirContext());
            try
            {
              Thread.sleep(500);
@@ -224,9 +207,9 @@
                    INFO_CTRL_PANEL_READING_CONFIGURATION_SUMMARY.get());
              }
            });
            getInfo().setConnection(conn);
            getInfo().setUserDataDirContext(null);
            getInfo().regenerateDescriptor();
            info.setConnection(conn);
            info.setUserDataDirContext(null);
            info.regenerateDescriptor();
            return conn;
          } catch (Throwable t)
          {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
@@ -2140,7 +2140,7 @@
   * or the provided credentials do not have enough rights.
   * @throws ConfigReadException if there is an error reading the configuration.
   */
  public static ConnectionWrapper getAdminDirContext(ControlPanelInfo controlInfo, String bindDN, String pwd)
  public static ConnectionWrapper getAdminDirContext(ControlPanelInfo controlInfo, DN bindDN, String pwd)
      throws NamingException, IOException, ConfigReadException
  {
    return createConnection(controlInfo.getAdminConnectorURL(), LDAPS, bindDN, pwd, controlInfo);
@@ -2162,7 +2162,7 @@
   * @throws ConfigReadException if there is an error reading the configuration.
   */
  public static ConnectionWrapper getUserDataDirContext(ControlPanelInfo controlInfo,
      String bindDN, String pwd) throws NamingException, IOException, ConfigReadException
      DN bindDN, String pwd) throws NamingException, IOException, ConfigReadException
  {
    if (controlInfo.connectUsingStartTLS())
    {
@@ -2178,7 +2178,7 @@
    }
  }
  private static ConnectionWrapper createConnection(String usedUrl, Type connectionType, String bindDN, String bindPwd,
  private static ConnectionWrapper createConnection(String usedUrl, Type connectionType, DN bindDN, String bindPwd,
      ControlPanelInfo controlInfo) throws NamingException, IOException, ConfigReadException
  {
    if (usedUrl == null)
opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -40,6 +40,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.DN;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ServerDescriptor;
import org.opends.admin.ads.TopologyCache;
@@ -1088,7 +1089,7 @@
      int port = 389;
      String adminUid = userData.getAdminUID();
      String pwd = userData.getAdminPwd();
      String dn = ADSContext.getAdministratorDN(adminUid).toString();
      DN dn = ADSContext.getAdministratorDN(adminUid);
      info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
      String adminConnectorUrl = info.getAdminConnectorURL();
opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -39,6 +39,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.DN;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.admin.ads.util.ConnectionWrapper;
@@ -379,7 +380,7 @@
          info.regenerateDescriptor();
          ConfigFromFile conf = new ConfigFromFile();
          conf.readConfiguration();
          String dn = ADSContext.getAdministratorDN(tfUid.getText()).toString();
          DN dn = ADSContext.getAdministratorDN(tfUid.getText());
          String pwd = tfPwd.getText();
          info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
          usedUrl = info.getAdminConnectorURL();
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -2766,7 +2766,7 @@
  private ConnectionWrapper createConnection(AuthenticationData auth) throws NamingException
  {
    String ldapUrl = auth.getLdapUrl();
    String dn = auth.getDn();
    DN dn = DN.valueOf(auth.getDn());
    String pwd = auth.getPwd();
    if (auth.useSecureConnection())
@@ -3205,7 +3205,8 @@
    DataReplicationOptions.Type type = (DataReplicationOptions.Type) qs.getFieldValue(FieldName.REPLICATION_OPTIONS);
    String host = qs.getFieldStringValue(FieldName.REMOTE_SERVER_HOST);
    String dn = qs.getFieldStringValue(FieldName.REMOTE_SERVER_DN);
    String dnStr = qs.getFieldStringValue(FieldName.REMOTE_SERVER_DN);
    DN dn = dnStr != null ? DN.valueOf(dnStr) : null;
    String pwd = qs.getFieldStringValue(FieldName.REMOTE_SERVER_PWD);
    if (type != DataReplicationOptions.Type.STANDALONE)
@@ -3228,7 +3229,7 @@
        port = Integer.parseInt(sPort);
        // Try to connect
        boolean[] globalAdmin = { hasGlobalAdministrators };
        String[] effectiveDn = { dn };
        DN[] effectiveDn = { dn };
        try
        {
          updateUserDataWithADS(host, port, dn, pwd, qs, errorMsgs, globalAdmin, effectiveDn);
@@ -3264,7 +3265,7 @@
    {
      AuthenticationData auth = new AuthenticationData();
      auth.setHostPort(new HostPort("".equals(host) ? null : host, port != null ? port : 0));
      auth.setDn(dn);
      auth.setDn(dn.toString());
      auth.setPwd(pwd);
      auth.setUseSecureConnection(true);
@@ -3339,7 +3340,7 @@
    return replicationPort;
  }
  private void checkRemoteHostPortDnAndPwd(String host, String sPort, String dn, String pwd, QuickSetup qs,
  private void checkRemoteHostPortDnAndPwd(String host, String sPort, DN dn, String pwd, QuickSetup qs,
      List<LocalizableMessage> errorMsgs)
  {
    // Check host
@@ -3366,7 +3367,7 @@
    }
    // Check dn
    if (dn == null || dn.length() == 0)
    if (dn == null || dn.size() == 0)
    {
      errorMsgs.add(INFO_EMPTY_REMOTE_DN.get());
      qs.displayFieldInvalid(FieldName.REMOTE_SERVER_DN, true);
@@ -3388,8 +3389,8 @@
    }
  }
  private void updateUserDataWithADS(String host, int port, String dn, String pwd, QuickSetup qs,
      List<LocalizableMessage> errorMsgs, boolean[] hasGlobalAdministrators, String[] effectiveDn)
  private void updateUserDataWithADS(String host, int port, DN dn, String pwd, QuickSetup qs,
      List<LocalizableMessage> errorMsgs, boolean[] hasGlobalAdministrators, DN[] effectiveDn)
      throws UserDataException
  {
    host = getHostNameForLdapUrl(host);
@@ -3525,7 +3526,7 @@
    }
  }
  private ConnectionWrapper newConnectionWrapper(String dn, String pwd, String[] effectiveDn, HostPort hostPort,
  private ConnectionWrapper newConnectionWrapper(DN dn, String pwd, DN[] effectiveDn, HostPort hostPort,
      ApplicationTrustManager trustManager) throws Throwable
  {
    try
@@ -3540,7 +3541,7 @@
        throw t;
      }
      // Try using a global administrator
      dn = ADSContext.getAdministratorDN(dn).toString();
      dn = ADSContext.getAdministratorDN(dn.toString());
      effectiveDn[0] = dn;
      return new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), trustManager);
    }
@@ -4086,7 +4087,7 @@
  {
    UserData uData = getUserData();
    HostPort hostPort = new HostPort(uData.getHostName(), uData.getAdminConnectorPort());
    String dn = uData.getDirectoryManagerDn();
    DN dn = DN.valueOf(uData.getDirectoryManagerDn());
    String pwd = uData.getDirectoryManagerPwd();
    return new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), null);
  }
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ServerController.java
@@ -28,6 +28,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.DN;
import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.admin.ads.util.PreferredConnection.Type;
import org.opends.quicksetup.Application;
@@ -465,7 +466,8 @@
        {
          timeout = application.getUserData().getConnectTimeout();
        }
        try (ConnectionWrapper conn = new ConnectionWrapper(ldapUrl, Type.LDAPS, userDn, userPw, timeout, null))
        try (ConnectionWrapper conn =
            new ConnectionWrapper(ldapUrl, Type.LDAPS, DN.valueOf(userDn), userPw, timeout, null))
        {
          return;
        }
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/DisableReplicationUserData.java
@@ -12,10 +12,12 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008-2009 Sun Microsystems, Inc.
 * Portions Copyright 2014 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.tools.dsreplication;
import org.forgerock.opendj.ldap.DN;
/**
 * This class is used to store the information provided by the user to
 * disable replication.  It is required because when we are in interactive
@@ -23,7 +25,7 @@
 */
public class DisableReplicationUserData extends MonoServerReplicationUserData
{
  private String bindDn;
  private DN bindDn;
  private String bindPwd;
  private boolean disableReplicationServer;
  private boolean disableAll;
@@ -34,7 +36,7 @@
   * @return the bind DN to be used to connect to the server if no Administrator
   * has been defined.
   */
  public String getBindDn()
  public DN getBindDn()
  {
    return bindDn;
  }
@@ -44,7 +46,7 @@
   * has been defined.
   * @param bindDn the bind DN to be used.
   */
  public void setBindDn(String bindDn)
  public void setBindDn(DN bindDn)
  {
    this.bindDn = bindDn;
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/EnableReplicationUserData.java
@@ -16,6 +16,7 @@
 */
package org.opends.server.tools.dsreplication;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.HostPort;
/**
@@ -29,7 +30,7 @@
  static final class EnableReplicationServerData
  {
    private HostPort hostPort = new HostPort(null, 0);
    private String bindDn;
    private DN bindDn;
    private String pwd;
    private int replicationPort;
    private boolean secureReplication;
@@ -103,7 +104,7 @@
     *
     * @return the dn to be used to bind to this server
     */
    String getBindDn()
    DN getBindDn()
    {
      return bindDn;
    }
@@ -114,7 +115,7 @@
     * @param bindDn
     *          the dn to be used to bind to this server
     */
    void setBindDn(String bindDn)
    void setBindDn(DN bindDn)
    {
      this.bindDn = bindDn;
    }
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -1201,7 +1201,7 @@
  private ConnectionWrapper newConnectionWrapper(
      LDAPConnectionConsoleInteraction ci, Type connType, int connectTimeout) throws NamingException
  {
    return new ConnectionWrapper(getHostPort(ci), connType, ci.getBindDN(), ci.getBindPassword(),
    return new ConnectionWrapper(getHostPort(ci), connType, DN.valueOf(ci.getBindDN()), ci.getBindPassword(),
        connectTimeout, ci.getTrustManager(), ci.getKeyManager());
  }
@@ -1475,7 +1475,7 @@
    return createAdministrativeConnection(uData, getAdministratorDN(uData.getAdminUid()));
  }
  private ConnectionWrapper createAdministrativeConnection(MonoServerReplicationUserData uData, final String bindDn)
  private ConnectionWrapper createAdministrativeConnection(MonoServerReplicationUserData uData, final DN bindDn)
  {
    try
    {
@@ -2380,7 +2380,7 @@
  private void setConnectionDetails(EnableReplicationServerData serverData, LDAPConnectionConsoleInteraction serverCI)
  {
    serverData.setHostPort(getHostPort2(serverCI));
    serverData.setBindDn(serverCI.getBindDN());
    serverData.setBindDn(DN.valueOf(serverCI.getBindDN()));
    serverData.setPwd(serverCI.getBindPassword());
  }
@@ -2489,7 +2489,7 @@
      final String adminUid = sourceServerCI.getProvidedAdminUID();
      uData.setHostPort(getHostPort2(sourceServerCI));
      uData.setAdminUid(adminUid);
      uData.setBindDn(sourceServerCI.getProvidedBindDN());
      uData.setBindDn(DN.valueOf(sourceServerCI.getProvidedBindDN()));
      uData.setAdminPwd(sourceServerCI.getBindPassword());
      if (adminUid != null)
@@ -3015,7 +3015,7 @@
  {
    initialize(uData);
    final String adminDN = getAdministratorDN(uData.getAdminUid());
    final DN adminDN = getAdministratorDN(uData.getAdminUid());
    final String adminPwd = uData.getAdminPwd();
    setConnectionDetails(uData.getServer1(), argParser.server1, adminDN, adminPwd);
    setConnectionDetails(uData.getServer2(), argParser.server2, adminDN, adminPwd);
@@ -3027,7 +3027,7 @@
  }
  private void setConnectionDetails(
      EnableReplicationServerData server, ServerArgs args, String adminDN, String adminPwd)
      EnableReplicationServerData server, ServerArgs args, DN adminDN, String adminPwd)
  {
    server.setHostPort(new HostPort(
        getValueOrDefault(args.hostNameArg), getValueOrDefault(args.portArg)));
@@ -3040,12 +3040,12 @@
    }
    else
    {
      server.setBindDn(getValueOrDefault(args.bindDnArg));
      server.setBindDn(DN.valueOf(getValueOrDefault(args.bindDnArg)));
      server.setPwd(pwd);
    }
  }
  private boolean canConnectWithCredentials(EnableReplicationServerData server, String adminDN, String adminPwd)
  private boolean canConnectWithCredentials(EnableReplicationServerData server, DN adminDN, String adminPwd)
  {
    try (ConnectionWrapper validCredentials = new ConnectionWrapper(
        server.getHostPort(), connectionType, adminDN, adminPwd, getConnectTimeout(), getTrustManager(sourceServerCI)))
@@ -3095,7 +3095,7 @@
  {
    uData.setBaseDNs(toDNs(argParser.getBaseDNs()));
    String adminUid = argParser.getAdministratorUID();
    String bindDn = argParser.getBindDNToDisable();
    DN bindDn = DN.valueOf(argParser.getBindDNToDisable());
    if (bindDn == null && adminUid == null)
    {
      adminUid = argParser.getAdministratorUIDOrDefault();
@@ -3784,7 +3784,7 @@
  private ReplicationCliReturnCode disableReplication(DisableReplicationUserData uData)
  {
    print(formatter.getFormattedWithPoints(INFO_REPLICATION_CONNECTING.get()));
    String bindDn = uData.getAdminUid() != null
    DN bindDn = uData.getAdminUid() != null
        ? getAdministratorDN(uData.getAdminUid())
        : uData.getBindDn();
@@ -8088,11 +8088,11 @@
      boolean forceAddBindPwdFile1 = false;
      if (useAdminUID)
      {
        String bindDN1 = server1.getBindDn();
        DN bindDN1 = server1.getBindDn();
        String adminUID = uData.getAdminUid();
        if (bindDN1 != null
            && adminUID != null
            && !areDnsEqual(getAdministratorDN(adminUID), bindDN1))
            && !getAdministratorDN(adminUID).equals(bindDN1))
        {
          forceAddBindDN1 = true;
          forceAddBindPwdFile1 = existsArg(firstServerCommandBuilder, OPTION_LONG_BINDPWD_FILE);
@@ -8180,11 +8180,11 @@
      boolean forceAddBindPwdFile2 = false;
      if (useAdminUID)
      {
        String bindDN2 = server2.getBindDn();
        DN bindDN2 = server2.getBindDn();
        String adminUID = uData.getAdminUid();
        if (bindDN2 != null
            && adminUID != null
            && !areDnsEqual(getAdministratorDN(adminUID), bindDN2))
            && !getAdministratorDN(adminUID).equals(bindDN2))
        {
          forceAddBindDN2 = true;
          forceAddBindPwdFile2 = existsArg(interactionBuilder, OPTION_LONG_BINDPWD_FILE);
@@ -8440,7 +8440,7 @@
                    .defaultValue("cn=Directory Manager")
                    .valuePlaceholder(INFO_BINDDN_PLACEHOLDER.get())
                    .buildArgument();
    bindDN.addValue(uData.getServer1().getBindDn());
    bindDN.addValue(uData.getServer1().getBindDn().toString());
    return bindDN;
  }
@@ -8454,7 +8454,7 @@
                    .defaultValue("cn=Directory Manager")
                    .valuePlaceholder(INFO_BINDDN_PLACEHOLDER.get())
                    .buildArgument();
    bindDN.addValue(uData.getServer2().getBindDn());
    bindDN.addValue(uData.getServer2().getBindDn().toString());
    return bindDN;
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
@@ -316,7 +316,7 @@
      if (managementContextOpened)
      {
        try (ConnectionWrapper conn = Utilities.getAdminDirContext(controlInfo, bindDn, bindPwd))
        try (ConnectionWrapper conn = Utilities.getAdminDirContext(controlInfo, DN.valueOf(bindDn), bindPwd))
        {
          controlInfo.setConnection(conn);
          controlInfo.regenerateDescriptor();
opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -39,8 +39,6 @@
import javax.net.ssl.KeyManager;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.FileBasedArgument;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ApplicationKeyManager;
@@ -52,10 +50,12 @@
import org.opends.server.util.CollectionUtils;
import org.opends.server.util.SelectableCertificateKeyManager;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.CommandBuilder;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.Menu;
import com.forgerock.opendj.cli.MenuBuilder;
import com.forgerock.opendj.cli.MenuResult;
@@ -147,7 +147,7 @@
      }
      else if (providedAdminUID != null)
      {
        return getAdministratorDN(providedAdminUID);
        return getAdministratorDN(providedAdminUID).toString();
      }
      else if (bindDN != null)
      {
@@ -155,7 +155,7 @@
      }
      else if (adminUID != null)
      {
        return getAdministratorDN(adminUID);
        return getAdministratorDN(adminUID).toString();
      }
      return null;
@@ -1244,7 +1244,7 @@
    }
    else if (isAdminUidArgVisible())
    {
      return getAdministratorDN(state.adminUID);
      return getAdministratorDN(state.adminUID).toString();
    }
    else
    {