Home > Archive > LDAP > May 2005 > New member - problems with ldap->add
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
New member - problems with ldap->add
|
|
|
| Hi,=20
I just joined the mailing list and is new to Net::LDAP. I was able
to perform the necessary functions to Active Directory through
Net::LDAP until I need to write a script to add a list of users to AD.
Here is a little snippet of the code:
while ( @row =3D $sth->fetchrow_array )=20
{
$firstname=3Ducfirst(lc($row[0]));
$lastname=3Ducfirst(lc($row[1]));
$cn=3D$firstname . " " . $lastname;
$dn=3D"dn =3D> 'cn=3D$cn, ou=3Dretail, ou=3Dusers, ou=3Dlevel2, dc=3Dt=
est, dc=3Dlab'";
my $results =3D $ldap->add($dn,=20
attr=3D>['cn' =3D> $cn,=20
'givenname' =3D> $firstname,
'sn' =3D> $lastname,
'physicaldeliveryofficename' =3D> $row[8],
'telephonenumber' =3D> $row[9],
'mail' =3D> $row[13],
'streetaddress' =3D> $row[2],
'l' =3D> $row[3],
'st' =3D> $row[4],
'postalcode' =3D> $row[5],
'title' =3D> $row[6],
'department' =3D> $row[7],
'pager' =3D> $row[12],
'mobile' =3D> $row[11],
'facsimiletelephonenumber' =3D> $row[10],
'objectclass' =3D> ['top', 'person',
'organizationalPerson', 'user'],
]);
This is the error I get. I believe the double single quote is giving
me problem.
Total entries returned: 3
failed to add entry: 0000202B: RefErr: DSID-031006D9, data 0, 1 access poin=
ts
ref 1: 'cnb.lab''
I tried to fix it by making the following changes=20
$dn=3D"dn =3D> cn=3D$cn, ou=3Dretail, ou=3Dusers, ou=3Dlevel2, dc=3Dtes=
t, dc=3Dlab";
and I end up with this error
0000208F: NameErr: DSID-03190843, problem 2006 <BAD_NAME> data 8349,
best match of:
'dn =3D> cn=3DJane Doe, ou=3Dretail, ou=3Dusers, ou=3Dlevel2, dc=3Dtest, =
dc=3Dlab'
| |
| Paul Connolly 2005-05-18, 4:06 am |
| Try: =
$dn=3D" cn=3D$cn,ou=3Dretail,ou=3Dusers,ou=3Dlev
el2,dc=3Dtest,dc=3Dlab";
-----Original Message-----
From: wy [mailto:wilyeo@gmail.com]=20
Sent: 18 May 2005 00:23
To: perl-ldap@perl.org
Subject: New member - problems with ldap->add
Hi,=20
I just joined the mailing list and is new to Net::LDAP. I was able
to perform the necessary functions to Active Directory through
Net::LDAP until I need to write a script to add a list of users to AD.
Here is a little snippet of the code:
while ( @row =3D $sth->fetchrow_array )=20
{
$firstname=3Ducfirst(lc($row[0]));
$lastname=3Ducfirst(lc($row[1]));
$cn=3D$firstname . " " . $lastname;
$dn=3D"dn =3D> 'cn=3D$cn, ou=3Dretail, ou=3Dusers, ou=3Dlevel2, =
dc=3Dtest, dc=3Dlab'";
my $results =3D $ldap->add($dn,=20
attr=3D>['cn' =3D> $cn,=20
'givenname' =3D> $firstname,
'sn' =3D> $lastname,
'physicaldeliveryofficename' =3D> $row[8],
'telephonenumber' =3D> $row[9],
'mail' =3D> $row[13],
'streetaddress' =3D> $row[2],
'l' =3D> $row[3],
'st' =3D> $row[4],
'postalcode' =3D> $row[5],
'title' =3D> $row[6],
'department' =3D> $row[7],
'pager' =3D> $row[12],
'mobile' =3D> $row[11],
'facsimiletelephonenumber' =3D> $row[10],
'objectclass' =3D> ['top', 'person',
'organizationalPerson', 'user'],
]);
This is the error I get. I believe the double single quote is giving
me problem.
Total entries returned: 3
failed to add entry: 0000202B: RefErr: DSID-031006D9, data 0, 1 access
points
ref 1: 'cnb.lab''
I tried to fix it by making the following changes=20
$dn=3D"dn =3D> cn=3D$cn, ou=3Dretail, ou=3Dusers, ou=3Dlevel2, =
dc=3Dtest, dc=3Dlab";
and I end up with this error
0000208F: NameErr: DSID-03190843, problem 2006 <BAD_NAME> data 8349,
best match of:
'dn =3D> cn=3DJane Doe, ou=3Dretail, ou=3Dusers, ou=3Dlevel2, =
dc=3Dtest, dc=3Dlab'
| |
| Erik Ableson 2005-05-20, 9:00 pm |
| |
|
|
|
|