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

Function parse_digest_params

parser/digest/digest_parser.c:348–391  ·  view source on GitHub ↗

* Parse Digest credentials parameter, one by one */

Source from the content-addressed store, hash-verified

346 * Parse Digest credentials parameter, one by one
347 */
348static inline int parse_digest_params(str* _s, dig_cred_t* _c)
349{
350 char* comma;
351
352 do {
353 /* Parse the first parameter */
354 if (parse_digest_param(_s, _c) < 0) {
355 return -1;
356 }
357
358 /* Try to find the next parameter */
359 comma = q_memchr(_s->s, ',', _s->len);
360 if (comma) {
361 /* Yes, there is another,
362 * remove any leading white-spaces
363 * and let _s point to the next
364 * parameter name
365 */
366 _s->len -= comma - _s->s + 1;
367 _s->s = comma + 1;
368 trim_leading(_s);
369 }
370 } while(comma); /* Repeat while there are next parameters */
371
372 /* Parse QOP body if the parameter was present */
373 if (_c->qop.qop_str.len > 0) {
374 parse_qop(&_c->qop);
375 }
376
377 /* Parse algorithm body if the parameter was present */
378 if (_c->alg.alg_str.len > 0) {
379 trim(&(_c->alg.alg_str));
380 _c->alg.alg_parsed = parse_digest_algorithm(&(_c->alg.alg_str));
381 } else {
382 /* No algorithm specified */
383 DASSERT(_c->alg.alg_parsed == ALG_UNSPEC);
384 }
385
386 if (_c->username.whole.len > 0) {
387 parse_username(&_c->username);
388 }
389
390 return 0;
391}
392
393
394/*

Callers 1

parse_digest_credFunction · 0.85

Calls 7

parse_digest_paramFunction · 0.85
q_memchrFunction · 0.85
trim_leadingFunction · 0.85
parse_qopFunction · 0.85
trimFunction · 0.85
parse_digest_algorithmFunction · 0.85
parse_usernameFunction · 0.85

Tested by

no test coverage detected