From: André Malo Date: Mon, 14 Jul 2003 23:23:00 +0000 (+0000) Subject: strip trailing spaces of groupnames. X-Git-Tag: pre_ajp_proxy~1421 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce1d7d03e4e4a1a7894128f4d5008a1b52afe9b4;p=apache strip trailing spaces of groupnames. PR: 12863 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100620 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index e93d714460..eb7aae4f1c 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_authz_groupfile: Strip trailing spaces of group names. This + hopefully saves some hours of searching for typos. PR 12863. + [André Malo] + *) Remove an extra bit of unnecessary code from the recently committed fix for PR 13946 (in mod_rewrite). Reported by Andre Malo. [Paul J. Reder] diff --git a/modules/aaa/mod_authz_groupfile.c b/modules/aaa/mod_authz_groupfile.c index bbd3ad5b7b..ae02a27f0c 100644 --- a/modules/aaa/mod_authz_groupfile.c +++ b/modules/aaa/mod_authz_groupfile.c @@ -86,6 +86,7 @@ */ #include "apr_strings.h" +#include "apr_lib.h" /* apr_isspace */ #include "ap_config.h" #include "httpd.h" @@ -148,6 +149,7 @@ static apr_status_t groups_for_user(apr_pool_t *p, char *user, char *grpfile, char l[MAX_STRING_LEN]; const char *group_name, *ll, *w; apr_status_t status; + apr_size_t group_len; if ((status = ap_pcfg_openfile(&f, p, grpfile)) != APR_SUCCESS) { return status ; @@ -163,11 +165,17 @@ static apr_status_t groups_for_user(apr_pool_t *p, char *user, char *grpfile, apr_pool_clear(sp); group_name = ap_getword(sp, &ll, ':'); + group_len = strlen(group_name); + + while (group_len && apr_isspace(*(group_name + group_len - 1))) { + --group_len; + } while (ll[0]) { w = ap_getword_conf(sp, &ll); if (!strcmp(w, user)) { - apr_table_setn(grps, apr_pstrdup(p, group_name), "in"); + apr_table_setn(grps, apr_pstrmemdup(p, group_name, group_len), + "in"); break; } }