MCPcopy Create free account
hub / github.com/apache/httpd / authenticate_digest_user

Function authenticate_digest_user

modules/aaa/mod_auth_digest.c:1572–1845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1570 */
1571
1572static 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);

Callers

nothing calls this directly

Calls 13

ap_auth_typeFunction · 0.85
ap_cstr_casecmpFunction · 0.85
ap_auth_nameFunction · 0.85
ap_get_module_configFunction · 0.85
note_digest_auth_failureFunction · 0.85
copy_uri_componentsFunction · 0.85
ap_unescape_urlFunction · 0.85
get_hashFunction · 0.85
ap_memeq_timingsafeFunction · 0.85
old_digestFunction · 0.85
new_digestFunction · 0.85
check_ncFunction · 0.85

Tested by

no test coverage detected