[sr-dev] git:master:28f107d0: kamctl: use VERIFY_USER variable to control if user check is done

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 14 14:56:39 CET 2017


Module: kamailio
Branch: master
Commit: 28f107d0eb48c59f0b89dbd9fc0fa24c599ed5f9
URL: https://github.com/kamailio/kamailio/commit/28f107d0eb48c59f0b89dbd9fc0fa24c599ed5f9

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/28f107d0eb48c59f0b89dbd9fc0fa24c599ed5f9.diff
Patch: https://github.com/kamailio/kamailio/commit/28f107d0eb48c59f0b89dbd9fc0fa24c599ed5f9.patch

---

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
 




More information about the sr-dev mailing list