You're attempting to add a new entry called "ou=People, dc=t3link, dc=com". Which is
not what I think what you want to do. It's most likely not working because the entry
already exists.
If you want to add a new entry, you need to give it a DN that does not exist yet such
as uid=mewilcox,ou=People,dc=t3link,dc=com.
Thus your example should look something like this:
my $result = $ldap->add (
dn => 'uid=lapuser2,ou=People, dc=t3link, dc=com',
attr => [ 'uid' => "ldapuser2",
'cn' => 'ldapuser2',
'userpassword' => 'blahaslbasdf',
'uidnumber' => 400,
'gidnumber' => 400,
'objectclass' => ['top', 'account',
'shadowAccount',
'posixAccount' ],
]
);
And error should be:
$result->code();
not
$result->error();
BTW the archives are at
http://www.geocrawler.com/lists/3/SourceForge/3482/0/
Mark
Jonathan Leto wrote:
> Hello all, I didn't see a place to look through archives, so if there is, I would
> greatly appreciate it.
>
> I have a simple script that looks like this:
>
> #!/usr/bin/perl -w
>
> use Net::LDAP qw(:all);
>
> $ldap = Net::LDAP->new("localhost") or die $@;
>
> my $msg = $ldap->bind(
> 'cn=Manager, dc=t3link, dc=com',
> password => "pass",
> );
>
> print "bind msg: " . $msg->code . "\n";
>
> my $result = $ldap->add (
> dn => 'ou=People, dc=t3link, dc=com',
> attr => [ 'uid' => "ldapuser2",
> 'cn' => 'ldapuser2',
> 'userpassword' => 'blahaslbasdf',
> 'uidnumber' => 400,
> 'gidnumber' => 400,
> 'objectclass' => ['top', 'account',
> 'shadowAccount',
> 'posixAccount' ],
> ]
> );
> print "ERROR:" . $result->error . "\n";
>
> For some reason, this has NO effect. None of the .dbb files change and doing a
> search with ldapsearch comes up empty. When using ldapadd with a comparable ldif
> file and the same user/pass, everything is fine. No error is printed out,
> and bind returns 0.
>
> I am using openldap 1.2.11 and Net::LDAP 0.19 on linux 2.2 .
>
> --
> jon...@le...
> "With pain comes clarity."
|