Hemant1612 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am performing search on AD server and retrieving data from the Directory. I have CSV file with values and I am using the fifth field ($data) as search string for Net::Ldap and storing sAMAccountName in $uid.
Now when the AD attribute has a trailing whitespace in the extensionAttribute1 value the search fails. If i add a trailing whitespace in search string (i.e $data) the search succeeds. here is the code fragment
my @fields = split "," , $line; my $data = $fields[5]; my $uid; my $filter = "(extensionAttribute1=$data)"; my $result = $ldap->search ( base => 'DC=Infoedge,DC=com', filter => $filter, ); foreach my $entry ($result->entries){ $uid=$entry->get_value('sAMAccountName'); }
How can I ask Net::Ldap to search for value even if a trailing whitespace is present in AD attribute extensionAttribute1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::LDAP search attribute with whitespace in AD
by AppleFritter (Vicar) on Oct 26, 2015 at 10:30 UTC | |
by Hemant1612 (Novice) on Oct 28, 2015 at 07:29 UTC |