summaryrefslogtreecommitdiff
path: root/modules/aaa
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2004-10-04 23:43:20 +0000
committerGraham Leggett <minfrin@apache.org>2004-10-04 23:43:20 +0000
commita2e54fb970d0bc6495ae2650edb41287ca8972a2 (patch)
tree28bb552fb273ab802738aab8b0e63ad6bd9a7ea4 /modules/aaa
parent0e9a37b863d859b63e4794940fb5f7c05a78356c (diff)
downloadhttpd-a2e54fb970d0bc6495ae2650edb41287ca8972a2.tar.gz
mod_auth_ldap: Handle the inconsistent way in which the MS LDAP
library handles special characters. PR: 24437 Obtained from: Submitted by: Jess Holle Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105379 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/aaa')
-rw-r--r--modules/aaa/mod_authnz_ldap.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/modules/aaa/mod_authnz_ldap.c b/modules/aaa/mod_authnz_ldap.c
index 88b7da389e..226aee94af 100644
--- a/modules/aaa/mod_authnz_ldap.c
+++ b/modules/aaa/mod_authnz_ldap.c
@@ -207,19 +207,47 @@ static void authn_ldap_build_filter(char *filtbuf,
* LDAP filter metachars are escaped.
*/
filtbuf_end = filtbuf + FILTER_LENGTH - 1;
- for (p = user, q=filtbuf + strlen(filtbuf);
- *p && q < filtbuf_end; *q++ = *p++) {
#if APR_HAS_MICROSOFT_LDAPSDK
- /* Note: The Microsoft SDK escapes for us, so is not necessary */
+ for (p = user, q=filtbuf + strlen(filtbuf);
+ *p && q < filtbuf_end; ) {
+ if (strchr("*()\\", *p) != NULL) {
+ if ( q + 3 >= filtbuf_end)
+ break; /* Don't write part of escape sequence if we can't write all of it */
+ *q++ = '\\';
+ switch ( *p++ )
+ {
+ case '*':
+ *q++ = '2';
+ *q++ = 'a';
+ break;
+ case '(':
+ *q++ = '2';
+ *q++ = '8';
+ break;
+ case ')':
+ *q++ = '2';
+ *q++ = '9';
+ break;
+ case '\\':
+ *q++ = '5';
+ *q++ = 'c';
+ break;
+ }
+ }
+ else
+ *q++ = *p++;
+ }
#else
+ for (p = user, q=filtbuf + strlen(filtbuf);
+ *p && q < filtbuf_end; *q++ = *p++) {
if (strchr("*()\\", *p) != NULL) {
*q++ = '\\';
if (q >= filtbuf_end) {
- break;
+ break;
}
}
-#endif
}
+#endif
*q = '\0';
/*