aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-18 16:36:00 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-18 16:36:00 +0000
commit8d29652fe272b964854eb92a555becfd416a653e (patch)
tree811f62b272b6feb97b3b249e170bf7917ede8059 /main
parent86772bd6b3b804a64770324acad795de157f70dc (diff)
Delay the creation of temporary files until we have a valid manager command to handle.
Without this patch, asterisk creates a temporary file before determining if the specified command is valid. If invalid, we weren't properly cleaning up the file. (closes issue #15730) Reported by: zmehmood Patches: M15730.diff uploaded by junky (license 177) Tested by: zmehmood git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@212763 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/manager.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/manager.c b/main/manager.c
index a8bd1edbb..73a66f0bd 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1798,7 +1798,7 @@ static int action_command(struct mansession *s, const struct message *m)
const char *id = astman_get_header(m, "ActionID");
char *buf, *final_buf;
char template[] = "/tmp/ast-ami-XXXXXX"; /* template for temporary file */
- int fd = mkstemp(template);
+ int fd;
off_t l;
if (ast_strlen_zero(cmd)) {
@@ -1811,6 +1811,8 @@ static int action_command(struct mansession *s, const struct message *m)
return 0;
}
+ fd = mkstemp(template);
+
astman_append(s, "Response: Follows\r\nPrivilege: Command\r\n");
if (!ast_strlen_zero(id))
astman_append(s, "ActionID: %s\r\n", id);