Blame SOURCES/httpd-2.4.6-mod_authz_dbd-missing-query.patch

008793
diff --git a/modules/aaa/mod_authz_dbd.c b/modules/aaa/mod_authz_dbd.c
008793
index 1a456fe..6a0f705 100644
008793
--- a/modules/aaa/mod_authz_dbd.c
008793
+++ b/modules/aaa/mod_authz_dbd.c
008793
@@ -116,7 +116,7 @@ static int authz_dbd_login(request_rec *r, authz_dbd_cfg *cfg,
008793
     const char *newuri = NULL;
008793
     int nrows;
008793
     const char *message;
008793
-    ap_dbd_t *dbd = dbd_handle(r);
008793
+    ap_dbd_t *dbd;
008793
     apr_dbd_prepared_t *query;
008793
     apr_dbd_results_t *res = NULL;
008793
     apr_dbd_row_t *row = NULL;
008793
@@ -126,6 +126,16 @@ static int authz_dbd_login(request_rec *r, authz_dbd_cfg *cfg,
008793
                       "No query configured for %s!", action);
008793
         return HTTP_INTERNAL_SERVER_ERROR;
008793
     }
008793
+
008793
+    dbd = dbd_handle(r);
008793
+    if (dbd == NULL) {
008793
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02902)
008793
+                      "No db handle available for %s! "
008793
+                      "Check your database access",
008793
+                      action);
008793
+        return HTTP_INTERNAL_SERVER_ERROR;
008793
+    }
008793
+
008793
     query = apr_hash_get(dbd->prepared, cfg->query, APR_HASH_KEY_STRING);
008793
     if (query == NULL) {
008793
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01643)
008793
@@ -202,7 +212,7 @@ static int authz_dbd_group_query(request_rec *r, authz_dbd_cfg *cfg,
008793
     /* SELECT group FROM authz WHERE user = %s */
008793
     int rv;
008793
     const char *message;
008793
-    ap_dbd_t *dbd = dbd_handle(r);
008793
+    ap_dbd_t *dbd;
008793
     apr_dbd_prepared_t *query;
008793
     apr_dbd_results_t *res = NULL;
008793
     apr_dbd_row_t *row = NULL;
008793
@@ -212,6 +222,15 @@ static int authz_dbd_group_query(request_rec *r, authz_dbd_cfg *cfg,
008793
                       "No query configured for dbd-group!");
008793
         return HTTP_INTERNAL_SERVER_ERROR;
008793
     }
008793
+
008793
+    dbd = dbd_handle(r);
008793
+    if (dbd == NULL) {
008793
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02903)
008793
+                      "No db handle available for dbd-query! "
008793
+                      "Check your database access");
008793
+        return HTTP_INTERNAL_SERVER_ERROR;
008793
+    }
008793
+
008793
     query = apr_hash_get(dbd->prepared, cfg->query, APR_HASH_KEY_STRING);
008793
     if (query == NULL) {
008793
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01650)