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

Collapse All | Expand All

(-)a/readconf.c (-1 / +3 lines)
Lines 1958-1964 fill_default_options(Options * options) Link Here
1958
		options->protocol = SSH_PROTO_2;
1958
		options->protocol = SSH_PROTO_2;
1959
	if (options->add_keys_to_agent == -1)
1959
	if (options->add_keys_to_agent == -1)
1960
		options->add_keys_to_agent = 0;
1960
		options->add_keys_to_agent = 0;
1961
	if (options->num_identity_files == 0) {
1961
	if (options->num_identity_files == 0
1962
	    && options->num_certificate_files == 0 /* a cert is equivalent to an identity */
1963
	    && options->identities_only != 1) {    /* don't add implicit identity when explicit desired */
1962
		if (options->protocol & SSH_PROTO_1) {
1964
		if (options->protocol & SSH_PROTO_1) {
1963
			add_identity_file(options, "~/",
1965
			add_identity_file(options, "~/",
1964
			    _PATH_SSH_CLIENT_IDENTITY, 0);
1966
			    _PATH_SSH_CLIENT_IDENTITY, 0);
(-)a/ssh.c (+24 lines)
Lines 2046-2051 load_public_identity_files(void) Link Here
2046
	Key *identity_keys[SSH_MAX_IDENTITY_FILES];
2046
	Key *identity_keys[SSH_MAX_IDENTITY_FILES];
2047
	char *certificate_files[SSH_MAX_CERTIFICATE_FILES];
2047
	char *certificate_files[SSH_MAX_CERTIFICATE_FILES];
2048
	struct sshkey *certificates[SSH_MAX_CERTIFICATE_FILES];
2048
	struct sshkey *certificates[SSH_MAX_CERTIFICATE_FILES];
2049
	size_t filename_len;
2050
	struct stat sb;
2049
#ifdef ENABLE_PKCS11
2051
#ifdef ENABLE_PKCS11
2050
	Key **keys;
2052
	Key **keys;
2051
	int nkeys;
2053
	int nkeys;
Lines 2162-2167 load_public_identity_files(void) Link Here
2162
		certificate_files[n_certs] = filename;
2164
		certificate_files[n_certs] = filename;
2163
		certificates[n_certs] = public;
2165
		certificates[n_certs] = public;
2164
		++n_certs;
2166
		++n_certs;
2167
2168
		/*
2169
		 * If no keys have been explicitly listed then try
2170
		 * to add the default private key variant too.
2171
		 */
2172
		if (options.num_identity_files != 0)
2173
			continue;
2174
		if (n_ids >= SSH_MAX_IDENTITY_FILES)
2175
			continue;
2176
		filename_len = strlen(filename);
2177
		if (filename_len > 9 && strncmp("-cert.pub", filename + (filename_len - 9), 9) == 0) {
2178
			xasprintf(&cp, "%.*s", (int)(filename_len - 9), filename);
2179
			if (stat(cp, &sb) == 0) { /* file exists */
2180
				debug("identity file %s type %d", cp, -1);
2181
				identity_files[n_ids] = cp;
2182
				identity_keys[n_ids] = NULL; /* since it's a private key, we'll load lazily */
2183
				n_ids++;
2184
			} else {
2185
				free(cp);
2186
			}
2187
		}
2188
2165
	}
2189
	}
2166
2190
2167
	options.num_identity_files = n_ids;
2191
	options.num_identity_files = n_ids;

Return to bug 2617