Re: How to bind to AD?

Chris Ridd <[email protected]> Sat, 13 Jun 2015 18:16:15 +0100
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
> On 13 Jun 2015, at 12:30, Natxo Asenjo <[email protected]> wrote:
>=20
>=20
>=20
> On Sat, Jun 13, 2015 at 11:47 AM, Chris Ridd <[email protected]> =
wrote:
>=20
> > On 11 Jun 2015, at 22:45, David Lee Lambert <[email protected]> =
wrote:
>=20
> > I've reduced my non-working code to the following...
> >
> > #! perl -w
> >
> > use Net::LDAP;
> > my $ad =3D Net::LDAP->new('ad.**org**.com', debug =3D> 2)
> >  or die "Couldn't connect to AD: $@, $!";
> > $ad->bind('**tried lots of stuff**', password =3D> '**password**')
> >  or die "Couldn't bind: $@, $!=E2=80=9D;
>=20
> I think what you=E2=80=99re checking here is a failure to either =
construct the bind operation or send the bind to the server.
>=20
> But this *isn=E2=80=99t* 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.
>=20
> exactly, and it turns out it is a FAQ ;-)
>=20
> =
http://search.cpan.org/~marschap/perl-ldap-0.65/lib/Net/LDAP/FAQ.pod#How_c=
an_I_tell_when_the_server_returns_an_error,_bind%28%29_always_returns_true=
?

It is quite a common mistake though. I know the synopsis in the main doc =
takes care to show bind returning a $mesg, but it never does anything =
with it. Perhaps that=E2=80=99s wrong.

While I=E2=80=99m looking at the man page, I see references still to =
bigfoot.com and umich.edu! Maybe they should be replaced with something =
less obsolete - such as example.com.

Chris=