]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR #43210: Disambiguate and tidy database authentication error messages.
authorChris Darroch <chrisd@apache.org>
Wed, 19 Mar 2008 23:57:00 +0000 (23:57 +0000)
committerChris Darroch <chrisd@apache.org>
Wed, 19 Mar 2008 23:57:00 +0000 (23:57 +0000)
Based on patch from Phil Endecott.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@639079 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_authn_dbd.c

index 2902828376751d0e2866b8074864b3bf3247b828..3341171e67d9fca3d202bee875fc2ad244a7e1bd 100644 (file)
@@ -98,24 +98,29 @@ static authn_status authn_dbd_password(request_rec *r, const char *user,
     ap_dbd_t *dbd = authn_dbd_acquire_fn(r);
     if (dbd == NULL) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "Error looking up %s in database", user);
+                      "Failed to acquire database connection to look up "
+                      "user '%s'", user);
         return AUTH_GENERAL_ERROR;
     }
 
     if (conf->user == NULL) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No AuthDBDUserPWQuery has been specified.");
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                      "No AuthDBDUserPWQuery has been specified");
         return AUTH_GENERAL_ERROR;
     }
 
     statement = apr_hash_get(dbd->prepared, conf->user, APR_HASH_KEY_STRING);
     if (statement == NULL) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "A prepared statement could not be found for AuthDBDUserPWQuery, key '%s'.", conf->user);
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                      "A prepared statement could not be found for "
+                      "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) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "Error looking up %s in database", user);
+                      "Query execution error looking up '%s' "
+                      "in database", user);
         return AUTH_GENERAL_ERROR;
     }
     for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1);
@@ -123,7 +128,8 @@ static authn_status authn_dbd_password(request_rec *r, const char *user,
          rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) {
         if (rv != 0) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                      "Error looking up %s in database", user);
+                          "Error retrieving results while looking up '%s' "
+                          "in database", user);
             return AUTH_GENERAL_ERROR;
         }
         if (dbd_password == NULL) {
@@ -184,22 +190,27 @@ static authn_status authn_dbd_realm(request_rec *r, const char *user,
     ap_dbd_t *dbd = authn_dbd_acquire_fn(r);
     if (dbd == NULL) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "Error looking up %s in database", user);
+                      "Failed to acquire database connection to look up "
+                      "user '%s:%s'", user, realm);
         return AUTH_GENERAL_ERROR;
     }
     if (conf->realm == NULL) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No AuthDBDUserRealmQuery has been specified.");
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                      "No AuthDBDUserRealmQuery has been specified");
         return AUTH_GENERAL_ERROR;
     }
     statement = apr_hash_get(dbd->prepared, conf->realm, APR_HASH_KEY_STRING);
     if (statement == NULL) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "A prepared statement could not be found for AuthDBDUserRealmQuery, key '%s'.", conf->realm);
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                      "A prepared statement could not be found for "
+                      "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) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "Error looking up %s:%s in database", user, realm);
+                      "Query execution error looking up '%s:%s' "
+                      "in database", user, realm);
         return AUTH_GENERAL_ERROR;
     }
     for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1);
@@ -207,7 +218,8 @@ static authn_status authn_dbd_realm(request_rec *r, const char *user,
          rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) {
         if (rv != 0) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                      "Error looking up %s in database", user);
+                          "Error retrieving results while looking up '%s:%s' "
+                          "in database", user, realm);
             return AUTH_GENERAL_ERROR;
         }
         if (dbd_hash == NULL) {