|
@@ -100,7 +100,7 @@ int th_get_param_value(str *in, str *name, str *value)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if(params) free_params(params);
|
|
if(params) free_params(params);
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
@@ -188,7 +188,7 @@ int th_mask_via(sip_msg_t *msg)
|
|
LM_ERR("cannot encode via %d\n", i);
|
|
LM_ERR("cannot encode via %d\n", i);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
LM_DBG("+body: %d: [%.*s]\n", out.len, out.len, out.s);
|
|
LM_DBG("+body: %d: [%.*s]\n", out.len, out.len, out.s);
|
|
l=del_lump(msg, via->name.s-msg->buf, vlen, 0);
|
|
l=del_lump(msg, via->name.s-msg->buf, vlen, 0);
|
|
if (l==0)
|
|
if (l==0)
|
|
@@ -221,7 +221,7 @@ int th_mask_callid(sip_msg_t *msg)
|
|
LM_ERR("cannot get Call-Id header\n");
|
|
LM_ERR("cannot get Call-Id header\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
out.s = th_mask_encode(msg->callid->body.s, msg->callid->body.len,
|
|
out.s = th_mask_encode(msg->callid->body.s, msg->callid->body.len,
|
|
&th_callid_prefix, &out.len);
|
|
&th_callid_prefix, &out.len);
|
|
if(out.s==NULL)
|
|
if(out.s==NULL)
|
|
@@ -229,7 +229,7 @@ int th_mask_callid(sip_msg_t *msg)
|
|
LM_ERR("cannot encode callid\n");
|
|
LM_ERR("cannot encode callid\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
l=del_lump(msg, msg->callid->body.s-msg->buf, msg->callid->body.len, 0);
|
|
l=del_lump(msg, msg->callid->body.s-msg->buf, msg->callid->body.len, 0);
|
|
if (l==0)
|
|
if (l==0)
|
|
{
|
|
{
|
|
@@ -254,7 +254,7 @@ int th_mask_contact(sip_msg_t *msg)
|
|
char *p;
|
|
char *p;
|
|
contact_t *c;
|
|
contact_t *c;
|
|
|
|
|
|
- if(msg->contact==NULL)
|
|
|
|
|
|
+ if(msg->contact==NULL)
|
|
{
|
|
{
|
|
LM_DBG("no contact header\n");
|
|
LM_DBG("no contact header\n");
|
|
return 0;
|
|
return 0;
|
|
@@ -265,7 +265,7 @@ int th_mask_contact(sip_msg_t *msg)
|
|
LM_ERR("failed parsing contact header\n");
|
|
LM_ERR("failed parsing contact header\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
c = ((contact_body_t*)msg->contact->parsed)->contacts;
|
|
c = ((contact_body_t*)msg->contact->parsed)->contacts;
|
|
in = c->uri;
|
|
in = c->uri;
|
|
|
|
|
|
@@ -293,7 +293,7 @@ int th_mask_contact(sip_msg_t *msg)
|
|
out.s = p;
|
|
out.s = p;
|
|
out.len += 2;
|
|
out.len += 2;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
l=del_lump(msg, in.s-msg->buf, in.len, 0);
|
|
l=del_lump(msg, in.s-msg->buf, in.len, 0);
|
|
if (l==0)
|
|
if (l==0)
|
|
{
|
|
{
|
|
@@ -325,9 +325,9 @@ int th_mask_record_route(sip_msg_t *msg)
|
|
}
|
|
}
|
|
hdr = msg->record_route;
|
|
hdr = msg->record_route;
|
|
i = 0;
|
|
i = 0;
|
|
- while(hdr!=NULL)
|
|
|
|
|
|
+ while(hdr!=NULL)
|
|
{
|
|
{
|
|
- if (parse_rr(hdr) < 0)
|
|
|
|
|
|
+ if (parse_rr(hdr) < 0)
|
|
{
|
|
{
|
|
LM_ERR("failed to parse RR\n");
|
|
LM_ERR("failed to parse RR\n");
|
|
return -1;
|
|
return -1;
|
|
@@ -416,7 +416,7 @@ int th_unmask_via(sip_msg_t *msg, str *cookie)
|
|
LM_ERR("cannot decode via %d\n", i);
|
|
LM_ERR("cannot decode via %d\n", i);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
LM_DBG("+body: %d: [%.*s]\n", out.len, out.len, out.s);
|
|
LM_DBG("+body: %d: [%.*s]\n", out.len, out.len, out.s);
|
|
if(i==2)
|
|
if(i==2)
|
|
{
|
|
{
|
|
@@ -428,7 +428,7 @@ int th_unmask_via(sip_msg_t *msg, str *cookie)
|
|
return -1;
|
|
return -1;
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
memset(via2, 0, sizeof(struct via_body));
|
|
memset(via2, 0, sizeof(struct via_body));
|
|
memcpy(out.s+out.len, CRLF, CRLF_LEN);
|
|
memcpy(out.s+out.len, CRLF, CRLF_LEN);
|
|
out.s[out.len+CRLF_LEN]='X';
|
|
out.s[out.len+CRLF_LEN]='X';
|
|
@@ -475,10 +475,10 @@ int th_unmask_callid(sip_msg_t *msg)
|
|
{
|
|
{
|
|
struct lump* l;
|
|
struct lump* l;
|
|
str out;
|
|
str out;
|
|
-
|
|
|
|
|
|
+
|
|
if(th_param_mask_callid==0)
|
|
if(th_param_mask_callid==0)
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
|
|
+
|
|
if(msg->callid==NULL)
|
|
if(msg->callid==NULL)
|
|
{
|
|
{
|
|
LM_ERR("cannot get Call-Id header\n");
|
|
LM_ERR("cannot get Call-Id header\n");
|
|
@@ -492,7 +492,7 @@ int th_unmask_callid(sip_msg_t *msg)
|
|
LM_DBG("call-id [%.*s] not encoded",msg->callid->body.len,msg->callid->body.s);
|
|
LM_DBG("call-id [%.*s] not encoded",msg->callid->body.len,msg->callid->body.s);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
out.s = th_mask_decode(msg->callid->body.s, msg->callid->body.len,
|
|
out.s = th_mask_decode(msg->callid->body.s, msg->callid->body.len,
|
|
&th_callid_prefix, 0, &out.len);
|
|
&th_callid_prefix, 0, &out.len);
|
|
if(out.s==NULL)
|
|
if(out.s==NULL)
|
|
@@ -500,7 +500,7 @@ int th_unmask_callid(sip_msg_t *msg)
|
|
LM_ERR("cannot decode callid\n");
|
|
LM_ERR("cannot decode callid\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
l=del_lump(msg, msg->callid->body.s-msg->buf, msg->callid->body.len, 0);
|
|
l=del_lump(msg, msg->callid->body.s-msg->buf, msg->callid->body.len, 0);
|
|
if (l==0)
|
|
if (l==0)
|
|
{
|
|
{
|
|
@@ -580,9 +580,9 @@ int th_flip_record_route(sip_msg_t *msg, int mode)
|
|
act = 0;
|
|
act = 0;
|
|
if(mode==1)
|
|
if(mode==1)
|
|
act = 2;
|
|
act = 2;
|
|
- while(hdr!=NULL)
|
|
|
|
|
|
+ while(hdr!=NULL)
|
|
{
|
|
{
|
|
- if (parse_rr(hdr) < 0)
|
|
|
|
|
|
+ if (parse_rr(hdr) < 0)
|
|
{
|
|
{
|
|
LM_ERR("failed to parse RR\n");
|
|
LM_ERR("failed to parse RR\n");
|
|
return -1;
|
|
return -1;
|
|
@@ -673,9 +673,9 @@ int th_unmask_route(sip_msg_t *msg)
|
|
}
|
|
}
|
|
hdr = msg->route;
|
|
hdr = msg->route;
|
|
i = 0;
|
|
i = 0;
|
|
- while(hdr!=NULL)
|
|
|
|
|
|
+ while(hdr!=NULL)
|
|
{
|
|
{
|
|
- if (parse_rr(hdr) < 0)
|
|
|
|
|
|
+ if (parse_rr(hdr) < 0)
|
|
{
|
|
{
|
|
LM_ERR("failed to parse RR\n");
|
|
LM_ERR("failed to parse RR\n");
|
|
return -1;
|
|
return -1;
|
|
@@ -691,7 +691,7 @@ int th_unmask_route(sip_msg_t *msg)
|
|
if (th_uri_prefix_checks
|
|
if (th_uri_prefix_checks
|
|
&& ((rr->nameaddr.uri.len<th_uri_prefix.len) ||
|
|
&& ((rr->nameaddr.uri.len<th_uri_prefix.len) ||
|
|
(strncasecmp(rr->nameaddr.uri.s,th_uri_prefix.s,
|
|
(strncasecmp(rr->nameaddr.uri.s,th_uri_prefix.s,
|
|
- th_uri_prefix.len)!=0)))
|
|
|
|
|
|
+ th_uri_prefix.len)!=0)))
|
|
{
|
|
{
|
|
LM_DBG("rr %d is not encoded: [%.*s]", i,
|
|
LM_DBG("rr %d is not encoded: [%.*s]", i,
|
|
rr->nameaddr.uri.len, rr->nameaddr.uri.s);
|
|
rr->nameaddr.uri.len, rr->nameaddr.uri.s);
|
|
@@ -702,7 +702,7 @@ int th_unmask_route(sip_msg_t *msg)
|
|
if(th_get_uri_param_value(&rr->nameaddr.uri, &th_uparam_name,
|
|
if(th_get_uri_param_value(&rr->nameaddr.uri, &th_uparam_name,
|
|
&eval)<0 || eval.len<=0)
|
|
&eval)<0 || eval.len<=0)
|
|
return -1;
|
|
return -1;
|
|
-
|
|
|
|
|
|
+
|
|
out.s = th_mask_decode(eval.s, eval.len,
|
|
out.s = th_mask_decode(eval.s, eval.len,
|
|
&th_uparam_prefix, 0, &out.len);
|
|
&th_uparam_prefix, 0, &out.len);
|
|
|
|
|
|
@@ -742,7 +742,7 @@ int th_unmask_ruri(sip_msg_t *msg)
|
|
/* Do nothing if ruri is not encoded */
|
|
/* Do nothing if ruri is not encoded */
|
|
if (th_uri_prefix_checks && ((REQ_LINE(msg).uri.len<th_uri_prefix.len) ||
|
|
if (th_uri_prefix_checks && ((REQ_LINE(msg).uri.len<th_uri_prefix.len) ||
|
|
(strncasecmp(REQ_LINE(msg).uri.s, th_uri_prefix.s,
|
|
(strncasecmp(REQ_LINE(msg).uri.s, th_uri_prefix.s,
|
|
- th_uri_prefix.len)!=0)))
|
|
|
|
|
|
+ th_uri_prefix.len)!=0)))
|
|
{
|
|
{
|
|
LM_DBG("ruri [%.*s] is not encoded",REQ_LINE(msg).uri.len,REQ_LINE(msg).uri.s);
|
|
LM_DBG("ruri [%.*s] is not encoded",REQ_LINE(msg).uri.len,REQ_LINE(msg).uri.s);
|
|
return 0;
|
|
return 0;
|
|
@@ -751,7 +751,7 @@ int th_unmask_ruri(sip_msg_t *msg)
|
|
if(th_get_uri_param_value(&REQ_LINE(msg).uri, &th_uparam_name, &eval)<0
|
|
if(th_get_uri_param_value(&REQ_LINE(msg).uri, &th_uparam_name, &eval)<0
|
|
|| eval.len<=0)
|
|
|| eval.len<=0)
|
|
return -1;
|
|
return -1;
|
|
-
|
|
|
|
|
|
+
|
|
out.s = th_mask_decode(eval.s, eval.len,
|
|
out.s = th_mask_decode(eval.s, eval.len,
|
|
&th_uparam_prefix, 0, &out.len);
|
|
&th_uparam_prefix, 0, &out.len);
|
|
if(out.s==NULL)
|
|
if(out.s==NULL)
|
|
@@ -759,7 +759,7 @@ int th_unmask_ruri(sip_msg_t *msg)
|
|
LM_ERR("cannot decode r-uri\n");
|
|
LM_ERR("cannot decode r-uri\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
LM_DBG("+decoded: %d: [%.*s]\n", out.len, out.len, out.s);
|
|
LM_DBG("+decoded: %d: [%.*s]\n", out.len, out.len, out.s);
|
|
l=del_lump(msg, REQ_LINE(msg).uri.s-msg->buf, REQ_LINE(msg).uri.len, 0);
|
|
l=del_lump(msg, REQ_LINE(msg).uri.s-msg->buf, REQ_LINE(msg).uri.len, 0);
|
|
if (l==0)
|
|
if (l==0)
|
|
@@ -941,7 +941,7 @@ int th_add_via_cookie(sip_msg_t *msg, struct via_body *via)
|
|
LM_ERR("failed adding cookie to via [%p]\n", via);
|
|
LM_ERR("failed adding cookie to via [%p]\n", via);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
out.len = 1+th_cookie_name.len+1+th_cookie_value.len+1;
|
|
out.len = 1+th_cookie_name.len+1+th_cookie_value.len+1;
|
|
out.s = (char*)pkg_malloc(out.len+1);
|
|
out.s = (char*)pkg_malloc(out.len+1);
|
|
if(out.s==0)
|
|
if(out.s==0)
|
|
@@ -1141,7 +1141,7 @@ int th_route_direction(sip_msg_t *msg)
|
|
LM_DBG("no route header - downstream\n");
|
|
LM_DBG("no route header - downstream\n");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- if (parse_rr(msg->route) < 0)
|
|
|
|
|
|
+ if (parse_rr(msg->route) < 0)
|
|
{
|
|
{
|
|
LM_ERR("failed to parse route header\n");
|
|
LM_ERR("failed to parse route header\n");
|
|
return -1;
|
|
return -1;
|