summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog5
-rw-r--r--sftp.c23
2 files changed, 14 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index a0bb45a5b..1eab73d8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -137,6 +137,9 @@
137 - deraadt@cvs.openbsd.org 2001/03/03 22:07:50 137 - deraadt@cvs.openbsd.org 2001/03/03 22:07:50
138 [sftp-server.c] 138 [sftp-server.c]
139 KNF 139 KNF
140 - markus@cvs.openbsd.org 2001/03/03 23:52:22
141 [sftp.c]
142 clean up arg processing. based on work by Christophe_Moret@hp.com
140 143
14120010304 14420010304
142 - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid. 145 - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
@@ -4329,4 +4332,4 @@
4329 - Wrote replacements for strlcpy and mkdtemp 4332 - Wrote replacements for strlcpy and mkdtemp
4330 - Released 1.0pre1 4333 - Released 1.0pre1
4331 4334
4332$Id: ChangeLog,v 1.893 2001/03/05 07:09:11 mouring Exp $ 4335$Id: ChangeLog,v 1.894 2001/03/05 07:10:47 mouring Exp $
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);