You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2012/11/13 22:03:11 UTC

svn commit: r1408958 - in /httpd/httpd/trunk: CHANGES modules/session/mod_session_dbd.c

Author: jailletc36
Date: Tue Nov 13 21:03:10 2012
New Revision: 1408958

URL: http://svn.apache.org/viewvc?rev=1408958&view=rev
Log:
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

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/session/mod_session_dbd.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1408958&r1=1408957&r2=1408958&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Nov 13 21:03:10 2012
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_session_dbd: fix a segmentation fault in the function dbd_remove.
+    PR 53452. [<rebanerebane gmail com>, Reimo Rebane]
+  
   *) core: New directive RegisterHttpMethod for registering non-standard
      HTTP methods. [Stefan Fritsch]
 

Modified: httpd/httpd/trunk/modules/session/mod_session_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?rev=1408958&r1=1408957&r2=1408958&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/session/mod_session_dbd.c (original)
+++ httpd/httpd/trunk/modules/session/mod_session_dbd.c Tue Nov 13 21:03:10 2012
@@ -333,18 +333,12 @@ static apr_status_t dbd_remove(request_r
 {
 
     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_r
         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) {



Re: svn commit: r1408958 - in /httpd/httpd/trunk: CHANGES modules/session/mod_session_dbd.c

Posted by Ruediger Pluem <rp...@apache.org>.

jailletc36@apache.org wrote:
> Author: jailletc36
> Date: Tue Nov 13 21:03:10 2012
> New Revision: 1408958
> 
> URL: http://svn.apache.org/viewvc?rev=1408958&view=rev
> Log:
> 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
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/modules/session/mod_session_dbd.c
> 
> Modified: httpd/httpd/trunk/CHANGES

> Modified: httpd/httpd/trunk/modules/session/mod_session_dbd.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?rev=1408958&r1=1408957&r2=1408958&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/session/mod_session_dbd.c (original)
> +++ httpd/httpd/trunk/modules/session/mod_session_dbd.c Tue Nov 13 21:03:10 2012

> @@ -352,15 +346,13 @@ static apr_status_t dbd_remove(request_r
>          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

Style. These are C99 style comments.
Furthermore the indenting seems to be wrong. Tabs?

> +		return rv;
> +	}
> +
>      rv = apr_dbd_pvbquery(dbd->driver, r->pool, dbd->handle, &rows, statement,
>                            key, NULL);
>      if (rv != APR_SUCCESS) {
> 
> 
> 

Regards

RĂ¼diger