vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jakub Jelen c98f55
diff --git a/readconf.c b/readconf.c
Jakub Jelen c98f55
index 374e741..23d74fb 100644
Jakub Jelen c98f55
--- a/readconf.c
Jakub Jelen c98f55
+++ b/readconf.c
Jakub Jelen c98f55
@@ -2229,6 +2229,10 @@ dump_client_config(Options *o, const char *host)
Jakub Jelen c98f55
 	int i;
Jakub Jelen c98f55
 	char vbuf[5];
Jakub Jelen c98f55
 
Jakub Jelen c98f55
+	/* This is normally prepared in ssh_kex2 */
Jakub Jelen c98f55
+	if (kex_assemble_names(KEX_DEFAULT_PK_ALG, &o->hostkeyalgorithms) != 0)
Jakub Jelen c98f55
+		fatal("%s: kex_assemble_names failed", __func__);
Jakub Jelen c98f55
+
Jakub Jelen c98f55
 	/* Most interesting options first: user, host, port */
Jakub Jelen c98f55
 	dump_cfg_string(oUser, o->user);
Jakub Jelen c98f55
 	dump_cfg_string(oHostName, host);
Jakub Jelen c98f55
@@ -2289,7 +2293,7 @@ dump_client_config(Options *o, const char *host)
Jakub Jelen c98f55
 	dump_cfg_string(oBindAddress, o->bind_address);
Jakub Jelen c98f55
 	dump_cfg_string(oCiphers, o->ciphers ? o->ciphers : KEX_CLIENT_ENCRYPT);
Jakub Jelen c98f55
 	dump_cfg_string(oControlPath, o->control_path);
Jakub Jelen c98f55
-	dump_cfg_string(oHostKeyAlgorithms, o->hostkeyalgorithms ? o->hostkeyalgorithms : KEX_DEFAULT_PK_ALG);
Jakub Jelen c98f55
+	dump_cfg_string(oHostKeyAlgorithms, o->hostkeyalgorithms);
Jakub Jelen c98f55
 	dump_cfg_string(oHostKeyAlias, o->host_key_alias);
Jakub Jelen c98f55
 	dump_cfg_string(oHostbasedKeyTypes, o->hostbased_key_types);
Jakub Jelen c98f55
 	dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices);
Jakub Jelen c98f55
diff --git a/servconf.c b/servconf.c
Jakub Jelen c98f55
index 04404a4..08c8139 100644
Jakub Jelen c98f55
--- a/servconf.c
Jakub Jelen c98f55
+++ b/servconf.c
Jakub Jelen c98f55
@@ -242,8 +242,6 @@ fill_default_server_options(ServerOptions *options)
Jakub Jelen c98f55
 		options->hostbased_authentication = 0;
Jakub Jelen c98f55
 	if (options->hostbased_uses_name_from_packet_only == -1)
Jakub Jelen c98f55
 		options->hostbased_uses_name_from_packet_only = 0;
Jakub Jelen c98f55
-	if (options->hostkeyalgorithms == NULL)
Jakub Jelen c98f55
-		options->hostkeyalgorithms = xstrdup(KEX_DEFAULT_PK_ALG);
Jakub Jelen c98f55
 	if (options->rsa_authentication == -1)
Jakub Jelen c98f55
 		options->rsa_authentication = 1;
Jakub Jelen c98f55
 	if (options->pubkey_authentication == -1)
Jakub Jelen c98f55
@@ -329,6 +327,8 @@ fill_default_server_options(ServerOptions *options)
Jakub Jelen c98f55
 	    kex_assemble_names(KEX_SERVER_MAC, &options->macs) != 0 ||
Jakub Jelen c98f55
 	    kex_assemble_names(KEX_SERVER_KEX, &options->kex_algorithms) != 0 ||
Jakub Jelen c98f55
 	    kex_assemble_names(KEX_DEFAULT_PK_ALG,
Jakub Jelen c98f55
+	    &options->hostkeyalgorithms) != 0 ||
Jakub Jelen c98f55
+	    kex_assemble_names(KEX_DEFAULT_PK_ALG,
Jakub Jelen c98f55
 	    &options->hostbased_key_types) != 0 ||
Jakub Jelen c98f55
 	    kex_assemble_names(KEX_DEFAULT_PK_ALG,
Jakub Jelen c98f55
 	    &options->pubkey_key_types) != 0)