Skip to content
Permalink
Browse files

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@.+
  • Loading branch information...
miconda committed Jul 9, 2019
1 parent 6a13f5f commit 94e9d47d2d2da82be23f1bae8cd6491c758a384c
Showing with 4 additions and 4 deletions.
  1. +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

0 comments on commit 94e9d47

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