| 1570 | */ |
| 1571 | |
| 1572 | static int authenticate_digest_user(request_rec *r) |
| 1573 | { |
| 1574 | digest_config_rec *conf; |
| 1575 | digest_header_rec *resp; |
| 1576 | request_rec *mainreq; |
| 1577 | const char *t; |
| 1578 | int res; |
| 1579 | authn_status return_code; |
| 1580 | |
| 1581 | /* do we require Digest auth for this URI? */ |
| 1582 | |
| 1583 | if (!(t = ap_auth_type(r)) || ap_cstr_casecmp(t, "Digest")) { |
| 1584 | return DECLINED; |
| 1585 | } |
| 1586 | |
| 1587 | if (!ap_auth_name(r)) { |
| 1588 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01780) |
| 1589 | "need AuthName: %s", r->uri); |
| 1590 | return HTTP_INTERNAL_SERVER_ERROR; |
| 1591 | } |
| 1592 | |
| 1593 | |
| 1594 | /* get the client response and mark */ |
| 1595 | |
| 1596 | mainreq = r; |
| 1597 | while (mainreq->main != NULL) { |
| 1598 | mainreq = mainreq->main; |
| 1599 | } |
| 1600 | while (mainreq->prev != NULL) { |
| 1601 | mainreq = mainreq->prev; |
| 1602 | } |
| 1603 | resp = (digest_header_rec *) ap_get_module_config(mainreq->request_config, |
| 1604 | &auth_digest_module); |
| 1605 | resp->needed_auth = 1; |
| 1606 | |
| 1607 | |
| 1608 | /* get our conf */ |
| 1609 | |
| 1610 | conf = (digest_config_rec *) ap_get_module_config(r->per_dir_config, |
| 1611 | &auth_digest_module); |
| 1612 | |
| 1613 | |
| 1614 | /* check for existence and syntax of Auth header */ |
| 1615 | |
| 1616 | if (resp->auth_hdr_sts != VALID) { |
| 1617 | if (resp->auth_hdr_sts == NOT_DIGEST) { |
| 1618 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01781) |
| 1619 | "client used wrong authentication scheme `%s': %s", |
| 1620 | resp->scheme, r->uri); |
| 1621 | } |
| 1622 | else if (resp->auth_hdr_sts == INVALID) { |
| 1623 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01782) |
| 1624 | "missing user, realm, nonce, uri, digest, " |
| 1625 | "cnonce, or nonce_count in authorization header: %s", |
| 1626 | r->uri); |
| 1627 | } |
| 1628 | /* else (resp->auth_hdr_sts == NO_HEADER) */ |
| 1629 | note_digest_auth_failure(r, conf, resp, 0); |
nothing calls this directly
no test coverage detected