aboutsummaryrefslogtreecommitdiffstats
path: root/g10/trustdb.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-01-12 04:34:31 +0000
committerNIIBE Yutaka <[email protected]>2022-01-12 04:34:31 +0000
commit4aeeaa65ad09fa72ee21c5597b1ce6255ec7dfa8 (patch)
tree5ae2eb25a31cb8589ef5c42ea370d796beb14ae1 /g10/trustdb.c
parentgpg: Report failed generation of subkey pair via status interface (diff)
downloadgnupg-4aeeaa65ad09fa72ee21c5597b1ce6255ec7dfa8.tar.gz
gnupg-4aeeaa65ad09fa72ee21c5597b1ce6255ec7dfa8.zip
gpg: Fix adding the list of ultimate trusted keys.
* g10/keygen.c (do_generate_keypair): Remove another call to update_ownertrust. * g10/trust.c (update_ownertrust): Add call to tdb_update_utk. * g10/trustdb.c (tdb_update_utk): New. * g10/trustdb.h (tdb_update_utk): New. -- GnuPG-bug-id: 5742 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/trustdb.c')
-rw-r--r--g10/trustdb.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/g10/trustdb.c b/g10/trustdb.c
index bcaa196d9..e8cd62d5f 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -308,6 +308,49 @@ add_utk (u32 *kid)
}
+/* Add/remove KID to/from the list of ultimately trusted keys. */
+void
+tdb_update_utk (u32 *kid, int add)
+{
+ struct key_item *k, *k_prev;
+
+ k_prev = NULL;
+ for (k = utk_list; k; k = k->next)
+ if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
+ break;
+ else
+ k_prev = k;
+
+ if (add)
+ {
+ if (!k)
+ {
+ k = new_key_item ();
+ k->kid[0] = kid[0];
+ k->kid[1] = kid[1];
+ k->ownertrust = TRUST_ULTIMATE;
+ k->next = utk_list;
+ utk_list = k;
+ if ( opt.verbose > 1 )
+ log_info(_("key %s: accepted as trusted key\n"), keystr(kid));
+ }
+ }
+ else
+ {
+ if (k)
+ {
+ if (k_prev)
+ k_prev->next = k->next;
+ else
+ utk_list = NULL;
+
+ xfree (k->trust_regexp);
+ xfree (k);
+ }
+ }
+}
+
+
/****************
* Verify that all our secret keys are usable and put them into the utk_list.
*/