From: Edgington, J. <je...@um...> - 2001-03-30 19:55:29
|
I am getting the following error and the code is below that (note this is from a Linux box with Perl 5.6.0) pulsar(4)>perl create.pl add failed: Net::LDAP::Add=HASH(0x82d7148)->error at create.pl line 31. pulsar(5)> 1 #!/umr/testbin/perl 2 3 $| =1; 4 5 6 use Net::LDAPS; 7 $ldaps = new Net::LDAPS('srvtst01.cc.umr.edu', 8 port=> '636'); 9 10 11 $UserPass="94ranger"; 12 $UserID="Administrator"; 13 $ADSserver='srvtst01.cc.umr.edu'; 14 $DomainDN=" dc=test, dc=umr, dc=edu"; 15 $UserDN="cn=$UserID, cn=users, " . $DomainDN; 16 17 $ldaps = Net::LDAPS->new($ADSserver) || die "failed: $@"; 18 19 $mesg = $ldaps->bind( dn =>"$UserDN", password => "$UserPass" ); 20 $mesg->code && die "bind failed: $mesg->error"; 21 22 $tempDN = "cn=Test Edgington, cn=Users, " . $DomainDN; 23 24 $mesg = $ldaps->add( 25 dn => 'cn=Users, dc=test, dc=umr, dc=edu', 26 attr => [ samAccountName => 'test2', 27 displayName => 'Test2 Edg', 28 userPrincipalName => 'te...@te...' 29 ] 30 ); 31 $mesg->code && die "add failed: $mesg->error"; 32 33 34 35 thanks. -----Original Message----- From: Behruz Rushenas [mailto:beh...@cp...] Sent: Friday, March 30, 2001 1:23 PM To: J Beck; 'Edgington, Jeffrey'; per...@li... Subject: RE: Creating a user in Win2K AD via Net::LDAP Make sure you are using the right object classes and the mandatory attributes you need to create a user in AD. Try this to create a mail-enabled user in ActiveDirectory. userAccountControl = 512 cn = John Smith givenName= John mailNickname =Smith sAMAccountName =Smith sn=Smith userPrincipalName =Smith objectclass=top;person;organizationalPerson;user;securityPrincipal;mailRecip ient You can even try first to add a entry by using the "ldapmodify" utility to make sure you can create this entry whithin the directory before starting to add it through a program. Behruz. -----Original Message----- From: per...@li... [mailto:per...@li...]On Behalf Of J Beck Sent: Friday, March 30, 2001 10:54 AM To: 'Edgington, Jeffrey'; per...@li... Subject: RE: Creating a user in Win2K AD via Net::LDAP you might want to look at your directory's logs. what kinds of errors are your getting. it could be permissions, a replicated branch, a required objectclass being left out... -----Original Message----- From: per...@li... [mailto:per...@li...]On Behalf Of Edgington, Jeffrey Sent: Friday, March 30, 2001 11:52 AM To: per...@li... Subject: Creating a user in Win2K AD via Net::LDAP I'm trying to create userid's in Win2K AD via Net::LDAP with little success.... I can manipulate current accounts, but can't create them.... has anyone else been successful with this?... and if so, would you care to share what you did? Thanks. jeff e. |
From: Edgington, J. <je...@um...> - 2001-04-01 00:39:35
|
Thanks to all that replied... I now have it working... the objectclass was what I was missing... now just have to figure out how to change the unicodePwd value.... that's the tricky one. :) jeff e. -----Original Message----- From: Clif Harden [mailto:cl...@di...] Sent: Friday, March 30, 2001 3:25 PM To: je...@um... Cc: per...@li... Subject: Re: Creating a user in Win2K AD via Net::LDAP > > I am getting the following error and the code is below that (note this is > from a Linux box with Perl 5.6.0) > > pulsar(4)>perl create.pl > add failed: Net::LDAP::Add=HASH(0x82d7148)->error at create.pl line 31. > pulsar(5)> > > 1 #!/umr/testbin/perl > 2 > 3 $| =1; > 4 > 5 > 6 use Net::LDAPS; > 7 $ldaps = new Net::LDAPS('srvtst01.cc.umr.edu', > 8 port=> '636'); > 9 > 10 > 11 $UserPass="94ranger"; > 12 $UserID="Administrator"; > 13 $ADSserver='srvtst01.cc.umr.edu'; > 14 $DomainDN=" dc=test, dc=umr, dc=edu"; > 15 $UserDN="cn=$UserID, cn=users, " . $DomainDN; > 16 > 17 $ldaps = Net::LDAPS->new($ADSserver) || die "failed: $@"; > 18 > 19 $mesg = $ldaps->bind( dn =>"$UserDN", password => "$UserPass" ); > 20 $mesg->code && die "bind failed: $mesg->error"; > 21 > 22 $tempDN = "cn=Test Edgington, cn=Users, " . $DomainDN; > 23 > 24 $mesg = $ldaps->add( > 25 dn => 'cn=Users, dc=test, dc=umr, dc=edu', > 26 attr => [ samAccountName => 'test2', > 27 displayName => 'Test2 Edg', > 28 userPrincipalName => 'te...@te...' > 29 ] > 30 ); I am no expert on Active Directory but I do not see anything about the objectClass definitions in the attr section. I would think that it would at least need the following; objectClass => [ "top ", "person ", "organizationalPerson ", "user"] Regards, Clif > 31 $mesg->code && die "add failed: $mesg->error"; > 32 > 33 > 34 > 35 > > thanks. > > > > > -----Original Message----- > From: Behruz Rushenas [mailto:beh...@cp...] > Sent: Friday, March 30, 2001 1:23 PM > To: J Beck; 'Edgington, Jeffrey'; per...@li... > Subject: RE: Creating a user in Win2K AD via Net::LDAP > > > Make sure you are using the right object classes and the mandatory > attributes you need to create a user in AD. > Try this to create a mail-enabled user in ActiveDirectory. > > userAccountControl = 512 > cn = John Smith > givenName= John > mailNickname =Smith > sAMAccountName =Smith > sn=Smith > userPrincipalName =Smith > objectclass=top;person;organizationalPerson;user;securityPrincipal;mailRecip > ient > > > You can even try first to add a entry by using the "ldapmodify" utility to > make sure you can create this entry whithin the directory before starting to > add it through a program. > > Behruz. > > > > -----Original Message----- > From: per...@li... > [mailto:per...@li...]On Behalf Of J Beck > Sent: Friday, March 30, 2001 10:54 AM > To: 'Edgington, Jeffrey'; per...@li... > Subject: RE: Creating a user in Win2K AD via Net::LDAP > > > you might want to look at your directory's logs. > what kinds of errors are your getting. > it could be permissions, a replicated branch, a required objectclass being > left out... > > > -----Original Message----- > From: per...@li... > [mailto:per...@li...]On Behalf Of > Edgington, Jeffrey > Sent: Friday, March 30, 2001 11:52 AM > To: per...@li... > Subject: Creating a user in Win2K AD via Net::LDAP > > > I'm trying to create userid's in Win2K AD via Net::LDAP with little > success.... I can manipulate current accounts, but can't create them.... has > anyone else been successful with this?... and if so, would you care to share > what you did? > > Thanks. > > jeff e. > > > > |
From: Behruz R. <beh...@cp...> - 2001-03-30 20:11:08
|
To have more information about your Error, try to do this: ------------------------------------------------------------------------- my $output = sprintf("ID: %s \tReturn code: %s \tMessage: %s ==> %s", $mesg->mesg_id, $mesg->code, ldap_error_name($mesg->code), ldap_error_text($mesg->code)); print "$output\n"; --------------------------------------------------------------------------- don't foregt to add the next line at the beginning of your script use Net::LDAP::Util qw(ldap_error_name ldap_error_text); Anyway, in your script, I don't see any attribute mapping for the "objectclass". You can NOT add an entry whitout specifying to which objectclass it belongs to. This is an example from the LDAP Module: ---------------------------------------- $result = $ldap->add ( dn => 'cn = Barbara Jensen, o=University of Michigan, c=us', attr => [ 'cn' => ['Barbara Jensen', 'Barbs Jensen'], 'sn => 'Jensen', 'mail' => 'b.j...@um...', 'objectclass' => ['top', 'person', 'organizationalPerson', 'inetOrgPerson' ], ] ); $result->code && warn "failed to add entry: ", $result->error ; ------------------------------------------ As you see this script create an entry having as objectclass "inetorgperson". I hope that can help you Behruz. -----Original Message----- From: per...@li... [mailto:per...@li...]On Behalf Of Edgington, Jeffrey Sent: Friday, March 30, 2001 11:55 AM To: per...@li... Subject: RE: Creating a user in Win2K AD via Net::LDAP I am getting the following error and the code is below that (note this is from a Linux box with Perl 5.6.0) pulsar(4)>perl create.pl add failed: Net::LDAP::Add=HASH(0x82d7148)->error at create.pl line 31. pulsar(5)> 1 #!/umr/testbin/perl 2 3 $| =1; 4 5 6 use Net::LDAPS; 7 $ldaps = new Net::LDAPS('srvtst01.cc.umr.edu', 8 port=> '636'); 9 10 11 $UserPass="94ranger"; 12 $UserID="Administrator"; 13 $ADSserver='srvtst01.cc.umr.edu'; 14 $DomainDN=" dc=test, dc=umr, dc=edu"; 15 $UserDN="cn=$UserID, cn=users, " . $DomainDN; 16 17 $ldaps = Net::LDAPS->new($ADSserver) || die "failed: $@"; 18 19 $mesg = $ldaps->bind( dn =>"$UserDN", password => "$UserPass" ); 20 $mesg->code && die "bind failed: $mesg->error"; 21 22 $tempDN = "cn=Test Edgington, cn=Users, " . $DomainDN; 23 24 $mesg = $ldaps->add( 25 dn => 'cn=Users, dc=test, dc=umr, dc=edu', 26 attr => [ samAccountName => 'test2', 27 displayName => 'Test2 Edg', 28 userPrincipalName => 'te...@te...' 29 ] 30 ); 31 $mesg->code && die "add failed: $mesg->error"; 32 33 34 35 thanks. -----Original Message----- From: Behruz Rushenas [mailto:beh...@cp...] Sent: Friday, March 30, 2001 1:23 PM To: J Beck; 'Edgington, Jeffrey'; per...@li... Subject: RE: Creating a user in Win2K AD via Net::LDAP Make sure you are using the right object classes and the mandatory attributes you need to create a user in AD. Try this to create a mail-enabled user in ActiveDirectory. userAccountControl = 512 cn = John Smith givenName= John mailNickname =Smith sAMAccountName =Smith sn=Smith userPrincipalName =Smith objectclass=top;person;organizationalPerson;user;securityPrincipal;mailRecip ient You can even try first to add a entry by using the "ldapmodify" utility to make sure you can create this entry whithin the directory before starting to add it through a program. Behruz. -----Original Message----- From: per...@li... [mailto:per...@li...]On Behalf Of J Beck Sent: Friday, March 30, 2001 10:54 AM To: 'Edgington, Jeffrey'; per...@li... Subject: RE: Creating a user in Win2K AD via Net::LDAP you might want to look at your directory's logs. what kinds of errors are your getting. it could be permissions, a replicated branch, a required objectclass being left out... -----Original Message----- From: per...@li... [mailto:per...@li...]On Behalf Of Edgington, Jeffrey Sent: Friday, March 30, 2001 11:52 AM To: per...@li... Subject: Creating a user in Win2K AD via Net::LDAP I'm trying to create userid's in Win2K AD via Net::LDAP with little success.... I can manipulate current accounts, but can't create them.... has anyone else been successful with this?... and if so, would you care to share what you did? Thanks. jeff e. |
From: Clif H. <cl...@di...> - 2001-03-30 21:37:11
|
> > I am getting the following error and the code is below that (note this is > from a Linux box with Perl 5.6.0) > > pulsar(4)>perl create.pl > add failed: Net::LDAP::Add=HASH(0x82d7148)->error at create.pl line 31. > pulsar(5)> > > 1 #!/umr/testbin/perl > 2 > 3 $| =1; > 4 > 5 > 6 use Net::LDAPS; > 7 $ldaps = new Net::LDAPS('srvtst01.cc.umr.edu', > 8 port=> '636'); > 9 > 10 > 11 $UserPass="94ranger"; > 12 $UserID="Administrator"; > 13 $ADSserver='srvtst01.cc.umr.edu'; > 14 $DomainDN=" dc=test, dc=umr, dc=edu"; > 15 $UserDN="cn=$UserID, cn=users, " . $DomainDN; > 16 > 17 $ldaps = Net::LDAPS->new($ADSserver) || die "failed: $@"; > 18 > 19 $mesg = $ldaps->bind( dn =>"$UserDN", password => "$UserPass" ); > 20 $mesg->code && die "bind failed: $mesg->error"; > 21 > 22 $tempDN = "cn=Test Edgington, cn=Users, " . $DomainDN; > 23 > 24 $mesg = $ldaps->add( > 25 dn => 'cn=Users, dc=test, dc=umr, dc=edu', > 26 attr => [ samAccountName => 'test2', > 27 displayName => 'Test2 Edg', > 28 userPrincipalName => 'te...@te...' > 29 ] > 30 ); I am no expert on Active Directory but I do not see anything about the objectClass definitions in the attr section. I would think that it would at least need the following; objectClass => [ "top ", "person ", "organizationalPerson ", "user"] Regards, Clif > 31 $mesg->code && die "add failed: $mesg->error"; > 32 > 33 > 34 > 35 > > thanks. > > > > > -----Original Message----- > From: Behruz Rushenas [mailto:beh...@cp...] > Sent: Friday, March 30, 2001 1:23 PM > To: J Beck; 'Edgington, Jeffrey'; per...@li... > Subject: RE: Creating a user in Win2K AD via Net::LDAP > > > Make sure you are using the right object classes and the mandatory > attributes you need to create a user in AD. > Try this to create a mail-enabled user in ActiveDirectory. > > userAccountControl = 512 > cn = John Smith > givenName= John > mailNickname =Smith > sAMAccountName =Smith > sn=Smith > userPrincipalName =Smith > objectclass=top;person;organizationalPerson;user;securityPrincipal;mailRecip > ient > > > You can even try first to add a entry by using the "ldapmodify" utility to > make sure you can create this entry whithin the directory before starting to > add it through a program. > > Behruz. > > > > -----Original Message----- > From: per...@li... > [mailto:per...@li...]On Behalf Of J Beck > Sent: Friday, March 30, 2001 10:54 AM > To: 'Edgington, Jeffrey'; per...@li... > Subject: RE: Creating a user in Win2K AD via Net::LDAP > > > you might want to look at your directory's logs. > what kinds of errors are your getting. > it could be permissions, a replicated branch, a required objectclass being > left out... > > > -----Original Message----- > From: per...@li... > [mailto:per...@li...]On Behalf Of > Edgington, Jeffrey > Sent: Friday, March 30, 2001 11:52 AM > To: per...@li... > Subject: Creating a user in Win2K AD via Net::LDAP > > > I'm trying to create userid's in Win2K AD via Net::LDAP with little > success.... I can manipulate current accounts, but can't create them.... has > anyone else been successful with this?... and if so, would you care to share > what you did? > > Thanks. > > jeff e. > > > > |