On 2003-08-25 19:43:57 +0000, Tom Meindl wrote:
> hi,
>
> i have a big problem with the following perl code:
>
> use strict;
> use warnings;
> use Net::LDAP;
>
> my $ldapserver = shift or die usage();
> my $uid = shift or die usage();
> my $passwd = shift or die usage();
>
> my $basedn = "ou=People,dc=domain,dc=com";
> my $binddn = "uid=$uid,$basedn";
> my $ldap;
# Can you try this right here in your script to see if its Net::LDAP
# or not!
my $ldapsearch = '/path/to/ldapsearch'; # from OpenLDAP binaries
print `$ldapsearch -x -h $ldapserver -D '$binddn' -w '$passwd' 2>&1`; exit;
# Note^ back-quotes
# Assuming $ldapserver is just hostname (and not URI or host:port)
# Cheers,
# Ziya.
>
> #-- connect and bind with uid and passwd to ldap server --#
>
> print "connecting to LDAP Server on host $ldapserver.....";
>
> eval {
> $ldap = Net::LDAP->new($ldapserver);
> };
>
> die "[FAILED]\n$@" if $@;
>
> print "[OK]\nusing bindn $binddn to authenticate.....";
>
> my $bind_mesg = $ldap->bind( $binddn, password => $passwd, version => 3 );
>
> if ($bind_mesg->code()) {
> die "[FAILED]\nLDAP Binding Error: " . $bind_mesg->error() . "\n";
> } else { print "[OK]\n"; }
> ...
> ...
> ...
> ...
> ...
> # and so on..
>
>
> the output of that script is as follows:
>
> connecting to LDAP Server on host xxxxx.....[OK]
> using bindn uid=test,ou=People,dc=domain,dc=com to authenticate.....[FAILED]
> LDAP Binding Error: Invalid credentials
>
>
> facts around:
>
> the OpenLDAP 2.1.4 server is in use correctly: it replaces nis with pam and nss and
> is therefore "heavy" tested.
>
> the same problem appears with Apache::AuthNetLDAP 0.19. i get an log entry in
> error_log with code 49...
>
> uid, passwd and dc's are chosen correctly!
>
>
> can anybody help me please!
>
> regards
> t
>
>