summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--apache2x/mod_httpauth.c41
2 files changed, 28 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index f3190a5..e0502b5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
0.9.5
- Build fixes for MAC OS 10.4 and 10.5
- Build fixes for Solaris
+ - In apache module, expose groups matched from "require groups" via
+ HTTPAUTH_GROUPS environment variable.
0.9.4 [30-07-2008]
- Rework event handling system so we don't use a full thread per
diff --git a/apache2x/mod_httpauth.c b/apache2x/mod_httpauth.c
index f2c76ad..b52dbdf 100644
--- a/apache2x/mod_httpauth.c
+++ b/apache2x/mod_httpauth.c
@@ -1076,6 +1076,25 @@ write_needed_groups(httpauth_context_t *ctx, request_rec *r)
return 0;
}
+static httpauth_request_t*
+setup_request_hreq (request_rec *r, char *user, char *groups)
+{
+ httpauth_request_t* hreq;
+
+ hreq = (httpauth_request_t*)apr_pcalloc (r->pool, sizeof (*hreq));
+ hreq->user = r->user;
+ hreq->groups = groups;
+
+ if (groups)
+ apr_table_setn (r->subprocess_env, "HTTPAUTH_GROUPS", groups);
+ else
+ apr_table_unset (r->subprocess_env, "HTTPAUTH_GROUPS");
+
+ ap_set_module_config (r->request_config, &httpauth_module, hreq);
+
+ return hreq;
+}
+
static int httpauth_authenticate(request_rec* r)
{
httpauth_context_t* ctx;
@@ -1113,17 +1132,13 @@ static int httpauth_authenticate(request_rec* r)
r->user = apr_pstrdup (r->pool, hreq->user);
r->ap_auth_type = HTTPAUTH_AUTHTYPE;
- /* Make another request config for this sub request */
- if (mainreq != r) {
- groups = hreq->groups ? apr_pstrdup (r->pool, hreq->groups) : 0;
-
- hreq = (httpauth_request_t*)apr_pcalloc (r->pool, sizeof (*hreq));
- hreq->user = r->user;
- hreq->groups = groups;
- ap_set_module_config (r->request_config, &httpauth_module, hreq);
- }
+ /* Make another request config for this sub request */
+ if (mainreq != r) {
+ groups = hreq->groups ? apr_pstrdup (r->pool, hreq->groups) : NULL;
+ hreq = setup_request_hreq (r, r->user, groups);
+ }
- return OK;
+ return OK;
}
/*
@@ -1199,12 +1214,8 @@ retry:
r->user = apr_pstrdup (r->pool, details);
r->ap_auth_type = HTTPAUTH_AUTHTYPE;
- hreq = (httpauth_request_t*)apr_pcalloc (r->pool, sizeof (*hreq));
- hreq->user = details;
- hreq->groups = groups;
-
/* Mark request as successfully authenticated */
- ap_set_module_config (r->request_config, &httpauth_module, hreq);
+ hreq = setup_request_hreq (r, details, groups);
return OK;
}