pki: Make sure imported certificate is certificate

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2023-09-21 18:00:00 +02:00
committed by Sahana Prasad
parent de8f36c93c
commit a8c844c9c2

View File

@@ -1868,7 +1868,18 @@ int ssh_pki_import_cert_blob(const ssh_string cert_blob,
*/
int ssh_pki_import_cert_file(const char *filename, ssh_key *pkey)
{
return ssh_pki_import_pubkey_file(filename, pkey);
int rc;
rc = ssh_pki_import_pubkey_file(filename, pkey);
if (rc == SSH_OK) {
/* check the key is a cert type. */
if (!is_cert_type((*pkey)->type)) {
SSH_KEY_FREE(*pkey);
return SSH_ERROR;
}
}
return rc;
}
/**