And...
On 20 Jan 2023, at 15:33, Norman Gray wrote:
This exposes a function
char* get_sorted_srv_records(const char* domain);
which does a SRV lookup, and orders the records that come back according to the specification of RFC 2782 (though in a single pass, rather than the clumsy multiple pass algorithm that the RFC suggests).
I should mention that the way I use this is
ldap_server = "ldap://foo"; // or ldap_server = "DNS:ldap.example.com";
char* server_list; if (strncmp(ldap_server, "DNS:", 4) == 0) { server_list = get_sorted_srv_records(&ldap_server[4]); } else { server_list = ldap_server; }
ldap_initialise(&directory, server_list);
Best wishes,
Norman