mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-06 12:33:23 +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:
parent
247eef005c
commit
e4d5e3cb0d
@ -4664,6 +4664,8 @@ main (int argc, char **argv)
|
|||||||
if (! hd)
|
if (! hd)
|
||||||
g10_exit (1);
|
g10_exit (1);
|
||||||
|
|
||||||
|
tofu_begin_batch_update (ctrl);
|
||||||
|
|
||||||
for (i = 1; i < argc; i ++)
|
for (i = 1; i < argc; i ++)
|
||||||
{
|
{
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
@ -4721,8 +4723,9 @@ main (int argc, char **argv)
|
|||||||
g10_exit (1);
|
g10_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
keydb_release (hd);
|
tofu_end_batch_update (ctrl);
|
||||||
|
|
||||||
|
keydb_release (hd);
|
||||||
}
|
}
|
||||||
#endif /*USE_TOFU*/
|
#endif /*USE_TOFU*/
|
||||||
break;
|
break;
|
||||||
|
@ -2584,6 +2584,8 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
|
|||||||
|
|
||||||
fingerprint = hexfingerprint (pk, NULL, 0);
|
fingerprint = hexfingerprint (pk, NULL, 0);
|
||||||
|
|
||||||
|
begin_transaction (ctrl);
|
||||||
|
|
||||||
for (; kb; kb = kb->next)
|
for (; kb; kb = kb->next)
|
||||||
{
|
{
|
||||||
PKT_user_id *user_id;
|
PKT_user_id *user_id;
|
||||||
@ -2605,6 +2607,8 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
|
|||||||
xfree (email);
|
xfree (email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end_transaction (ctrl, 0);
|
||||||
|
|
||||||
xfree (fingerprint);
|
xfree (fingerprint);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user