diff options
author | Noriko Hosoi <nhosoi@kiki.usersys.redhat.com> | 2009-06-23 13:51:14 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@kiki.usersys.redhat.com> | 2009-06-23 13:51:14 -0700 |
commit | 5c3eb36aaa05e9cd4eaa923e337d3b55cf584a39 (patch) | |
tree | dfdce7b3dbc725f54f58359084202cd20deb8e55 /ldap | |
parent | a3ac94486635d18bc2546a26e8ce9b633c2249ea (diff) | |
download | ds-5c3eb36aaa05e9cd4eaa923e337d3b55cf584a39.tar.gz ds-5c3eb36aaa05e9cd4eaa923e337d3b55cf584a39.tar.xz ds-5c3eb36aaa05e9cd4eaa923e337d3b55cf584a39.zip |
504383 PCRE breaks SASL Mapping
Fix Description: unescape parenthesis in the regular expression.
E.g., ^u:\(.*\) ==> ^u:(.*)
This unescape is necessary for the new regex code using PCRE
to keep the backward compatibility.
Diffstat (limited to 'ldap')
-rw-r--r-- | ldap/servers/slapd/sasl_map.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c index 10a0cf4a..637ea5dc 100644 --- a/ldap/servers/slapd/sasl_map.c +++ b/ldap/servers/slapd/sasl_map.c @@ -274,6 +274,29 @@ freeConfigEntry( Slapi_Entry ** e ) { } } +/* + * unescape parenthesis in the regular expression. + * E.g., ^u:\(.*\) ==> ^u:(.*) + * This unescape is necessary for the new regex code using PCRE + * to keep the backward compatibility. + */ +char * +_sasl_unescape_parenthesis(char *input) +{ + char *s = NULL; + char *d = NULL; + + for (s = input, d = input; s && *s; s++) { + if (*s == '\\' && *(s+1) && (*(s+1) == '(' || *(s+1) == ')')) { + *d++ = *(++s); + } else { + *d++ = *s; + } + } + *d = '\0'; + return input; +} + static int sasl_map_config_parse_entry(Slapi_Entry *entry, sasl_map_data **new_dp) { @@ -284,7 +307,7 @@ sasl_map_config_parse_entry(Slapi_Entry *entry, sasl_map_data **new_dp) char *map_name = NULL; *new_dp = NULL; - regex = slapi_entry_attr_get_charptr( entry, "nsSaslMapRegexString" ); + regex = _sasl_unescape_parenthesis(slapi_entry_attr_get_charptr( entry, "nsSaslMapRegexString" )); basedntemplate = slapi_entry_attr_get_charptr( entry, "nsSaslMapBaseDNTemplate" ); filtertemplate = slapi_entry_attr_get_charptr( entry, "nsSaslMapFilterTemplate" ); map_name = slapi_entry_attr_get_charptr( entry, "cn" ); |