| 98 |
ap_dbd_t *dbd = authn_dbd_acquire_fn(r); |
ap_dbd_t *dbd = authn_dbd_acquire_fn(r); |
| 99 |
if (dbd == NULL) { |
if (dbd == NULL) { |
| 100 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
| 101 |
"Error looking up %s in database", user); |
"Failed to acquire database connection to look up " |
| 102 |
|
"user '%s'", user); |
| 103 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 104 |
} |
} |
| 105 |
|
|
| 106 |
if (conf->user == NULL) { |
if (conf->user == NULL) { |
| 107 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No AuthDBDUserPWQuery has been specified."); |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
| 108 |
|
"No AuthDBDUserPWQuery has been specified"); |
| 109 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 110 |
} |
} |
| 111 |
|
|
| 112 |
statement = apr_hash_get(dbd->prepared, conf->user, APR_HASH_KEY_STRING); |
statement = apr_hash_get(dbd->prepared, conf->user, APR_HASH_KEY_STRING); |
| 113 |
if (statement == NULL) { |
if (statement == NULL) { |
| 114 |
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, |
| 115 |
|
"A prepared statement could not be found for " |
| 116 |
|
"AuthDBDUserPWQuery with the key '%s'", conf->user); |
| 117 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 118 |
} |
} |
| 119 |
if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement, |
if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement, |
| 120 |
0, user, NULL) != 0) { |
0, user, NULL) != 0) { |
| 121 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
| 122 |
"Error looking up %s in database", user); |
"Query execution error looking up '%s' " |
| 123 |
|
"in database", user); |
| 124 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 125 |
} |
} |
| 126 |
for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1); |
for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1); |
| 128 |
rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) { |
rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) { |
| 129 |
if (rv != 0) { |
if (rv != 0) { |
| 130 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, |
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, |
| 131 |
"Error looking up %s in database", user); |
"Error retrieving results while looking up '%s' " |
| 132 |
|
"in database", user); |
| 133 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 134 |
} |
} |
| 135 |
if (dbd_password == NULL) { |
if (dbd_password == NULL) { |
| 190 |
ap_dbd_t *dbd = authn_dbd_acquire_fn(r); |
ap_dbd_t *dbd = authn_dbd_acquire_fn(r); |
| 191 |
if (dbd == NULL) { |
if (dbd == NULL) { |
| 192 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
| 193 |
"Error looking up %s in database", user); |
"Failed to acquire database connection to look up " |
| 194 |
|
"user '%s:%s'", user, realm); |
| 195 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 196 |
} |
} |
| 197 |
if (conf->realm == NULL) { |
if (conf->realm == NULL) { |
| 198 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No AuthDBDUserRealmQuery has been specified."); |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
| 199 |
|
"No AuthDBDUserRealmQuery has been specified"); |
| 200 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 201 |
} |
} |
| 202 |
statement = apr_hash_get(dbd->prepared, conf->realm, APR_HASH_KEY_STRING); |
statement = apr_hash_get(dbd->prepared, conf->realm, APR_HASH_KEY_STRING); |
| 203 |
if (statement == NULL) { |
if (statement == NULL) { |
| 204 |
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, |
| 205 |
|
"A prepared statement could not be found for " |
| 206 |
|
"AuthDBDUserRealmQuery with the key '%s'", conf->realm); |
| 207 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 208 |
} |
} |
| 209 |
if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement, |
if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement, |
| 210 |
0, user, realm, NULL) != 0) { |
0, user, realm, NULL) != 0) { |
| 211 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
| 212 |
"Error looking up %s:%s in database", user, realm); |
"Query execution error looking up '%s:%s' " |
| 213 |
|
"in database", user, realm); |
| 214 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 215 |
} |
} |
| 216 |
for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1); |
for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1); |
| 218 |
rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) { |
rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) { |
| 219 |
if (rv != 0) { |
if (rv != 0) { |
| 220 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, |
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, |
| 221 |
"Error looking up %s in database", user); |
"Error retrieving results while looking up '%s:%s' " |
| 222 |
|
"in database", user, realm); |
| 223 |
return AUTH_GENERAL_ERROR; |
return AUTH_GENERAL_ERROR; |
| 224 |
} |
} |
| 225 |
if (dbd_hash == NULL) { |
if (dbd_hash == NULL) { |