From 1fc39f21642a02610e0846b78f7f4da0331912c8 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Sat, 1 Sep 2007 13:26:27 +0000 Subject: [PATCH] mod_authnz_ldap, mod_authn_dbd: Tidy up the code to expose authn parameters to the environment. Improve portability to EBCDIC machines by using apr_toupper() git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@571798 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ modules/aaa/mod_authn_dbd.c | 4 ++-- modules/aaa/mod_authnz_ldap.c | 7 +++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 3c0a50ae0a..b6ddfb499b 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) mod_authnz_ldap, mod_authn_dbd: Tidy up the code to expose authn + parameters to the environment. Improve portability to + EBCDIC machines by using apr_toupper(). [Martin Kraemer] + *) mod_deflate: fix content_encoding detection in inflate_out filter when it's not in response headers table. PR 42993 [Nick Kew] diff --git a/modules/aaa/mod_authn_dbd.c b/modules/aaa/mod_authn_dbd.c index d557c6b43b..c81e311185 100644 --- a/modules/aaa/mod_authn_dbd.c +++ b/modules/aaa/mod_authn_dbd.c @@ -138,7 +138,7 @@ static authn_status authn_dbd_password(request_rec *r, const char *user, char *str = apr_pstrcat(r->pool, AUTHN_PREFIX, name, NULL); - int j = 13; + int j = sizeof(AUTHN_PREFIX)-1; /* string length of "AUTHENTICATE_", excluding the trailing NIL */ while (str[j]) { if (!apr_isalnum(str[j])) { str[j] = '_'; @@ -222,7 +222,7 @@ static authn_status authn_dbd_realm(request_rec *r, const char *user, char *str = apr_pstrcat(r->pool, AUTHN_PREFIX, name, NULL); - int j = 13; + int j = sizeof(AUTHN_PREFIX)-1; /* string length of "AUTHENTICATE_", excluding the trailing NIL */ while (str[j]) { if (!apr_isalnum(str[j])) { str[j] = '_'; diff --git a/modules/aaa/mod_authnz_ldap.c b/modules/aaa/mod_authnz_ldap.c index 406928dd3b..3208b7fcaf 100644 --- a/modules/aaa/mod_authnz_ldap.c +++ b/modules/aaa/mod_authnz_ldap.c @@ -30,6 +30,7 @@ #include "apr_xlate.h" #define APR_WANT_STRFUNC #include "apr_want.h" +#include "apr_lib.h" #if APR_HAVE_UNISTD_H /* for getpid() */ @@ -442,11 +443,9 @@ start_over: int i = 0; while (sec->attributes[i]) { char *str = apr_pstrcat(r->pool, AUTHN_PREFIX, sec->attributes[i], NULL); - int j = 13; + int j = sizeof(AUTHN_PREFIX)-1; /* string length of "AUTHENTICATE_", excluding the trailing NIL */ while (str[j]) { - if (str[j] >= 'a' && str[j] <= 'z') { - str[j] = str[j] - ('a' - 'A'); - } + str[j] = apr_toupper(str[j]); j++; } apr_table_setn(e, str, vals[i]); -- 2.40.0