[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: slapo-rwm and rewriteRules



RaphaÃl 'SurcouF' Bordet wrote:

Thanks for this tips, it's works fine.

database        relay
suffix          "o=Example,c=US"
relay           "dc=example,dc=com"
overlay         rwm
rwm-rewriteEngine       on
rwm-rewriteMap          ldap mail2uid
			"ldap://:9011/dc=example,dc=com?uid?sub";
rwm-rewriteMap          ldap uid2mail
			"ldap://:9011/dc=example,dc=com?mail?sub";

rwm-rewriteContext      default
rwm-rewriteRule         "^(.+,)?(mail=[^,]+),o=Example,c=US$"
			"$1uid=${mail2uid($2)},dc=example,dc=com" ":@I"

Why this rule is needed ?

rwm-rewriteRule         "^(.+,)?o=Example,c=US$"
			"$1dc=example,dc=com" ":@I"

This rule isn't needed when I'm using "massage" argument for "relay" directive.

The "massage" directive automatically instantiates the equivalent of this rule, and more. I rather configure those rules manually to be able to fine-grain control the order of execution of rules.


rwm-rewriteContext      searchEntryDN
rwm-rewriteRule         "^(.+,)?(uid=[^,]+),dc=example,dc=com$"
			"$1mail=${uid2mail($2)},o=Example,c=US" ":@I"

This rule work fine. I've tried to do the same rule for departmentNumber
and departmentUID RDN change but slapd doesn't start if I set this
following rules :


rwm-rewriteContext      searchEntryDN
rwm-rewriteRule		"^(.+,)?(uid=[^,]+),dc=example,dc=com$"
			"$1mail={uid2mail($2)},o=Example,c=US" ":I"
rwm-rewriteRule		"^(.+,)?(departmentUID=[^,]+),dmdName=[^,]+,dc=[a-zA-Z]+,dc=example,dc=com$"
			"$1departmentNumber={uid2number($2)},ou=services,o=Example,c=US$"
":@I"

Did you define the uid2number map?

rwm-rewriteRule         "^(.+,)?dc=example,dc=com$"
			"$1o=Example,c=US" ":@I"

ïThis rule isn't needed when I'm using "massage" argument for "relay" directive.

See above.

Last question : can I modify returned attribute value using rwm ?

Only DN-valued attributes. It (intentionally) doesn't work for other attrs.

p.



Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
---------------------------------------
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Email:   pierangelo.masarati@sys-net.it
---------------------------------------