MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / parse_credentials

Function parse_credentials

parser/digest/digest.c:61–85  ·  view source on GitHub ↗

* Parse digest credentials * Return value -1 means that the function was unable to allocate * memory and therefore the server should return Internal Server Error, * not Bad Request in this case ! * Bad Request should be send when return value != -1 */

Source from the content-addressed store, hash-verified

59 * Bad Request should be send when return value != -1
60 */
61int parse_credentials(struct hdr_field* _h)
62{
63 int res;
64
65 if (_h->parsed) {
66 return 0; /* Already parsed */
67 }
68
69 if (new_credentials(_h) < 0) {
70 LM_ERR("failed to create new credentials\n");
71 return -1;
72 }
73
74 /* parse_digest_cred must return < -1 on error otherwise we will be
75 * unable to distinguish if the error was caused by the server or if the
76 * credentials are broken
77 */
78 res = parse_digest_cred(&(_h->body), &(((auth_body_t*)(_h->parsed))->digest));
79
80 if (res != 0) {
81 free_credentials((auth_body_t**)(void*)&(_h->parsed));
82 }
83
84 return res;
85}
86
87
88/*

Callers 7

pv_get_authattrFunction · 0.85
authorizeFunction · 0.85
find_credentialsFunction · 0.85
ds_hash_authusernameFunction · 0.85
get_diverterFunction · 0.85
w_sip_captureFunction · 0.85
ipsec_get_authFunction · 0.85

Calls 3

new_credentialsFunction · 0.85
parse_digest_credFunction · 0.85
free_credentialsFunction · 0.85

Tested by

no test coverage detected