From: Graham B. <gb...@po...> - 2000-10-03 09:25:37
|
On Tue, Oct 03, 2000 at 12:39:19AM -0700, Robert Chien wrote: > On Fri, Sep 29, 2000 at 09:37:20AM +0100, Graham Barr wrote: > > On Fri, Sep 29, 2000 at 12:03:22AM -0700, Robert Chien wrote: > > > Greetings, > > > > > > I'm putting together some code and learning perl-ldap for > > > the first time. I've run into a deadend and hope some of you > > > may provide some insight here. > > > > > > What I'm trying to do is quite simple, just adding an entry > > > to a LDAP server. > > > > > > $ldap->bind ( dn => "cn=something", > > > password => "somepasswd" ); > > > $result = Net::LDAP::Entry->new; > > > $result->add ( > > > dn => 'uid=$username,$base', Ah, missed this before. The dn is not an attribute per-se. You must set it via $result->dn('uid=$username,$base'); Although I suspect you want " not ' there Graham. > > > attr => [ 'objectclass' => [ 'top', 'person', > > > 'organizationalPerson', > > > 'inetOrgPerson', > > > 'inetUser' ], > > > 'mail' => '$mail', > > > 'userPassword' => '' > > > ] > > > ); > > > $result->update( $ldap ); > > > > Here is your problem. > > > > $mesg = $result->update( $ldap ); > > > > $mesg->code && warn "failed to add entry: ", $mesg->error; > > Thanks. After changing the script per your suggestion, I > get: > > failed to add entry: objectName at > /usr/perl5/site_perl/5.005/Convert/ASN1/_encode.pm line 47. > > I have double-checked for typos, but couldn't find any. > > Robert > > > > $result->code && warn "failed to add entry: ", $result->error; > > > $ldap->unbind; > > > > > > This is pretty much out of the perldoc, but when I try to > > > > I hope not. > > > > Graham. |