View | Details | Raw Unified | Return to bug 2413
Collapse All | Expand All

(-)a/ssh.c (-8 / +26 lines)
Lines 221-240 static void main_sigchld_handler(int); Link Here
221
void muxclient(const char *);
221
void muxclient(const char *);
222
void muxserver_listen(void);
222
void muxserver_listen(void);
223
223
224
/* ~/ expand a list of paths. NB. assumes path[n] is heap-allocated. */
224
/*
225
 * ~ expand hostfiles lists, checking for magic "none" option that causes
226
 * the list to be treated as empty.
227
 */
225
static void
228
static void
226
tilde_expand_paths(char **paths, u_int num_paths)
229
expand_hostfiles(char **paths, u_int *num_pathsp)
227
{
230
{
228
	u_int i;
231
	u_int i, has_none = 0;
229
	char *cp;
232
	char *cp;
230
233
231
	for (i = 0; i < num_paths; i++) {
234
	for (i = 0; i < *num_pathsp; i++) {
235
		if (strcasecmp(paths[i], "none") == 0) {
236
			has_none = 1;
237
			break;
238
		}
232
		cp = tilde_expand_filename(paths[i], original_real_uid);
239
		cp = tilde_expand_filename(paths[i], original_real_uid);
233
		free(paths[i]);
240
		free(paths[i]);
234
		paths[i] = cp;
241
		paths[i] = cp;
235
	}
242
	}
243
244
	if (has_none) {
245
		for (i = 0; i < *num_pathsp; i++) {
246
			free(paths[i]);
247
			paths[i] = NULL;
248
		}
249
		*num_pathsp = 0;
250
		return;
251
	}
236
}
252
}
237
253
254
238
/*
255
/*
239
 * Attempt to resolve a host name / port to a set of addresses and
256
 * Attempt to resolve a host name / port to a set of addresses and
240
 * optionally return any CNAMEs encountered along the way.
257
 * optionally return any CNAMEs encountered along the way.
Lines 1313-1322 main(int ac, char **av) Link Here
1313
	/* load options.identity_files */
1330
	/* load options.identity_files */
1314
	load_public_identity_files();
1331
	load_public_identity_files();
1315
1332
1316
	/* Expand ~ in known host file names. */
1333
	/* Expand ~ in known host file names and check for "none" */
1317
	tilde_expand_paths(options.system_hostfiles,
1334
	expand_hostfiles(options.system_hostfiles,
1318
	    options.num_system_hostfiles);
1335
	    &options.num_system_hostfiles);
1319
	tilde_expand_paths(options.user_hostfiles, options.num_user_hostfiles);
1336
	expand_hostfiles(options.user_hostfiles,
1337
	    &options.num_user_hostfiles);
1320
1338
1321
	signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */
1339
	signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */
1322
	signal(SIGCHLD, main_sigchld_handler);
1340
	signal(SIGCHLD, main_sigchld_handler);
(-)a/sshconnect.c (-2 / +8 lines)
Lines 904-910 check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, Link Here
904
		if (want_cert && !check_host_cert(hostname, host_key))
904
		if (want_cert && !check_host_cert(hostname, host_key))
905
			goto fail;
905
			goto fail;
906
		if (options.check_host_ip && ip_status == HOST_NEW) {
906
		if (options.check_host_ip && ip_status == HOST_NEW) {
907
			if (readonly || want_cert)
907
			if (readonly || want_cert || num_user_hostfiles == 0)
908
				logit("%s host key for IP address "
908
				logit("%s host key for IP address "
909
				    "'%.128s' not in list of known hosts.",
909
				    "'%.128s' not in list of known hosts.",
910
				    type, ip);
910
				    type, ip);
Lines 1004-1009 check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, Link Here
1004
		if (options.check_host_ip && ip_status == HOST_NEW) {
1004
		if (options.check_host_ip && ip_status == HOST_NEW) {
1005
			snprintf(hostline, sizeof(hostline), "%s,%s", host, ip);
1005
			snprintf(hostline, sizeof(hostline), "%s,%s", host, ip);
1006
			hostp = hostline;
1006
			hostp = hostline;
1007
			if (num_user_hostfiles == 0)
1008
				break;
1007
			if (options.hash_known_hosts) {
1009
			if (options.hash_known_hosts) {
1008
				/* Add hash of host and IP separately */
1010
				/* Add hash of host and IP separately */
1009
				r = add_host_to_hostfile(user_hostfiles[0],
1011
				r = add_host_to_hostfile(user_hostfiles[0],
Lines 1017-1025 check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, Link Here
1017
				    options.hash_known_hosts);
1019
				    options.hash_known_hosts);
1018
			}
1020
			}
1019
		} else {
1021
		} else {
1022
			hostp = host;
1023
			if (num_user_hostfiles == 0)
1024
				break;
1020
			r = add_host_to_hostfile(user_hostfiles[0], host,
1025
			r = add_host_to_hostfile(user_hostfiles[0], host,
1021
			    host_key, options.hash_known_hosts);
1026
			    host_key, options.hash_known_hosts);
1022
			hostp = host;
1023
		}
1027
		}
1024
1028
1025
		if (!r)
1029
		if (!r)
Lines 1084-1089 check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, Link Here
1084
		}
1088
		}
1085
		/* The host key has changed. */
1089
		/* The host key has changed. */
1086
		warn_changed_key(host_key);
1090
		warn_changed_key(host_key);
1091
		if (num_user_hostfiles == 0)
1092
			goto fail;
1087
		error("Add correct host key in %.100s to get rid of this message.",
1093
		error("Add correct host key in %.100s to get rid of this message.",
1088
		    user_hostfiles[0]);
1094
		    user_hostfiles[0]);
1089
		error("Offending %s key in %s:%lu", key_type(host_found->key),
1095
		error("Offending %s key in %s:%lu", key_type(host_found->key),

Return to bug 2413