]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 212764 via svnmerge from
authorSean Bright <sean@malleable.com>
Tue, 18 Aug 2009 16:41:15 +0000 (16:41 +0000)
committerSean Bright <sean@malleable.com>
Tue, 18 Aug 2009 16:41:15 +0000 (16:41 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r212764 | seanbright | 2009-08-18 12:38:36 -0400 (Tue, 18 Aug 2009) | 18 lines

  Merged revisions 212763 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r212763 | seanbright | 2009-08-18 12:36:00 -0400 (Tue, 18 Aug 2009) | 11 lines

    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.6.1@212766 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index cfc50e45b60dcadc2b9a00b2035d034d9ee76a20..9b2a3973f68699e5e333e37e18069d258ef7e50b 100644 (file)
@@ -2236,7 +2236,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)) {
@@ -2249,6 +2249,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);