0

I'm using the OpenLDAP API in C to connect to an external LDAP server and retrieve certain information. However, the software needs to run behind a HTTP CONNECT corporate proxy.

OpenLDAP doesn't expose the underlying socket calls, so is there a way to use the OpenLDAP API to specify a proxy to go through?

LDAP* lp;
int res = ldap_initialize(&lp, "ldap://some-server.com:389");

... /* Can I specify a proxy server somehow here? */

ldap_sasl_bind_s(m_connection, "", LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);

I looked through the manual and did some Googling and found LDAP_OPT_URI which is an option code that can be passed to ldap_set_option, along with a URI. The manual describes the purpose of this option as :

"Sets/gets a comma- or space-separated list of URIs to be contacted by the library when trying to establish a connection."

That description seems a bit vague to me, but I thought it might sound like this could allow me to set a proxy URL. However, I tried it and it has no effect anyway.

So, does OpenLDAP provide some way to connect via a proxy?

4

0 回答 0