]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapo-rwm.5
feff69dea5deb260de5aa96e9ede087d8b104cba
[openldap] / doc / man / man5 / slapo-rwm.5
1 .TH SLAPO-RWM 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2017 The OpenLDAP Foundation, All Rights Reserved.
3 .\" Copying restrictions apply.  See the COPYRIGHT file.
4 .\" Copyright 2004, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
5 .\" $OpenLDAP$
6 .\"
7 .\" Portions of this document should probably be moved to slapd-ldap(5)
8 .\" and maybe manual pages for librewrite.
9 .\"
10 .SH NAME
11 slapo\-rwm \- rewrite/remap overlay to slapd
12 .SH SYNOPSIS
13 ETCDIR/slapd.conf
14 .SH DESCRIPTION
15 The
16 .B rwm
17 overlay to
18 .BR slapd (8)
19 performs basic DN/data rewrite and objectClass/attributeType mapping.
20 Its usage is mostly intended to provide virtual views of existing data
21 either remotely, in conjunction with the proxy backend described in
22 .BR slapd\-ldap (5),
23 or locally, in conjunction with the relay backend described in
24 .BR slapd\-relay (5).
25 .LP
26 This overlay is experimental.
27 .SH MAPPING
28 An important feature of the
29 .B rwm
30 overlay is the capability to map objectClasses and attributeTypes
31 from the local set (or a subset of it) to a foreign set, and vice versa.
32 This is accomplished by means of the 
33 .B rwm\-map
34 directive.
35 .TP
36 .B rwm\-map "{attribute | objectclass} [<local name> | *] {<foreign name> | *}"
37 Map attributeTypes and objectClasses from the foreign server to
38 different values on the local slapd.
39 The reason is that some attributes might not be part of the local
40 slapd's schema, some attribute names might be different but serve the
41 same purpose, etc.
42 If local or foreign name is `*', the name is preserved.
43 If local name is omitted, the foreign name is removed.
44 Unmapped names are preserved if both local and foreign name are `*',
45 and removed if local name is omitted and foreign name is `*'.
46 .LP
47 The local 
48 .I objectClasses 
49 and 
50 .I attributeTypes 
51 must be defined in the local schema; the foreign ones do not have to,
52 but users are encouraged to explicitly define the remote attributeTypes
53 and the objectClasses they intend to map.  All in all, when remapping
54 a remote server via back-ldap (\fBslapd\-ldap\fP(5)) 
55 or back-meta (\fBslapd\-meta\fP(5))
56 their definition can be easily obtained by querying the \fIsubschemaSubentry\fP
57 of the remote server; the problem should not exist when remapping a local 
58 database.
59 Note, however, that the decision whether to rewrite or not attributeTypes
60 with 
61 .IR "distinguishedName syntax" ,
62 requires the knowledge of the attributeType syntax.
63 See the REWRITING section for details.
64 .LP
65 Note that when mapping DN-valued attributes from local to remote,
66 first the DN is rewritten, and then the attributeType is mapped;
67 while mapping from remote to local, first the attributeType is mapped,
68 and then the DN is rewritten.
69 As such, it is important that the local attributeType is appropriately
70 defined as using the distinguishedName syntax.
71 Also, note that there are DN-related syntaxes (i.e. compound types with
72 a portion that is DN-valued), like nameAndOptionalUID,
73 whose values are currently not rewritten.
74 .LP
75 If the foreign type of an attribute mapping is not defined on the local 
76 server, it might be desirable to have the attribute values normalized after
77 the mapping process. Not normalizing the values can lead to wrong results, 
78 when the
79 .B rwm
80 overlay is used together with e.g. the
81 .B pcache
82 overlay. This normalization can be enabled by means of the 
83 .B rwm\-normalize\-mapped\-attrs
84 directive.
85 .TP
86 .B rwm\-normalize\-mapped\-attrs {yes|no}
87 Set this to "yes", if the
88 .B rwm
89 overlay should try to normalize the values of attributes that are mapped from
90 an attribute type that is unknown to the local server. The default value of
91 this setting is "no".
92 .TP
93 .B rwm-drop-unrequested-attrs {yes|no}
94 Set this to "yes", if the
95 .B rwm
96 overlay should drop attributes that are not explicitly requested
97 by a search operation.
98 When this is set to "no", the
99 .B rwm
100 overlay will leave all attributes in place, so that subsequent modules
101 can further manipulate them.
102 In any case, unrequested attributes will be omitted from search results
103 by the frontend, when the search entry response package is encoded.
104 The default value of this setting is "yes".
105 .SH SUFFIX MASSAGING
106 A basic feature of the
107 .B rwm
108 overlay is the capability to perform suffix massaging between a virtual
109 and a real naming context by means of the 
110 .B rwm\-suffixmassage
111 directive.
112 This, in conjunction with proxy backends,
113 .BR slapd\-ldap (5)
114 and
115 .BR slapd\-meta (5),
116 or with the relay backend, 
117 .BR slapd\-relay (5),
118 allows one to create virtual views of databases.
119 A distinguishing feature of this overlay is that, when instantiated
120 before any database, it can modify the DN of requests
121 .I before
122 database selection.
123 For this reason, rules that rewrite the empty DN ("") 
124 or the subschemaSubentry DN (usually "cn=subschema"),
125 would prevent clients from reading the root DSE or the DSA's schema.
126 .TP
127 .B rwm\-suffixmassage "[<virtual naming context>]" "<real naming context>"
128 Shortcut to implement naming context rewriting; the trailing part
129 of the DN is rewritten from the virtual to the real naming context
130 in the bindDN, searchDN, searchFilterAttrDN, compareDN, compareAttrDN,
131 addDN, addAttrDN, modifyDN, modifyAttrDN, modrDN, newSuperiorDN,
132 deleteDN, exopPasswdDN, and from the real to the virtual naming context
133 in the searchEntryDN, searchAttrDN and matchedDN rewrite contexts.
134 By default no rewriting occurs for the searchFilter 
135 and for the referralAttrDN and referralDN rewrite contexts.
136 If no \fI<virtual naming context>\fP is given, the first suffix of the
137 database is used; this requires the 
138 .B rwm\-suffixmassage
139 directive be defined \fIafter\fP the database
140 .B suffix
141 directive.
142 The
143 .B rwm\-suffixmassage
144 directive automatically sets the
145 .B rwm\-rewriteEngine
146 to
147 .BR ON .
148 .LP
149 See the REWRITING section for details.
150 .SH REWRITING
151 A string is rewritten according to a set of rules, called a `rewrite
152 context'.
153 The rules are based on POSIX (''extended'') regular expressions with
154 substring matching; basic variable substitution and map resolution 
155 of substrings is allowed by specific mechanisms detailed in the following.
156 The behavior of pattern matching/substitution can be altered by a set
157 of flags.
158 .LP
159 .RS
160 .nf
161 <rewrite context> ::= <rewrite rule> [...]
162 <rewrite rule> ::= <pattern> <action> [<flags>]
163 .fi
164 .RE
165 .LP
166 The underlying concept is to build a lightweight rewrite module
167 for the slapd server (initially dedicated to the LDAP backend):
168 .LP
169 .SH Passes
170 An incoming string is matched against a set of
171 .IR rewriteRules .
172 Rules are made of a 
173 .IR "regex match pattern" , 
174
175 .I "substitution pattern"
176 and a set of actions, described by a set of 
177 .IR "optional flags" .
178 In case of match, string rewriting is performed according to the
179 substitution pattern that allows one to refer to substrings matched in the
180 incoming string.
181 The actions, if any, are finally performed.
182 Each rule is executed recursively, unless altered by specific action 
183 flags; see "Action Flags" for details.
184 A default limit on the recursion level is set, and can be altered
185 by the
186 .B rwm\-rewriteMaxPasses
187 directive, as detailed in the "Additional Configuration Syntax" section.
188 The substitution pattern allows map resolution of substrings.
189 A map is a generic object that maps a substitution pattern to a value.
190 The flags are divided in "Pattern Matching Flags" and "Action Flags";
191 the former alter the regex match pattern behavior, while the latter
192 alter the actions that are taken after substitution.
193 .SH "Pattern Matching Flags"
194 .TP
195 .B `C'
196 honors case in matching (default is case insensitive)
197 .TP
198 .B `R'
199 use POSIX ''basic'' regular expressions (default is ''extended'')
200 .TP
201 .B `M{n}'
202 allow no more than
203 .B n
204 recursive passes for a specific rule; does not alter the max total count
205 of passes, so it can only enforce a stricter limit for a specific rule.
206 .SH "Action Flags"
207 .TP
208 .B `:'
209 apply the rule once only (default is recursive)
210 .TP
211 .B `@'
212 stop applying rules in case of match; the current rule is still applied 
213 recursively; combine with `:' to apply the current rule only once 
214 and then stop.
215 .TP
216 .B `#'
217 stop current operation if the rule matches, and issue an `unwilling to
218 perform' error.
219 .TP
220 .B `G{n}'
221 jump
222 .B n
223 rules back and forth (watch for loops!).
224 Note that `G{1}' is implicit in every rule.
225 .TP
226 .B `I'
227 ignores errors in rule; this means, in case of error, e.g. issued by a
228 map, the error is treated as a missed match.
229 The `unwilling to perform' is not overridden.
230 .TP
231 .B `U{n}'
232 uses
233 .B
234 n
235 as return code if the rule matches; the flag does not alter the recursive
236 behavior of the rule, so, to have it performed only once, it must be used 
237 in combination with `:', e.g.
238 .B `:U{32}'
239 returns the value `32' (indicating noSuchObject) after exactly 
240 one execution of the rule, if the pattern matches.
241 As a consequence, its behavior is equivalent to `@', with the return
242 code set to
243 .BR n ;
244 or, in other words, `@' is equivalent to `U{0}'.
245 Positive errors are allowed, indicating the related LDAP error codes
246 as specified in \fIdraft-ietf-ldapbis-protocol\fP.
247 .LP
248 The ordering of the flags can be significant.
249 For instance: `IG{2}' means ignore errors and jump two lines ahead
250 both in case of match and in case of error, while `G{2}I' means ignore
251 errors, but jump two lines ahead only in case of match.
252 .LP
253 More flags (mainly Action Flags) will be added as needed.
254 .SH "Pattern Matching"
255 See
256 .BR regex (7)
257 and/or
258 .BR re_format (7).
259 .SH "Substitution Pattern Syntax"
260 Everything starting with `$' requires substitution;
261 .LP
262 the only obvious exception is `$$', which is turned into a single `$';
263 .LP
264 the basic substitution is `$<d>', where `<d>' is a digit;
265 0 means the whole string, while 1-9 is a submatch, as discussed in 
266 .BR regex (7)
267 and/or
268 .BR re_format (7).
269 .LP
270 a `$' followed by a `{' invokes an advanced substitution.
271 The pattern is:
272 .LP
273 .RS
274 `$' `{' [ <operator> ] <name> `(' <substitution> `)' `}'
275 .RE
276 .LP
277 where <name> must be a legal name for the map, i.e.
278 .LP
279 .RS
280 .nf
281 <name> ::= [a-z][a-z0-9]* (case insensitive)
282 <operator> ::= `>' `|' `&' `&&' `*' `**' `$'
283 .fi
284 .RE
285 .LP
286 and <substitution> must be a legal substitution
287 pattern, with no limits on the nesting level.
288 .LP
289 The operators are:
290 .TP
291 .B >
292 sub-context invocation; <name> must be a legal, already defined
293 rewrite context name
294 .TP
295 .B |
296 external command invocation; <name> must refer to a legal, already
297 defined command name (NOT IMPLEMENTED YET)
298 .TP
299 .B &
300 variable assignment; <name> defines a variable in the running
301 operation structure which can be dereferenced later; operator
302 .B &
303 assigns a variable in the rewrite context scope; operator
304 .B &&
305 assigns a variable that scopes the entire session, e.g. its value
306 can be dereferenced later by other rewrite contexts
307 .TP
308 .B *
309 variable dereferencing; <name> must refer to a variable that is
310 defined and assigned for the running operation; operator
311 .B *
312 dereferences a variable scoping the rewrite context; operator
313 .B **
314 dereferences a variable scoping the whole session, e.g. the value
315 is passed across rewrite contexts
316 .TP
317 .B $
318 parameter dereferencing; <name> must refer to an existing parameter;
319 the idea is to make some run-time parameters set by the system
320 available to the rewrite engine, as the client host name, the bind DN
321 if any, constant parameters initialized at config time, and so on;
322 no parameter is currently set by either 
323 .B back\-ldap
324 or
325 .BR back\-meta ,
326 but constant parameters can be defined in the configuration file
327 by using the
328 .B rewriteParam
329 directive.
330 .LP
331 Substitution escaping has been delegated to the `$' symbol, 
332 which is used instead of `\e' in string substitution patterns
333 because `\e' is already escaped by slapd's low level parsing routines;
334 as a consequence, regex escaping requires
335 two `\e' symbols, e.g. `\fB.*\e.foo\e.bar\fP' must
336 be written as `\fB.*\e\e.foo\e\e.bar\fP'.
337 .\"
338 .\" The symbol can be altered at will by redefining the related macro in
339 .\" "rewrite-int.h".
340 .\"
341 .SH "Rewrite Context"
342 A rewrite context is a set of rules which are applied in sequence.
343 The basic idea is to have an application initialize a rewrite
344 engine (think of Apache's mod_rewrite ...) with a set of rewrite
345 contexts; when string rewriting is required, one invokes the
346 appropriate rewrite context with the input string and obtains the
347 newly rewritten one if no errors occur.
348 .LP
349 Each basic server operation is associated to a rewrite context;
350 they are divided in two main groups: client \-> server and
351 server \-> client rewriting.
352 .LP
353 client \-> server:
354 .LP
355 .RS
356 .nf
357 (default)            if defined and no specific context 
358                      is available
359 bindDN               bind
360 searchDN             search
361 searchFilter         search
362 searchFilterAttrDN   search
363 compareDN            compare
364 compareAttrDN        compare AVA
365 addDN                add
366 addAttrDN            add AVA (DN portion of "ref" excluded)
367 modifyDN             modify
368 modifyAttrDN         modify AVA (DN portion of "ref" excluded)
369 referralAttrDN       add/modify DN portion of referrals
370                      (default to none)
371 renameDN             modrdn (the old DN)
372 newSuperiorDN        modrdn (the new parent DN, if any)
373 newRDN               modrdn (the new relative DN)
374 deleteDN             delete
375 exopPasswdDN         password modify extended operation DN
376 .fi
377 .RE
378 .LP
379 server \-> client:
380 .LP
381 .RS
382 .nf
383 searchEntryDN        search (only if defined; no default;
384                      acts on DN of search entries)
385 searchAttrDN         search AVA (only if defined; defaults
386                      to searchEntryDN; acts on DN-syntax
387                      attributes of search results)
388 matchedDN            all ops (only if applicable; defaults
389                      to searchEntryDN)
390 referralDN           all ops (only if applicable; defaults
391                      to none)
392 .fi
393 .RE
394 .LP
395 .SH "Basic Configuration Syntax"
396 All rewrite/remap directives start with the prefix
397 .BR rwm\- ;
398 for backwards compatibility with the historical
399 .BR slapd\-ldap (5)
400 and
401 .BR slapd\-meta (5)
402 builtin rewrite/remap capabilities, the prefix may be omitted, 
403 but this practice is strongly discouraged.
404 .TP
405 .B rwm\-rewriteEngine { on | off }
406 If `on', the requested rewriting is performed; if `off', no
407 rewriting takes place (an easy way to stop rewriting without
408 altering too much the configuration file).
409 .TP
410 .B rwm\-rewriteContext <context name> "[ alias <aliased context name> ]"
411 <Context name> is the name that identifies the context, i.e. the name
412 used by the application to refer to the set of rules it contains.
413 It is used also to reference sub contexts in string rewriting.
414 A context may alias another one.
415 In this case the alias context contains no rule, and any reference to
416 it will result in accessing the aliased one.
417 .TP
418 .B rwm\-rewriteRule "<regex match pattern>" "<substitution pattern>" "[ <flags> ]"
419 Determines how a string can be rewritten if a pattern is matched.
420 Examples are reported below.
421 .SH "Additional Configuration Syntax"
422 .TP
423 .B rwm\-rewriteMap "<map type>" "<map name>" "[ <map attrs> ]"
424 Allows one to define a map that transforms substring rewriting into
425 something else.
426 The map is referenced inside the substitution pattern of a rule.
427 .TP
428 .B rwm\-rewriteParam <param name> <param value>
429 Sets a value with global scope, that can be dereferenced by the
430 command `${$paramName}'.
431 .TP
432 .B rwm\-rewriteMaxPasses <number of passes> [<number of passes per rule>]
433 Sets the maximum number of total rewriting passes that can be
434 performed in a single rewrite operation (to avoid loops).
435 A safe default is set to 100; note that reaching this limit is still
436 treated as a success; recursive invocation of rules is simply 
437 interrupted.
438 The count applies to the rewriting operation as a whole, not 
439 to any single rule; an optional per-rule limit can be set.
440 This limit is overridden by setting specific per-rule limits
441 with the `M{n}' flag.
442
443 .SH "MAPS"
444 Currently, few maps are builtin but additional map types may be
445 registered at runtime.
446
447 Supported maps are:
448 .TP
449 .B LDAP <URI> [bindwhen=<when>] [version=<version>] [binddn=<DN>] [credentials=<cred>]
450 The
451 .B LDAP
452 map expands a value by performing a simple LDAP search.
453 Its configuration is based on a mandatory URI, whose
454 .B attrs
455 portion must contain exactly one attribute
456 (use
457 .B entryDN
458 to fetch the DN of an entry).
459 If a multi-valued attribute is used, only the first value is considered.
460
461 The parameter
462 .B bindwhen
463 determines when the connection is established.
464 It can take the values
465 .BR now ,
466 .BR later ,
467 and
468 .BR everytime ,
469 respectively indicating that the connection should be created at startup,
470 when required, or any time it is used.
471 In the former two cases, the connection is cached, while in the latter
472 a fresh new one is used all times.  This is the default.
473
474 The parameters
475 .B binddn
476 and
477 .B credentials
478 represent the DN and the password that is used to perform an authenticated
479 simple bind before performing the search operation; if not given,
480 an anonymous connection is used.
481
482 The parameter
483 .B version
484 can be 2 or 3 to indicate the protocol version that must be used.
485 The default is 3.
486
487 .TP
488 .B slapd <URI>
489 The
490 .B slapd
491 map expands a value by performing an internal LDAP search.
492 Its configuration is based on a mandatory URI, which must begin with
493 .B "ldap:///"
494 (i.e., it must be an LDAP URI and it must not specify a host).
495 As with the
496 LDAP map, the
497 .B attrs
498 portion must contain exactly one attribute, and if
499 a multi-valued attribute is used, only the first value is considered.
500
501 .SH "REWRITE CONFIGURATION EXAMPLES"
502 .nf
503 # set to `off' to disable rewriting
504 rwm\-rewriteEngine on
505
506 # the rules the "suffixmassage" directive implies
507 rwm\-rewriteEngine on
508 # all dataflow from client to server referring to DNs
509 rwm\-rewriteContext default
510 rwm\-rewriteRule "(.+,)?<virtualnamingcontext>$" "$1<realnamingcontext>" ":"
511 # empty filter rule
512 rwm\-rewriteContext searchFilter
513 # all dataflow from server to client
514 rwm\-rewriteContext searchEntryDN
515 rwm\-rewriteRule "(.+,)?<realnamingcontext>$" "$1<virtualnamingcontext>" ":"
516 rwm\-rewriteContext searchAttrDN alias searchEntryDN
517 rwm\-rewriteContext matchedDN alias searchEntryDN
518 # misc empty rules
519 rwm\-rewriteContext referralAttrDN
520 rwm\-rewriteContext referralDN
521
522 # Everything defined here goes into the `default' context.
523 # This rule changes the naming context of anything sent
524 # to `dc=home,dc=net' to `dc=OpenLDAP, dc=org'
525
526 rwm\-rewriteRule "(.+,)?dc=home,[ ]?dc=net$"
527             "$1dc=OpenLDAP, dc=org"  ":"
528
529 # since a pretty/normalized DN does not include spaces
530 # after rdn separators, e.g. `,', this rule suffices:
531
532 rwm\-rewriteRule "(.+,)?dc=home,dc=net$"
533             "$1dc=OpenLDAP,dc=org"  ":"
534
535 # Start a new context (ends input of the previous one).
536 # This rule adds blanks between DN parts if not present.
537 rwm\-rewriteContext  addBlanks
538 rwm\-rewriteRule     "(.*),([^ ].*)" "$1, $2"
539
540 # This one eats blanks
541 rwm\-rewriteContext  eatBlanks
542 rwm\-rewriteRule     "(.*), (.*)" "$1,$2"
543
544 # Here control goes back to the default rewrite
545 # context; rules are appended to the existing ones.
546 # anything that gets here is piped into rule `addBlanks'
547 rwm\-rewriteContext  default
548 rwm\-rewriteRule     ".*" "${>addBlanks($0)}" ":"
549
550 .\" # Anything with `uid=username' is looked up in
551 .\" # /etc/passwd for gecos (I know it's nearly useless,
552 .\" # but it is there just as a guideline to implementing
553 .\" # custom maps).
554 .\" # Note the `I' flag that leaves `uid=username' in place 
555 .\" # if `username' does not have a valid account, and the
556 .\" # `:' that forces the rule to be processed exactly once.
557 .\" rwm\-rewriteContext  uid2Gecos
558 .\" rwm\-rewriteRule     "(.*)uid=([a\-z0\-9]+),(.+)"
559 .\"                 "$1cn=$2{xpasswd},$3"      "I:"
560 .\" 
561 .\" # Finally, in a bind, if one uses a `uid=username' DN,
562 .\" # it is rewritten in `cn=name surname' if possible.
563 .\" rwm\-rewriteContext  bindDN
564 .\" rwm\-rewriteRule     ".*" "${>addBlanks(${>uid2Gecos($0)})}" ":"
565 .\" 
566 # Rewrite the search base according to `default' rules.
567 rwm\-rewriteContext  searchDN alias default
568
569 # Search results with OpenLDAP DN are rewritten back with
570 # `dc=home,dc=net' naming context, with spaces eaten.
571 rwm\-rewriteContext  searchEntryDN
572 rwm\-rewriteRule     "(.*[^ ],)?[ ]?dc=OpenLDAP,[ ]?dc=org$"
573                 "${>eatBlanks($1)}dc=home,dc=net"    ":"
574
575 # Bind with email instead of full DN: we first need
576 # an ldap map that turns attributes into a DN (the
577 # argument used when invoking the map is appended to 
578 # the URI and acts as the filter portion)
579 rwm\-rewriteMap ldap attr2dn "ldap://host/dc=my,dc=org?dn?sub"
580
581 # Then we need to detect DN made up of a single email,
582 # e.g. `mail=someone@example.com'; note that the rule
583 # in case of match stops rewriting; in case of error,
584 # it is ignored.  In case we are mapping virtual
585 # to real naming contexts, we also need to rewrite
586 # regular DNs, because the definition of a bindDN
587 # rewrite context overrides the default definition.
588 rwm\-rewriteContext bindDN
589 rwm\-rewriteRule "^mail=[^,]+@[^,]+$" "${attr2dn($0)}" ":@I"
590
591 # This is a rather sophisticated example. It massages a
592 # search filter in case who performs the search has
593 # administrative privileges.  First we need to keep
594 # track of the bind DN of the incoming request, which is
595 # stored in a variable called `binddn' with session scope,
596 # and left in place to allow regular binding:
597 rwm\-rewriteContext  bindDN
598 rwm\-rewriteRule     ".+" "${&&binddn($0)}$0" ":"
599
600 # A search filter containing `uid=' is rewritten only
601 # if an appropriate DN is bound.
602 # To do this, in the first rule the bound DN is
603 # dereferenced, while the filter is decomposed in a
604 # prefix, in the value of the `uid=<arg>' AVA, and 
605 # in a suffix. A tag `<>' is appended to the DN. 
606 # If the DN refers to an entry in the `ou=admin' subtree, 
607 # the filter is rewritten OR-ing the `uid=<arg>' with
608 # `cn=<arg>'; otherwise it is left as is. This could be
609 # useful, for instance, to allow apache's auth_ldap-1.4
610 # module to authenticate users with both `uid' and
611 # `cn', but only if the request comes from a possible
612 # `cn=Web auth,ou=admin,dc=home,dc=net' user.
613 rwm\-rewriteContext searchFilter
614 rwm\-rewriteRule "(.*\e\e()uid=([a\-z0\-9_]+)(\e\e).*)"
615   "${**binddn}<>${&prefix($1)}${&arg($2)}${&suffix($3)}"
616   ":I"
617 rwm\-rewriteRule "^[^,]+,ou=admin,dc=home,dc=net$"
618   "${*prefix}|(uid=${*arg})(cn=${*arg})${*suffix}" ":@I"
619 rwm\-rewriteRule ".*<>$" "${*prefix}uid=${*arg}${*suffix}" ":"
620
621 # This example shows how to strip unwanted DN-valued
622 # attribute values from a search result; the first rule
623 # matches DN values below "ou=People,dc=example,dc=com";
624 # in case of match the rewriting exits successfully.
625 # The second rule matches everything else and causes
626 # the value to be rejected.
627 rwm\-rewriteContext searchEntryDN
628 rwm\-rewriteRule ".+,ou=People,dc=example,dc=com$" "$0" ":@"
629 rwm\-rewriteRule ".*" "" "#"
630 .fi
631 .SH "MAPPING EXAMPLES"
632 The following directives map the object class `groupOfNames' to
633 the object class `groupOfUniqueNames' and the attribute type
634 `member' to the attribute type `uniqueMember':
635 .LP
636 .RS
637 .nf
638 map objectclass groupOfNames groupOfUniqueNames
639 map attribute uniqueMember member
640 .fi
641 .RE
642 .LP
643 This presents a limited attribute set from the foreign
644 server:
645 .LP
646 .RS
647 .nf
648 map attribute cn *
649 map attribute sn *
650 map attribute manager *
651 map attribute description *
652 map attribute *
653 .fi
654 .RE
655 .LP
656 These lines map cn, sn, manager, and description to themselves, and 
657 any other attribute gets "removed" from the object before it is sent 
658 to the client (or sent up to the LDAP server).  This is obviously a 
659 simplistic example, but you get the point.
660 .SH FILES
661 .TP
662 ETCDIR/slapd.conf
663 default slapd configuration file
664 .SH SEE ALSO
665 .BR slapd.conf (5),
666 .BR slapd\-config (5),
667 .BR slapd\-ldap (5),
668 .BR slapd\-meta (5),
669 .BR slapd\-relay (5),
670 .BR slapd (8),
671 .BR regex (7),
672 .BR re_format (7).
673 .SH AUTHOR
674 Pierangelo Masarati; based on back-ldap rewrite/remap features
675 by Howard Chu, Pierangelo Masarati.