=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sftp.c,v retrieving revision 1.75 retrieving revision 1.75.2.1 diff -u -r1.75 -r1.75.2.1 --- src/usr.bin/ssh/sftp.c 2006/02/20 17:19:54 1.75 +++ src/usr.bin/ssh/sftp.c 2006/09/30 04:06:51 1.75.2.1 @@ -1,3 +1,4 @@ +/* $OpenBSD: sftp.c,v 1.75.2.1 2006/09/30 04:06:51 brad Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -14,26 +15,31 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "includes.h" -RCSID("$OpenBSD: sftp.c,v 1.75 2006/02/20 17:19:54 stevesk Exp $"); - -#include #include +#include #include #include +#include +#include +#include #include #include #include #include +#include +#include +#include +#include +#include -#include "buffer.h" #include "xmalloc.h" #include "log.h" #include "pathnames.h" #include "misc.h" #include "sftp.h" +#include "buffer.h" #include "sftp-common.h" #include "sftp-client.h" @@ -236,7 +242,7 @@ 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)); } @@ -539,6 +545,7 @@ 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; @@ -563,8 +570,6 @@ out: xfree(abs_src); - if (abs_dst) - xfree(abs_dst); globfree(&g); return(err); } @@ -1277,6 +1282,7 @@ if (parse_dispatch_command(conn, cmd, &pwd, 1) != 0) { xfree(dir); xfree(pwd); + xfree(conn); return (-1); } } else { @@ -1289,6 +1295,7 @@ err = parse_dispatch_command(conn, cmd, &pwd, 1); xfree(dir); xfree(pwd); + xfree(conn); return (err); } xfree(dir); @@ -1345,6 +1352,7 @@ break; } xfree(pwd); + xfree(conn); if (el != NULL) el_end(el); @@ -1358,23 +1366,12 @@ { int c_in, c_out; -#ifdef USE_PIPES - int pin[2], pout[2]; - - if ((pipe(pin) == -1) || (pipe(pout) == -1)) - fatal("pipe: %s", strerror(errno)); - *in = pin[0]; - *out = pout[1]; - c_in = pout[0]; - c_out = pin[1]; -#else /* USE_PIPES */ int inout[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, inout) == -1) fatal("socketpair: %s", strerror(errno)); *in = *out = inout[0]; c_in = c_out = inout[1]; -#endif /* USE_PIPES */ if ((sshpid = fork()) == -1) fatal("fork: %s", strerror(errno)); @@ -1441,7 +1438,7 @@ 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");