Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The problem is this: there is a uid in AD that when I search for it, the search does not return anything. $search->count is equal to 0, so I just set the lastlogintime to 0. The ID that I am searching for is definitely in AD but for some reason it does not find it at all when it searches for it. We think the issue may be the possibility that the ID is actually a reference. From what it looks like, I might be able to get the correct result if I just don't try to dereference the object (ID) when I search for it, however I don't know how to do this. I realize that are several Net::LDAP modules that deal with this and I looked at them but I really don't understand them. If anyone has any ideas, I would appreciate a little help. Also, I know the information is a little sketchy here so if you need more, please let me know. Thanks!foreach my $uid (keys %results){ $search = $ad_ldap->search( base => 'DC=company,DC=domain,DC=lan', scope => 'sub', filter => "(&(cn=".$uid.")(objectclass=user))", attrs => ['lastlogon', 'cn'] ); # if no results were returned, set ad_lastlogintime to 0 and g +o to next uid if ( $search->count == 0){ $results{$uid}{ad_lastlogintime}{0} = 1; next; } # store the AD last login time in the uid hash foreach my $entry ($search->entries){ $results{$uid}{ad_lastlogintime}{$entry->get_value('lastlo +gon')} = 1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't get correct returns when querying Active Directory with Net::LDAP
by shmem (Chancellor) on Mar 06, 2009 at 21:58 UTC | |
by Anonymous Monk on Mar 09, 2009 at 15:06 UTC |