diff options
author | Jan Pazdziora <jpazdziora@redhat.com> | 2015-04-24 14:56:21 +0200 |
---|---|---|
committer | Jan Pazdziora <jpazdziora@redhat.com> | 2015-05-04 14:16:17 +0200 |
commit | 32d345e8e470c3a579338e5ce53b029d19220a4d (patch) | |
tree | e2e1b30144d85b4bc97036ba4bdea169ec05d2a0 /mod_authnz_pam.c | |
parent | abd1ee22aabe2a7cbe8b719544499485e7037bb4 (diff) | |
download | mod_authnz_pam-32d345e8e470c3a579338e5ce53b029d19220a4d.tar.gz mod_authnz_pam-32d345e8e470c3a579338e5ce53b029d19220a4d.tar.xz mod_authnz_pam-32d345e8e470c3a579338e5ce53b029d19220a4d.zip |
Reimplement ap_escape_urlencoded for Apache 2.2.
Diffstat (limited to 'mod_authnz_pam.c')
-rw-r--r-- | mod_authnz_pam.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mod_authnz_pam.c b/mod_authnz_pam.c index 3de486e..968b567 100644 --- a/mod_authnz_pam.c +++ b/mod_authnz_pam.c @@ -71,6 +71,31 @@ static int pam_authenticate_conv(int num_msg, const struct pam_message ** msg, s return PAM_SUCCESS; } +#if AP_MODULE_MAGIC_AT_LEAST(20111025,1) +#else +#include <stdio.h> +#include "apr_lib.h" +static const char * ap_escape_urlencoded(apr_pool_t * pool, const char * buffer) { + char * copy = apr_palloc(pool, 3 * strlen(buffer) + 1); + char * p = copy; + while (*buffer) { + if (!apr_isalnum(*buffer) && !strchr(".-*_ ", *buffer)) { + *p++ = '%'; + sprintf(p, "%02x", *p); + *p += 2; + } else if (*buffer == ' ') { + *p++ = '+'; + } else { + *p++ = *buffer; + } + buffer++; + } + *p++ = '\0'; + return copy; +} +#endif + + static const char * format_location(request_rec * r, const char * url, const char *login) { const char * out = ""; const char * p = url; |