diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | include/ap_provider.h | 6 | ||||
-rw-r--r-- | modules/aaa/mod_auth_basic.c | 4 | ||||
-rw-r--r-- | modules/aaa/mod_auth_digest.c | 4 | ||||
-rw-r--r-- | modules/aaa/mod_authn_dbm.c | 3 | ||||
-rw-r--r-- | modules/aaa/mod_authn_file.c | 3 | ||||
-rw-r--r-- | modules/dav/main/providers.c | 4 | ||||
-rw-r--r-- | server/provider.c | 28 |
8 files changed, 41 insertions, 15 deletions
@@ -2,11 +2,11 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Add version string to provider API. [Justin Erenkrantz] + *) Rewrite of aaa modules to an authn/authz model. [Dirk-Willem van Gulik, Justin Erenkrantz] - - Changes with Apache 2.0.44 *) build: './configure && make' now works without an in-tree diff --git a/include/ap_provider.h b/include/ap_provider.h index 22fe2eb96d..b89ade296f 100644 --- a/include/ap_provider.h +++ b/include/ap_provider.h @@ -67,12 +67,14 @@ * @param pool The pool to create any storage from * @param provider_group The group to store the provider in * @param provider_name The name for this provider + * @param provider_version The version for this provider * @param provider Opaque structure for this provider * @return APR_SUCCESS if all went well */ AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool, const char *provider_group, const char *provider_name, + const char *provider_version, const void *provider); /** @@ -80,9 +82,11 @@ AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool, * provider pool. * @param provider_group The group to look for this provider in * @param provider_name The name for the provider + * @param provider_version The version for the provider * @return provider pointer to provider if found, NULL otherwise */ AP_DECLARE(void *) ap_lookup_provider(const char *provider_group, - const char *provider_name); + const char *provider_name, + const char *provider_version); #endif diff --git a/modules/aaa/mod_auth_basic.c b/modules/aaa/mod_auth_basic.c index a5f99beff8..72fbdc74c8 100644 --- a/modules/aaa/mod_auth_basic.c +++ b/modules/aaa/mod_auth_basic.c @@ -115,7 +115,7 @@ static const char *add_authn_provider(cmd_parms *cmd, void *config, /* lookup and cache the actual provider now */ newp->provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP, - newp->provider_name); + newp->provider_name, "0"); if (newp->provider == NULL) { /* by the time they use it, the provider should be loaded and @@ -256,7 +256,7 @@ static int authenticate_basic_user(request_rec *r) */ if (!current_provider) { provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP, - AUTHN_DEFAULT_PROVIDER); + AUTHN_DEFAULT_PROVIDER, "0"); } else { provider = current_provider->provider; diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index 4abc035f93..3da42a972a 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -506,7 +506,7 @@ static const char *add_authn_provider(cmd_parms *cmd, void *config, /* lookup and cache the actual provider now */ newp->provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP, - newp->provider_name); + newp->provider_name, "0"); if (newp->provider == NULL) { /* by the time they use it, the provider should be loaded and @@ -1476,7 +1476,7 @@ static const char *get_hash(request_rec *r, const char *user, */ if (!current_provider) { provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP, - AUTHN_DEFAULT_PROVIDER); + AUTHN_DEFAULT_PROVIDER, "0"); } else { provider = current_provider->provider; diff --git a/modules/aaa/mod_authn_dbm.c b/modules/aaa/mod_authn_dbm.c index 6c001bc797..19697ef114 100644 --- a/modules/aaa/mod_authn_dbm.c +++ b/modules/aaa/mod_authn_dbm.c @@ -191,7 +191,8 @@ static const authn_provider authn_dbm_provider = static void register_hooks(apr_pool_t *p) { - ap_register_provider(p, AUTHN_PROVIDER_GROUP, "dbm", &authn_dbm_provider); + ap_register_provider(p, AUTHN_PROVIDER_GROUP, "dbm", "0", + &authn_dbm_provider); } module AP_MODULE_DECLARE_DATA authn_dbm_module = diff --git a/modules/aaa/mod_authn_file.c b/modules/aaa/mod_authn_file.c index 2188c540e9..1a7d87a45b 100644 --- a/modules/aaa/mod_authn_file.c +++ b/modules/aaa/mod_authn_file.c @@ -219,7 +219,8 @@ static const authn_provider authn_file_provider = static void register_hooks(apr_pool_t *p) { - ap_register_provider(p, AUTHN_PROVIDER_GROUP, "file", &authn_file_provider); + ap_register_provider(p, AUTHN_PROVIDER_GROUP, "file", "0", + &authn_file_provider); } module AP_MODULE_DECLARE_DATA authn_file_module = diff --git a/modules/dav/main/providers.c b/modules/dav/main/providers.c index c808dcd53f..c2b721c472 100644 --- a/modules/dav/main/providers.c +++ b/modules/dav/main/providers.c @@ -62,10 +62,10 @@ DAV_DECLARE(void) dav_register_provider(apr_pool_t *p, const char *name, const dav_provider *provider) { - ap_register_provider(p, DAV_PROVIDER_GROUP, name, provider); + ap_register_provider(p, DAV_PROVIDER_GROUP, name, "0", provider); } const dav_provider * dav_lookup_provider(const char *name) { - return ap_lookup_provider(DAV_PROVIDER_GROUP, name); + return ap_lookup_provider(DAV_PROVIDER_GROUP, name, "0"); } diff --git a/server/provider.c b/server/provider.c index d90a5e349e..f9c7363827 100644 --- a/server/provider.c +++ b/server/provider.c @@ -69,9 +69,11 @@ static apr_status_t cleanup_global_providers(void *ctx) AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool, const char *provider_group, const char *provider_name, + const char *provider_version, const void *provider) { apr_hash_t *provider_group_hash; + apr_hash_t *provider_version_hash; if (global_providers == NULL) { global_providers = apr_hash_make(pool); @@ -89,17 +91,28 @@ AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool, } + provider_version_hash = apr_hash_get(provider_group_hash, provider_name, + APR_HASH_KEY_STRING); + + if (!provider_version_hash) { + provider_version_hash = apr_hash_make(pool); + apr_hash_set(provider_group_hash, provider_name, APR_HASH_KEY_STRING, + provider_version_hash); + + } + /* just set it. no biggy if it was there before. */ - apr_hash_set(provider_group_hash, provider_name, APR_HASH_KEY_STRING, + apr_hash_set(provider_version_hash, provider_version, APR_HASH_KEY_STRING, provider); return APR_SUCCESS; } AP_DECLARE(void *) ap_lookup_provider(const char *provider_group, - const char *provider_name) + const char *provider_name, + const char *provider_version) { - apr_hash_t *provider_group_hash; + apr_hash_t *provider_group_hash, *provider_name_hash; if (global_providers == NULL) { return NULL; @@ -112,6 +125,13 @@ AP_DECLARE(void *) ap_lookup_provider(const char *provider_group, return NULL; } - return apr_hash_get(provider_group_hash, provider_name, + provider_name_hash = apr_hash_get(provider_group_hash, provider_name, + APR_HASH_KEY_STRING); + + if (provider_name_hash == NULL) { + return NULL; + } + + return apr_hash_get(provider_name_hash, provider_version, APR_HASH_KEY_STRING); } |