Move ssh_match_group() from misc.c to match.c

ssh_match_group() has been moved from misc.c to match.c, because it fits
better with other match_*() functions in match.c

The name of the function has also been changed from "ssh_match_group" to
"match_group" to be consistent with the naming of the other match.c
functions.

Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Eshan Kelkar
2024-06-11 09:15:00 +05:30
committed by Sahana Prasad
parent 21627509f5
commit d41a0aaa13
8 changed files with 46 additions and 44 deletions

View File

@@ -170,8 +170,8 @@ SSH_PACKET_CALLBACK(ssh_packet_newkeys)
/* Check if signature from server matches user preferences */
if (session->opts.wanted_methods[SSH_HOSTKEYS]) {
rc = ssh_match_group(session->opts.wanted_methods[SSH_HOSTKEYS],
sig->type_c);
rc = match_group(session->opts.wanted_methods[SSH_HOSTKEYS],
sig->type_c);
if (rc == 0) {
ssh_set_error(session,
SSH_FATAL,
@@ -277,10 +277,14 @@ SSH_PACKET_CALLBACK(ssh_packet_ext_info)
if (cmp == 0) {
/* TODO check for NULL bytes */
SSH_LOG(SSH_LOG_PACKET, "Extension: %s=<%s>", name, value);
if (ssh_match_group(value, "rsa-sha2-512")) {
rc = match_group(value, "rsa-sha2-512");
if (rc == 1) {
session->extensions |= SSH_EXT_SIG_RSA_SHA512;
}
if (ssh_match_group(value, "rsa-sha2-256")) {
rc = match_group(value, "rsa-sha2-256");
if (rc == 1) {
session->extensions |= SSH_EXT_SIG_RSA_SHA256;
}
} else {