feat: test null hostkey on ci

Signed-off-by: Gauravsingh Sisodia <xaerru@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Gauravsingh Sisodia
2024-08-23 09:48:00 +00:00
committed by Jakub Jelen
parent d730b40b91
commit fd1c3e8878
6 changed files with 170 additions and 1 deletions

View File

@@ -796,6 +796,8 @@ int ssh_set_client_kex(ssh_session session)
const char *wanted = NULL;
int ok;
int i;
bool gssapi_null_alg = false;
char *hostkeys = NULL;
/* Skip if already set, for example for the rekey or when we do the guessing
* it could have been already used to make some protocol decisions. */
@@ -831,6 +833,9 @@ int ssh_set_client_kex(ssh_session session)
/* Prefix the default algorithms with gsskex algs */
session->opts.wanted_methods[SSH_KEX] =
ssh_prefix_without_duplicates(default_methods[SSH_KEX], gssapi_algs);
gssapi_null_alg = true;
SAFE_FREE(gssapi_algs);
}
#endif
@@ -847,6 +852,15 @@ int ssh_set_client_kex(ssh_session session)
ssh_set_error_oom(session);
return SSH_ERROR;
}
if (gssapi_null_alg) {
hostkeys = ssh_append_without_duplicates(client->methods[i], "null");
if (hostkeys == NULL) {
ssh_set_error_oom(session);
return SSH_ERROR;
}
SAFE_FREE(client->methods[i]);
client->methods[i] = hostkeys;
}
continue;
}