Hello All,
I have a strange problem. My "ldap_start_tls_s" fails with an error "Operation Error" (!).
However, if I ignore this error and continue with the "ldap_bind", the connection succeds over
An SSL/TLS connection and everything works fine (I am able to do a search
and so on).
I have started slapd as: "slapd -d127 -h "ldaps://example.slapd.com:636" (I want a LDAP
connection only over SSL/TLS).
My code snippet for LDAP client looks like:
rc = ldap_initialize(&ld, "ldaps://example.slapd.com:636");
/*
* Set LDAP version to 3.
*/
version = LDAP_VERSION3;
if( ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version ) != LDAP_OPT_SUCCESS ){
fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n",
version);
exit(-1);
}
ldap_start_tls_s(ld, NULL, NULL);
rc = ldap_bind_s( ld, "cn=Manager, o=My Company, c=US", "secret", LDAP_AUTH_SIMPLE);
if (rc != LDAP_SUCCESS)
{
printf("ldap_simple_bind_s error: %d, %s\n", rc,
ldap_err2string( rc ));
ldap_unbind_s( ld );
exit(1);
}
//I have a search operation after this
Any idea what is going on?
Any help is appreciated.
Regards,
Prashant Kumar