Module: kamailio
Branch: master
Commit: 28f107d0eb48c59f0b89dbd9fc0fa24c599ed5f9
URL:
https://github.com/kamailio/kamailio/commit/28f107d0eb48c59f0b89dbd9fc0fa24…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-12-14T14:55:27+01:00
kamctl: use VERIFY_USER variable to control if user check is done
- help automating some commands such as acl grant
---
Modified: utils/kamctl/kamctl
Modified: utils/kamctl/kamctl.base
Modified: utils/kamctl/kamctlrc
---
Diff:
https://github.com/kamailio/kamailio/commit/28f107d0eb48c59f0b89dbd9fc0fa24…
Patch:
https://github.com/kamailio/kamailio/commit/28f107d0eb48c59f0b89dbd9fc0fa24…
---
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 569ddd8f3b..f82f6f540a 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -311,14 +311,16 @@ acl() {
case $1 in
show)
if [ $# -eq 2 ] ; then
- is_user $2
- if [ $? -ne 0 ] ; then
- mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
- read answer
- if [ "$answer" = "y" -o "$answer" = "Y" ] ;
then
- minfo "Proceeding with non-local user"
- else
- exit 1
+ if [ $VERIFY_USER -eq 1 ] ; then
+ is_user $2
+ if [ $? -ne 0 ] ; then
+ mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
+ read answer
+ if [ "$answer" = "y" -o "$answer" = "Y" ] ;
then
+ minfo "Proceeding with non-local user"
+ else
+ exit 1
+ fi
fi
fi
set_user $2
@@ -338,14 +340,16 @@ acl() {
usage
exit 1
fi
- is_user $2
- if [ $? -ne 0 ] ; then
- mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
- read answer
- if [ "$answer" = "y" -o "$answer" = "Y" ] ;
then
- minfo "Proceeding with non-local user"
- else
- exit 1
+ if [ $VERIFY_USER -eq 1 ] ; then
+ is_user $2
+ if [ $? -ne 0 ] ; then
+ mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
+ read answer
+ if [ "$answer" = "y" -o "$answer" = "Y" ] ;
then
+ minfo "Proceeding with non-local user"
+ else
+ exit 1
+ fi
fi
fi
set_user $2
diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base
index 29ee2177d8..eb8ab554b7 100644
--- a/utils/kamctl/kamctl.base
+++ b/utils/kamctl/kamctl.base
@@ -136,6 +136,9 @@ fi
if [ -z "$ACL_GROUPS" ] ; then
ACL_GROUPS="local ld int voicemail free-pstn"
fi
+if [ -z "$VERIFY_USER" ] ; then
+ VERIFY_USER=1
+fi
##### ----------------------------------------------- #####
#### Defined values
diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
index 46fcdf5664..836290a5b8 100644
--- a/utils/kamctl/kamctlrc
+++ b/utils/kamctl/kamctlrc
@@ -142,6 +142,10 @@
## are accepted
# ACL_GROUPS="local ld int voicemail free-pstn"
+## check if user exists (used by some commands such as acl);
+## - default on (1); off (0)
+# VERIFY_USER=1
+
## verbose - debug purposes - default '0'
# VERBOSE=1