lists.arthurdejong.org
RSS feed

Imprecise description for nslcd.conf "map"

[Date Prev][Date Next] [Thread Prev][Thread Next]

Imprecise description for nslcd.conf "map"



Hi,

I've had some issues configuring nslcd and finally had to revert to poring 
through the source.

The nslcd.conf man page says:

       map MAP ATTRIBUTE NEWATTRIBUTE
              This option allows for custom attributes to be looked up instead
              of  the  default RFC 2307 attributes.  The MAP may be one of the
              supported maps below.  The ATTRIBUTE is the one as used  in  RFC
              2307  (e.g.  userPassword,  ipProtocolNumber, macAddress, etc.).
              The NEWATTRIBUTE may be any attribute as it is available in  the
              directory.

              If  the NEWATTRIBUTE is presented in quotes (") it is treated as
              an expression which will be evaluated to  build  up  the  actual
              value  used.   See  the section on attribute mapping expressions
              below for more details.
...

So I had configured:

map passwd homeDirectory /home/guest

But when I query with "getent passwd joe" I don't see the home directory being 
replaced.

Looking at the function attmap_get_value() it tells a different story:

https://arthurdejong.org/git/nss-pam-ldapd/tree/nslcd/attmap.c#n272

which I read to mean, "if the NEWATTRIBUTE isn't quoted, it names a simple 
attribute and a 1:1 substitution of old attribute value with new attribute 
value happens".

I.e.

map passwd lhs rhs

is the equivalent of:

map passwd lhs "${rhs}"

which is not implied by the man page.  The manual suggests that anything NOT 
quoted is treated as a literal string with no expansions/replacements happening.

Am I still interpreting things incorrectly?

Thanks,

-Philip