2
什麼是使用網:: LDAP添加OU的正確語法添加LDAP OU,我試過如下:使用的Net :: LDAP
#!/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 "[email protected]";
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;
而且得到了以下錯誤:
value of naming attribute 'ou' is not present in entry 64
但是使用ldapmodify命令行,並使用該下面的ldif,工作原理:
dn: ou=Users,dc=lab,dc=net
changetype: add
objectclass: top
objectclass: organizationalUnit
ou: Users