Skip to content
Permalink
Browse files

Merge pull request #1594 from vasilevalex/validate_ipv6

Allow IPv6 address in hostname
  • Loading branch information
razvancrainea committed Mar 6, 2019
2 parents 48023ac + e1c48c2 commit 873bd820cb1770b048435dc5bb7a7b99a156539e
Showing with 3 additions and 3 deletions.
  1. +3 −3 modules/sipmsgops/sipmsgops.c
@@ -1585,7 +1585,7 @@ static int check_hostname(str *domain)
}

/* always starts with a ALPHANUM */
if (!IS_ALPHANUM(domain->s[0])) {
if (!IS_ALPHANUM(domain->s[0]) && (domain->s[0] != '[')) {
LM_DBG("invalid starting character in domain: %c[%d]\n", domain->s[0], domain->s[0]);
return -1;
}
@@ -1594,7 +1594,7 @@ static int check_hostname(str *domain)
end = domain->s + domain->len - 1;

for (p = domain->s + 1; p < end; p++) {
if (!IS_ALPHANUM(*p) && (*p != '-')) {
if (!IS_ALPHANUM(*p) && (*p != '-') && (*p != ':')) {
if (*p != '.') {
LM_DBG("invalid character in hostname: %c[%d]\n", *p, *p);
return -1;
@@ -1606,7 +1606,7 @@ static int check_hostname(str *domain)
}

/* check if the last character is a '-' */
if (!IS_ALPHANUM(*end) && (*end != '.')) {
if (!IS_ALPHANUM(*end) && (*end != '.') && (*end != ']')) {
LM_DBG("invalid character at the end of the domain: %c[%d]\n", *end, *end);
return -1;
}

0 comments on commit 873bd82

Please sign in to comment.
You can’t perform that action at this time.