Skip to content

Commit cced213

Browse files
committed
Clarify the map option in the manual page
This tries to make it a little clearer how expressions in the map statement may be used.
1 parent 1cca4b0 commit cced213

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

man/nslcd.conf.5.xml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,15 @@
442442
The <replaceable>ATTRIBUTE</replaceable> is the one as
443443
used in <acronym>RFC</acronym> 2307 (e.g. <literal>userPassword</literal>,
444444
<literal>ipProtocolNumber</literal>, <literal>macAddress</literal>, etc.).
445-
The <replaceable>NEWATTRIBUTE</replaceable> may be any attribute
445+
</para>
446+
<para>
447+
The <replaceable>NEWATTRIBUTE</replaceable> may be the name of any attribute
446448
as it is available in the directory.
447449
</para>
448450
<para>
449-
If the <replaceable>NEWATTRIBUTE</replaceable> is presented in
450-
quotes (") it is treated as an expression which will be evaluated
451+
If the <replaceable>NEWATTRIBUTE</replaceable> is quoted (")
452+
as <replaceable>"EXPRESSION"</replaceable>
453+
it is treated as an expression which will be evaluated
451454
to build up the actual value used.
452455
See the section on attribute mapping expressions below for more details.
453456
</para>
@@ -1118,27 +1121,27 @@
11181121
</para>
11191122
<variablelist remap="TP">
11201123
<varlistentry>
1121-
<term><literal>${attr}</literal> (or <literal>$attr</literal> for short)</term>
1124+
<term><literal>"${attr}"</literal> (or <literal>"$attr"</literal> for short)</term>
11221125
<listitem><para>
11231126
will substitute the value of the attribute
11241127
</para></listitem>
11251128
</varlistentry>
11261129
<varlistentry>
1127-
<term><literal>${attr:-word}</literal></term>
1130+
<term><literal>"${attr:-word}"</literal></term>
11281131
<listitem><para>
11291132
(use default) will substitute the value of the attribute or, if the
11301133
attribute is not set or empty substitute the word
11311134
</para></listitem>
11321135
</varlistentry>
11331136
<varlistentry>
1134-
<term><literal>${attr:+word}</literal></term>
1137+
<term><literal>"${attr:+word}"</literal></term>
11351138
<listitem><para>
11361139
(use alternative) will substitute <literal>word</literal> if attribute
11371140
is set, otherwise substitute the empty string
11381141
</para></listitem>
11391142
</varlistentry>
11401143
<varlistentry> <!-- since 0.9.7 -->
1141-
<term><literal>${attr:offset:length}</literal></term>
1144+
<term><literal>"${attr:offset:length}"</literal></term>
11421145
<listitem><para>
11431146
will substitute <literal>length</literal> characters (actually
11441147
bytes) starting from position <literal>offset</literal> (which
@@ -1149,28 +1152,28 @@
11491152
</para></listitem>
11501153
</varlistentry>
11511154
<varlistentry> <!-- since 0.9.0 -->
1152-
<term><literal>${attr#word}</literal></term>
1155+
<term><literal>"${attr#word}"</literal></term>
11531156
<listitem><para>
11541157
remove the shortest possible match of <literal>word</literal> from the
11551158
left of the attribute value
11561159
</para></listitem>
11571160
</varlistentry>
11581161
<varlistentry> <!-- since 0.9.0 (pynslcd only) -->
1159-
<term><literal>${attr##word}</literal></term>
1162+
<term><literal>"${attr##word}"</literal></term>
11601163
<listitem><para>
11611164
remove the longest possible match of <literal>word</literal> from the
11621165
left of the attribute value (<command>pynslcd</command> only)
11631166
</para></listitem>
11641167
</varlistentry>
11651168
<varlistentry> <!-- since 0.9.0 (pynslcd only) -->
1166-
<term><literal>${attr%word}</literal></term>
1169+
<term><literal>"${attr%word}"</literal></term>
11671170
<listitem><para>
11681171
remove the shortest possible match of <literal>word</literal> from the
11691172
right of the attribute value (<command>pynslcd</command> only)
11701173
</para></listitem>
11711174
</varlistentry>
11721175
<varlistentry> <!-- since 0.9.0 (pynslcd only) -->
1173-
<term><literal>${attr%%word}</literal></term>
1176+
<term><literal>"${attr%%word}"</literal></term>
11741177
<listitem><para>
11751178
remove the longest possible match of <literal>word</literal> from the
11761179
right of the attribute value (<command>pynslcd</command> only)
@@ -1195,28 +1198,28 @@
11951198
</para>
11961199
<variablelist remap="TP">
11971200
<varlistentry>
1198-
<term><literal>"${shadowFlag:-0}"</literal></term>
1201+
<term><literal>map shadow shadowFlag "${shadowFlag:-0}"</literal></term>
11991202
<listitem><para>
12001203
use the <literal>shadowFlag</literal> attribute, using the
12011204
value 0 as default
12021205
</para></listitem>
12031206
</varlistentry>
12041207
<varlistentry>
1205-
<term><literal>"${homeDirectory:-/home/$uid}"</literal></term>
1208+
<term><literal>map passd homeDirectory "${homeDirectory:-/home/$uid}"</literal></term>
12061209
<listitem><para>
12071210
use the <literal>uid</literal> attribute to build a
12081211
<literal>homeDirectory</literal> value if that attribute is missing
12091212
</para></listitem>
12101213
</varlistentry>
12111214
<varlistentry>
1212-
<term><literal>"${isDisabled:+100}"</literal></term>
1215+
<term><literal>map shadow shadowExpire "${isDisabled:+100}"</literal></term>
12131216
<listitem><para>
12141217
if the <literal>isDisabled</literal> attribute is set, return 100,
12151218
otherwise leave value empty
12161219
</para></listitem>
12171220
</varlistentry>
12181221
<varlistentry>
1219-
<term><literal>"${userPassword#{crypt\}}"</literal></term>
1222+
<term><literal>map shadow userPassword "${userPassword#{crypt\}}"</literal></term>
12201223
<listitem><para>
12211224
strip the {crypt} prefix from the userPassword attribute, returning
12221225
the raw hash value

0 commit comments

Comments
 (0)