[Date Prev][Date Next] [Chronological] [Thread] [Top]

fail to add an entry with PERL LDAP module



Hi all,
I success to add an entry in my openLDAP directory with LDAPADD .
But the same entry continuously failed to be append when i try to do it with
PERL LDAP module.

1 -  Next is the LDIF entry loaded successfully :
----------------------------------------------------------------------------
---------------------------
dn: uid=capri,ou=free,o=sunumail.sn
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: inetLocalMailRecipient
uid: capri
cn: capri
sn: capri
mail: capri@myorg.com
mailLocalAddress: capri@myorg.com
mailRoutingAddress: capri@myorg.com
mailHost: myorg.com
userPassword: x
title: na
mailQuota: 7340032
destinationindicator: xxx
homephone: 000-00-00
l: XX
street: na
homepostaladdress: na
postalcode: na
telexnumber: na
mobile: 000-00-00

2 -  Next is the same entry  that fail with a perl script  :
----------------------------------------------------------------------------
---------------------------
#!/usr/bin/perl5.8.0
use Net::LDAP::Util qw(ldap_error_name ldap_error_text);
use Net::LDAP qw(:all);

# Two syntaxes for initialization.  Choose one.
$ldap = Net::LDAP->new('localhost') or die "$@";
$bmsg = $ldap->bind('cn=Directory Manager,o=myorg.com',
             password => 'secret'
           ) || die $@;

if ( $bmsg->code ) {
   LDAPerror ( "Binding status ....", $bmsg );
 }

my $msgr;
$msgr = $ldap->add('uid=capricorne, ou=free, o=myorg.com',
                     attr    => [ 'uid' => 'capricorne',
                                  'cn' => 'capricorne',
                                  'sn' => 'capricorne',
                                  'mail' => 'capricorne@myorg.com',
                                  'mailLocalAddress' =>
'capricorne@myorg.com',
                                  'mailRoutingAddress' =>
'capricorne@myorg.com',
                                  'mailHost' => 'myorg.com',
                                  'userPassword' => 'x',
                                  'title' => 'na',
                                  'mailQuota' => '7340032',
                                  'destinationIndicator' => 'xxx',
                                  'homePhone' => '000-00-00',
                                  'l' => 'XX',
                                  'street' => 'na',
                                  'homePostalAddress' => 'na',
                                  'postalCode' => 'na',
                                  'telexNumber' => 'na',
                                  'mobile' => '000-00-00',
                                  'objectclass' => [ 'top', 'person',
'organizationalPerson', 'inetOrgPerson', 'inetLocalMailRecipient'],
                                ]
                           );
 # ERROR module
 if ( $msgr->code ) {
    LDAPerror ( "Creation entry status ... : ", $msgr );
  }

sub LDAPerror
 {
   my ($from, $mesg) = @_;
   print "Return code: ", $mesg->code;
   print "\t\tMessage: ", $mesg->error_name;
   print " :",          $mesg->error_text;
   print "MessageID: ", $mesg->mesg_id;
 }

$ldap->unbind;

3 -  Next is the error code :
----------------------------------------------------------------------------
---------------------------
Return code: 64   Message: LDAP_NAMING_VIOLATION :The request violates the
structure of the DIT
MessageID: 2    .... DN:

Can help me to find what is wrong in the perl script.

Regards

Thierno6C