#include "../../data_lump.h"
#include "../../mem/mem.h"
#include "../../parser/digest/digest.h"
#include "../../pvar.h"
#include "../../str.h"
#include "../../ut.h"
#include "../../mod_fix.h"
#include "auth_mod.h"
#include "common.h"
#include "challenge.h"
#include "nonce.h"
#include "index.h"
#include "api.h"

Go to the source code of this file.
Defines | |
| #define | DIGEST_MD5 ", algorithm=MD5" |
| #define | DIGEST_MD5_LEN (sizeof(DIGEST_MD5)-1) |
| #define | DIGEST_NONCE "\", nonce=\"" |
| #define | DIGEST_NONCE_LEN (sizeof(DIGEST_NONCE)-1) |
| #define | DIGEST_REALM ": Digest realm=\"" |
| #define | DIGEST_REALM_LEN (sizeof(DIGEST_REALM)-1) |
| #define | MESSAGE_401 "Unauthorized" |
| #define | MESSAGE_407 "Proxy Authentication Required" |
| #define | PROXY_AUTH_CHALLENGE "Proxy-Authenticate" |
| #define | QOP_PARAM ", qop=\"auth\"" |
| #define | QOP_PARAM_LEN (sizeof(QOP_PARAM)-1) |
| #define | STALE_PARAM ", stale=true" |
| #define | STALE_PARAM_LEN (sizeof(STALE_PARAM)-1) |
| #define | WWW_AUTH_CHALLENGE "WWW-Authenticate" |
Functions | |
| static char * | build_auth_hf (int _stale, str *_realm, int *_len, int _qop, char *_hf_name) |
| Create {WWW,Proxy}-Authenticate header field. | |
| static int | challenge (struct sip_msg *_msg, gparam_p _realm, int _qop, int _code, char *_message, char *_challenge_msg) |
| Create and send a authentification challenge. | |
| int | consume_credentials (struct sip_msg *_m, char *_s1, char *_s2) |
| Remove used credentials from a SIP message header. | |
| int | proxy_challenge (struct sip_msg *_msg, char *_realm, char *_qop) |
| Challenge a user to send credentials using Proxy-Authorize header field. | |
| int | www_challenge (struct sip_msg *_msg, char *_realm, char *_qop) |
| Challenge a user to send credentials using WWW-Authorize header field. | |
Variables | |
| static str | auth_400_err = str_init(MESSAGE_400) |
| static str | auth_500_err = str_init(MESSAGE_500) |
Definition in file challenge.c.
| #define DIGEST_MD5 ", algorithm=MD5" |
| #define DIGEST_MD5_LEN (sizeof(DIGEST_MD5)-1) |
| #define DIGEST_NONCE "\", nonce=\"" |
| #define DIGEST_NONCE_LEN (sizeof(DIGEST_NONCE)-1) |
| #define DIGEST_REALM ": Digest realm=\"" |
| #define DIGEST_REALM_LEN (sizeof(DIGEST_REALM)-1) |
| #define MESSAGE_401 "Unauthorized" |
| #define MESSAGE_407 "Proxy Authentication Required" |
| #define PROXY_AUTH_CHALLENGE "Proxy-Authenticate" |
| #define QOP_PARAM ", qop=\"auth\"" |
| #define QOP_PARAM_LEN (sizeof(QOP_PARAM)-1) |
| #define STALE_PARAM ", stale=true" |
| #define STALE_PARAM_LEN (sizeof(STALE_PARAM)-1) |
| #define WWW_AUTH_CHALLENGE "WWW-Authenticate" |
| static char* build_auth_hf | ( | int | _stale, | |
| str * | _realm, | |||
| int * | _len, | |||
| int | _qop, | |||
| char * | _hf_name | |||
| ) | [inline, static] |
Create {WWW,Proxy}-Authenticate header field.
| _stale | ||
| _realm | authentification realm | |
| _len | length, will be set | |
| _qop | qop value | |
| _hf_name | header field name |
Definition at line 90 of file challenge.c.
References calc_nonce(), CRLF, CRLF_LEN, DIGEST_MD5, DIGEST_MD5_LEN, DIGEST_NONCE, DIGEST_NONCE_LEN, DIGEST_REALM, DIGEST_REALM_LEN, _str::len, LM_DBG, LM_ERR, nonce_expire, NONCE_LEN, nonce_reuse, pkg_malloc, QOP_PARAM, QOP_PARAM_LEN, reserve_nonce_index(), _str::s, secret, STALE_PARAM, and STALE_PARAM_LEN.
Referenced by challenge().
| static int challenge | ( | struct sip_msg * | _msg, | |
| gparam_p | _realm, | |||
| int | _qop, | |||
| int | _code, | |||
| char * | _message, | |||
| char * | _challenge_msg | |||
| ) | [inline, static] |
Create and send a authentification challenge.
| _msg | SIP message | |
| _realm | authentification realm | |
| _qop | qop value | |
| _code | response code | |
| _message | response message | |
| _challenge_msg | challenge message |
Definition at line 165 of file challenge.c.
References sip_msg::authorization, build_auth_hf(), fixup_get_svalue(), get_authorized_cred(), get_realm(), HDR_AUTHORIZATION_T, HDR_PROXYAUTH_T, sip_uri::host, _str::len, LM_ERR, hdr_field::parsed, pkg_free, sip_msg::proxy_auth, _str::s, send_resp(), auth_body::stale, and strip_realm().
Referenced by proxy_challenge(), and www_challenge().
| int consume_credentials | ( | struct sip_msg * | _m, | |
| char * | _s1, | |||
| char * | _s2 | |||
| ) |
Remove used credentials from a SIP message header.
| _m | SIP message | |
| _s1 | unused | |
| _s2 | unused |
Definition at line 269 of file challenge.c.
References sip_msg::authorization, sip_msg::buf, del_lump(), get_authorized_cred(), hdr_field::len, len, LM_ERR, METHOD_ACK, METHOD_CANCEL, hdr_field::name, sip_msg::proxy_auth, and _str::s.
| int proxy_challenge | ( | struct sip_msg * | _msg, | |
| char * | _realm, | |||
| char * | _qop | |||
| ) |
Challenge a user to send credentials using Proxy-Authorize header field.
| _msg | SIP message | |
| _realm | authentification realm | |
| _qop | qop value |
Definition at line 255 of file challenge.c.
References challenge(), MESSAGE_407, and PROXY_AUTH_CHALLENGE.
| int www_challenge | ( | struct sip_msg * | _msg, | |
| char * | _realm, | |||
| char * | _qop | |||
| ) |
Challenge a user to send credentials using WWW-Authorize header field.
| _msg | SIP message | |
| _realm | authentification realm | |
| _qop | qop value |
Challenge a user to send credentials using WWW-Authorize header field
| _msg | SIP message | |
| _realm | authentification realm | |
| _qop | qop value |
Definition at line 234 of file challenge.c.
References challenge(), MESSAGE_401, and WWW_AUTH_CHALLENGE.
str auth_400_err = str_init(MESSAGE_400) [static] |
Definition at line 51 of file challenge.c.
str auth_500_err = str_init(MESSAGE_500) [static] |
Definition at line 52 of file challenge.c.
1.5.6