I believe the following patch addresses this problem. I am still a
bit conf used about what constitutes a DNS name. Alex has suggested
they should contain an underscore. My colleague who reviewed the code
had a different opinion.
Disclaimer: Since I'm not a C programmer I did not
really review your
patch in detail but just want to add some general notes.
1. Reviewing this ticket my impression is that the only problem is that
-h also accepts a LDAP URI because -H should be used instead.
IIRC -h was only meant to take an IP address or hostname.
Therefore I'd strongly recommend to simply reject an LDAP URI for -h.
Is that your goal?
2. The term "DNS name" is a bit too blurry. In case of option -h it
should be an IP address or _hostname_. And according to best practices
hostnames SHOULD NOT contain underscores.
Whether you _allow_ underscores to accommodate some strange setups is