]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_auth_form: Make sure the optional functions are loaded even when
authorGraham Leggett <minfrin@apache.org>
Sun, 13 Oct 2013 12:14:39 +0000 (12:14 +0000)
committerGraham Leggett <minfrin@apache.org>
Sun, 13 Oct 2013 12:14:39 +0000 (12:14 +0000)
the AuthFormProvider isn't specified.

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

CHANGES
modules/aaa/mod_auth_form.c

diff --git a/CHANGES b/CHANGES
index 40309c7eeb8b17e43d3adc12b94da1bc38d58564..e5bad54100531df84247ebb43a2717e611f35ee8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_auth_form: Make sure the optional functions are loaded even when
+     the AuthFormProvider isn't specified. [Graham Leggett]
+
   *) core: Don't truncate output when sending is interrupted by a signal,
      such as from an exiting CGI process. PR 55643. [Jeff Trawick]
 
index 7bba517b80d95c56dd44a05201da655c3df8d216..b8891606b33a1ebfb52e471e4336552da4a36ffe 100644 (file)
@@ -173,25 +173,6 @@ static const char *add_authn_provider(cmd_parms * cmd, void *config,
                             "Form Authentication", newp->provider_name);
     }
 
-    if (!ap_session_load_fn || !ap_session_get_fn || !ap_session_set_fn) {
-        ap_session_load_fn = APR_RETRIEVE_OPTIONAL_FN(ap_session_load);
-        ap_session_get_fn = APR_RETRIEVE_OPTIONAL_FN(ap_session_get);
-        ap_session_set_fn = APR_RETRIEVE_OPTIONAL_FN(ap_session_set);
-        if (!ap_session_load_fn || !ap_session_get_fn || !ap_session_set_fn) {
-            return "You must load mod_session to enable the mod_auth_form "
-                   "functions";
-        }
-    }
-
-    if (!ap_request_insert_filter_fn || !ap_request_remove_filter_fn) {
-        ap_request_insert_filter_fn = APR_RETRIEVE_OPTIONAL_FN(ap_request_insert_filter);
-        ap_request_remove_filter_fn = APR_RETRIEVE_OPTIONAL_FN(ap_request_remove_filter);
-        if (!ap_request_insert_filter_fn || !ap_request_remove_filter_fn) {
-            return "You must load mod_request to enable the mod_auth_form "
-                   "functions";
-        }
-    }
-
     /* Add it to the list now. */
     if (!conf->providers) {
         conf->providers = newp;
@@ -567,6 +548,7 @@ static apr_status_t get_session_auth(request_rec * r,
 {
     const char *authname = ap_auth_name(r);
     session_rec *z = NULL;
+
     ap_session_load_fn(r, &z);
 
     if (user) {
@@ -1271,8 +1253,40 @@ static int authenticate_form_redirect_handler(request_rec * r)
 
 }
 
+static int authenticate_form_post_config(apr_pool_t *pconf, apr_pool_t *plog,
+        apr_pool_t *ptemp, server_rec *s)
+{
+
+    if (!ap_session_load_fn || !ap_session_get_fn || !ap_session_set_fn) {
+        ap_session_load_fn = APR_RETRIEVE_OPTIONAL_FN(ap_session_load);
+        ap_session_get_fn = APR_RETRIEVE_OPTIONAL_FN(ap_session_get);
+        ap_session_set_fn = APR_RETRIEVE_OPTIONAL_FN(ap_session_set);
+        if (!ap_session_load_fn || !ap_session_get_fn || !ap_session_set_fn) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, APLOGNO()
+                    "You must load mod_session to enable the mod_auth_form "
+                                       "functions");
+            return !OK;
+        }
+    }
+
+    if (!ap_request_insert_filter_fn || !ap_request_remove_filter_fn) {
+        ap_request_insert_filter_fn = APR_RETRIEVE_OPTIONAL_FN(ap_request_insert_filter);
+        ap_request_remove_filter_fn = APR_RETRIEVE_OPTIONAL_FN(ap_request_remove_filter);
+        if (!ap_request_insert_filter_fn || !ap_request_remove_filter_fn) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, APLOGNO()
+                    "You must load mod_request to enable the mod_auth_form "
+                                       "functions");
+            return !OK;
+        }
+    }
+
+    return OK;
+}
+
 static void register_hooks(apr_pool_t * p)
 {
+    ap_hook_post_config(authenticate_form_post_config,NULL,NULL,APR_HOOK_MIDDLE);
+
 #if AP_MODULE_MAGIC_AT_LEAST(20080403,1)
     ap_hook_check_authn(authenticate_form_authn, NULL, NULL, APR_HOOK_MIDDLE,
                         AP_AUTH_INTERNAL_PER_CONF);