summaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-03-05 07:10:47 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-03-05 07:10:47 +0000
commit46d6e0909951021c3b16bf8ccf1778c01d370c4b (patch)
tree2cba96c7eeddbacac28cb41ee9aa9af3858c8a38 /sftp.c
parent1addabd4911aca21ebc3acb06e0673b7ba9fceb8 (diff)
- markus@cvs.openbsd.org 2001/03/03 23:52:22
[sftp.c] clean up arg processing. based on work by Christophe_Moret@hp.com
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/sftp.c b/sftp.c
index 16a2616a9..b2c4a649a 100644
--- a/sftp.c
+++ b/sftp.c
@@ -24,7 +24,7 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27RCSID("$OpenBSD: sftp.c,v 1.8 2001/02/28 05:36:28 deraadt Exp $"); 27RCSID("$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);