Cornichon has asked for the wisdom of the Perl Monks concerning the following question:
Hello everyone,
I'm writing a script that receives as a parameter the name of a user and performs a search in LDAP but I can't find a way to use a Perl variable in the LDAP search filter.
The code used for the search is this one:
$value = $ldap->search( base => 'dc=xxdom,dc=xxdc', scope => 'sub', filter => '(sn="xx")', );
Let's say the variable $name contains the name I need to do the search.
I tried this: filter => '(sn = $name)'.
It's not working, does anyone have a solution for me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use a variable in ldapsearch filter
by kcott (Archbishop) on Mar 28, 2020 at 01:47 UTC | |
|
Re: use a variable in ldapsearch filter
by AnomalousMonk (Archbishop) on Mar 28, 2020 at 01:17 UTC | |
|
Re: use a variable in ldapsearch filter
by Cornichon (Initiate) on Apr 09, 2020 at 16:49 UTC |