Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
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'

Report this thread to moderator Post Follow-up to this message
Old Post
Wy
05-18-05 02:01 AM


RE: New member - problems with ldap->add
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'


Report this thread to moderator Post Follow-up to this message
Old Post
Paul Connolly
05-18-05 09:06 AM


Re: New member - problems with ldap->add

Report this thread to moderator Post Follow-up to this message
Old Post
Erik Ableson
05-21-05 02:00 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

LDAP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:06 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.