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

Collapse All | Expand All

(-)openssh-5.8p1/pathnames.h (+2 lines)
Lines 65-72 Link Here
65
 * readable by anyone except the user him/herself, though this does not
65
 * readable by anyone except the user him/herself, though this does not
66
 * contain anything particularly secret.
66
 * contain anything particularly secret.
67
 */
67
 */
68
#define _PA_SSH_USER_HOSTFILE		  ".ssh/known_hosts"
68
#define _PATH_SSH_USER_HOSTFILE		"~/.ssh/known_hosts"
69
#define _PATH_SSH_USER_HOSTFILE		"~/.ssh/known_hosts"
69
/* backward compat for protocol 2 */
70
/* backward compat for protocol 2 */
71
#define _PA_SSH_USER_HOSTFILE2		  ".ssh/known_hosts2"
70
#define _PATH_SSH_USER_HOSTFILE2	"~/.ssh/known_hosts2"
72
#define _PATH_SSH_USER_HOSTFILE2	"~/.ssh/known_hosts2"
71
73
72
/*
74
/*
(-)openssh-5.8p1/readconf.c (-12 / +27 lines)
Lines 249-254 static struct { Link Here
249
	{ NULL, oBadOption }
249
	{ NULL, oBadOption }
250
};
250
};
251
251
252
/* optional path to be used instead of user's HOME directory
253
 * to search for the per-user configuration directory .ssh
254
*/
255
char *path_instead_pwdir = NULL;
256
252
/*
257
/*
253
 * Adds a local TCP/IP port forward to options.  Never returns if there is an
258
 * Adds a local TCP/IP port forward to options.  Never returns if there is an
254
 * error.
259
 * error.
Lines 1232-1263 fill_default_options(Options * options) Link Here
1232
	/* options->hostkeyalgorithms, default set in myproposals.h */
1237
	/* options->hostkeyalgorithms, default set in myproposals.h */
1233
	if (options->protocol == SSH_PROTO_UNKNOWN)
1238
	if (options->protocol == SSH_PROTO_UNKNOWN)
1234
		options->protocol = SSH_PROTO_2;
1239
		options->protocol = SSH_PROTO_2;
1240
	char *home = path_instead_pwdir;
1241
	if (NULL == home)  home = "~";
1235
	if (options->num_identity_files == 0) {
1242
	if (options->num_identity_files == 0) {
1236
		if (options->protocol & SSH_PROTO_1) {
1243
		if (options->protocol & SSH_PROTO_1) {
1237
			len = 2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1;
1244
			len = strlen(home) + 1 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1;
1238
			options->identity_files[options->num_identity_files] =
1245
			options->identity_files[options->num_identity_files] =
1239
			    xmalloc(len);
1246
			    xmalloc(len);
1240
			snprintf(options->identity_files[options->num_identity_files++],
1247
			snprintf(options->identity_files[options->num_identity_files++],
1241
			    len, "~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
1248
			    len, "%s/%.100s", home , _PATH_SSH_CLIENT_IDENTITY);
1242
		}
1249
		}
1243
		if (options->protocol & SSH_PROTO_2) {
1250
		if (options->protocol & SSH_PROTO_2) {
1244
			len = 2 + strlen(_PATH_SSH_CLIENT_ID_RSA) + 1;
1251
			len = strlen(home) + 1 + strlen(_PATH_SSH_CLIENT_ID_RSA) + 1;
1245
			options->identity_files[options->num_identity_files] =
1252
			options->identity_files[options->num_identity_files] =
1246
			    xmalloc(len);
1253
			    xmalloc(len);
1247
			snprintf(options->identity_files[options->num_identity_files++],
1254
			snprintf(options->identity_files[options->num_identity_files++],
1248
			    len, "~/%.100s", _PATH_SSH_CLIENT_ID_RSA);
1255
			    len, "%s/%.100s", home , _PATH_SSH_CLIENT_ID_RSA);
1249
1256
1250
			len = 2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1;
1257
			len = strlen(home) + 1 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1;
1251
			options->identity_files[options->num_identity_files] =
1258
			options->identity_files[options->num_identity_files] =
1252
			    xmalloc(len);
1259
			    xmalloc(len);
1253
			snprintf(options->identity_files[options->num_identity_files++],
1260
			snprintf(options->identity_files[options->num_identity_files++],
1254
			    len, "~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
1261
			    len, "%s/%.100s", home , _PATH_SSH_CLIENT_ID_DSA);
1255
#ifdef OPENSSL_HAS_ECC
1262
#ifdef OPENSSL_HAS_ECC
1256
			len = 2 + strlen(_PATH_SSH_CLIENT_ID_ECDSA) + 1;
1263
			len = strlen(home) + 1 + strlen(_PATH_SSH_CLIENT_ID_ECDSA) + 1;
1257
			options->identity_files[options->num_identity_files] =
1264
			options->identity_files[options->num_identity_files] =
1258
			    xmalloc(len);
1265
			    xmalloc(len);
1259
			snprintf(options->identity_files[options->num_identity_files++],
1266
			snprintf(options->identity_files[options->num_identity_files++],
1260
			    len, "~/%.100s", _PATH_SSH_CLIENT_ID_ECDSA);
1267
			    len, "%s/%.100s", home , _PATH_SSH_CLIENT_ID_ECDSA);
1261
#endif
1268
#endif
1262
		}
1269
		}
1263
	}
1270
	}
Lines 1265-1276 fill_default_options(Options * options) Link Here
1265
		options->escape_char = '~';
1272
		options->escape_char = '~';
1266
	if (options->system_hostfile == NULL)
1273
	if (options->system_hostfile == NULL)
1267
		options->system_hostfile = _PATH_SSH_SYSTEM_HOSTFILE;
1274
		options->system_hostfile = _PATH_SSH_SYSTEM_HOSTFILE;
1268
	if (options->user_hostfile == NULL)
1275
	if (options->user_hostfile == NULL) {
1269
		options->user_hostfile = _PATH_SSH_USER_HOSTFILE;
1276
	        len = strlen(home) + 1 + strlen(_PA_SSH_USER_HOSTFILE) + 1;
1277
		options->user_hostfile = xmalloc(len);
1278
		snprintf(options->user_hostfile,
1279
			 len, "%s/%.100s", home , _PA_SSH_USER_HOSTFILE);
1280
	}
1270
	if (options->system_hostfile2 == NULL)
1281
	if (options->system_hostfile2 == NULL)
1271
		options->system_hostfile2 = _PATH_SSH_SYSTEM_HOSTFILE2;
1282
		options->system_hostfile2 = _PATH_SSH_SYSTEM_HOSTFILE2;
1272
	if (options->user_hostfile2 == NULL)
1283
	if (options->user_hostfile2 == NULL) {
1273
		options->user_hostfile2 = _PATH_SSH_USER_HOSTFILE2;
1284
	        len = strlen(home) + 1 + strlen(_PA_SSH_USER_HOSTFILE2) + 1;
1285
		options->user_hostfile2 = xmalloc(len);
1286
		snprintf(options->user_hostfile2,
1287
			 len, "%s/%.100s", home , _PA_SSH_USER_HOSTFILE2);
1288
	}
1274
	if (options->log_level == SYSLOG_LEVEL_NOT_SET)
1289
	if (options->log_level == SYSLOG_LEVEL_NOT_SET)
1275
		options->log_level = SYSLOG_LEVEL_INFO;
1290
		options->log_level = SYSLOG_LEVEL_INFO;
1276
	if (options->clear_forwardings == 1)
1291
	if (options->clear_forwardings == 1)
(-)openssh-5.8p1/ssh.c (-2 / +20 lines)
Lines 157-162 Options options; Link Here
157
/* optional user configfile */
157
/* optional user configfile */
158
char *config = NULL;
158
char *config = NULL;
159
159
160
/* optional path to be used instead of user's HOME directory
161
 * to search for the per-user configuration directory .ssh
162
*/
163
extern char *path_instead_pwdir;
164
160
/*
165
/*
161
 * Name of the host we are connecting to.  This is the name given on the
166
 * Name of the host we are connecting to.  This is the name given on the
162
 * command line, or the HostName specified for the user-supplied name in a
167
 * command line, or the HostName specified for the user-supplied name in a
Lines 196-201 usage(void) Link Here
196
"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n"
201
"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n"
197
"           [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
202
"           [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
198
"           [-I pkcs11] [-i identity_file]\n"
203
"           [-I pkcs11] [-i identity_file]\n"
204
"           [-H path_to_per-user_configdir]\n"
199
"           [-L [bind_address:]port:host:hostport]\n"
205
"           [-L [bind_address:]port:host:hostport]\n"
200
"           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
206
"           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
201
"           [-R [bind_address:]port:host:hostport] [-S ctl_path]\n"
207
"           [-R [bind_address:]port:host:hostport] [-S ctl_path]\n"
Lines 296-302 main(int ac, char **av) Link Here
296
	argv0 = av[0];
302
	argv0 = av[0];
297
303
298
 again:
304
 again:
299
	while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
305
	while ((opt = getopt(ac, av, "1246ab:c:e:fgH:i:kl:m:no:p:qstvx"
300
	    "ACD:F:I:KL:MNO:PR:S:TVw:W:XYy")) != -1) {
306
	    "ACD:F:I:KL:MNO:PR:S:TVw:W:XYy")) != -1) {
301
		switch (opt) {
307
		switch (opt) {
302
		case '1':
308
		case '1':
Lines 568-578 main(int ac, char **av) Link Here
568
		case 'F':
574
		case 'F':
569
			config = optarg;
575
			config = optarg;
570
			break;
576
			break;
577
		case 'H':
578
			path_instead_pwdir = optarg;
579
			break;
571
		default:
580
		default:
572
			usage();
581
			usage();
573
		}
582
		}
574
	}
583
	}
575
584
585
	if (path_instead_pwdir) {
586
	  xfree(pw->pw_dir);
587
	  pw->pw_dir = xstrdup(path_instead_pwdir);
588
	}
589
576
	ac -= optind;
590
	ac -= optind;
577
	av += optind;
591
	av += optind;
578
592
Lines 1484-1490 load_public_identity_files(void) Link Here
1484
	if ((pw = getpwuid(original_real_uid)) == NULL)
1498
	if ((pw = getpwuid(original_real_uid)) == NULL)
1485
		fatal("load_public_identity_files: getpwuid failed");
1499
		fatal("load_public_identity_files: getpwuid failed");
1486
	pwname = xstrdup(pw->pw_name);
1500
	pwname = xstrdup(pw->pw_name);
1487
	pwdir = xstrdup(pw->pw_dir);
1501
	if (path_instead_pwdir) {
1502
	  pwdir = xstrdup(path_instead_pwdir);
1503
	} else {
1504
	  pwdir = xstrdup(pw->pw_dir);
1505
	}
1488
	if (gethostname(thishost, sizeof(thishost)) == -1)
1506
	if (gethostname(thishost, sizeof(thishost)) == -1)
1489
		fatal("load_public_identity_files: gethostname: %s",
1507
		fatal("load_public_identity_files: gethostname: %s",
1490
		    strerror(errno));
1508
		    strerror(errno));

Return to bug 1942