1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-31 11:41:32 +01:00

g10: Update a key's TOFU policy in a transaction.

* g10/tofu.c (tofu_set_policy): Do the update in a transaction.
* g10/gpg.c (main): Do a TOFU policy update in a batch transaction.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2016-08-31 11:40:33 +02:00
parent 247eef005c
commit e4d5e3cb0d
2 changed files with 8 additions and 1 deletions

View File

@ -4664,6 +4664,8 @@ main (int argc, char **argv)
if (! hd)
g10_exit (1);
tofu_begin_batch_update (ctrl);
for (i = 1; i < argc; i ++)
{
KEYDB_SEARCH_DESC desc;
@ -4721,8 +4723,9 @@ main (int argc, char **argv)
g10_exit (1);
}
keydb_release (hd);
tofu_end_batch_update (ctrl);
keydb_release (hd);
}
#endif /*USE_TOFU*/
break;

View File

@ -2584,6 +2584,8 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
fingerprint = hexfingerprint (pk, NULL, 0);
begin_transaction (ctrl);
for (; kb; kb = kb->next)
{
PKT_user_id *user_id;
@ -2605,6 +2607,8 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
xfree (email);
}
end_transaction (ctrl, 0);
xfree (fingerprint);
return 0;
}