summaryrefslogtreecommitdiffstats
path: root/tests/data/rewrite.conf
diff options
context:
space:
mode:
Diffstat (limited to 'tests/data/rewrite.conf')
-rw-r--r--tests/data/rewrite.conf23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/data/rewrite.conf b/tests/data/rewrite.conf
new file mode 100644
index 0000000..eef4d93
--- /dev/null
+++ b/tests/data/rewrite.conf
@@ -0,0 +1,23 @@
+rewriteEngine on
+
+# We have an attribute value from a DN that we want to paste into a filter
+#
+# N.B. Do not use ${escape2filter(${unescapedn($1)})}, but chain them inside
+# the same rewriteMap like this, since only that is safe in the presence of
+# arbitrary data
+rewriteMap escape dn2filter unescapedn escape2filter
+
+# We have a DN that we want to paste into a filter
+rewriteMap escape dn2dnfilter escape2filter
+
+# We have a filter value and want to construct a DN
+rewriteMap escape fitler2dn unescapefilter escape2dn
+
+rewriteContext testdn2filter
+rewriteRule "^([^=]*)=([^,+]*)((\+[^,]*)?,(.*))?" "(&($1=${dn2filter($2)})(entryDN:dnOneLevelMatch:=$5))" ":"
+
+rewriteContext testdn2dnfilter
+rewriteRule ".*" "entryDN=${dn2dnfilter($0)}" ":"
+
+rewriteContext testfilter2dn
+rewriteRule "^\(([^=]*)=([^)]*)\)" "$1=${fitler2dn($2)},dc=example,dc=com" ":"