You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2014/04/17 15:39:01 UTC

svn commit: r1588247 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS modules/aaa/mod_auth_form.c

Author: jim
Date: Thu Apr 17 13:39:01 2014
New Revision: 1588247

URL: http://svn.apache.org/r1588247
Log:
Merge r1531672 from trunk:

mod_auth_form: Make sure the optional functions are loaded even when
the AuthFormProvider isn't specified.

Submitted by: minfrin
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/modules/aaa/mod_auth_form.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1531672

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1588247&r1=1588246&r2=1588247&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Thu Apr 17 13:39:01 2014
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.10
 
+  *) mod_auth_form: Make sure the optional functions are loaded even when
+     the AuthFormProvider isn't specified. [Graham Leggett]
+
   *) mod_ssl: avoid processing bogus SSLCertificateKeyFile values
      (and logging garbled file names). PR 56306. [Kaspar Brand]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1588247&r1=1588246&r2=1588247&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Thu Apr 17 13:39:01 2014
@@ -100,11 +100,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_auth_form: Make sure the optional functions are loaded even when
-    the AuthFormProvider isn't specified. PR 56351.
-    trunk patch: https://svn.apache.org/r1531672
-    2.4.x patch: trunk patch works, modulo CHANGES
-    +1: minfrin, jim, ylavic
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.4.x/modules/aaa/mod_auth_form.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/aaa/mod_auth_form.c?rev=1588247&r1=1588246&r2=1588247&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/aaa/mod_auth_form.c (original)
+++ httpd/httpd/branches/2.4.x/modules/aaa/mod_auth_form.c Thu Apr 17 13:39:01 2014
@@ -173,25 +173,6 @@ static const char *add_authn_provider(cm
                             "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(req
 {
     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_ha
 
 }
 
+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);