From: <Bob...@kp...> - 2003-01-16 20:03:59
|
I over simplified, a trifle. Your search code will look something like this my $msg = $ldap -> search ( base => "ou=my OU, o=My Org, C=us", scope => "sub", filter => "sn=*", ); if ($msg -> error()) { die "An error has occurred --" . $msg -> error(); } # or other appropriate error handling while (my $ent = $msg -> shift_entry(){ my $dn = $ent -> dn(); my $cn = $ent -> get_value("cn"); print("DN: $dn belongs to $cn\n"); # do some other stuff } The fact that you are getting "can't call search on undefined value" would indicate that there was an error that needs to be sorted out. You will need to put the appropriate X.500 address data in the string that you pass in 'base =>'. In my case I have a Directory set up along the lines country (c=us) organization (ou=My Company Name) organizationalUnit (ou= My Administrative Unit) Person1 (sn=Abel) person2 (sn=Baker) .... personN (sn=Zed) I am not sure what you need to specify the search base on Active Directory. B Bob Goolsby bob...@kp... (925) 926-3406 Patrice Gagnon <Pat...@gm...> 01/16/2003 10:44 AM To Bob Goolsby/CA/KAIPERM@KAIPERM cc Subject Re: perl LDAP and Active directory ok thanks... another question: for example: if i have many OU like main OU is Users and sub OU is managing and my doamin is guru.foo.ca is that correct if I write my string like this: $ldap -> search ( base => "ou=managing, ou=users, dc=guru,dc=foo,dc=ca", scope => "sub", filter => "sn=*", ); because I have an error like: Can't call method "search" on an undefined value. the o=My Org ???? represent wich part of my upper string?? the C=us ??? represent wich part of my upper string?? thanks in advance!!:) At 09:27 2003-01-16 -0800, you wrote: >Set your search base at the OU level and use sub-tree search. > > $ldap -> search ( base => "ou=my OU, o=My Org, C=us", > scope => "sub", > filter => "sn=*", > ); > > >Bob Goolsby >bob...@kp... >(925) 926-3406 > > > >Patrice Gagnon <Pat...@gm...> >Sent by: per...@li... >01/16/2003 08:29 AM > >To >per...@li... >cc > >Subject >perl LDAP and Active directory > > > > > > >Hi, > >I have a question. I want to make a list of users from an OU in the >Windows >2000 Active Directory. I can bind to my server but i don't know how to >proceed to make a list of users of an OU. > >if you have any trick..... > > >Thanks in advance.. > > > >------------------------------------------------------- >This SF.NET email is sponsored by: Thawte.com >Understand how to protect your customers personal information by >implementing >SSL on your Apache Web Server. Click here to get our FREE Thawte Apache >Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en |