On Sat, Jun 13, 2015 at 11:47 AM, Chris Ridd <chrisr...@mac.com> wrote:
> > > On 11 Jun 2015, at 22:45, David Lee Lambert <dav...@lmert.com> wrote: > > > I've reduced my non-working code to the following... > > > > #! perl -w > > > > use Net::LDAP; > > my $ad = Net::LDAP->new('ad.**org**.com', debug => 2) > > or die "Couldn't connect to AD: $@, $!"; > > $ad->bind('**tried lots of stuff**', password => '**password**') > > or die "Couldn't bind: $@, $!”; > > I think what you’re checking here is a failure to either construct the > bind operation or send the bind to the server. > > But this *isn’t* the right way to check for bind failures. Binds are just > another LDAP operation which returns a result, so you should check the > result message like you do for search further down. > exactly, and it turns out it is a FAQ ;-) http://search.cpan.org/~marschap/perl-ldap-0.65/lib/Net/LDAP/FAQ.pod#How_can_I_tell_when_the_server_returns_an_error,_bind%28%29_always_returns_true ? $mesg = $ldap->bind( $dn, password => $passwd ); if ( $mesg->code ) { # Handle error codes here } > > This won’t solve your underlying problem with AD, but you might get more > of an idea what’s failing if you look at the bind result. > > this is a FAQ as well :-): http://search.cpan.org/~marschap/perl-ldap-0.65/lib/Net/LDAP/FAQ.pod#What_is_the_proper_format_of_the_bind_DN ? but as I replied earlier for AD ldap there are other options which are usually shorter. -- Groeten, natxo