title: How to connect to a ldap through a proxy ldap?
body: <p>I've a little issue. At work, we will shortly use a proxy ldap to connect to our ldap.</p>
  
  <p>However, my perl script used to connect directly to the ldap, and I can't find the right way to connect to the ldap through the ldap proxy.</p>
  
  <p>The ldap team told me to simply change "my.local.ldap.org" by the url of the proxy.</p>
  
  <p>But when I do that, I get nothing back except the error "Can't contact LDAP server at myscript.pl line X, &lt; DATA> line 403."</p>
  
  <p>I'm at my wits end, since I'm pretty new to perl. </p>
  
  <p>How can I connect to my ldap throught the ldap proxy and get my data ?</p>
  
  <p>There is my perl code :</p>
  
  <pre><code>#!/usr/bin/perl
  
  use warnings;
  use strict;
  use Net::LDAP;
  use Net::SMTP;
  use MIME::Lite;
  use Getopt::Std;
  
  connect_ldap();
  
  sub connect_ldap {
  
      my @attributs = qw(uid subsidiary preferredLanguage);
  
      my $ldap = Net::LDAP-&gt;new(
          "my.local.ldap.org",
          port =&gt; 389
      ) or die open (STDERR, "&gt;&amp;SDTOUT");
  
      my $mesg = $ldap-&gt;bind (
          "cn=app_readonly,ou=account,ou=security,o=oubase",
          password =&gt; "mypassword"
      );
  
      $mesg = $ldap-&gt;search(
          base   =&gt; "o=oubase",
          scope =&gt; "sub",
          filter =&gt; "(&amp;(objectclass=inetOrgPerson)(|(subsidiary=sub1)(subsidiary=sub2))(role=id=app_access,id=APP,*))",
          attrs =&gt; [ @attributs ]
      );
  
   printf "COUNT : %s\n", $mesg-&gt;count;
  foreach my $entry ($mesg-&gt;entries) {
  $entry-&gt;dump;
   }
  print "==========================================\n";
  
          $mesg = $ldap-&gt;unbind;
          $ldap-&gt;unbind;
  
      }
  </code></pre>