[asterisk-commits] twilson: branch eliel/cli-permissions r159194 - in /team/eliel/cli-permission...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 25 12:02:08 CST 2008


Author: twilson
Date: Tue Nov 25 12:02:07 2008
New Revision: 159194

URL: http://svn.digium.com/view/asterisk?view=rev&rev=159194
Log:
Make ast_cli_command()/ast_cli_command_multiple() a macro for ast_cli_command_full()/ast_cli_command_multiple_full() to avoid an API change.

Modified:
    team/eliel/cli-permissions/apps/app_rpt.c
    team/eliel/cli-permissions/channels/console_gui.c
    team/eliel/cli-permissions/include/asterisk/cli.h
    team/eliel/cli-permissions/main/asterisk.c
    team/eliel/cli-permissions/main/cli.c
    team/eliel/cli-permissions/main/config.c
    team/eliel/cli-permissions/main/manager.c
    team/eliel/cli-permissions/pbx/pbx_gtkconsole.c
    team/eliel/cli-permissions/res/res_clialiases.c

Modified: team/eliel/cli-permissions/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/apps/app_rpt.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/apps/app_rpt.c (original)
+++ team/eliel/cli-permissions/apps/app_rpt.c Tue Nov 25 12:02:07 2008
@@ -14019,8 +14019,8 @@
 					MONITOR_DISK_BLOCKS_PER_MINUTE) / 60;
 			}
 			if (blocksleft >= myrpt->p.monminblocks)
-				ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, nullfd,mycmd);
-		} else ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, nullfd,mycmd);
+				ast_cli_command(nullfd,mycmd);
+		} else ast_cli_command(nullfd,mycmd);
 		/* look at callerid to see what node this comes from */
 		if (!chan->cid.cid_num) /* if doesn't have caller id */
 		{
@@ -14545,7 +14545,7 @@
 	/* wait for telem to be done */
 	while(myrpt->tele.next != &myrpt->tele) usleep(100000);
 	sprintf(tmp,"mixmonitor stop %s",chan->name);
-	ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, nullfd,tmp);
+	ast_cli_command(nullfd,tmp);
 	close(nullfd);
 	rpt_mutex_lock(&myrpt->lock);
 	myrpt->hfscanmode = 0;

Modified: team/eliel/cli-permissions/channels/console_gui.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/channels/console_gui.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/channels/console_gui.c (original)
+++ team/eliel/cli-permissions/channels/console_gui.c Tue Nov 25 12:02:07 2008
@@ -396,7 +396,7 @@
 		break;
 
 	case KEY_MUTE: /* send or do not send audio */
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, env->gui->outfd, "console mute toggle");
+		ast_cli_command(env->gui->outfd, "console mute toggle");
 		break;
 
 	case KEY_FREEZE: /* freeze/unfreeze the incoming frames */
@@ -432,7 +432,7 @@
 	ast_log(LOG_WARNING, "keypad_pick_up called\n");
 
 	if (env->owner) { /* someone is calling us, just answer */
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, gui->outfd, "console answer");
+		ast_cli_command(gui->outfd, "console answer");
 	} else { /* we have someone to call */
 		char buf[160];
 		const char *who = ast_skip_blanks(read_message(gui->bd_msg));
@@ -442,7 +442,7 @@
 		print_message(gui->bd_dialed, "\n");
 		print_message(gui->bd_dialed, who);
 		reset_board(gui->bd_msg);
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, gui->outfd, buf);
+		ast_cli_command(gui->outfd, buf);
 	}
 }
 
@@ -737,7 +737,7 @@
 		keypad_pick_up(env);
 		break;
 	case KEY_HANG_UP:
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, gui->outfd, "console hangup");
+		ast_cli_command(gui->outfd, "console hangup");
 		break;
 
 	/* other functions */
@@ -977,7 +977,7 @@
 #if 0 /* do not react, we don't want to die because the window is minimized */
 				if (ev[i].active.gain == 0 && ev[i].active.state & SDL_APPACTIVE) {
 					ast_log(LOG_WARNING, "/* somebody has killed us ? */");
-					ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, gui->outfd, "stop now");
+					ast_cli_command(gui->outfd, "stop now");
 				}
 #endif
 				break;

Modified: team/eliel/cli-permissions/include/asterisk/cli.h
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/include/asterisk/cli.h?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/include/asterisk/cli.h (original)
+++ team/eliel/cli-permissions/include/asterisk/cli.h Tue Nov 25 12:02:07 2008
@@ -204,7 +204,9 @@
  * \retval 0 on success
  * \retval -1 on failure
  */
-int ast_cli_command(int uid, int gid, int fd, const char *s);
+int ast_cli_command_full(int uid, int gid, int fd, const char *s);
+
+#define ast_cli_command(fd,s) ast_cli_command_full(CLI_NO_PERMS, CLI_NO_PERMS, fd, s) 
 
 /*! 
  * \brief Executes multiple CLI commands
@@ -217,7 +219,9 @@
  * \param s incoming string
  * \retval number of commands executed
  */
-int ast_cli_command_multiple(int uid, int gid, int fd, size_t size, const char *s);
+int ast_cli_command_multiple_full(int uid, int gid, int fd, size_t size, const char *s);
+
+#define ast_cli_command_multiple(fd,size,s) ast_cli_command_multiple_full(CLI_NO_PERMS, CLI_NO_PERMS, fd, size, s)
 
 /*! \brief Registers a command or an array of commands
  * \param e which cli entry to register.

Modified: team/eliel/cli-permissions/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/main/asterisk.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/main/asterisk.c (original)
+++ team/eliel/cli-permissions/main/asterisk.c Tue Nov 25 12:02:07 2008
@@ -1074,10 +1074,10 @@
 			}
 			tmp[res] = 0;
 			if (strncmp(tmp, "cli quit after ", 15) == 0) {
-				ast_cli_command_multiple(con->uid, con->gid, con->fd, res - 15, tmp + 15);
+				ast_cli_command_multiple_full(con->uid, con->gid, con->fd, res - 15, tmp + 15);
 				break;
 			}
-			ast_cli_command_multiple(con->uid, con->gid, con->fd, res, tmp);
+			ast_cli_command_multiple_full(con->uid, con->gid, con->fd, res, tmp);
 		}
 		if (fds[1].revents) {
 			res = read_credentials(con->p[0], tmp, sizeof(tmp), con);
@@ -1577,7 +1577,7 @@
 		else
 			ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
 	} else 
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, STDOUT_FILENO, s);
+		ast_cli_command(STDOUT_FILENO, s);
 }
 
 static int remoteconsolehandler(char *s)
@@ -2898,7 +2898,7 @@
 
 	for (v = ast_variable_browse(cfg, "startup_commands"); v; v = v->next) {
 		if (ast_true(v->value))
-			ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, fd, v->name);
+			ast_cli_command(fd, v->name);
 	}
 
 	close(fd);

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=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/main/cli.c (original)
+++ team/eliel/cli-permissions/main/cli.c Tue Nov 25 12:02:07 2008
@@ -2180,7 +2180,7 @@
 	return __ast_cli_generator(text, word, state, 1);
 }
 
-int ast_cli_command(int uid, int gid, int fd, const char *s)
+int ast_cli_command_full(int uid, int gid, int fd, const char *s)
 {
 	char *args[AST_MAX_ARGS + 1];
 	struct ast_cli_entry *e;
@@ -2235,7 +2235,7 @@
 	return 0;
 }
 
-int ast_cli_command_multiple(int uid, int gid, int fd, size_t size, const char *s)
+int ast_cli_command_multiple_full(int uid, int gid, int fd, size_t size, const char *s)
 {
 	char cmd[512];
 	int x, y = 0, count = 0;
@@ -2244,7 +2244,7 @@
 		cmd[y] = s[x];
 		y++;
 		if (s[x] == '\0') {
-			ast_cli_command(uid, gid, fd, cmd);
+			ast_cli_command_full(uid, gid, fd, cmd);
 			y = 0;
 			count++;
 		}

Modified: team/eliel/cli-permissions/main/config.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/main/config.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/main/config.c (original)
+++ team/eliel/cli-permissions/main/config.c Tue Nov 25 12:02:07 2008
@@ -2496,7 +2496,7 @@
 		if (!strcmp(cfmtime->filename, a->argv[2])) {
 			char *buf = alloca(strlen("module reload ") + strlen(cfmtime->who_asked) + 1);
 			sprintf(buf, "module reload %s", cfmtime->who_asked);
-			ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, a->fd, buf);
+			ast_cli_command(a->fd, buf);
 		}
 	}
 	AST_LIST_UNLOCK(&cfmtime_head);

Modified: team/eliel/cli-permissions/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/main/manager.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/main/manager.c (original)
+++ team/eliel/cli-permissions/main/manager.c Tue Nov 25 12:02:07 2008
@@ -2212,7 +2212,7 @@
 	if (!ast_strlen_zero(id))
 		astman_append(s, "ActionID: %s\r\n", id);
 	/* FIXME: Wedge a ActionID response in here, waiting for later changes */
-	ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, fd, cmd);	/* XXX need to change this to use a FILE * */
+	ast_cli_command(fd, cmd);	/* XXX need to change this to use a FILE * */
 	l = lseek(fd, 0, SEEK_END);	/* how many chars available */
 
 	/* This has a potential to overflow the stack.  Hence, use the heap. */

Modified: team/eliel/cli-permissions/pbx/pbx_gtkconsole.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/pbx/pbx_gtkconsole.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/pbx/pbx_gtkconsole.c (original)
+++ team/eliel/cli-permissions/pbx/pbx_gtkconsole.c Tue Nov 25 12:02:07 2008
@@ -323,7 +323,7 @@
 {
 #if 0
 	/* Clever... */
-	ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, clipipe[1], "quit");
+	ast_cli_command(clipipe[1], "quit");
 #else
 	kill(getpid(), SIGTERM);
 #endif
@@ -350,7 +350,7 @@
 	strncpy(buf, gtk_entry_get_text(GTK_ENTRY(cli)), sizeof(buf) - 1);
 	gtk_entry_set_text(GTK_ENTRY(cli), "");
 	if (strlen(buf)) {
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, clipipe[1], buf);
+		ast_cli_command(clipipe[1], buf);
 	}
 	return TRUE;
 }

Modified: team/eliel/cli-permissions/res/res_clialiases.c
URL: http://svn.digium.com/view/asterisk/team/eliel/cli-permissions/res/res_clialiases.c?view=diff&rev=159194&r1=159193&r2=159194
==============================================================================
--- team/eliel/cli-permissions/res/res_clialiases.c (original)
+++ team/eliel/cli-permissions/res/res_clialiases.c Tue Nov 25 12:02:07 2008
@@ -122,9 +122,9 @@
 			ast_str_append(&real_cmd, 0, " %s", a->argv[i - 1]);
 		}
 
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, a->fd, real_cmd->str);
+		ast_cli_command(a->fd, real_cmd->str);
 	} else {
-		ast_cli_command(CLI_NO_PERMS, CLI_NO_PERMS, a->fd, alias->real_cmd);
+		ast_cli_command(a->fd, alias->real_cmd);
 	}
 
 	ao2_ref(alias, -1);




More information about the asterisk-commits mailing list