Commit cbd4d25e authored by Pekka Pessi's avatar Pekka Pessi

nta.c, sip_util.c: avoid using invalid Via/Contact from stun-enabled transport

darcs-hash:20070328152007-55b16-c74764c53aac747cb02b4cd86a83b5c512edec46.gz
parent 005946bd
......@@ -1823,10 +1823,20 @@ int agent_init_contact(nta_agent_t *self)
if (self->sa_contact)
return 0;
if (self->sa_vias)
v1 = self->sa_vias;
else
v1 = self->sa_public_vias;
for (v1 = self->sa_vias ? self->sa_vias : self->sa_public_vias;
v1;
v1 = v1->v_next) {
if (host_is_ip_address(v1->v_host)) {
if (!host_is_local(v1->v_host))
break;
}
else if (!host_has_domain_invalid(v1->v_host)) {
break;
}
}
if (v1 == NULL)
v1 = self->sa_vias ? self->sa_vias : self->sa_public_vias;
if (!v1)
return -1;
......
......@@ -247,8 +247,8 @@ sip_contact_string_from_via(su_home_t *home,
if (port || host_is_ip_address(host))
transport = NULL;
}
else if (port && host_is_ip_address(host) &&
strcmp(port, SIP_DEFAULT_SERV) == 0) {
else if (port && strcmp(port, SIP_DEFAULT_SERV) == 0 &&
(host_is_ip_address(host) || host_has_domain_invalid(host))) {
port = NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment