]> andersk Git - openssh.git/blobdiff - sftp.c
- stevesk@cvs.openbsd.org 2006/07/26 13:57:17
[openssh.git] / sftp.c
diff --git a/sftp.c b/sftp.c
index f5589f2b9c4a50b2c41454639b04999a8b7c307e..ca91bc50b7afaa85f8d243e737266105941772c1 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: sftp.c,v 1.89 2006/07/26 13:57:17 stevesk Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sftp.c,v 1.75 2006/02/20 17:19:54 stevesk Exp $");
 
 #include <sys/types.h>
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
 #include <sys/ioctl.h>
+#include <sys/param.h>
+#include <sys/socket.h>
 #include <sys/wait.h>
 
+#include <errno.h>
+
 #ifdef HAVE_PATHS_H
 # include <paths.h>
 #endif
@@ -32,8 +36,11 @@ RCSID("$OpenBSD: sftp.c,v 1.75 2006/02/20 17:19:54 stevesk Exp $");
 #else
 typedef void EditLine;
 #endif
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
-#include "buffer.h"
 #include "xmalloc.h"
 #include "log.h"
 #include "pathnames.h"
@@ -244,7 +251,7 @@ local_do_shell(const char *args)
                if (errno != EINTR)
                        fatal("Couldn't wait for child: %s", strerror(errno));
        if (!WIFEXITED(status))
-               error("Shell exited abormally");
+               error("Shell exited abnormally");
        else if (WEXITSTATUS(status))
                error("Shell exited with status %d", WEXITSTATUS(status));
 }
@@ -547,6 +554,7 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
 
                if (g.gl_matchc == 1 && dst) {
                        /* If directory specified, append filename */
+                       xfree(tmp);
                        if (is_dir(dst)) {
                                if (infer_path(g.gl_pathv[0], &tmp)) {
                                        err = 1;
@@ -571,8 +579,6 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
 
 out:
        xfree(abs_src);
-       if (abs_dst)
-               xfree(abs_dst);
        globfree(&g);
        return(err);
 }
@@ -1289,6 +1295,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2)
                        if (parse_dispatch_command(conn, cmd, &pwd, 1) != 0) {
                                xfree(dir);
                                xfree(pwd);
+                               xfree(conn);
                                return (-1);
                        }
                } else {
@@ -1301,6 +1308,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2)
                        err = parse_dispatch_command(conn, cmd, &pwd, 1);
                        xfree(dir);
                        xfree(pwd);
+                       xfree(conn);
                        return (err);
                }
                xfree(dir);
@@ -1365,6 +1373,7 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2)
                        break;
        }
        xfree(pwd);
+       xfree(conn);
 
 #ifdef USE_LIBEDIT
        if (el != NULL)
@@ -1464,7 +1473,7 @@ main(int argc, char **argv)
        __progname = ssh_get_progname(argv[0]);
        memset(&args, '\0', sizeof(args));
        args.list = NULL;
-       addargs(&args, ssh_program);
+       addargs(&args, "%s", ssh_program);
        addargs(&args, "-oForwardX11 no");
        addargs(&args, "-oForwardAgent no");
        addargs(&args, "-oPermitLocalCommand no");
This page took 0.347544 seconds and 4 git commands to generate.