Stephen writes:
/* Bind anonymously to the LDAP server. */ rc = ldap_simple_bind_s( ld, NULL, NULL );
I think that still Binds with LDAP version 2, which the server may be rejecting. Try to set LDAP version 3 first: int protocol = LDAP_VERSION3; ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION, &protocol );
Yes, that was it.
if ( rc != LDAP_SUCCESS ) { fprintf(stderr, "ldap_simple_bind_s: %s\n", ldap_err2string(rc)); return( 1 ); }
That only prints a textual representation fo the error code. It does not print the diagnosticMessage which the server may have enclosed to answer your question. Try ldap_perror(ld, "Bind failed");
Implementing this results in a very useful error message confirming your guess... Bind failed: Protocol error (2) additional info: historical protocol version requested, use LDAPv3 instead
Thank you for your helpful reply
Regards Stephen