From: Voglmaier, R. E. <rv...@gl...> - 2000-10-18 07:16:43
|
Matt, it seems to me that objectclasses need to be defined as: @objectclasses = ['top','person'] I rather use this syntax : $result = $ldap->add ( dn => $DN , attr => [ 'sn' => $SN, 'cn' => $CN, 'objectclass' => @objectclasses, 'userpassword' => $UserPw, 'uid' =>$UserId, ] ); # Everything's OK ? $result->code && die "Failed to add entry \n, Reason: $result->error" ; This gives You the possibility to see if the add method failed. hope this helps. cheers Reinhard > -----Original Message----- > From: Graham Barr [SMTP:gb...@po...] > Sent: mercoledì 18 ottobre 2000 07:19 > To: LDAP Mailing List > Cc: Matt Chudleigh > Subject: [Fwd] Net::LDAP > > ----- Forwarded message from Matt Chudleigh <ma...@cr...> ----- > > From: "Matt Chudleigh" <ma...@cr...> > To: <gb...@po...> > Subject: Net::LDAP > Date: Tue, 17 Oct 2000 17:27:08 -0600 > X-Mailer: Microsoft Outlook Express 5.50.4133.2400 > > Hello, > > I am a technical support consultant for Critical Mass productions up here > in Calgary, Canada. Over the recent weeks, I have been trying to setup a > web interface to our OpenLDAP server to allow us to easily add/change/view > the database. I am using your Net::LDAP module with some success in > searching and deleting entries from the LDAP database. However, I am > compleatly stumped trying to get Net::LDAP to add entries to the database. > Our server name is called europa, and we have setup the OpenLDAP server to > use dc=europa as a search base. When I use the following code, it seems to > add just fine, however, when I search for the entry using the command > line: ldapsearch -L -b dc=europa cn=Te* > the entry is not returned. If I run this code first, then I try to add the > same entry from the command line (Using ldapadd and a file) is says that > the entry already exists. If you can provide any assistance whatsoever, it > would be very much appreciated. If you can get this to work, I would owe > my sanity to you as well. > > Thanks in advance, > > Matt Chudleigh > Technical Support Consultant > Critical Mass Productions > ma...@cr... > > I am using the following code to attempt to add entries.. > > #!/usr/bin/perl > > use Net::LDAP; > > my $host = 'europa.criticalmass.com'; > my $name = 'cn=Manager, dc=criticalmass'; > my $pass = 'secret'; > my $vers = 2; > my $DN = 'cn=test2 test2, dc=europa'; > > $ldap = Net::LDAP->new($host) or die $@; > > my %bindargs; > $bindargs{dn} = $name; > $bindargs{password} = $pass; > $bindargs{version} = $vers; > > $ldap->bind(%bindargs) or die $@; > > my $addname = 'test2 test2'; > my $addlast = 'test2'; > my $addclas = 'person'; > my $addmail = 'te...@te...'; > my $addhome = '222-2222'; > my $addwork = '2222'; > my $addloca = 'calgary'; > > my %addthing; > $addthing{dn} = $DN; > $addthing{cn} = $addname; > $addthing{objectclass} = $addclas; > $addthing{mail} = $addmail; > $addthing{sn} = $addlast; > $addthing{homephone} = $addhome; > $addthing{phonenumber} = $addwork; > $addthing{location} = $addloca; > > $ldap->add (%addthing); > > $ldap->unbind() or die $@; > > > > > ----- End forwarded message ----- |