]> granicus.if.org Git - apache/commitdiff
strip trailing spaces of groupnames.
authorAndré Malo <nd@apache.org>
Mon, 14 Jul 2003 23:23:00 +0000 (23:23 +0000)
committerAndré Malo <nd@apache.org>
Mon, 14 Jul 2003 23:23:00 +0000 (23:23 +0000)
PR: 12863

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100620 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/aaa/mod_authz_groupfile.c

diff --git a/CHANGES b/CHANGES
index e93d7144604e227b5e8cd514d07cf3a7b901bc66..eb7aae4f1caaae2926e0b0a848d988013e01458c 100644 (file)
--- 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]
index bbd3ad5b7b38de6e7314120b89080872b1e23d05..ae02a27f0c8eaa305e7f86da44d79201a000aadd 100644 (file)
@@ -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;
             }
         }