You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2012/07/22 10:31:52 UTC

svn commit: r1364229 - in /httpd/httpd/trunk/modules/aaa: mod_authn_dbd.c mod_authz_dbd.c

Author: sf
Date: Sun Jul 22 08:31:52 2012
New Revision: 1364229

URL: http://svn.apache.org/viewvc?rev=1364229&view=rev
Log:
Correctly log the error returned by apr_dbd_pvselect()

Modified:
    httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c
    httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c

Modified: httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c?rev=1364229&r1=1364228&r2=1364229&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c Sun Jul 22 08:31:52 2012
@@ -100,6 +100,7 @@ static authn_status authn_dbd_password(r
     apr_dbd_prepared_t *statement;
     apr_dbd_results_t *res = NULL;
     apr_dbd_row_t *row = NULL;
+    int ret;
 
     authn_dbd_conf *conf = ap_get_module_config(r->per_dir_config,
                                                 &authn_dbd_module);
@@ -124,11 +125,12 @@ static authn_status authn_dbd_password(r
                       "AuthDBDUserPWQuery with the key '%s'", conf->user);
         return AUTH_GENERAL_ERROR;
     }
-    if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement,
-                              0, user, NULL) != 0) {
+    if ((ret = apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res,
+                                statement, 0, user, NULL) != 0)) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01656)
                       "Query execution error looking up '%s' "
-                      "in database", user);
+                      "in database [%s]",
+                      user, apr_dbd_error(dbd->driver, dbd->handle, ret));
         return AUTH_GENERAL_ERROR;
     }
     for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1);
@@ -193,6 +195,7 @@ static authn_status authn_dbd_realm(requ
     apr_dbd_prepared_t *statement;
     apr_dbd_results_t *res = NULL;
     apr_dbd_row_t *row = NULL;
+    int ret;
 
     authn_dbd_conf *conf = ap_get_module_config(r->per_dir_config,
                                                 &authn_dbd_module);
@@ -215,11 +218,13 @@ static authn_status authn_dbd_realm(requ
                       "AuthDBDUserRealmQuery with the key '%s'", conf->realm);
         return AUTH_GENERAL_ERROR;
     }
-    if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement,
-                              0, user, realm, NULL) != 0) {
+    if ((ret = apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res,
+                                statement, 0, user, realm, NULL) != 0)) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01661)
                       "Query execution error looking up '%s:%s' "
-                      "in database", user, realm);
+                      "in database [%s]",
+                      user, realm,
+                      apr_dbd_error(dbd->driver, dbd->handle, ret));
         return AUTH_GENERAL_ERROR;
     }
     for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1);

Modified: httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c?rev=1364229&r1=1364228&r2=1364229&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c Sun Jul 22 08:31:52 2012
@@ -162,8 +162,8 @@ static int authz_dbd_login(request_rec *
                           "authz_dbd: no redirect query!");
             /* OK, this is non-critical; we can just not-redirect */
         }
-        else if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res,
-                                  query, 0, r->user, NULL) == 0) {
+        else if ((rv = apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle,
+                                        &res, query, 0, r->user, NULL) == 0)) {
             for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1);
                  rv != -1;
                  rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) {