[asterisk-commits] eliel: branch eliel/cli-permissions r159772 - in /team/eliel/cli-permissions:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 28 12:45:34 CST 2008


Author: eliel
Date: Fri Nov 28 12:45:34 2008
New Revision: 159772

URL: http://svn.digium.com/view/asterisk?view=rev&rev=159772
Log:
- Make regular expression matching case INsensitive.
- Explain that we can use regular expressions in the cli_permissions.conf.sample file with two
  examples.

Modified:
    team/eliel/cli-permissions/configs/cli_permissions.conf.sample
    team/eliel/cli-permissions/main/cli.c

Modified: team/eliel/cli-permissions/configs/cli_permissions.conf.sample
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/configs/cli_permissions.conf.sample?view=diff&rev=159772&r1=159771&r2=159772
==============================================================================
--- team/eliel/cli-permissions/configs/cli_permissions.conf.sample (original)
+++ team/eliel/cli-permissions/configs/cli_permissions.conf.sample Fri Nov 28 12:45:34 2008
@@ -35,6 +35,14 @@
 ;          core set verbose
 ; If the user is not specified, the default_perm option will be apply to
 ; every command.
+;
+; Notice that you can also use regular expressions to allow or deny access to a
+; certain command like: 'core show application D*'. In this example the user will be
+; allowed to view the documentation for all the applications starting with 'D'.
+; Another regular expression could be: 'channel originate SIP/[0-9]* extension *'
+; allowing the user to use 'channel originate' on a sip channel and with the 'extension'
+; parameter and avoiding the use of the 'application' parameter.
+;
 ; We can also use the templates syntax:
 ; [supportTemplate](!)
 ; deny=all

Modified: team/eliel/cli-permissions/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/main/cli.c?view=diff&rev=159772&r1=159771&r2=159772
==============================================================================
--- team/eliel/cli-permissions/main/cli.c (original)
+++ team/eliel/cli-permissions/main/cli.c Fri Nov 28 12:45:34 2008
@@ -188,7 +188,7 @@
 		AST_LIST_TRAVERSE(user_perm->perms, perm, list) {
 			if (strcasecmp(perm->command, "all") && strncasecmp(perm->command, command, strlen(perm->command))) {
 				/* if the perm->command is a pattern, check it against command. */
-				ispattern = !regcomp(&regexbuf, perm->command, REG_EXTENDED | REG_NOSUB);
+				ispattern = !regcomp(&regexbuf, perm->command, REG_EXTENDED | REG_NOSUB | REG_ICASE);
 				if (ispattern && regexec(&regexbuf, command, 0, NULL, 0)) {
 					regfree(&regexbuf);
 					continue;




More information about the asterisk-commits mailing list