On Mon, August 22, 2005 2:10 pm, Rick Greene said:
> Further update:
>
> I have tried to just manually create a new entry within the PERL script
> itself, and it fails on different message:
>
> add error: addRequest.addRequest.objectName is undefined at
> /usr/lib/perl5/site_perl/5.8.6/Net/LDAP/Message.pm line 178
>
> Here is the code that leads up to the above message (the bind is done a
> few lines before, authenticated and it does succeed):
>
>    $entry=Net::LDAP::Entry->new();

You need to set the DN with

  $entry->dn($dn);

Graham.

>    $entry->add(
> 'dn'=>'cn=kingr,o=PennLibraryStaff,dc=library,dc=upenn,dc=edu');
>    $entry->add( 'objectclass'=>
> ["person","organizationalPerson","inetOrgPerson","posixAccount","upennEduPerson"
> ]);
>    $entry->add( 'cn' => "kingr");
>    $entry->add( 'sn' => "kingr");
>    $entry->add( 'userid' => "kingr");
>    $entry->add( 'uidNumber' => "3019");
>    $entry->add( 'gidNumber' => "100");
>    $entry->add( 'homeDirectory' => "/home/kingr");
>    $entry->add( 'userPassword' => "{SHA}6wEWbSyjuY4/gp469HkIAxqj3vs=");
>    $entry->add( 'loginShell' => "/bin/bash");
>    $entry->add( 'gecos' => "Richard P. King");
>    $result=$ldap->add( $entry ) ;
>    $result->code && die "add error: ", $result->error;
>
> I feel like I'm missing a key detail here.  Can anyone see what it is?
>
> Thanks in advance,
> Rick
>
> Rick Greene wrote:
>> I'm trying to read in a simple LDIF file to add an entry to my LDAP
>> server.  Here is the basic routine (extraneous details omitted for
>> brevity and security):
>>
>> $ldif = Net::LDAP::LDIF->new($tmp,"r",onerror => 'warn');
>> $entry = $ldif->ready_entry();
>> $ldap = Net::LDAP->new($LDAPSERVER);
>> $result=$ldap->bind("$binddn",password=>"$bindpass",version=>"3");
>> $result=$ldap->add($entry);
>>
>> Now, everything seems to work until I get to the $ldap->add method.
>>  From that I get various versions of the following:
>>
>> objectclass: value #0 invalid per syntax at ldap.cgi
>>
>> I can get that error message to change to different attributes, but
>> basically keeps saying the same thing.  I've tried adding the following
>> just before the $ldap->add but it didn't help:
>> $entry->add('changetype'=>'add');
>>
>> I've even gone through a routine to save off the value of each
>> attribute, do a $entry->delete on the attribute, and then a $entry->add
>> to re-add the attribute, to no avail.
>>
>> I've done extensive searching on the web and nothing I've found has
>> helped, so I'm really hoping someone here can aid me ASAP, for I have to
>> get this done in the next day or two.
>>
>> Thanks,
>> Rick
>>
>>
>>
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> ______________________________________________________________________
>>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
>


Reply via email to