mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-03 01:34:42 +00:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@212763 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user