Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Net::LDAP; use Data::Dumper; use Net::LDAP::Util qw(ldap_error_text ldap_error_name ldap_error_desc ); my $LDAPServerAddress = '10.4.78.107'; my $errorMsg=checkPassword('test@navitools.com','test'); print "$errorMsg....."; sub checkPassword() { my ($user,$password)=@_; my $ldap = Net::LDAP->new($LDAPServerAddress, port => '636',scheme = +> 'ldaps') || return "Can't connect to $LDAPServerAddress via LDAP" +; my $result=$ldap->bind("CN=Test User,OU=Corp, DC=navitools,DC=com",p +assword=>$password) || die "$@"; $ldap->unbind(); $result->code && return $result->error; # return error message if fa +iled return 1; # return "undef" on success }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Active Directory authentication using login name
by lcs (Novice) on Dec 19, 2007 at 11:25 UTC | |
|
Re: Active Directory authentication using login name
by shmem (Chancellor) on Dec 19, 2007 at 13:33 UTC |