version 1.82, 2020/06/26 05:42:16 |
version 1.83, 2020/10/04 09:45:01 |
|
|
*/ |
*/ |
static HostStatus |
static HostStatus |
check_hostkeys_by_key_or_type(struct hostkeys *hostkeys, |
check_hostkeys_by_key_or_type(struct hostkeys *hostkeys, |
struct sshkey *k, int keytype, const struct hostkey_entry **found) |
struct sshkey *k, int keytype, int nid, const struct hostkey_entry **found) |
{ |
{ |
u_int i; |
u_int i; |
HostStatus end_return = HOST_NEW; |
HostStatus end_return = HOST_NEW; |
|
|
if (k == NULL) { |
if (k == NULL) { |
if (hostkeys->entries[i].key->type != keytype) |
if (hostkeys->entries[i].key->type != keytype) |
continue; |
continue; |
|
if (nid != -1 && |
|
sshkey_type_plain(keytype) == KEY_ECDSA && |
|
hostkeys->entries[i].key->ecdsa_nid != nid) |
|
continue; |
end_return = HOST_FOUND; |
end_return = HOST_FOUND; |
if (found != NULL) |
if (found != NULL) |
*found = hostkeys->entries + i; |
*found = hostkeys->entries + i; |
|
|
{ |
{ |
if (key == NULL) |
if (key == NULL) |
fatal("no key to look up"); |
fatal("no key to look up"); |
return check_hostkeys_by_key_or_type(hostkeys, key, 0, found); |
return check_hostkeys_by_key_or_type(hostkeys, key, 0, -1, found); |
} |
} |
|
|
int |
int |
lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype, |
lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype, int nid, |
const struct hostkey_entry **found) |
const struct hostkey_entry **found) |
{ |
{ |
return (check_hostkeys_by_key_or_type(hostkeys, NULL, keytype, |
return (check_hostkeys_by_key_or_type(hostkeys, NULL, keytype, nid, |
found) == HOST_FOUND); |
found) == HOST_FOUND); |
} |
} |
|
|