Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Ldap Group membership

by Anonymous Monk
on May 23, 2005 at 14:01 UTC ( #459565=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hey all, i am trying to write a perl script that will pull all the members of a group in ldap. Does anyone have a starting point?

Replies are listed 'Best First'.
Re: Ldap Group membership
by g0n (Priest) on May 23, 2005 at 14:10 UTC
    Have a look at Net::LDAP. The code will look something like:

    use strict; use Net::LDAP; my $ldap = Net::LDAP->new($ldaphost); my $result = $ldap->search( base=>$groupdn,filter=>'(objectclass=*)',a +ttrs=>['member']); if ($result->code) { print $result->error."\n"; exit 1; } my $entry = $result->entry; my @members = $entry->get('member');

    Warning: Not tested.

    Update: added an error check.


    g0n, backpropagated monk

      Why would someone post something that is not tested? Does it helps anyone?
        it helped me!
Re: Ldap Group membership
by robartes (Priest) on May 23, 2005 at 14:06 UTC
    Use Net::LDAP to do a search for all the member attritubes in the group. That should get you started well enough.


Re: Ldap Group membership
by reasonablekeith (Deacon) on May 23, 2005 at 14:20 UTC
    You could have also typed 'LDAP' in the search box and clicked search ;-)
    my name's not Keith, and I'm not reasonable.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://459565]
Approved by ZlR
[Corion]: Hi jkva!
[Corion]: karlgoethevier: Oooh, that sounds interesting! ;)
[karlgoethebier]: btw, good morning
[Happy-the-monk]: karlgoethebier: have fun! Did some archery at the age of 14 or so.
[karlgoethebier]: Corion: It is, indeed.
[Happy-the-monk]: even more OT: received the complete series of Robin Hood/Robin of Sherwood 1984 on used dvds this morning :)
[Happy-the-monk]: (purely coincidental)
[jkva]: Corion Hey there :)
[Happy-the-monk]: Discipulus: are there any perl monks in Milano?
[Discipulus]: i the moment likely no

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-10-20 09:59 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (260 votes). Check out past polls.