From: Jim Jagielski Date: Mon, 3 Dec 2012 16:35:52 +0000 (+0000) Subject: Merge r1408958, r1408961, r1409170 from trunk: X-Git-Tag: 2.4.4~385 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29a7dbff860108bd55b745c0cba49ddbe5f146f3;p=apache Merge r1408958, r1408961, r1409170 from trunk: 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 --- diff --git a/CHANGES b/CHANGES index e0b451fa6a..2101392401 100644 --- 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. [, Reimo Rebane] + *) core: Functions to provide server load values: ap_get_sload() and ap_get_loadavg(). [Jim Jagielski, Jan Kaluza , Jeff Trawick] diff --git a/STATUS b/STATUS index b4e0c7bdaf..f9446a8484 100644 --- 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) diff --git a/modules/session/mod_session_dbd.c b/modules/session/mod_session_dbd.c index a1fbdc797b..d6349a8d30 100644 --- a/modules/session/mod_session_dbd.c +++ b/modules/session/mod_session_dbd.c @@ -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) {