1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix missing comments in Windows Pageant.

When I took the key comments out of the RSAKey / ssh2_userkey
structures stored in pageant.c's trees and moved them into the new
containing PageantKey structure, I forgot that that would mean Windows
Pageant - which tries to read the comments _from_ those structures -
would now not be able to show comments in its list box.

Comments are small, so the easiest fix is just to duplicate them in
both places.
This commit is contained in:
Simon Tatham 2020-01-10 19:27:07 +00:00
parent 0a3fc21e23
commit 7dde732f7d

View File

@ -43,7 +43,7 @@ typedef struct PageantKeySort {
typedef struct PageantKey {
PageantKeySort sort;
strbuf *public_blob; /* the true owner of sort.public_blob */
char *comment; /* always stored separately, never in rkey/skey */
char *comment; /* stored separately, whether or not in rkey/skey */
union {
RSAKey *rkey; /* if ssh_version == 1 */
ssh2_userkey *skey; /* if ssh_version == 2 */
@ -59,6 +59,7 @@ static void pk_free(PageantKey *pk)
sfree(pk->rkey);
}
if (pk->sort.ssh_version == 2 && pk->skey) {
sfree(pk->skey->comment);
ssh_key_free(pk->skey->key);
sfree(pk->skey);
}
@ -140,10 +141,8 @@ bool pageant_add_ssh1_key(RSAKey *rkey)
if (add234(keytree, pk) == pk) {
pk->rkey = rkey;
if (rkey->comment) {
pk->comment = rkey->comment;
rkey->comment = NULL;
}
if (rkey->comment)
pk->comment = dupstr(rkey->comment);
return true;
} else {
pk_free(pk);
@ -161,10 +160,8 @@ bool pageant_add_ssh2_key(ssh2_userkey *skey)
if (add234(keytree, pk) == pk) {
pk->skey = skey;
if (skey->comment) {
pk->comment = skey->comment;
skey->comment = NULL;
}
if (skey->comment)
pk->comment = dupstr(skey->comment);
return true;
} else {
pk_free(pk);