From: Chris R. <Chr...@me...> - 2000-05-04 15:29:05
|
On Thu, 04 May 2000 15:47:25 BST, Graham Barr wrote: > ----- Forwarded message from Gerald Roehrbein/Pctdmn <gro...@bi...> ----- > > From: Gerald Roehrbein/Pctdmn <gro...@bi...> > Date: Thu, 4 May 2000 14:54:40 -0100 > To: gb...@po... > Subject: Your LDAP Perl Module > > > Hello Graham, > > I try to use your LDAP Module but I'am not able to use it. Maybe I'am not > so experienced with LDAP. > I have to write a little module that should do the following: > > The Module have to use 3 Parameter (Name, Password, UniqueId) > Then it should build a mail adress Uni...@my... and a mail alias. > The Software should query > LDAP to permit/deny double e-mail aliases. And then it should add the data > to LDAP directory. > > Sounds easy. > > The prgram is from the examples of ACTIVE PERL but it does not run. > The Source Code is below and the output of the programm is added below the > source. I do not know what the problem > is and how to debug. I'am not an experienced Perl prorgammer so I do not > have any idea how to debug it and how to get more information about the > reasons of the errors. A lot of the problems appear to be because you haven't taught your script enough about what information your LDAP server is holding. > > ---------------------------------------------------------------------BEGIN > OF SOURCE------------------------------------------------------------- > use CGI; > # use strict # 'vars'; > # use Mail::Send; > use Net::LDAP; > # use Net::LDAP::message; > > $ldap = Net::LDAP->new('mcis01', debug=> 3) or die "$@"; > $ldap->bind ; # an anonymous bind > $mesg = $ldap->search ( # perform a search > base => "c=mcis01", That isn't a legal country name. Country names can only be two characters wide, eg US, or GB, or EH. (A mini competition! Who can tell me where c=EH is?) > filter => "(& (uid= (o=microsoft))" That isn't a legal search filter. It should probably be something like: filter => '(&(uid=1234abcd)(o=microsoft))' > $result = $ldap->add ( > dn => 'cn = Barbara Jensen', That DN looks unlikely; it is indicating a person directly below the directory ROOT entry. > attr => [ 'cn' => ['Barbara Jensen', 'Barbs Jensen'], > #'sn' => 'Jensen', > 'mail' => 'b.j...@um...' > ] This is not adding all the attributes that are required by the directory. In particular, you need to specify the objectclass attribute. You need to work out: 1) what is the DN of the top entry that your LDAP server is storing. This entry is often called something like an "initial naming context", or possibly just "naming context". 2) where under this point you can add entries. If you find out th DN of the top entry is "o=some company,c=US" then change the add to say: dn => "cn=Barbara Jensen,o=some company,c=US", Graham, does the sample script look awfully familiar to you? Like the start of an old version of LDAP.pod perhaps? :-) Cheers, Chris |