Net::LDAP::Entry help...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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->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');

Re: Net::LDAP::Entry help...

onlineviewer wrote:
Quoted text here. Click to load it

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

Site Timeline