Hadn't seen a reply to the post yet, but if you are still looking for the 
answer:

...

foreach $entry ($mesg->all_entries) {
    print "dn: " . $entry->dn() . "<br>";
    foreach $attr ($entry->attributes()) {
       foreach $val ($entry->get_value($attr)) {
          printf("%s: %s<br>", $attr, $val);
       }
    }
}

Mark

Mark Funk wrote the following at 12/1/2006 6:12 PM:
> Folks,
> 
> I am trying to do an LDAP lookup to see if a user belongs to a certain group.
> I connect ok and LDAP only sends me the first member of the attribute group.
> Is there a way to list all members of an attribute group?
> 
> Code snippet:
>  use NET::LDAP;
>  $ldap = Net::LDAP->new( 'tcpauthprd' ) or die "$@";
>   
>  @mesg = $ldap->bind;    # an anonymous bind
>   
>  @mesg = $ldap->search( base =>"ou=groups,o=xxx",
>                       filter =>"(cn=reboot_rts)",
>                       attrs => ['member']
>                     );
> 
> # If there is a result code (indicating an error),
> # display an error message
> if ($mesg->code) {
>   print "An error occurred during the LDAP search attempt:\n";
>   die $mesg->error;
> }
>  my $countOfEntriesReturned = $mesg->count;
>  print "Search returned $countOfEntriesReturned entries ...\n\n";
> 
> 
>  foreach $entry ($mesg->all_entries) {
>     print "dn: " . $entry->dn() . "<br>";
>     @attrs = $entry->attributes();
>     foreach $attr (@attrs) {
>        printf("%s: %s<br>", $attr, $entry->get_value($attr));
>     }
>  }
> 
> 
> Results:
> User->tivplacenet 
> IP-->10.2.0.81 
> Search returned 1 entries ... 
> dn: cn=reboot_rts,ou=groups,o=xxx
> member: secAuthority=default
> 
> 
> In LDAP however, the member attribute holds the following multiple lines...
> 
> cn=reboot_rts,ou=groups,o=xxx
> member=secAuthority=default
> member=cn=ssanchez,ou=employees,o=childrensplace
> member=cn=eayala,ou=employees,o=childrensplace
> member=cn=rdaniel,ou=employees,o=childrensplace
> member=cn=amugnone,ou=employees,o=childrensplace
> member=cn=arivier,ou=employees,o=childrensplace
> member=cn=dlevitt,ou=employees,o=childrensplace
> member=cn=aginart,ou=employees,o=childrensplace
> member=cn=bsilletti,ou=employees,o=childrensplace
> member=cn=rgiambertone,ou=employees,o=childrensplace
> 
> TIA,
> David M. Funk
> President/CEO
> Tivoli Certified Enterprise Consultant
> Specializing in Network and Systems Management Solutions
> Trinity Solutions           
> 604 Cassandra Dr.        
> Cranberry Twp., PA 16066
>  Phone: 724-316-0721                    
> Fax:     724-772-7889 
> email: [EMAIL PROTECTED]
> 
> 
---
Mark Leighton
CLIC Lan Supervisor, Information Commons, University of Toronto
Phone: (416) 946-7094   Fax: (416) 978-0440
E-mail: mark{DOT}leighton{AT}utoronto.ca

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to