2015-12-11 12:54 GMT+01:00 Natxo Asenjo <natxo.ase...@gmail.com>: > hi, > > On Fri, Dec 11, 2015 at 12:15 PM, Clément OUDOT <clem.ou...@gmail.com> > wrote: > >> You should do a search directly on the member DN (with scope base) >> instead of requestind the suffix in sub _get_ad_user_mail : >> >> sub _get_ad_user_mail { >> my ($ad_user) = @_; >> my $search_ad = $ad_ldap->search( >> base => $ad_user, >> scope => "base", >> filter => "(objectclass=*)", >> attr => ['mail'], >> ); >> >> $search_ad->code && die "error on search ad: $@: " . >> $search_ad->error; >> for my $entry ( $search_ad->entries ) { >> my $ad_user_mail = $entry->get_value('mail'); >> return $ad_user_mail; >> } >> } >> >> > mmm, not very much difference, I'm afraid. Now it's even a bit slower: > 2m45sec. Could be network bound (behind a vpn connection now). > > Maybe I need to get a list of users and save its info in another hash, > that could be much faster than making lots of queries per group. >
Another solution is to search users with a filter on memberOf attribute: (memberOf=<DN of Group>), then you get directly all users entries that belong to the group. Clément.