searching hostname section of nisNetgroupTriple

[email protected] ("Patrick W.") Tue, 29 Oct 2013 22:41:05 -0700 (PDT)
Newsgroups perl.ldap
Message-ID <[email protected]>
Hi,

I am having a bit of problem with ldap search on nisNetgroupTriple attribute.

Getting the list of user netgroups a user ($uid in this example) belongs to work:

my $res = $ldap->search( base => $netgrpbasedn, filter => "(nisNetgroupTriple=*,$uid,*)", attrs => ['dn', 'cn']);


But search returns nothing if I do the following, to get a list of host netgroups that a host is belongs to:

my $res = $ldap->search( base => $netgrpbasedn, filter => "(nisNetgroupTriple=$host,*,*)", attrs => ['dn', 'cn']);

The $host will be in the form of fqdn hostname (ie. server.acme.com)

I have tried setting $filter like these also:

$filter = "(nisNetgroupTriple=\($host,*,*\))"
$filter = "(nisNetgroupTriple=$host,-,-)"

Any pointer will be appreciated.

Patrick