FS-535: be more careful and catch ipv6 edge case
This commit is contained in:
parent
22047f9337
commit
87edbed6bb
|
@ -5740,6 +5740,10 @@ char *sofia_glue_get_register_host(const char *uri)
|
||||||
const char *s;
|
const char *s;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
|
if (zstr(uri)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ((s = switch_stristr("sip:", uri))) {
|
if ((s = switch_stristr("sip:", uri))) {
|
||||||
s += 4;
|
s += 4;
|
||||||
} else if ((s = switch_stristr("sips:", uri))) {
|
} else if ((s = switch_stristr("sips:", uri))) {
|
||||||
|
@ -5755,9 +5759,12 @@ char *sofia_glue_get_register_host(const char *uri)
|
||||||
/* remove port for register_host for testing nat acl take into account
|
/* remove port for register_host for testing nat acl take into account
|
||||||
ipv6 addresses which are required to have brackets around the addr
|
ipv6 addresses which are required to have brackets around the addr
|
||||||
*/
|
*/
|
||||||
if ((p = strchr(register_host, ']')) && (*(p + 1) == ':')) {
|
|
||||||
*(p + 1) = '\0';
|
if ((p = strchr(register_host, ']'))) {
|
||||||
} else {
|
if (*(p + 1) == ':') {
|
||||||
|
*(p + 1) = '\0';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if ((p = strrchr(register_host, ':'))) {
|
if ((p = strrchr(register_host, ':'))) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue