mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
feat(pki): add support for user ID in ssh_key structure
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
@@ -95,6 +95,9 @@ struct ssh_key_struct {
|
|||||||
uint8_t sk_flags;
|
uint8_t sk_flags;
|
||||||
ssh_string sk_key_handle;
|
ssh_string sk_key_handle;
|
||||||
ssh_string sk_reserved;
|
ssh_string sk_reserved;
|
||||||
|
|
||||||
|
/* Resident key specific metadata */
|
||||||
|
ssh_string sk_user_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_signature_struct {
|
struct ssh_signature_struct {
|
||||||
|
|||||||
13
src/pki.c
13
src/pki.c
@@ -166,6 +166,13 @@ ssh_key pki_key_dup_common_init(const ssh_key key, int demote)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key->sk_user_id != NULL) {
|
||||||
|
new->sk_user_id = ssh_string_copy(key->sk_user_id);
|
||||||
|
if (new->sk_user_id == NULL) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!demote) {
|
if (!demote) {
|
||||||
new->sk_flags = key->sk_flags;
|
new->sk_flags = key->sk_flags;
|
||||||
|
|
||||||
@@ -232,6 +239,8 @@ void ssh_key_clean (ssh_key key)
|
|||||||
ssh_string_free(key->sk_key_handle);
|
ssh_string_free(key->sk_key_handle);
|
||||||
ssh_string_burn(key->sk_reserved);
|
ssh_string_burn(key->sk_reserved);
|
||||||
ssh_string_free(key->sk_reserved);
|
ssh_string_free(key->sk_reserved);
|
||||||
|
ssh_string_burn(key->sk_user_id);
|
||||||
|
ssh_string_free(key->sk_user_id);
|
||||||
key->sk_flags = 0;
|
key->sk_flags = 0;
|
||||||
}
|
}
|
||||||
key->cert_type = SSH_KEYTYPE_UNKNOWN;
|
key->cert_type = SSH_KEYTYPE_UNKNOWN;
|
||||||
@@ -787,6 +796,10 @@ int ssh_key_cmp(const ssh_key k1,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ssh_string_cmp(k1->sk_user_id, k2->sk_user_id) != 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (what == SSH_KEY_CMP_PRIVATE) {
|
if (what == SSH_KEY_CMP_PRIVATE) {
|
||||||
if (k1->sk_flags != k2->sk_flags) {
|
if (k1->sk_flags != k2->sk_flags) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user