Fix associated with issue 3871.
Use the correct methods in ConnectionUtils to generate the LDAP urls to be used to connect to the server.
| | |
| | | SortedSet<InetAddress> addresses = desc.getAddresses(); |
| | | if (addresses.size() == 0) { |
| | | if (port > 0) { |
| | | url = "ldaps://localhost:" + port; |
| | | url = ConnectionUtils.getLDAPUrl("localhost", port, true); |
| | | } |
| | | } else { |
| | | if (port > 0) { |
| | | InetAddress address = addresses.first(); |
| | | url = "ldaps://" + |
| | | ConnectionUtils.getHostNameForLdapUrl(address.getHostAddress()) + ":" |
| | | + port; |
| | | String a = address.getHostAddress(); |
| | | url = ConnectionUtils.getLDAPUrl(a, port, true); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | usedUrl = |
| | | "ldaps://"+hostName.getText().trim()+":"+port.getText().trim(); |
| | | usedUrl = ConnectionUtils.getLDAPUrl(hostName.getText().trim(), |
| | | new Integer(port.getText().trim()), true); |
| | | ctx = Utils.createLdapsContext(usedUrl, dn.getText(), |
| | | String.valueOf(pwd.getPassword()), |
| | | Utils.getDefaultLDAPTimeout(), null, |