From: Paul H. <hei...@cs...> - 2000-06-09 13:38:55
|
On Thu, 8 Jun 2000, Yann Ramin wrote: > I've noticed that no error code is returned when a bind operation uses > invalid credentials. ? How can I test if a bind was successful or > not? This is my main LDAP authentication scheme :) I noticed the same thing. Here's my workaround: print qq(Binding to LDAP database...\n); my $ldap = Net::LDAP->new( $ldaphost ) or die; my $msg = $ldap->bind( $rootuser, password => $pass ); if ( $msg->code ) { # Hmm. Probably the password is bad. We'll try an # anonymous bind just to make sure the server's running my $test = $ldap->bind; if ( $test->code ) { # hmm, the server's down print "*** The LDAP server seems to be down. Sorry. ***\n"; } else { # yep, the password must be bad. $ldap->unbind; print "*** Please check the password and try again. ***\n"; } exit 1; } . Paul Heinlein <hei...@cs...> . . . . . . . . . . . Webmaster, Systems Administrator . . Department of Computer Science and Engineering . . Oregon Graduate Institute of Science and Technology . . Beaverton, Oregon, USA . . . . 503-748-1199 http://www.cse.ogi.edu/~heinlein/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |