diff options
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | RCSID("$OpenBSD: sftp.c,v 1.8 2001/02/28 05:36:28 deraadt Exp $"); | 27 | RCSID("$OpenBSD: sftp.c,v 1.9 2001/03/03 23:52:22 markus Exp $"); |
28 | 28 | ||
29 | /* XXX: commandline mode */ | 29 | /* XXX: commandline mode */ |
30 | /* XXX: copy between two remote hosts (commandline) */ | 30 | /* XXX: copy between two remote hosts (commandline) */ |
@@ -91,24 +91,14 @@ make_ssh_args(char *add_arg) | |||
91 | static char **args = NULL; | 91 | static char **args = NULL; |
92 | static int nargs = 0; | 92 | static int nargs = 0; |
93 | char debug_buf[4096]; | 93 | char debug_buf[4096]; |
94 | int i, use_subsystem = 1; | 94 | int i; |
95 | |||
96 | /* no subsystem if protocol 1 or the server-spec contains a '/' */ | ||
97 | if (use_ssh1 || | ||
98 | (sftp_server != NULL && strchr(sftp_server, '/') != NULL)) | ||
99 | use_subsystem = 0; | ||
100 | 95 | ||
101 | /* Init args array */ | 96 | /* Init args array */ |
102 | if (args == NULL) { | 97 | if (args == NULL) { |
103 | nargs = use_subsystem ? 6 : 5; | 98 | nargs = 2; |
104 | i = 0; | 99 | i = 0; |
105 | args = xmalloc(sizeof(*args) * nargs); | 100 | args = xmalloc(sizeof(*args) * nargs); |
106 | args[i++] = "ssh"; | 101 | args[i++] = "ssh"; |
107 | args[i++] = use_ssh1 ? "-oProtocol=1" : "-oProtocol=2"; | ||
108 | if (use_subsystem) | ||
109 | args[i++] = "-s"; | ||
110 | args[i++] = "-oForwardAgent=no"; | ||
111 | args[i++] = "-oForwardX11=no"; | ||
112 | args[i++] = NULL; | 102 | args[i++] = NULL; |
113 | } | 103 | } |
114 | 104 | ||
@@ -121,6 +111,13 @@ make_ssh_args(char *add_arg) | |||
121 | return(NULL); | 111 | return(NULL); |
122 | } | 112 | } |
123 | 113 | ||
114 | /* no subsystem if the server-spec contains a '/' */ | ||
115 | if (sftp_server == NULL || strchr(sftp_server, '/') == NULL) | ||
116 | make_ssh_args("-s"); | ||
117 | make_ssh_args("-oForwardX11=no"); | ||
118 | make_ssh_args("-oForwardAgent=no"); | ||
119 | make_ssh_args(use_ssh1 ? "-oProtocol=1" : "-oProtocol=2"); | ||
120 | |||
124 | /* Otherwise finish up and return the arg array */ | 121 | /* Otherwise finish up and return the arg array */ |
125 | if (sftp_server != NULL) | 122 | if (sftp_server != NULL) |
126 | make_ssh_args(sftp_server); | 123 | make_ssh_args(sftp_server); |