[Pkg-gnupg-commit] [gnupg2] 29/118: g10: Update a key's TOFU policy in a transaction.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Thu Sep 15 18:25:02 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch encoding-and-speling
in repository gnupg2.
commit e4d5e3cb0d10e8f77c7100d42cfdb32051de1c18
Author: Neal H. Walfield <neal at g10code.com>
Date: Wed Aug 31 11:40:33 2016 +0200
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 at g10code.com>
---
g10/gpg.c | 5 ++++-
g10/tofu.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/g10/gpg.c b/g10/gpg.c
index 3193e74..a9770d7 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -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;
diff --git a/g10/tofu.c b/g10/tofu.c
index 137065a..4285e96 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -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;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list