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