View | Details | Raw Unified | Return to bug 742 | Differences between
and this patch

Collapse All | Expand All

(-)sftp.c (+37 lines)
Lines 32-37 Link Here
32
#include "pathnames.h"
32
#include "pathnames.h"
33
#include "misc.h"
33
#include "misc.h"
34
34
35
/* XXX: This rats nest needs to be sorted out */
36
#define SSH_MAX_IDENTITY_FILES            100
37
#define SSH_MAX_FORWARDS_PER_DIRECTION    100
38
uid_t original_real_uid;
39
#include "readconf.h"
40
35
#include "sftp.h"
41
#include "sftp.h"
36
#include "sftp-common.h"
42
#include "sftp-common.h"
37
#include "sftp-client.h"
43
#include "sftp-client.h"
Lines 127-132 Link Here
127
	arglist args;
133
	arglist args;
128
	extern int optind;
134
	extern int optind;
129
	extern char *optarg;
135
	extern char *optarg;
136
	Options options;
137
	char *config;
130
138
131
	args.list = NULL;
139
	args.list = NULL;
132
	addargs(&args, "ssh");		/* overwritten with ssh_program */
140
	addargs(&args, "ssh");		/* overwritten with ssh_program */
Lines 149-154 Link Here
149
			debug_level++;
157
			debug_level++;
150
			break;
158
			break;
151
		case 'F':
159
		case 'F':
160
			config = optarg;
152
		case 'o':
161
		case 'o':
153
			addargs(&args, "-%c%s", ch, optarg);
162
			addargs(&args, "-%c%s", ch, optarg);
154
			break;
163
			break;
Lines 221-226 Link Here
221
		if (!*host) {
230
		if (!*host) {
222
			fprintf(stderr, "Missing hostname\n");
231
			fprintf(stderr, "Missing hostname\n");
223
			usage();
232
			usage();
233
		}
234
235
		/* We just want any 'Protocol' defined in configuration files */
236
		initialize_options(&options);
237
238
		if (config != NULL) {
239
			if (!read_config_file(config, host, &options))
240
			fatal("Can't open user config file %.100s: "
241
			    "%.100s", config, strerror(errno));
242
		} else  {
243
			char buf[256];
244
			struct passwd *pw;
245
			pw = getpwuid(getuid());
246
247
			snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir,
248
			    _PATH_SSH_USER_CONFFILE);
249
			(void)read_config_file(buf, host, &options);
250
			(void)read_config_file(_PATH_HOST_CONFIG_FILE, host, &options);
251
		}
252
253
		/* XXX: magic number 4 below is SSH_PROTO_2 */
254
		if (sshver == 2 && options.protocol !=  4) {
255
			sshver = 1;
256
257
			printf("Configuration override\n");
258
			if (sftp_server == NULL)
259
				sftp_server = _PATH_SFTP_SERVER;
260
224
		}
261
		}
225
262
226
		addargs(&args, "-oProtocol %d", sshver);
263
		addargs(&args, "-oProtocol %d", sshver);

Return to bug 742