Changes with Apache 2.0.43
+ *) Add ap_register_provider/ap_lookup_provider API.
+ [John K. Sterling <john@sterls.com>, Justin Erenkrantz]
+
*) Add -p option to apxs to allow programs to be compiled with apxs.
[Justin Erenkrantz]
--- /dev/null
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+#ifndef AP_PROVIDER_H
+#define AP_PROVIDER_H
+
+#include "ap_config.h"
+
+/**
+ * @package Provider API
+ */
+
+/**
+ * This function is used to register a provider with the global
+ * provider pool.
+ * @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 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 void *provider);
+
+/**
+ * This function is used to retrieve a provider from the global
+ * provider pool.
+ * @param provider_group The group to look for this provider in
+ * @param provider_name The name for the provider
+ * @return provider point if found, NULL otherwise
+ */
+AP_DECLARE(void *) ap_lookup_provider(const char *provider_group,
+ const char *provider_name);
+
+#endif
dnl these are the front-end authentication modules
-std_auth_provider_objects="auth_provider.lo"
-
-APACHE_MODULE(auth_basic, basic authentication,
- mod_auth_basic.lo $std_auth_provider_objects, , yes)
-APACHE_MODULE(auth_digest, RFC2617 Digest authentication,
- mod_auth_digest.lo $std_auth_provider_objects , , most, [
+APACHE_MODULE(auth_basic, basic authentication, , , yes)
+APACHE_MODULE(auth_digest, RFC2617 Digest authentication, , , most, [
ap_old_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$APR_SOURCE_DIR/include -I$abs_builddir/srclib/apr/include"
AC_TRY_COMPILE([#include <apr.h>], [
extern "C" {
#endif
-/* Create a set of AAA_DECLARE(type) and AAA_DECLARE_DATA with
- * appropriate export and import tags for the platform
- */
-#if !defined(WIN32)
-#define AAA_DECLARE(type) type
-#define AAA_DECLARE_DATA
-#elif defined(AAA_DECLARE_STATIC)
-#define AAA_DECLARE(type) type __stdcall
-#define AAA_DECLARE_DATA
-#elif defined(AAA_DECLARE_EXPORT)
-#define AAA_DECLARE(type) __declspec(dllexport) type __stdcall
-#define AAA_DECLARE_DATA __declspec(dllexport)
-#else
-#define AAA_DECLARE(type) __declspec(dllimport) type __stdcall
-#define AAA_DECLARE_DATA __declspec(dllimport)
-#endif
-
+#define AUTHN_PROVIDER_GROUP "authn"
#define AUTHN_DEFAULT_PROVIDER "file"
typedef enum {
authn_provider_list *next;
};
-AAA_DECLARE(void) authn_register_provider(apr_pool_t *p, const char *name,
- const authn_provider *provider);
-AAA_DECLARE(const authn_provider *) authn_lookup_provider(const char *name);
-
typedef struct {
/* For a given user, return a hash of all groups the user belongs to. */
apr_hash_t * (*get_user_groups)(request_rec *r, const char *user);
} authz_provider;
-AAA_DECLARE(void) authz_register_provider(apr_pool_t *p, const char *name,
- const authz_provider *provider);
-AAA_DECLARE(const authz_provider *) authz_lookup_provider(const char *name);
#ifdef __cplusplus
}
#endif
#include "http_log.h"
#include "http_protocol.h"
#include "http_request.h"
+#include "ap_provider.h"
#include "mod_auth.h"
newp->provider_name = provider_name;
/* lookup and cache the actual provider now */
- newp->provider = authn_lookup_provider(newp->provider_name);
+ newp->provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP,
+ newp->provider_name);
if (newp->provider == NULL) {
/* by the time they use it, the provider should be loaded and
* provider.
*/
if (!current_provider) {
- provider = authn_lookup_provider(AUTHN_DEFAULT_PROVIDER);
+ provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP,
+ AUTHN_DEFAULT_PROVIDER);
}
else {
provider = current_provider->provider;
#include "util_md5.h"
#include "apr_shm.h"
#include "apr_rmm.h"
+#include "ap_provider.h"
#include "mod_auth.h"
newp->provider_name = provider_name;
/* lookup and cache the actual provider now */
- newp->provider = authn_lookup_provider(newp->provider_name);
+ newp->provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP,
+ newp->provider_name);
if (newp->provider == NULL) {
/* by the time they use it, the provider should be loaded and
* provider.
*/
if (!current_provider) {
- provider = authn_lookup_provider(AUTHN_DEFAULT_PROVIDER);
+ provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP,
+ AUTHN_DEFAULT_PROVIDER);
}
else {
provider = current_provider->provider;
static void register_hooks(apr_pool_t *p)
{
- authn_register_provider(p, "dbm", &authn_dbm_provider);
+ ap_register_provider(p, AUTHN_PROVIDER_GROUP, "dbm", &authn_dbm_provider);
}
module AP_MODULE_DECLARE_DATA authn_dbm_module =
static void register_hooks(apr_pool_t *p)
{
- authn_register_provider(p, "file", &authn_file_provider);
+ ap_register_provider(p, AUTHN_PROVIDER_GROUP, "file", &authn_file_provider);
}
module AP_MODULE_DECLARE_DATA authn_file_module =
#include "apr_pools.h"
#include "apr_hash.h"
+#include "ap_provider.h"
#include "mod_dav.h"
-
-static apr_hash_t *dav_repos_providers = NULL;
-
-
-static apr_status_t dav_cleanup_providers(void *ctx)
-{
- dav_repos_providers = NULL;
- return APR_SUCCESS;
-}
+#define DAV_PROVIDER_GROUP "dav"
DAV_DECLARE(void) dav_register_provider(apr_pool_t *p, const char *name,
const dav_provider *provider)
{
- if (dav_repos_providers == NULL) {
- dav_repos_providers = apr_hash_make(p);
- apr_pool_cleanup_register(p, NULL, dav_cleanup_providers, apr_pool_cleanup_null);
- }
-
- /* just set it. no biggy if it was there before. */
- apr_hash_set(dav_repos_providers, name, APR_HASH_KEY_STRING, provider);
+ ap_register_provider(p, DAV_PROVIDER_GROUP, name, provider);
}
const dav_provider * dav_lookup_provider(const char *name)
{
- /* Better watch out against no registered providers */
- if (dav_repos_providers == NULL) {
- return NULL;
- }
-
- return apr_hash_get(dav_repos_providers, name, APR_HASH_KEY_STRING);
+ return ap_lookup_provider(DAV_PROVIDER_GROUP, name);
}
rfc1413.c connection.c listen.c \
mpm_common.c util_charset.c util_debug.c util_xml.c \
util_filter.c exports.c buildmark.c scoreboard.c \
- error_bucket.c protocol.c core.c request.c
+ error_bucket.c protocol.c core.c request.c provider.c
TARGETS = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) export_vars.h httpd.exp
--- /dev/null
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+#include "apr_pools.h"
+#include "apr_hash.h"
+
+#include "ap_provider.h"
+
+static apr_hash_t *global_providers = NULL;
+
+static apr_status_t cleanup_global_providers(void *ctx)
+{
+ global_providers = NULL;
+ return APR_SUCCESS;
+}
+
+AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool,
+ const char *provider_group,
+ const char *provider_name,
+ const void *provider)
+{
+ apr_hash_t *provider_group_hash;
+
+ if (global_providers == NULL) {
+ global_providers = apr_hash_make(pool);
+ apr_pool_cleanup_register(pool, NULL, cleanup_global_providers,
+ apr_pool_cleanup_null);
+ }
+
+ provider_group_hash = apr_hash_get(global_providers, provider_group,
+ APR_HASH_KEY_STRING);
+
+ if (!provider_group_hash) {
+ provider_group_hash = apr_hash_make(pool);
+ apr_hash_set(global_providers, provider_group, APR_HASH_KEY_STRING,
+ provider_group_hash);
+
+ }
+
+ /* just set it. no biggy if it was there before. */
+ apr_hash_set(provider_group_hash, provider_name, APR_HASH_KEY_STRING,
+ provider);
+
+ return APR_SUCCESS;
+}
+
+AP_DECLARE(void *) ap_lookup_provider(const char *provider_group,
+ const char *provider_name)
+{
+ apr_hash_t *provider_group_hash;
+
+ if (global_providers == NULL) {
+ return NULL;
+ }
+
+ provider_group_hash = apr_hash_get(global_providers, provider_group,
+ APR_HASH_KEY_STRING);
+
+ if (provider_group_hash == NULL) {
+ return NULL;
+ }
+
+ return apr_hash_get(provider_group_hash, provider_name,
+ APR_HASH_KEY_STRING);
+}