|
|
10ea73 |
--- a/modules/aaa/mod_auth_digest.c 2019/03/12 09:24:19 1855297
|
|
|
10ea73 |
+++ b/modules/aaa/mod_auth_digest.c 2019/03/12 09:24:26 1855298
|
|
|
10ea73 |
@@ -92,7 +92,6 @@
|
|
|
10ea73 |
int check_nc;
|
|
|
10ea73 |
const char *algorithm;
|
|
|
10ea73 |
char *uri_list;
|
|
|
10ea73 |
- const char *ha1;
|
|
|
10ea73 |
} digest_config_rec;
|
|
|
10ea73 |
|
|
|
10ea73 |
|
|
|
10ea73 |
@@ -153,6 +152,7 @@
|
|
|
10ea73 |
apr_time_t nonce_time;
|
|
|
10ea73 |
enum hdr_sts auth_hdr_sts;
|
|
|
10ea73 |
int needed_auth;
|
|
|
10ea73 |
+ const char *ha1;
|
|
|
10ea73 |
client_entry *client;
|
|
|
10ea73 |
} digest_header_rec;
|
|
|
10ea73 |
|
|
|
10ea73 |
@@ -1304,7 +1304,7 @@
|
|
|
10ea73 |
*/
|
|
|
10ea73 |
|
|
|
10ea73 |
static authn_status get_hash(request_rec *r, const char *user,
|
|
|
10ea73 |
- digest_config_rec *conf)
|
|
|
10ea73 |
+ digest_config_rec *conf, const char **rethash)
|
|
|
10ea73 |
{
|
|
|
10ea73 |
authn_status auth_result;
|
|
|
10ea73 |
char *password;
|
|
|
10ea73 |
@@ -1356,7 +1356,7 @@
|
|
|
10ea73 |
} while (current_provider);
|
|
|
10ea73 |
|
|
|
10ea73 |
if (auth_result == AUTH_USER_FOUND) {
|
|
|
10ea73 |
- conf->ha1 = password;
|
|
|
10ea73 |
+ *rethash = password;
|
|
|
10ea73 |
}
|
|
|
10ea73 |
|
|
|
10ea73 |
return auth_result;
|
|
|
10ea73 |
@@ -1483,25 +1483,24 @@
|
|
|
10ea73 |
|
|
|
10ea73 |
/* RFC-2069 */
|
|
|
10ea73 |
static const char *old_digest(const request_rec *r,
|
|
|
10ea73 |
- const digest_header_rec *resp, const char *ha1)
|
|
|
10ea73 |
+ const digest_header_rec *resp)
|
|
|
10ea73 |
{
|
|
|
10ea73 |
const char *ha2;
|
|
|
10ea73 |
|
|
|
10ea73 |
ha2 = ap_md5(r->pool, (unsigned char *)apr_pstrcat(r->pool, resp->method, ":",
|
|
|
10ea73 |
resp->uri, NULL));
|
|
|
10ea73 |
return ap_md5(r->pool,
|
|
|
10ea73 |
- (unsigned char *)apr_pstrcat(r->pool, ha1, ":", resp->nonce,
|
|
|
10ea73 |
- ":", ha2, NULL));
|
|
|
10ea73 |
+ (unsigned char *)apr_pstrcat(r->pool, resp->ha1, ":",
|
|
|
10ea73 |
+ resp->nonce, ":", ha2, NULL));
|
|
|
10ea73 |
}
|
|
|
10ea73 |
|
|
|
10ea73 |
/* RFC-2617 */
|
|
|
10ea73 |
static const char *new_digest(const request_rec *r,
|
|
|
10ea73 |
- digest_header_rec *resp,
|
|
|
10ea73 |
- const digest_config_rec *conf)
|
|
|
10ea73 |
+ digest_header_rec *resp)
|
|
|
10ea73 |
{
|
|
|
10ea73 |
const char *ha1, *ha2, *a2;
|
|
|
10ea73 |
|
|
|
10ea73 |
- ha1 = conf->ha1;
|
|
|
10ea73 |
+ ha1 = resp->ha1;
|
|
|
10ea73 |
|
|
|
10ea73 |
a2 = apr_pstrcat(r->pool, resp->method, ":", resp->uri, NULL);
|
|
|
10ea73 |
ha2 = ap_md5(r->pool, (const unsigned char *)a2);
|
|
|
10ea73 |
@@ -1514,7 +1513,6 @@
|
|
|
10ea73 |
NULL));
|
|
|
10ea73 |
}
|
|
|
10ea73 |
|
|
|
10ea73 |
-
|
|
|
10ea73 |
static void copy_uri_components(apr_uri_t *dst,
|
|
|
10ea73 |
apr_uri_t *src, request_rec *r) {
|
|
|
10ea73 |
if (src->scheme && src->scheme[0] != '\0') {
|
|
|
10ea73 |
@@ -1759,7 +1757,7 @@
|
|
|
10ea73 |
return HTTP_UNAUTHORIZED;
|
|
|
10ea73 |
}
|
|
|
10ea73 |
|
|
|
10ea73 |
- return_code = get_hash(r, r->user, conf);
|
|
|
10ea73 |
+ return_code = get_hash(r, r->user, conf, &resp->ha1);
|
|
|
10ea73 |
|
|
|
10ea73 |
if (return_code == AUTH_USER_NOT_FOUND) {
|
|
|
10ea73 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01790)
|
|
|
10ea73 |
@@ -1789,7 +1787,7 @@
|
|
|
10ea73 |
|
|
|
10ea73 |
if (resp->message_qop == NULL) {
|
|
|
10ea73 |
/* old (rfc-2069) style digest */
|
|
|
10ea73 |
- if (strcmp(resp->digest, old_digest(r, resp, conf->ha1))) {
|
|
|
10ea73 |
+ if (strcmp(resp->digest, old_digest(r, resp))) {
|
|
|
10ea73 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01792)
|
|
|
10ea73 |
"user %s: password mismatch: %s", r->user,
|
|
|
10ea73 |
r->uri);
|
|
|
10ea73 |
@@ -1819,7 +1817,7 @@
|
|
|
10ea73 |
return HTTP_UNAUTHORIZED;
|
|
|
10ea73 |
}
|
|
|
10ea73 |
|
|
|
10ea73 |
- exp_digest = new_digest(r, resp, conf);
|
|
|
10ea73 |
+ exp_digest = new_digest(r, resp);
|
|
|
10ea73 |
if (!exp_digest) {
|
|
|
10ea73 |
/* we failed to allocate a client struct */
|
|
|
10ea73 |
return HTTP_INTERNAL_SERVER_ERROR;
|
|
|
10ea73 |
@@ -1903,7 +1901,7 @@
|
|
|
10ea73 |
|
|
|
10ea73 |
/* calculate rspauth attribute
|
|
|
10ea73 |
*/
|
|
|
10ea73 |
- ha1 = conf->ha1;
|
|
|
10ea73 |
+ ha1 = resp->ha1;
|
|
|
10ea73 |
|
|
|
10ea73 |
a2 = apr_pstrcat(r->pool, ":", resp->uri, NULL);
|
|
|
10ea73 |
ha2 = ap_md5(r->pool, (const unsigned char *)a2);
|