Skip to content

Commit

Permalink
tm: default port checking in via_matching()
Browse files Browse the repository at this point in the history
(cherry picked from commit 5fabdea)
  • Loading branch information
miconda committed Nov 27, 2017
1 parent eb746c0 commit be53e5d
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/modules/tm/t_lookup.c
Expand Up @@ -259,17 +259,35 @@ static inline int via_matching( struct via_body *inv_via,
* different senders generating the same tid
*/
if (inv_via->host.len!=ack_via->host.len)
return 0;;
return 0;
if (memcmp(inv_via->host.s, ack_via->host.s,
ack_via->host.len)!=0)
return 0;
if (inv_via->port!=ack_via->port)
return 0;
if (inv_via->port!=ack_via->port) {
if(!(inv_via->port==0
&& (ack_via->port==SIP_PORT || ack_via->port==SIPS_PORT)))
return 0;
if(!(ack_via->port==0
&& (inv_via->port==SIP_PORT || inv_via->port==SIPS_PORT)))
return 0;
}
if (inv_via->transport.len!=ack_via->transport.len)
return 0;
if (memcmp(inv_via->transport.s, ack_via->transport.s,
ack_via->transport.len)!=0)
return 0;

if (inv_via->port!=ack_via->port
&& (inv_via->port==0 || ack_via->port==0)) {
/* test SIPS_PORT (5061) is used with TLS transport*/
if(inv_via->port==SIPS_PORT || ack_via->port==SIPS_PORT) {
if(ack_via->transport.len!=3
|| memcmp(inv_via->transport.s, "TLS", 3)!=0) {
return 0;
}
}
}

/* everything matched -- we found it */
return 1;
}
Expand Down

0 comments on commit be53e5d

Please sign in to comment.