Module: kamailio Branch: master Commit: 94e9d47d2d2da82be23f1bae8cd6491c758a384c URL: https://github.com/kamailio/kamailio/commit/94e9d47d2d2da82be23f1bae8cd6491c...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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@.+
---
Modified: utils/kamctl/kamctl.base
---
Diff: https://github.com/kamailio/kamailio/commit/94e9d47d2d2da82be23f1bae8cd6491c... Patch: https://github.com/kamailio/kamailio/commit/94e9d47d2d2da82be23f1bae8cd6491c...
---
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@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