From 94e9d47d2d2da82be23f1bae8cd6491c758a384c Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Tue, 9 Jul 2019 09:35:08 +0200 Subject: [PATCH] kamctl: relaxed regex check on aor and sip uri - it required a dot (.), not valid for ipv6 and single word domains (e.g., localhost) - now just match on USERNAME_RE@.+ --- utils/kamctl/kamctl.base | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base index d16fa978b87..01518faae0f 100644 --- a/utils/kamctl/kamctl.base +++ b/utils/kamctl/kamctl.base @@ -667,7 +667,7 @@ in SIP_DOMAIN" # check the parameter if it is a valid address of record (user@domain) check_aor() { - echo "$1" | $EGREP "^$USERNAME_RE@.*\..*" >/dev/null + echo "$1" | $EGREP "^$USERNAME_RE@.+" >/dev/null if [ $? -ne 0 ] ; then echo "error: invalid AoR: $1" >&2 exit 1 @@ -676,7 +676,7 @@ check_aor() { # check the parameter if it is a valid address of record (user@domain) is_aor() { - echo "$1" | $EGREP "^$USERNAME_RE@.*\..*" >/dev/null + echo "$1" | $EGREP "^$USERNAME_RE@.+" >/dev/null if [ $? -ne 0 ] ; then false else @@ -686,7 +686,7 @@ is_aor() { # check the parameter if it is a valid SIP address of record (sip:user@domain) check_sipaor() { - echo "$1" | $EGREP "^sip(s)?:$USERNAME_RE@.*\..*" >/dev/null + echo "$1" | $EGREP "^sip(s)?:$USERNAME_RE@.+" >/dev/null if [ $? -ne 0 ] ; then echo "error: invalid SIP AoR: $1" >&2 exit 1 @@ -697,7 +697,7 @@ check_sipaor() { # quite simplified now -- it captures just very basic # errors check_uri() { - echo "$1" | $EGREP "^sip(s)?:($USERNAME_RE@)?.*\..*" > /dev/null + echo "$1" | $EGREP "^sip(s)?:($USERNAME_RE@)?.+" > /dev/null if [ $? -ne 0 ] ; then echo "error: invalid SIP URI: $1" >&2 exit 1