title: Connecting to an LDAP server via a Corporate Proxy
body: <p>I'm using the <a href="http://www.openldap.org/" rel="nofollow"><strong>OpenLDAP</strong></a> 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.</p>
  
  <p>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?</p>
  
  <pre><code>LDAP* lp;
  int res = ldap_initialize(&amp;lp, "ldap://some-server.com:389");
  
  ... /* Can I specify a proxy server somehow here? */
  
  ldap_sasl_bind_s(m_connection, "", LDAP_SASL_SIMPLE, &amp;cred, NULL, NULL, NULL);
  </code></pre>
  
  <p>I looked through the manual and did some Googling and found <code>LDAP_OPT_URI</code> which is an option code that can be passed to <code>ldap_set_option</code>, along with a URI.  The manual describes the purpose of this option as :</p>
  
  <blockquote>
    <p>"Sets/gets a comma- or space-separated list of URIs to be contacted by
    the library when trying to establish a connection."</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>So, does OpenLDAP provide some way to connect via a proxy?</p>