]> granicus.if.org Git - apache/commitdiff
Merge r1408958, r1408961, r1409170 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 3 Dec 2012 16:35:52 +0000 (16:35 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 3 Dec 2012 16:35:52 +0000 (16:35 +0000)
mod_session_dbd: fix a segmentation fault in the function dbd_remove.
The segmentation fault is caused by an uninitialized function pointer session_dbd_acquire_fn.
PR 53452

formatting: space vs tab

Axed C++ comments.

Submitted by: jailletc36, fuankg
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1416583 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/session/mod_session_dbd.c

diff --git a/CHANGES b/CHANGES
index e0b451fa6a185d5771d61ac71dd58480ecfb46ae..2101392401eb84b9e3794771fd26c093e16d6312 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ Changes with Apache 2.4.4
      a post-rotate program when -p is used, per the documentation.
      [Joe Orton]
 
+  *) mod_session_dbd: fix a segmentation fault in the function dbd_remove.
+    PR 53452. [<rebanerebane gmail com>, Reimo Rebane]
+
   *) core: Functions to provide server load values: ap_get_sload() and
      ap_get_loadavg(). [Jim Jagielski, Jan Kaluza <jkaluza redhat.com>,
      Jeff Trawick]
diff --git a/STATUS b/STATUS
index b4e0c7bdaf3cdf225582a986aa53b3ee89c7a12f..f9446a8484deec5c393c51f9abadc071e4caf638 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -97,14 +97,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      documentation patch : http://apache-doc-fr.gryzor.com/fallbackresource_disabled_2.4_doc.patch
      +1: gryzor, covener, sf
 
-    * mod_session_dbd: fix a segmentation fault in the function dbd_remove.
-      PR 53452
-      trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1408958
-                   http://svn.apache.org/viewvc?view=revision&revision=1408961 (style issue)
-                   http://svn.apache.org/viewvc?view=revision&revision=1409170 (style issue)
-      2.4.x patch: http://people.apache.org/~jailletc36/backport_mod_session_dbd.patch
-      +1: jailletc36, sf, jim
-
     * mod_log_forensic: Don't log spurious "-" characters.
       trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1410954
       2.4.x patch: trunk patch works (modulo CHANGES)
index a1fbdc797bccefa750a39fe2a9181727c7afdf72..d6349a8d306dfaf646f9a1e16304fe641840b075 100644 (file)
@@ -333,18 +333,12 @@ static apr_status_t dbd_remove(request_rec * r, const char *key)
 {
 
     apr_status_t rv;
+    ap_dbd_t *dbd;
     apr_dbd_prepared_t *statement;
     int rows = 0;
 
     session_dbd_dir_conf *conf = ap_get_module_config(r->per_dir_config,
                                                       &session_dbd_module);
-    ap_dbd_t *dbd = session_dbd_acquire_fn(r);
-    if (dbd == NULL) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01861)
-                      "failed to acquire database connection to remove "
-                      "session with key '%s'", key);
-        return APR_EGENERAL;
-    }
 
     if (conf->deletelabel == NULL) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01862)
@@ -352,15 +346,13 @@ static apr_status_t dbd_remove(request_rec * r, const char *key)
         return APR_EGENERAL;
     }
 
-    statement = apr_hash_get(dbd->prepared, conf->deletelabel,
-                             APR_HASH_KEY_STRING);
-    if (statement == NULL) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01863)
-                      "prepared statement could not be found for "
-                      "SessionDBDdeletelabel with the label '%s'",
-                      conf->deletelabel);
-        return APR_EGENERAL;
+    rv = dbd_init(r, conf->deletelabel, &dbd, &statement);
+    if (rv != APR_SUCCESS) {
+        /* No need to do additional error logging here, it has already
+           been done in dbd_init if needed */
+        return rv;
     }
+
     rv = apr_dbd_pvbquery(dbd->driver, r->pool, dbd->handle, &rows, statement,
                           key, NULL);
     if (rv != APR_SUCCESS) {