srinivas_rocks has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks,
I have been working with LDAP server configurations from some time and now I want to integrate the LDAP in my project.
I want to use LDAP to authenticate the users when they login to my portal.
I found Net::LDAP as a good perl module that can be used to serve my purpose.
I was successful in executing search statements and here is the code
for the above code I got the following correct output:#! /usr/bin/perl use Net::LDAP; $ldap = Net::LDAP->new ( "<ip address>" ) or die "Connection Failed $@ +"; $mesg = $ldap->bind ( "<user name>", password => "<password>", version => 3 ); $base = "dc=example,dc=com"; $mesg = $ldap->search ( # perform a search base => $base, filter => "(objectclass=*)" ); $mesg->code && die $mesg->error; foreach $entry ($mesg->all_entries) { $entry->dump; }
now when I am trying to execute compare function whose code is--------------------------------------------------------------------- +--- dn:dc=example,dc=com dc: example description: Root LDAP entry for example.com objectClass: dcObject organizationalUnit ou: rootobject ---------------------------------------------------------------------- +-- dn:ou=People,dc=example,dc=com ou: People description: All people in organisation objectClass: organizationalUnit ---------------------------------------------------------------------- +-- dn:uid=srinivas,ou=People,dc=example,dc=com uid: srinivas cn: srinivas objectClass: account posixAccount top shadowAccount userPassword: {crypt}$1$zYwJ/asE$DsYRb6CXjzJihNyTV2lC9. shadowLastChange: 13986 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 503 gidNumber: 100 homeDirectory: /home/srinivas
I am getting following error when I execute the above script$mesg = $ldap->compare( $base, attr => "uid", value => "srinivas" ); $mesg->code && die $mesg->error; foreach $entry ($mesg->all_entries) { $entry->dump; }
Can any one suggest whether there are any additional attributed that are to be added or any other why that I can compare my username and password for authentication. Any suggestion will be helpful.No such attribute at ldap_compare.pl line 34, <DATA> line 259.
Thanks in Advance.
Srinivas.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Need help on Net::LDAP
by mr_mischief (Monsignor) on Apr 30, 2008 at 15:39 UTC | |
by MidLifeXis (Monsignor) on Apr 30, 2008 at 17:48 UTC | |
by ghenry (Vicar) on May 03, 2008 at 20:08 UTC | |
by MidLifeXis (Monsignor) on May 05, 2008 at 11:18 UTC | |
by ghenry (Vicar) on May 05, 2008 at 12:57 UTC | |
Re: Need help on Net::LDAP
by jhourcle (Prior) on Apr 30, 2008 at 16:19 UTC | |
Re: Need help on Net::LDAP
by ghenry (Vicar) on May 03, 2008 at 20:08 UTC | |
by srinivas_rocks (Sexton) on May 12, 2008 at 07:58 UTC |
Back to
Seekers of Perl Wisdom