This was also asked on SO. The Win32 LDAP API has an option to set a certificate verification callback with
ldap_set_option(connection, LDAP_OPT_SERVER_CERTIFICATE, &callback);
callback is a VERIFYSERVERCERT function pointer. Is there any way to get extra, per-connection data into this function? Or if not, is the callback guaranteed to be invoked on the same thread as
ldap_connect so that I can put extra data in thread-local storage?
My goal is to pass a memory-backed certificate store to
CertGetCertificateChain, so some other way to do that would also work.