diff options
author | manu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2011-03-02 13:08:09 +0000 |
---|---|---|
committer | manu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2011-03-02 13:08:09 +0000 |
commit | 3c822c774a3f42cc9a4c18af817583490d14876f (patch) | |
tree | 12f67b4d9c15e06455248d1cb0720da76e4d19b8 /auth_mellon_cache.c | |
parent | 0a03c79d868bf4e30d6052aeeff1789644fe09b8 (diff) | |
download | mod_auth_mellon-3c822c774a3f42cc9a4c18af817583490d14876f.tar.gz mod_auth_mellon-3c822c774a3f42cc9a4c18af817583490d14876f.tar.xz mod_auth_mellon-3c822c774a3f42cc9a4c18af817583490d14876f.zip |
Allow MellonUser variable to be translated through MellonSetEnv
git-svn-id: https://modmellon.googlecode.com/svn/trunk@112 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_cache.c')
-rw-r--r-- | auth_mellon_cache.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c index 958c11a..9c03506 100644 --- a/auth_mellon_cache.c +++ b/auth_mellon_cache.c @@ -368,19 +368,6 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) } } - if(t->user[0] != '\0') { - /* We have a user-"name". Set r->user and r->ap_auth_type. */ - r->user = apr_pstrdup(r->pool, t->user); - r->ap_auth_type = apr_pstrdup(r->pool, "Mellon"); - } else { - /* We don't have a user-"name". Log error. */ - ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, - "Didn't find the attribute \"%s\" in the attributes" - " which were received from the IdP. Cannot set a user" - " for this request without a valid user attribute.", - d->userattr); - } - /* Allocate a set of counters for duplicate variables in the list. */ counters = apr_hash_make(r->pool); @@ -399,6 +386,11 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) value = t->env[i].value; + /* + * If we find a variable remapping to MellonUser, use it. + */ + if ((t->user[0] == '\0') && (strcmp(varname, d->userattr) == 0)) + strcpy(t->user, value); /* Find the number of times this variable has been set. */ count = apr_hash_get(counters, varname, APR_HASH_KEY_STRING); @@ -426,6 +418,20 @@ void am_cache_env_populate(request_rec *r, am_cache_entry_t *t) ++(*count); } + if(t->user[0] != '\0') { + /* We have a user-"name". Set r->user and r->ap_auth_type. */ + r->user = apr_pstrdup(r->pool, t->user); + r->ap_auth_type = apr_pstrdup(r->pool, "Mellon"); + } else { + /* We don't have a user-"name". Log error. */ + ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, + "Didn't find the attribute \"%s\" in the attributes" + " which were received from the IdP. Cannot set a user" + " for this request without a valid user attribute.", + d->userattr); + } + + /* Populate with the session? */ if (d->dump_session) { char *session; |