-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Adding an ampersand to the start of your filter ($filter="&
(objectClass=...") should work just fine.
However, if you really want to nest:
my $filter = "(&(objectClass=dhcpHost)(objectClass=mwcDHCPhost)";
$filter .= "(dhcpStatements=fixed-address " . $config{ip}. ")" if
defined($config{ip});
$filter .= "(mwcDHCPhostAuthedAs=" . $config{user} . ")" if
defined($config{user});
$filter .= "(dhcpHWAddress=ethernet " . $config{mac} . ")" if
defined($config{mac});
$filter .= ")";
On Sep 26, 2006, at 12:52 PM, Zane C. Bowers wrote:
my $filter="(objectClass=dhcpHost)(objectClass=mwcDHCPhost)";
if (defined($config{ip})){$filter.="(dhcpStatements=fixed-address ".
$config{ip}.")";};
if (defined($config{user})){$filter.="(mwcDHCPhostAuthedAs=".$config
{user}.")";};
if (defined($config{mac})){$filter.="(dhcpHWAddress=ethernet ".
$config{mac}.")";};
That is how I originally started building a filter. The problem was
it did not
work. The problem is it will generate a filter that will work with
ldapsearch,
but will not work with Net::LDAP.
After reading the RFC and doing a bit of testing, I found
"(&(objectClass=dhcpHost)(objectClass=mwcDHCPhost))" will work, but
it needs
to be done in groups of layered.
Before I set out to most likely re-invent the well, any one know of
any
existing solutions for this?
- --
Glenn Lamb
Systems Administrator
[EMAIL PROTECTED]
http://www.stanford.edu/~glamb/gpg.txt
CE4B 7186 D8FD 317F 8364 12CD 02BB ED17 F3E8 555C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
iD8DBQFFGYhlArvtF/PoVVwRAtH3AKDB0OZIanrLI0e6USqPZzTxksT4kACgwtXR
MuMb0S0vAHIDjnDRm7hV6vk=
=U2oK
-----END PGP SIGNATURE-----