Re: searching hostname section of nisNetgroupTriple

[email protected] (Christopher Bongaarts) Wed, 30 Oct 2013 10:23:10 -0500
Newsgroups perl.ldap
Organization University of Minnesota
Message-ID <[email protected]>
Since you can probably assume that the triples will have all three 
fields, you can probably get away with the simpler filter:

   (nisNetgroupTriple=$host,*)

especially if you can ensure $host does not contain any commas.

One possibility for your problem is your directory server doesn't index 
single character substrings (so the comma alone will never match).

On 10/30/2013 12:41 AM, Patrick W. wrote:
> 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


-- 
%%  Christopher A. Bongaarts   %%  [email protected]          %%
%%  OIT - Identity Management  %%  http://umn.edu/~cab  %%
%%  University of Minnesota    %%  +1 (612) 625-1809    %%