Click here to get back home

Net::LDAP::Entry help...

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Net::LDAP::Entry help... onlineviewer 09-25-2006
Posted by onlineviewer on September 25, 2006, 10:11 pm
Please log in for more thread options


Hello All,
I am having a problem with getting this to work. In this code section
I'm fetching data from mysql and assigning it to the array @Users
array. $Users[0] contains username and $Users[1] contains the password.
So i'm trying to add this info to my ldap server. The script runs, but
ldap does not contain the new entry. I'm not sure if this is a good way
to go about this. If you need more code section let me know. Any
suggestions ??? Thanks,

use Net::LDAP::Entry;
while ( @Users = $sth->fetchrow_array( ) ) {
$entry = Net::LDAP::Entry->new;
$entry->dn($host);
$entry->add('uid' => '$Users[0]' );
$entry->add('userPassword' => '$Users[1]' );
$entry->add('givenName' => '$Users[0]' );
$entry->add('loginShell' => '/bin/bash' );
$entry->add('gidNumber' => '2222' );
$entry->add('homeDirectory' => '/home/ftpusers/$Users[0]' );
$entry->add('objectClass' => 'top');
$entry->add('objectClass' => 'person');
$entry->add('objectClass' => 'posixAccount');


Posted by Charles DeRykus on October 2, 2006, 7:22 pm
Please log in for more thread options


onlineviewer wrote:
> Hello All,
> I am having a problem with getting this to work. In this code section
> I'm fetching data from mysql and assigning it to the array @Users
> array. $Users[0] contains username and $Users[1] contains the password.
> So i'm trying to add this info to my ldap server. The script runs, but
> ldap does not contain the new entry. I'm not sure if this is a good way
> to go about this. If you need more code section let me know. Any
> suggestions ??? Thanks,
>
> use Net::LDAP::Entry;
> while ( @Users = $sth->fetchrow_array( ) ) {
> $entry = Net::LDAP::Entry->new;
> $entry->dn($host);
> $entry->add('uid' => '$Users[0]' );
> $entry->add('userPassword' => '$Users[1]' );
> $entry->add('givenName' => '$Users[0]' );
> $entry->add('loginShell' => '/bin/bash' );
> $entry->add('gidNumber' => '2222' );
> $entry->add('homeDirectory' => '/home/ftpusers/$Users[0]' );
> $entry->add('objectClass' => 'top');
> $entry->add('objectClass' => 'person');
> $entry->add('objectClass' => 'posixAccount');
>

Take a look at the NOTE below from the Net::LDAP::Entry doc:

...
$entry->add ( 'sn' => 'Barr' );
$entry->add ( 'street' => [ '1 some road','nowhere' ] );

NOTE: these changes are local to the client and will not
appear on the directory server until the "update" method
is called.

--
Charles DeRykus


Similar ThreadsPosted
PERL/GTK : Entry March 18, 2007, 5:34 am
Understaing NET::LDAP August 4, 2004, 10:47 am
Installation LDAP April 29, 2005, 6:27 am
async Net::LDAP October 10, 2005, 9:06 pm
NET:LDAP start_tls does not work July 7, 2004, 12:19 pm
Problem installing Net::LDAP September 22, 2005, 12:54 pm
Net::LDAP compare question June 16, 2006, 10:08 am
OLE- LDAP - uSNChanged - Returns Unknown OLE Object July 21, 2004, 1:35 pm
Net::LDAP makefile generation fails on ActiveState Perl 5.8.8 June 23, 2006, 2:57 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap