Changeset 674 for server/common/oursrc/httpdmods
- Timestamp:
- Mar 5, 2008, 7:51:55 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/common/oursrc/httpdmods/mod_vhost_ldap.c
r673 r674 420 420 }; 421 421 422 char* mod_vhost_ldap_sanitize(apr_pool_t* p, const char* source) { 423 char* target = apr_palloc(p, 3*strlen(source)+1); 422 char *mod_vhost_ldap_escape(apr_pool_t *p, const char *source) 423 { 424 char *target = apr_palloc(p, 3 * strlen(source) + 1); 425 char *result = target; 424 426 for (; *source; source++) { 425 427 switch (*source) { 426 case '*': 427 strcpy(target, "\\2a"); 428 target += 3; 429 break; 430 case '(': 431 strcpy(target, "\\28"); 432 target += 3; 433 break; 434 case ')': 435 strcpy(target, "\\29"); 436 target += 3; 437 break; 438 case '\\': 439 strcpy(target, "\\5c"); 428 case '*': case '(': case ')': case '\\': 429 sprintf(target, "\\%02hhx", *source); 440 430 target += 3; 441 431 break; 442 432 default: 443 433 *target++ = *source; 434 break; 444 435 } 445 436 } 446 437 *target = '\0'; 447 return target;438 return result; 448 439 } 449 440 … … 499 490 "[mod_vhost_ldap.c]: translating %s", r->uri); 500 491 501 s_hostname = mod_vhost_ldap_ sanitize(r->pool, hostname);492 s_hostname = mod_vhost_ldap_escape(r->pool, hostname); 502 493 apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(|(apacheServerName=%s)(apacheServerAlias=%s)))", conf->filter, s_hostname, s_hostname); 503 494
Note: See TracChangeset
for help on using the changeset viewer.