Re: [exim] need help with NIS

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: T. Horsnell
CC: exim-users
New-Topics: [exim] exim -bh and permissions
Subject: Re: [exim] need help with NIS
On Wed, 26 Sep 2007, T. Horsnell wrote:

> and would like to replace the search of /etc/shadow
> with a nis{passwd} thing. What is the syntax?
>
>    {${extract{1}{:}{${lookup{$2}lsearch{nis{passwd}}{$value}}}}\

>
> doesnt work,


Well, no, it won't, because you are asking for an lsearch lookup rather
than a NIS lookup. The syntax of a NIS lookup is

${lookup{key}nis{NIS-full-map-name}{yes-string}{no-string}}

The Exim manual says:

nis: The given file is the name of a NIS map, and a NIS lookup is done
with the given key, without a terminating binary zero. There is a
variant called nis0 which does include the terminating binary zero in
the key. This is reportedly needed for Sun-style alias files. Exim
does not recognize NIS aliases; the full map names must be used.

>    {${extract{1}{:}{${lookup{$2}{nis{passwd}}{$value}}}}\

>
> How do we extract a line from nis's passwd tables using a
> userid as a keyword?


A guess:

${extract{1}{:}{${lookup{$2}nis{not-just-passwd}}}}

$value is the default; you can omit it. I can't remember what you have
to say for the full map name, but I think it is more than just "passwd".
Let me see if I can find a NIS example -- aha! There is one in the Exim
book:

data = ${lookup{$local_part}nis{mail.aliases}}




-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book