Adding New OU

[email protected] (Lupin Deterd)
Newsgroups perl.ldap
Message-ID <[email protected]>
Hi,

What is the correct syntax of adding an OU using Net::LDAP, I tried
the following:
!/usr/bin/perl -w

use 5.10.1; use strict;

use Net::LDAP; use Data::Dumper;

my $ldap = Net::LDAP->new("192.168.183.2") or die "$@"; my $mesg =
$ldap->bind( "cn=admin,dc=lab,dc=net", password => 'xxx' );

$mesg = $ldap->add( "ou=Users,dc=lab,dc=net", attrs => [

    'ou'          => 'dc=Users',
    'objectClass' => [ 'top', 'organizationalUnit' ]
  ]

);

say $mesg->error; say $mesg->code;

And got the following error:

value of naming attribute 'ou' is not present in entry 64

However using the ldapmodify command line, and using this following ldif, works:

dn: ou=Users,dc=lab,dc=net changetype: add objectclass: top
objectclass: organizationalUnit ou: Users


Thanks,
Lupin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.