Beispiel #1
0
static int authenticate_digest_user(request_rec *r)
{
    digest_config_rec *sec =
    (digest_config_rec *) ap_get_module_config(r->per_dir_config,
					    &digest_module);
    digest_header_rec *response = ap_pcalloc(r->pool, sizeof(digest_header_rec));
    conn_rec *c = r->connection;
    char *a1;
    int res;

    if ((res = get_digest_rec(r, response)))
	return res;

    if (!sec->pwfile)
	return DECLINED;

    if (!(a1 = get_hash(r, c->user, sec->pwfile))) {
	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server,
		    "user %s not found: %s", c->user, r->uri);
	ap_note_digest_auth_failure(r);
	return AUTH_REQUIRED;
    }
    if (strcmp(response->digest, find_digest(r, response, a1))) {
	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server,
		    "user %s: password mismatch: %s", c->user, r->uri);
	ap_note_digest_auth_failure(r);
	return AUTH_REQUIRED;
    }
    return OK;
}
Beispiel #2
0
/* Order the list of input files so each next file applies to the previous: */
static bool order_input(struct File **files)
{
    struct File *cur, *succ;

    /* Determine first file */
    cur = find_first(*files);
    if (cur == NULL) return false;
    *files = move_to_front(*files, cur);

    /* Order remaining files */
    while (cur->next)
    {
        succ = find_digest(cur->next, cur->diff.digest2);
        if (succ == NULL) return false;
        cur->next = move_to_front(cur->next, succ);
        cur = cur->next;
    }

    return true;
}