[asterisk-commits] kpfleming: branch 1.4 r90098 - in /branches/1.4: configs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 28 16:30:46 CST 2007


Author: kpfleming
Date: Wed Nov 28 16:30:46 2007
New Revision: 90098

URL: http://svn.digium.com/view/asterisk?view=rev&rev=90098
Log:
it is impossible to set permissions for manager accounts created by users.conf (reported internally, patched by me)

Modified:
    branches/1.4/configs/users.conf.sample
    branches/1.4/main/manager.c

Modified: branches/1.4/configs/users.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.4/configs/users.conf.sample?view=diff&rev=90098&r1=90097&r2=90098
==============================================================================
--- branches/1.4/configs/users.conf.sample (original)
+++ branches/1.4/configs/users.conf.sample Wed Nov 28 16:30:46 2007
@@ -46,6 +46,11 @@
 ;
 hasmanager = no
 ;
+; Set permissions for manager entry (see manager.conf.sample for documentation)
+; (defaults to *all* permissions)
+;managerread = system,call,log,verbose,command,agent,user,config
+;managerwrite = system,call,log,verbose,command,agent,user,config
+;
 ; Remaining options are not specific to users.conf entries but are general.
 ;
 callwaiting = yes

Modified: branches/1.4/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/manager.c?view=diff&rev=90098&r1=90097&r2=90098
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Wed Nov 28 16:30:46 2007
@@ -1054,6 +1054,9 @@
 		struct ast_variable *v;
 		const char *password = NULL;
 		int hasmanager = 0;
+		const char *readperms = NULL;
+		const char *writeperms = NULL;
+
 		if (strcasecmp(cat, user) || !strcasecmp(cat, "general")) {
 			cat = ast_category_browse(cfg, cat);
 			continue;
@@ -1063,6 +1066,10 @@
 				password = v->value;
 			else if (!strcasecmp(v->name, "hasmanager"))
 				hasmanager = ast_true(v->value);
+			else if (!strcasecmp(v->name, "managerread"))
+				readperms = v->value;
+			else if (!strcasecmp(v->name, "managerwrite"))
+				writeperms = v->value;
 		}
 		if (!hasmanager)
 			break;
@@ -1072,8 +1079,8 @@
 			return -1;
 		}
 		ast_copy_string(s->username, cat, sizeof(s->username));
-		s->readperm = -1;
-		s->writeperm = -1;
+		s->readperm = readperms ? get_perm(readperms) : -1;
+		s->writeperm = writeperms ? get_perm(writeperms) : -1;
 		ast_config_destroy(cfg);
 		if (events)
 			set_eventmask(s, events);




More information about the asterisk-commits mailing list