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

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