]> granicus.if.org Git - apache/commitdiff
Merge r1364229 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 14 Aug 2012 20:54:00 +0000 (20:54 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 14 Aug 2012 20:54:00 +0000 (20:54 +0000)
Correctly log the error returned by apr_dbd_pvselect()

Submitted by: sf
Reviewed/backported by: jim

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

STATUS
modules/aaa/mod_authn_dbd.c
modules/aaa/mod_authz_dbd.c

diff --git a/STATUS b/STATUS
index 937e338681f290f693ec3a27276e9dfe9ef6f9f3..8ea08146e0d813d843bef51675a1562ac6606815 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -93,11 +93,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.4.x patch: trunk patch works
      +1: rjung, humbedooh, trawick (needs CHANGES entry)
 
-   * Correctly log the error returned by apr_dbd_pvselect().
-     trunk patch: http://svn.apache.org/viewvc?view=rev&rev=1364229
-     2.4.x patch: trunk patch works
-     +1: rjung, trawick, jim
-
    * Various code clean up.
      Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
      PR: 52893
index 5819abd463b5a8321f496055228b6945723d66ec..db5b05f682f3c35d03974cec4db22268d8557ce2 100644 (file)
@@ -100,6 +100,7 @@ static authn_status authn_dbd_password(request_rec *r, const char *user,
     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(request_rec *r, const char *user,
                       "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(request_rec *r, const char *user,
     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(request_rec *r, const char *user,
                       "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);
index 59ca2b34f6332f6ee2e50e0a947b5e3fed65d016..86d3b5612a96f7615f570d02b442a00022c0b09a 100644 (file)
@@ -162,8 +162,8 @@ static int authz_dbd_login(request_rec *r, authz_dbd_cfg *cfg,
                           "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)) {