3.31.2. RewriteFunction Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define you own special Perl function to rewrite user names. You can define an arbitrarily complex Perl function that might call external programs, search in databases or whatever. The user name is changed to whatever is returned by this function.
If you define a RewriteFunction for a Realm or Handler, it will be used in preference to any RewriteUsername. RewriteUsername will be ignored for that Realm or Handler.
# Strip out NULs, trailing realms, translate to
# lower case and remove single quotes
RewriteFunction sub { my($a) = shift; $a =~ s/[\000]//g; $a =~
s/^([^@]+).*/$1/; $a =~ tr/[A-Z]/[a-z]/; $a =~ s/'//g; $a; }