Browse Source

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@.+
Daniel-Constantin Mierla 6 years ago
parent
commit
94e9d47d2d
1 changed files with 4 additions and 4 deletions
  1. 4 4
      utils/kamctl/kamctl.base

+ 4 - 4
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