Skip to content

Commit

Permalink
kamctl: relaxed regex check on aor and sip uri
Browse files Browse the repository at this point in the history
- it required a dot (.), not valid for ipv6 and single word domains
(e.g., localhost)
- now just match on USERNAME_RE@.+

(cherry picked from commit 94e9d47)
(cherry picked from commit a77c4a9)
  • Loading branch information
miconda committed Sep 24, 2019
1 parent edd1ff5 commit 7025cfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/kamctl/kamctl.base
Expand Up @@ -633,7 +633,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" > /dev/stderr
exit 1
Expand All @@ -642,7 +642,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
Expand All @@ -652,7 +652,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" > /dev/stderr
exit 1
Expand All @@ -663,7 +663,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" > /dev/stderr
exit 1
Expand Down

0 comments on commit 7025cfa

Please sign in to comment.