[OPENDJ-505] dsreplication enable fails when hostname contains an underscore Created: 22/May/12  Updated: 19/May/20

Status: Dev backlog
Project: OpenDJ
Component/s: replication
Affects Version/s: 2.6.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: manuelgaupp Assignee: Matthew Swift
Resolution: Unresolved Votes: 0
Labels: release-notes

Mac OS X 10.7, Java 1.6.0_31

Issue Links:
relates to OPENDJ-6624 Remove code of (old) dsreplication tool Blocked


When dsreplication enable is called with a hostname that contains an underscore, the following exception is thrown:

bin/dsreplication enable -X --host1 illegal_host_name --port1 4444 --bindDN1 "cn=Directory Manager" \
--bindPassword1 "secret" --host2 illegal_host_name --port2 5444 --bindDN2 "cn=Directory Manager" \
--bindPassword2 "secret" --secureReplication1 --secureReplication2 --replicationPort2 8990 \
-w secret -n -b "dc=example,dc=com"

Establishing connections ..... Done.
Checking registration information .....
Error updating registration information. Details: Registration information
error. Error type: 'ERROR_UNEXPECTED'. Details:
javax.naming.directory.InvalidAttributeValueException: 'hostname' has no
values.; remaining name 'cn=null:4444,cn=Servers,cn=admin data'
for a detailed log of this operation.


The reason for this error seems to be the usage of java.net.URI, especially the getHost() method. This method returns null if the hostname contains an underscore.
As per RFC 2181 it is okay to have underscores in domain names (see http://stackoverflow.com/a/2183140).

I suggest to use another method/class to derive the hostname from the InitialLdapContext (if possible).

Comment by jblaine [ 23/Jan/13 ]

getHost() is right to return null if the hostname contains and underscore.

RFC 2181 indicates that a domain name can have underscores. Hostnames cannot, per RFC 1123.

Legit: foo.some_thing.com

Invalid: foo_bar.example.com

Comment by Matthew Swift [ 06/Jan/16 ]

Re-opening for re-evaluation.

Generated at Thu Jun 04 23:33:45 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.