mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-03 16:53:03 +01:00
Cleaned up comment handling.
This commit is contained in:
parent
14b10c5443
commit
4c7ac53ed3
@ -385,18 +385,6 @@ agent_key_from_file (CTRL ctrl, const char *desc_text,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
comment_sexp = gcry_sexp_find_token (s_skey, "comment", 0);
|
|
||||||
if (comment_sexp)
|
|
||||||
{
|
|
||||||
comment = gcry_sexp_nth_data (comment_sexp, 1, &comment_length);
|
|
||||||
if (! comment)
|
|
||||||
{
|
|
||||||
rc = GPG_ERR_INV_SEXP;
|
|
||||||
gcry_sexp_release (s_skey);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
len = gcry_sexp_sprint (s_skey, GCRYSEXP_FMT_CANON, NULL, 0);
|
len = gcry_sexp_sprint (s_skey, GCRYSEXP_FMT_CANON, NULL, 0);
|
||||||
assert (len);
|
assert (len);
|
||||||
buf = xtrymalloc (len);
|
buf = xtrymalloc (len);
|
||||||
@ -415,8 +403,13 @@ agent_key_from_file (CTRL ctrl, const char *desc_text,
|
|||||||
case PRIVATE_KEY_CLEAR:
|
case PRIVATE_KEY_CLEAR:
|
||||||
break; /* no unprotection needed */
|
break; /* no unprotection needed */
|
||||||
case PRIVATE_KEY_PROTECTED:
|
case PRIVATE_KEY_PROTECTED:
|
||||||
|
comment_sexp = gcry_sexp_find_token (s_skey, "comment", 0);
|
||||||
|
if (comment_sexp)
|
||||||
|
comment = gcry_sexp_nth_data (comment_sexp, 1, &comment_length);
|
||||||
|
|
||||||
rc = modify_description (desc_text,
|
rc = modify_description (desc_text,
|
||||||
comment, comment_length, &desc_text_modified);
|
comment, comment_length, &desc_text_modified);
|
||||||
|
gcry_sexp_release (comment_sexp);
|
||||||
if (rc)
|
if (rc)
|
||||||
log_error ("failed to modify description: %s\n", gpg_strerror (rc));
|
log_error ("failed to modify description: %s\n", gpg_strerror (rc));
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user