[sr-dev] git:master:94e9d47d: kamctl: relaxed regex check on aor and sip uri

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 9 09:38:39 CEST 2019


Module: kamailio
Branch: master
Commit: 94e9d47d2d2da82be23f1bae8cd6491c758a384c
URL: https://github.com/kamailio/kamailio/commit/94e9d47d2d2da82be23f1bae8cd6491c758a384c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-07-09T09:35:08+02:00

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 at .+

---

Modified: utils/kamctl/kamctl.base

---

Diff:  https://github.com/kamailio/kamailio/commit/94e9d47d2d2da82be23f1bae8cd6491c758a384c.diff
Patch: https://github.com/kamailio/kamailio/commit/94e9d47d2d2da82be23f1bae8cd6491c758a384c.patch

---

diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base
index d16fa978b8..01518faae0 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 at domain)
 check_aor() {
-	echo "$1" | $EGREP "^$USERNAME_RE at .*\..*" >/dev/null
+	echo "$1" | $EGREP "^$USERNAME_RE at .+" >/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 at domain)
 is_aor() {
-	echo "$1" | $EGREP "^$USERNAME_RE at .*\..*" >/dev/null
+	echo "$1" | $EGREP "^$USERNAME_RE at .+" >/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 at domain)
 check_sipaor() {
-	echo "$1" | $EGREP "^sip(s)?:$USERNAME_RE at .*\..*" >/dev/null
+	echo "$1" | $EGREP "^sip(s)?:$USERNAME_RE at .+" >/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




More information about the sr-dev mailing list