|
|
1ee018 |
diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c
|
|
|
1ee018 |
index b50bcf9..5bfec82 100644
|
|
|
1ee018 |
--- a/modules/aaa/mod_auth_digest.c
|
|
|
1ee018 |
+++ b/modules/aaa/mod_auth_digest.c
|
|
|
1ee018 |
@@ -92,7 +92,6 @@ typedef struct digest_config_struct {
|
|
|
1ee018 |
int check_nc;
|
|
|
1ee018 |
const char *algorithm;
|
|
|
1ee018 |
char *uri_list;
|
|
|
1ee018 |
- const char *ha1;
|
|
|
1ee018 |
} digest_config_rec;
|
|
|
1ee018 |
|
|
|
1ee018 |
|
|
|
1ee018 |
@@ -153,6 +152,7 @@ typedef struct digest_header_struct {
|
|
|
1ee018 |
apr_time_t nonce_time;
|
|
|
1ee018 |
enum hdr_sts auth_hdr_sts;
|
|
|
1ee018 |
int needed_auth;
|
|
|
1ee018 |
+ const char *ha1;
|
|
|
1ee018 |
client_entry *client;
|
|
|
1ee018 |
} digest_header_rec;
|
|
|
1ee018 |
|
|
|
1ee018 |
@@ -1295,7 +1295,7 @@ static int hook_note_digest_auth_failure(request_rec *r, const char *auth_type)
|
|
|
1ee018 |
*/
|
|
|
1ee018 |
|
|
|
1ee018 |
static authn_status get_hash(request_rec *r, const char *user,
|
|
|
1ee018 |
- digest_config_rec *conf)
|
|
|
1ee018 |
+ digest_config_rec *conf, const char **rethash)
|
|
|
1ee018 |
{
|
|
|
1ee018 |
authn_status auth_result;
|
|
|
1ee018 |
char *password;
|
|
|
1ee018 |
@@ -1347,7 +1347,7 @@ static authn_status get_hash(request_rec *r, const char *user,
|
|
|
1ee018 |
} while (current_provider);
|
|
|
1ee018 |
|
|
|
1ee018 |
if (auth_result == AUTH_USER_FOUND) {
|
|
|
1ee018 |
- conf->ha1 = password;
|
|
|
1ee018 |
+ *rethash = password;
|
|
|
1ee018 |
}
|
|
|
1ee018 |
|
|
|
1ee018 |
return auth_result;
|
|
|
1ee018 |
@@ -1474,25 +1474,24 @@ static int check_nonce(request_rec *r, digest_header_rec *resp,
|
|
|
1ee018 |
|
|
|
1ee018 |
/* RFC-2069 */
|
|
|
1ee018 |
static const char *old_digest(const request_rec *r,
|
|
|
1ee018 |
- const digest_header_rec *resp, const char *ha1)
|
|
|
1ee018 |
+ const digest_header_rec *resp)
|
|
|
1ee018 |
{
|
|
|
1ee018 |
const char *ha2;
|
|
|
1ee018 |
|
|
|
1ee018 |
ha2 = ap_md5(r->pool, (unsigned char *)apr_pstrcat(r->pool, resp->method, ":",
|
|
|
1ee018 |
resp->uri, NULL));
|
|
|
1ee018 |
return ap_md5(r->pool,
|
|
|
1ee018 |
- (unsigned char *)apr_pstrcat(r->pool, ha1, ":", resp->nonce,
|
|
|
1ee018 |
- ":", ha2, NULL));
|
|
|
1ee018 |
+ (unsigned char *)apr_pstrcat(r->pool, resp->ha1, ":",
|
|
|
1ee018 |
+ resp->nonce, ":", ha2, NULL));
|
|
|
1ee018 |
}
|
|
|
1ee018 |
|
|
|
1ee018 |
/* RFC-2617 */
|
|
|
1ee018 |
static const char *new_digest(const request_rec *r,
|
|
|
1ee018 |
- digest_header_rec *resp,
|
|
|
1ee018 |
- const digest_config_rec *conf)
|
|
|
1ee018 |
+ digest_header_rec *resp)
|
|
|
1ee018 |
{
|
|
|
1ee018 |
const char *ha1, *ha2, *a2;
|
|
|
1ee018 |
|
|
|
1ee018 |
- ha1 = conf->ha1;
|
|
|
1ee018 |
+ ha1 = resp->ha1;
|
|
|
1ee018 |
|
|
|
1ee018 |
a2 = apr_pstrcat(r->pool, resp->method, ":", resp->uri, NULL);
|
|
|
1ee018 |
ha2 = ap_md5(r->pool, (const unsigned char *)a2);
|
|
|
1ee018 |
@@ -1505,7 +1504,6 @@ static const char *new_digest(const request_rec *r,
|
|
|
1ee018 |
NULL));
|
|
|
1ee018 |
}
|
|
|
1ee018 |
|
|
|
1ee018 |
-
|
|
|
1ee018 |
static void copy_uri_components(apr_uri_t *dst,
|
|
|
1ee018 |
apr_uri_t *src, request_rec *r) {
|
|
|
1ee018 |
if (src->scheme && src->scheme[0] != '\0') {
|
|
|
1ee018 |
@@ -1742,7 +1740,7 @@ static int authenticate_digest_user(request_rec *r)
|
|
|
1ee018 |
return HTTP_UNAUTHORIZED;
|
|
|
1ee018 |
}
|
|
|
1ee018 |
|
|
|
1ee018 |
- return_code = get_hash(r, r->user, conf);
|
|
|
1ee018 |
+ return_code = get_hash(r, r->user, conf, &resp->ha1);
|
|
|
1ee018 |
|
|
|
1ee018 |
if (return_code == AUTH_USER_NOT_FOUND) {
|
|
|
1ee018 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01790)
|
|
|
1ee018 |
@@ -1772,7 +1770,7 @@ static int authenticate_digest_user(request_rec *r)
|
|
|
1ee018 |
|
|
|
1ee018 |
if (resp->message_qop == NULL) {
|
|
|
1ee018 |
/* old (rfc-2069) style digest */
|
|
|
1ee018 |
- if (strcmp(resp->digest, old_digest(r, resp, conf->ha1))) {
|
|
|
1ee018 |
+ if (strcmp(resp->digest, old_digest(r, resp))) {
|
|
|
1ee018 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01792)
|
|
|
1ee018 |
"user %s: password mismatch: %s", r->user,
|
|
|
1ee018 |
r->uri);
|
|
|
1ee018 |
@@ -1802,7 +1800,7 @@ static int authenticate_digest_user(request_rec *r)
|
|
|
1ee018 |
return HTTP_UNAUTHORIZED;
|
|
|
1ee018 |
}
|
|
|
1ee018 |
|
|
|
1ee018 |
- exp_digest = new_digest(r, resp, conf);
|
|
|
1ee018 |
+ exp_digest = new_digest(r, resp);
|
|
|
1ee018 |
if (!exp_digest) {
|
|
|
1ee018 |
/* we failed to allocate a client struct */
|
|
|
1ee018 |
return HTTP_INTERNAL_SERVER_ERROR;
|
|
|
1ee018 |
@@ -1886,7 +1884,7 @@ static int add_auth_info(request_rec *r)
|
|
|
1ee018 |
|
|
|
1ee018 |
/* calculate rspauth attribute
|
|
|
1ee018 |
*/
|
|
|
1ee018 |
- ha1 = conf->ha1;
|
|
|
1ee018 |
+ ha1 = resp->ha1;
|
|
|
1ee018 |
|
|
|
1ee018 |
a2 = apr_pstrcat(r->pool, ":", resp->uri, NULL);
|
|
|
1ee018 |
ha2 = ap_md5(r->pool, (const unsigned char *)a2);
|