#include "string.h"#include "ctype.h"#include "../../dprint.h"#include "../../str.h"#include "../../mem/mem.h"#include "auth_hdr.h"#include "auth.h"

Go to the source code of this file.
Defines | |
| #define | add_string(_p, _s, _l) |
| #define | ALGORITHM_FIELD_LEN (sizeof(ALGORITHM_FIELD_S)-1) |
| #define | ALGORITHM_FIELD_S "algorithm=MD5" |
| #define | ALGORITHM_STATE 7 |
| #define | AUTHENTICATE_DIGEST_LEN (sizeof(AUTHENTICATE_DIGEST_S)-1) |
| #define | AUTHENTICATE_DIGEST_S "Digest" |
| #define | AUTHENTICATE_MD5 (1<<0) |
| #define | AUTHENTICATE_MD5SESS (1<<1) |
| #define | AUTHENTICATE_STALE (1<<2) |
| #define | AUTHORIZATION_HDR_START "Authorization: Digest " |
| #define | AUTHORIZATION_HDR_START_LEN (sizeof(AUTHORIZATION_HDR_START)-1) |
| #define | CASE_5B(_hex4, _c5, _new_state, _quoted) |
| #define | CASE_6B(_hex4, _c5, _c6, _new_state, _quoted) |
| #define | CNONCE_FIELD_LEN (sizeof(CNONCE_FIELD_S)-1) |
| #define | CNONCE_FIELD_S "cnonce=\"" |
| #define | DOMAIN_STATE 5 |
| #define | FIELD_SEPARATOR_LEN (sizeof(FIELD_SEPARATOR_S)-1) |
| #define | FIELD_SEPARATOR_S "\", " |
| #define | FIELD_SEPARATOR_UQ_LEN (sizeof(FIELD_SEPARATOR_UQ_S)-1) |
| #define | FIELD_SEPARATOR_UQ_S ", " |
| #define | GET3B(_p) ((*(_p)<<24) + (*(_p+1)<<16) + (*(_p+2)<<8) + 0xff) |
| #define | GET4B(_p) ((*(_p)<<24) + (*(_p+1)<<16) + (*(_p+2)<<8) + *(_p+3)) |
| #define | LOWER1B(_n) ((_n)|0x20) |
| #define | LOWER4B(_n) ((_n)|0x20202020) |
| #define | NC_FIELD_LEN (sizeof(NC_FIELD_S)-1) |
| #define | NC_FIELD_S "nc=" |
| #define | NONCE_FIELD_LEN (sizeof(NONCE_FIELD_S)-1) |
| #define | NONCE_FIELD_S "nonce=\"" |
| #define | NONCE_STATE 3 |
| #define | OPAQUE_FIELD_LEN (sizeof(OPAQUE_FIELD_S)-1) |
| #define | OPAQUE_FIELD_S "opaque=\"" |
| #define | OPAQUE_STATE 6 |
| #define | OTHER_STATE 0 |
| #define | PROXY_AUTHORIZATION_HDR_START "Proxy-Authorization: Digest " |
| #define | PROXY_AUTHORIZATION_HDR_START_LEN (sizeof(PROXY_AUTHORIZATION_HDR_START)-1) |
| #define | QOP_FIELD_LEN (sizeof(QOP_FIELD_S)-1) |
| #define | QOP_FIELD_S "qop=" |
| #define | QOP_STATE 1 |
| #define | REALM_FIELD_LEN (sizeof(REALM_FIELD_S)-1) |
| #define | REALM_FIELD_S "realm=\"" |
| #define | REALM_STATE 2 |
| #define | RESPONSE_FIELD_LEN (sizeof(RESPONSE_FIELD_S)-1) |
| #define | RESPONSE_FIELD_S "response=\"" |
| #define | STALE_STATE 4 |
| #define | URI_FIELD_LEN (sizeof(URI_FIELD_S)-1) |
| #define | URI_FIELD_S "uri=\"" |
| #define | USERNAME_FIELD_LEN (sizeof(USERNAME_FIELD_S)-1) |
| #define | USERNAME_FIELD_S "username=\"" |
Functions | |
| str * | build_authorization_hdr (int code, str *uri, struct uac_credential *crd, struct authenticate_body *auth, char *response) |
| int | parse_authenticate_body (str *body, struct authenticate_body *auth) |
| #define add_string | ( | _p, | |||
| _s, | |||||
| _l | ) |
Value:
do {\ memcpy( _p, _s, _l);\ _p += _l; \ }while(0)
Definition at line 306 of file auth_hdr.c.
Referenced by build_authorization_hdr().
| #define ALGORITHM_FIELD_LEN (sizeof(ALGORITHM_FIELD_S)-1) |
| #define ALGORITHM_FIELD_S "algorithm=MD5" |
| #define ALGORITHM_STATE 7 |
| #define AUTHENTICATE_DIGEST_LEN (sizeof(AUTHENTICATE_DIGEST_S)-1) |
| #define AUTHENTICATE_DIGEST_S "Digest" |
| #define AUTHENTICATE_MD5 (1<<0) |
| #define AUTHENTICATE_MD5SESS (1<<1) |
| #define AUTHENTICATE_STALE (1<<2) |
| #define AUTHORIZATION_HDR_START "Authorization: Digest " |
| #define AUTHORIZATION_HDR_START_LEN (sizeof(AUTHORIZATION_HDR_START)-1) |
| #define CASE_5B | ( | _hex4, | |||
| _c5, | |||||
| _new_state, | |||||
| _quoted | ) |
| #define CASE_6B | ( | _hex4, | |||
| _c5, | |||||
| _c6, | |||||
| _new_state, | |||||
| _quoted | ) |
| #define CNONCE_FIELD_LEN (sizeof(CNONCE_FIELD_S)-1) |
| #define CNONCE_FIELD_S "cnonce=\"" |
| #define DOMAIN_STATE 5 |
| #define FIELD_SEPARATOR_LEN (sizeof(FIELD_SEPARATOR_S)-1) |
| #define FIELD_SEPARATOR_S "\", " |
| #define FIELD_SEPARATOR_UQ_LEN (sizeof(FIELD_SEPARATOR_UQ_S)-1) |
| #define FIELD_SEPARATOR_UQ_S ", " |
| #define GET3B | ( | _p | ) | ((*(_p)<<24) + (*(_p+1)<<16) + (*(_p+2)<<8) + 0xff) |
| #define GET4B | ( | _p | ) | ((*(_p)<<24) + (*(_p+1)<<16) + (*(_p+2)<<8) + *(_p+3)) |
| #define LOWER1B | ( | _n | ) | ((_n)|0x20) |
| #define LOWER4B | ( | _n | ) | ((_n)|0x20202020) |
| #define NC_FIELD_LEN (sizeof(NC_FIELD_S)-1) |
| #define NC_FIELD_S "nc=" |
| #define NONCE_FIELD_LEN (sizeof(NONCE_FIELD_S)-1) |
| #define NONCE_FIELD_S "nonce=\"" |
| #define NONCE_STATE 3 |
| #define OPAQUE_FIELD_LEN (sizeof(OPAQUE_FIELD_S)-1) |
| #define OPAQUE_FIELD_S "opaque=\"" |
| #define OPAQUE_STATE 6 |
| #define OTHER_STATE 0 |
| #define PROXY_AUTHORIZATION_HDR_START "Proxy-Authorization: Digest " |
| #define PROXY_AUTHORIZATION_HDR_START_LEN (sizeof(PROXY_AUTHORIZATION_HDR_START)-1) |
| #define QOP_FIELD_LEN (sizeof(QOP_FIELD_S)-1) |
| #define QOP_FIELD_S "qop=" |
| #define QOP_STATE 1 |
| #define REALM_FIELD_LEN (sizeof(REALM_FIELD_S)-1) |
| #define REALM_FIELD_S "realm=\"" |
| #define REALM_STATE 2 |
| #define RESPONSE_FIELD_LEN (sizeof(RESPONSE_FIELD_S)-1) |
| #define RESPONSE_FIELD_S "response=\"" |
| #define STALE_STATE 4 |
| #define URI_FIELD_LEN (sizeof(URI_FIELD_S)-1) |
| #define URI_FIELD_S "uri=\"" |
| #define USERNAME_FIELD_LEN (sizeof(USERNAME_FIELD_S)-1) |
| #define USERNAME_FIELD_S "username=\"" |
| str* build_authorization_hdr | ( | int | code, | |
| str * | uri, | |||
| struct uac_credential * | crd, | |||
| struct authenticate_body * | auth, | |||
| char * | response | |||
| ) |
Definition at line 313 of file auth_hdr.c.
References add_string, ALGORITHM_FIELD_LEN, ALGORITHM_FIELD_S, AUTHORIZATION_HDR_START, AUTHORIZATION_HDR_START_LEN, authenticate_body::cnonce, CNONCE_FIELD_LEN, CNONCE_FIELD_S, CRLF, CRLF_LEN, FIELD_SEPARATOR_LEN, FIELD_SEPARATOR_S, FIELD_SEPARATOR_UQ_LEN, FIELD_SEPARATOR_UQ_S, authenticate_body::flags, _str::len, len, LM_CRIT, LM_DBG, LM_ERR, authenticate_body::nc, NC_FIELD_LEN, NC_FIELD_S, authenticate_body::nonce, NONCE_FIELD_LEN, NONCE_FIELD_S, authenticate_body::opaque, OPAQUE_FIELD_LEN, OPAQUE_FIELD_S, pkg_free, pkg_malloc, PROXY_AUTHORIZATION_HDR_START, PROXY_AUTHORIZATION_HDR_START_LEN, QOP_AUTH, QOP_AUTH_INT, QOP_FIELD_LEN, QOP_FIELD_S, uac_credential::realm, REALM_FIELD_LEN, REALM_FIELD_S, RESPONSE_FIELD_LEN, RESPONSE_FIELD_S, _str::s, URI_FIELD_LEN, URI_FIELD_S, uac_credential::user, USERNAME_FIELD_LEN, and USERNAME_FIELD_S.
Referenced by uac_auth().
| int parse_authenticate_body | ( | str * | body, | |
| struct authenticate_body * | auth | |||
| ) |
Definition at line 91 of file auth_hdr.c.
References ALGORITHM_STATE, AUTHENTICATE_DIGEST_LEN, AUTHENTICATE_DIGEST_S, AUTHENTICATE_MD5, AUTHENTICATE_STALE, CASE_5B, CASE_6B, authenticate_body::domain, DOMAIN_STATE, authenticate_body::flags, GET3B, GET4B, _str::len, LM_DBG, LM_ERR, LOWER1B, LOWER4B, authenticate_body::nonce, NONCE_STATE, authenticate_body::opaque, OPAQUE_STATE, OTHER_STATE, authenticate_body::qop, QOP_AUTH, QOP_STATE, authenticate_body::realm, REALM_STATE, _str::s, and STALE_STATE.
Referenced by uac_auth().
1.5.6