[svn-commits] russell: branch 1.4 r62739 - /branches/1.4/main/manager.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed May 2 13:55:01 MST 2007


Author: russell
Date: Wed May  2 15:55:00 2007
New Revision: 62739

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62739
Log:
Backport the change that only went in to trunk that fixes the command manager
action over http.  (reported internally by pari and bkruse)

Modified:
    branches/1.4/main/manager.c

Modified: branches/1.4/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/manager.c?view=diff&rev=62739&r1=62738&r2=62739
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Wed May  2 15:55:00 2007
@@ -1612,11 +1612,24 @@
 {
 	const char *cmd = astman_get_header(m, "Command");
 	const char *id = astman_get_header(m, "ActionID");
+	char *buf;
+	char template[] = "/tmp/ast-ami-XXXXXX";	/* template for temporary file */
+	int fd = mkstemp(template);
+	off_t l;
+
 	astman_append(s, "Response: Follows\r\nPrivilege: Command\r\n");
 	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(s->fd, cmd);
+	ast_cli_command(fd, cmd);	/* XXX need to change this to use a FILE * */
+	l = lseek(fd, 0, SEEK_END);	/* how many chars available */
+	buf = alloca(l+1);
+	lseek(fd, 0, SEEK_SET);
+	read(fd, buf, l);
+	buf[l] = '\0';
+	close(fd);
+	unlink(template);
+	astman_append(s, buf);
 	astman_append(s, "--END COMMAND--\r\n\r\n");
 	return 0;
 }



More information about the svn-commits mailing list