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

lutoff
15.06.2007 dba093e971f1dd1e52cb524ab831c8fe98844f2e
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsServiceCliMain.java
@@ -223,22 +223,42 @@
    String pwd  = argParser.getBindPassword(dn,out,err) ;
    // Try to connect
    String ldapUrl = "ldap://"+host+":"+port;
   InitialLdapContext ctx = null;
   ReturnCode returnCode = ReturnCode.SUCCESSFUL ;
    try
    InitialLdapContext ctx = null;
    ReturnCode returnCode = ReturnCode.SUCCESSFUL;
    if (argParser.useSSL())
    {
      ctx = ConnectionUtils.createLdapContext(ldapUrl, dn, pwd,
          ConnectionUtils.getDefaultLDAPTimeout(), null);
      String ldapsUrl = "ldaps://" + host + ":" + port;
      try
      {
        ctx = ConnectionUtils.createLdapsContext(ldapsUrl,
            dn, pwd, ConnectionUtils.getDefaultLDAPTimeout(), null,
             argParser.getTrustManager());
      }
      catch (NamingException e)
      {
        int msgID = MSGID_ADMIN_CANNOT_CONNECT_TO_ADS;
        String message = getMessage(msgID, host);
        err.println(wrapText(message, MAX_LINE_WIDTH));
        return ReturnCode.CANNOT_CONNECT_TO_ADS.getReturnCode();
      }
    }
    catch (NamingException e)
    else
    {
      int    msgID   = MSGID_ADMIN_CANNOT_CONNECT_TO_ADS;
      String message = getMessage(msgID, host);
      String ldapUrl = "ldap://" + host + ":" + port;
      try
      {
        ctx = ConnectionUtils.createLdapContext(ldapUrl, dn, pwd,
            ConnectionUtils.getDefaultLDAPTimeout(), null);
      }
      catch (NamingException e)
      {
        int msgID = MSGID_ADMIN_CANNOT_CONNECT_TO_ADS;
        String message = getMessage(msgID, host);
      err.println(wrapText(message, MAX_LINE_WIDTH));
      return ReturnCode.CANNOT_CONNECT_TO_ADS.getReturnCode();
        err.println(wrapText(message, MAX_LINE_WIDTH));
        return ReturnCode.CANNOT_CONNECT_TO_ADS.getReturnCode();
      }
    }
    ADSContext adsContext = new ADSContext(ctx);