Hello,

I would like to get a list of the memberUids from a openldap group.
I tried with the script above, but even if I have 3 members I get as count only 1 and the results contains a single string with all 3 members.

Can anyone please help me.

Thank you
Andreas


use Net::LDAP qw(:all);
use Net::LDAP::LDIF;

use DBI;            # Load the DBI module
use FindBin '$Bin';


##
## set variables
##



$port = getservbyname("ldap","tcp") || "389";


##
## make the connection, bind, and search
##
my $rootdn   = "uid=admin,dc=sb-brixen,dc=it";
my $rootpw   = "*****";
$scope = "sub";

$conn = new Net::LDAP('titan', port=>$port) || die "unable to connect: $...@\n";

$conn->bind(dn => "$rootdn", password => "$rootpw") || die "unable to bind: $...@\n";

my $filtergrp = '(memberUid=*)';

$basedn = "cn=trust-me-rdp-spx,ou=groups,dc=sb-brixen,dc=it";
$searchobj = $conn->search(base=>$basedn, scope=>$scope, filter=>$filtergrp,attrs => ['memberUid']);

my $entry;

my $max = $searchobj->count;
print $max,"\n";
  for($i = 0 ; $i < $max ; $i++) {
    $entry = $searchobj->entry($i);
    print $entry->get_value('memberUid'),'\n';
  }


--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to