diff options
author | Nick Kew <niq@apache.org> | 2010-06-23 01:03:11 +0200 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2010-06-23 01:03:11 +0200 |
commit | b8769181a388c20dc196a7927404f2f8b4a76867 (patch) | |
tree | ab40c84bab4588ae9307940d4a1eb7dbc101866d /modules/aaa/mod_authn_dbm.c | |
parent | New module: mod_authn_cache (diff) | |
download | apache2-b8769181a388c20dc196a7927404f2f8b4a76867.tar.xz apache2-b8769181a388c20dc196a7927404f2f8b4a76867.zip |
Enable authn_cache in the main easy-to-do authn provider modules
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@957072 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/aaa/mod_authn_dbm.c')
-rw-r--r-- | modules/aaa/mod_authn_dbm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/aaa/mod_authn_dbm.c b/modules/aaa/mod_authn_dbm.c index 94c089aab5..f1e1dbecad 100644 --- a/modules/aaa/mod_authn_dbm.c +++ b/modules/aaa/mod_authn_dbm.c @@ -39,6 +39,11 @@ #include "mod_auth.h" +static APR_OPTIONAL_FN_TYPE(ap_authn_cache_store) *authn_cache_store = NULL; +#define AUTHN_CACHE_STORE(r,user,realm,data) \ + if (authn_cache_store != NULL) \ + authn_cache_store((r), "dbm", (user), (realm), (data)) + typedef struct { const char *pwfile; const char *dbmtype; @@ -137,6 +142,7 @@ static authn_status check_dbm_pw(request_rec *r, const char *user, if (colon_pw) { *colon_pw = '\0'; } + AUTHN_CACHE_STORE(r, user, NULL, dbm_password); rv = apr_password_validate(password, dbm_password); @@ -177,6 +183,7 @@ static authn_status get_dbm_realm_hash(request_rec *r, const char *user, } *rethash = dbm_hash; + AUTHN_CACHE_STORE(r, user, realm, dbm_hash); return AUTH_USER_FOUND; } @@ -187,11 +194,16 @@ static const authn_provider authn_dbm_provider = &get_dbm_realm_hash, }; +static void opt_retr(void) +{ + authn_cache_store = APR_RETRIEVE_OPTIONAL_FN(ap_authn_cache_store); +} static void register_hooks(apr_pool_t *p) { ap_register_auth_provider(p, AUTHN_PROVIDER_GROUP, "dbm", AUTHN_PROVIDER_VERSION, &authn_dbm_provider, AP_AUTH_INTERNAL_PER_CONF); + ap_hook_optional_fn_retrieve(opt_retr, NULL, NULL, APR_HOOK_MIDDLE); } AP_DECLARE_MODULE(authn_dbm) = |