--- httpd-2.2.22.orig/modules/aaa/mod_authz_dbm.c 2006-07-12 04:38:44.000000000 +0100 +++ httpd-2.2.22/modules/aaa/mod_authz_dbm.c 2012-02-09 16:13:33.823005895 +0000 @@ -32,6 +32,8 @@ typedef struct { char *grpfile; char *dbmtype; + int case_insensitive; + int user_forcelower; int authoritative; } authz_dbm_config_rec; @@ -62,6 +64,8 @@ conf->grpfile = NULL; conf->dbmtype = "default"; + conf->case_insensitive = 0; /* case sensitive by default */ + conf->user_forcelower = 0; /* don't fold case by default */ conf->authoritative = 1; /* fortress is secure by default */ return conf; @@ -75,6 +79,14 @@ AP_INIT_TAKE1("AuthzDBMType", ap_set_string_slot, (void *)APR_OFFSETOF(authz_dbm_config_rec, dbmtype), OR_AUTHCFG, "what type of DBM file the group file is"), + AP_INIT_FLAG("AuthzDBMCaseInsensitive", ap_set_flag_slot, + (void *)APR_OFFSETOF(authz_dbm_config_rec, case_insensitive), + OR_AUTHCFG, "Set to 'On' to force tests groupnames" + "made by this module to be case insensitive (default is Off.)"), + AP_INIT_FLAG("AuthzDBMUserForceLower", ap_set_flag_slot, + (void *)APR_OFFSETOF(authz_dbm_config_rec, user_forcelower), + OR_AUTHCFG, "Set to 'On' to force tests of usernames" + "made by this module to be lower case (default is Off.)"), AP_INIT_FLAG("AuthzDBMAuthoritative", ap_set_flag_slot, (void *)APR_OFFSETOF(authz_dbm_config_rec, authoritative), OR_AUTHCFG, "Set to 'Off' to allow access control to be passed along to " @@ -158,6 +170,13 @@ return DECLINED; } + if (conf->user_forcelower) { + /* make a forced-lowercase copy of r->user */ + user = apr_pstrdup(r->user); + for(w=user; *w; w++) + *w = tolower(*w); + } + for (x = 0; x < reqs_arr->nelts; x++) { if (!(reqs[x].method_mask & (AP_METHOD_BIT << m))) { @@ -221,6 +240,9 @@ if (!strcmp(v, filegroup)) { return OK; } + if (conf->case_insensitive && !strcasecmp(v, filegroup)) { + return OK; + } } if (conf->authoritative) { @@ -243,6 +265,9 @@ if (!strcmp(v, w)) { return OK; } + if (conf->case_insensitive && !strcasecmp(v, w)) { + return OK; + } } } } @@ -256,7 +281,7 @@ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Authorization of user %s to access %s failed, reason: %s", - r->user, r->uri, + user, r->uri, reason ? reason : "user is not part of the " "'require'ed group(s).");