]> granicus.if.org Git - apache/commitdiff
Per Greg's request, add a version string component to the ap_provider.h
authorJustin Erenkrantz <jerenkrantz@apache.org>
Sat, 30 Nov 2002 18:48:41 +0000 (18:48 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Sat, 30 Nov 2002 18:48:41 +0000 (18:48 +0000)
functions.  This allows modules to register different versions of the
same provider.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97696 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/ap_provider.h
modules/aaa/mod_auth_basic.c
modules/aaa/mod_auth_digest.c
modules/aaa/mod_authn_dbm.c
modules/aaa/mod_authn_file.c
modules/dav/main/providers.c
server/provider.c

diff --git a/CHANGES b/CHANGES
index bb236f477ca08330142f8dfc2d033457ca4aa7d3..5362cf91f744605d111667c08d063ab3c82ca7b1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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
index 22fe2eb96d8da2a88f337165fd4a792f4f407340..b89ade296f4a919244e9fa86f7bf625ac5b04bb8 100644 (file)
  * @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
index a5f99beff803d1c1c180e892b79fa5f9efd45fa9..72fbdc74c8a05e688be1911aeed79bcf66c8c798 100644 (file)
@@ -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;
index 4abc035f93b4243dc35018210d4a1db6d20f9345..3da42a972ac37db7d7619cafa74bf9a0762b7664 100644 (file)
@@ -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;
index 6c001bc79771446a1071ea7008ada1ca846b242b..19697ef11428c92c4f5518578ccbbefa1be440ca 100644 (file)
@@ -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 =
index 2188c540e96ce753f57c2e1bba6fdc4ea7852e33..1a7d87a45b2011d9bcddb85cca8ff9b52170487b 100644 (file)
@@ -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 =
index c808dcd53f46e66e0440f6143c73d270bf7b836d..c2b721c47242a04ee0a55213eea272ea6ee5e756 100644 (file)
 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");
 }
index d90a5e349e6601e67a8a85f62bb7581be34db4ed..f9c7363827b54621bcb99fbb76c052159018e9f1 100644 (file)
@@ -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);
 }