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

Function get_realm

modules/auth/common.c:44–71  ·  view source on GitHub ↗

* Return parsed To or From, host part of the parsed uri is realm */

Source from the content-addressed store, hash-verified

42 * Return parsed To or From, host part of the parsed uri is realm
43 */
44int get_realm(struct sip_msg* _m, hdr_types_t _hftype, struct sip_uri** _u)
45{
46
47 if(_u==NULL)
48 return -1;
49 if ((REQ_LINE(_m).method.len == 8)
50 && !memcmp(REQ_LINE(_m).method.s, "REGISTER", 8)
51 && (_hftype == HDR_AUTHORIZATION_T)
52 ) {
53 if (!_m->to && ((parse_headers(_m, HDR_TO_F, 0)==-1) || (!_m->to))) {
54 LM_ERR("failed to parse TO headers\n");
55 return -1;
56 }
57
58 /* Body of To header field is parsed automatically */
59 if((*_u = parse_to_uri(_m))==NULL)
60 return -1;
61 } else {
62 if (parse_from_header(_m) < 0) {
63 LM_ERR("failed to parse FROM headers\n");
64 return -2;
65 }
66 if((*_u = parse_from_uri(_m))==NULL)
67 return -1;
68 }
69
70 return 0;
71}
72
73
74/*

Callers 2

pre_authFunction · 0.85
challengeFunction · 0.85

Calls 3

parse_to_uriFunction · 0.85
parse_from_headerFunction · 0.85
parse_from_uriFunction · 0.85

Tested by

no test coverage detected