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

Status: Open
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
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OS X 10.7, Java 1.6.0_31



 Description   

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'
See
/var/folders/bh/th445qyd0ldcblbf_5xzsxxc0000gn/T/opendj-replication-9171122199231087850.log
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).



 Comments   
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 Aug 22 01:23:09 BST 2019 using Jira 7.13.5#713005-sha1:8d78f1047b9cca7d35d4d13f706b37e27d869e07.