From: Shain M. <sm...@tv...> - 2001-01-09 15:26:19
|
Hi, I am running into yet another problem here ( everytime I think I know what I am doing...I find out I don't :-) Anyway here is my code. The first part CheckLogin works fine...the username is checked and if it is there it then goes to CheckPasswordHTML and tries to bind as that user. When I check the ldap log I see the the CheckLogin binds anonymously as it should. The problem is that the log shows CheckPasswordHTML as and anonymous bind too. I have printed out the $userDNfinal variable and it shows the correct value..any ideas? Thanks again Shain PS-Do I need the unbind statements in there...I have tried with both present and commented out and it did not seem to make a difference. sub CheckLogin { $ldap = new Net::LDAP('server'); $mesg = $ldap->bind(); $mesg = $ldap->search ( base => 'dc=tvd,dc=com', scope => 'sub', filter => "uid=$UserName" ); if ($mesg->count != 1) { $mesg = $ldap->unbind(); &BadLoginHTML; } else { $mesg = $ldap->unbind(); &CheckPasswordHTML; } } sub CheckPasswordHTML { $userDN1 = "uid="; $userDN2 = ",ou=People,dc=tvd,dc=com"; $ldap = new Net::LDAP('server'); $userDNfinal = $userDN1 . $UserName . $userDN2; $mesg = $ldap->bind ( base => $userDNfinal, password => $Password ); if ($mesg->code() == 49) { &BadLoginHTML; } else { &ConfirmLoginHTML; } } |