In addition, random seed has to be initialized, otherwise the behavior is predictable.
I didn't think it too big of a deal, since it doesn't have to be cryptographically random. I can submit a patch to call srandom() first.
On the other side, I do not think that calling srand() in libldap is a good idea. The client application should do that. Or is there any other option?
The function ldap_domain2hostlist returns a list of strings, there isn't any weight/prio information for the client to act on. Furthermore the weight prio section was commented out, I figured the library was the right place to do it.
The algo specified in rfc2782 is detailed, and specifies a random number should be generated., I didn't want to implement it because it results in sorting once by prio, once by weight instead of one sort that does both.