diff options
author | djm@openbsd.org <djm@openbsd.org> | 2022-06-27 23:41:55 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2022-06-27 23:43:15 +0200 |
commit | 2a822f29300b2de7335fbff65f0b187a0c582304 (patch) | |
tree | df888d693970828ec8b65ce205eee8679728ea3a /sftp.c | |
parent | upstream: Roll back previous KEX changes as they aren't safe until (diff) | |
download | openssh-2a822f29300b2de7335fbff65f0b187a0c582304.tar.xz openssh-2a822f29300b2de7335fbff65f0b187a0c582304.zip |
upstream: allow arguments to sftp -D option, e.g. sftp -D
"/usr/libexec/sftp-server -el debug3"
ok markus@
OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.216 2022/05/13 06:31:50 djm Exp $ */ +/* $OpenBSD: sftp.c,v 1.217 2022/06/27 21:41:55 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -2387,8 +2387,8 @@ usage(void) int main(int argc, char **argv) { - int in, out, ch, err, tmp, port = -1, noisy = 0; - char *host = NULL, *user, *cp, *file2 = NULL; + int r, in, out, ch, err, tmp, port = -1, noisy = 0; + char *host = NULL, *user, *cp, **cpp, *file2 = NULL; int debug_level = 0; char *file1 = NULL, *sftp_server = NULL; char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL; @@ -2586,10 +2586,12 @@ main(int argc, char **argv) connect_to_server(ssh_program, args.list, &in, &out); } else { - args.list = NULL; - addargs(&args, "sftp-server"); - - connect_to_server(sftp_direct, args.list, &in, &out); + if ((r = argv_split(sftp_direct, &tmp, &cpp, 1)) != 0) + fatal_r(r, "Parse -D arguments"); + if (cpp[0] == 0) + fatal("No sftp server specified via -D"); + connect_to_server(cpp[0], cpp, &in, &out); + argv_free(cpp, tmp); } freeargs(&args); |