summaryrefslogtreecommitdiffstats
path: root/g10/tdbdump.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2021-11-13 20:34:06 +0100
committerWerner Koch <wk@gnupg.org>2021-11-13 20:34:06 +0100
commit99ef78aa0ca7e48ceba400e1a43f8185cf9bbf71 (patch)
treeb20761fcffe080bbea90194ffd36d0f9c8403f23 /g10/tdbdump.c
parentkeyboxd: New option --steal-socket. (diff)
downloadgnupg2-99ef78aa0ca7e48ceba400e1a43f8185cf9bbf71.tar.xz
gnupg2-99ef78aa0ca7e48ceba400e1a43f8185cf9bbf71.zip
gpg: Remove stale ultimately trusted keys from the trustdb.
* g10/tdbdump.c (export_ownertrust): Skip records marked with the option --trusted-key. (import_ownertrust): Clear the trusted-key flag. * g10/tdbio.h (struct trust_record): Add field flags. * g10/tdbio.c (tdbio_dump_record): Improve output. (tdbio_read_record, tdbio_write_record): Handle flags. * g10/trustdb.c (verify_own_keys): Clear stale trusted-keys and set the flag for new --trusted-keys. (tdb_update_ownertrust): Add arg as_trusted_key. Update callers. -- GnuPG-bug-id: 5685 Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/tdbdump.c')
-rw-r--r--g10/tdbdump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/g10/tdbdump.c b/g10/tdbdump.c
index 73a6c2c57..2a02ad108 100644
--- a/g10/tdbdump.c
+++ b/g10/tdbdump.c
@@ -109,7 +109,9 @@ export_ownertrust (ctrl_t ctrl)
{
if (rec.rectype == RECTYPE_TRUST)
{
- if (!rec.r.trust.ownertrust)
+ /* Skip records with no ownertrust set or those with trust
+ * set via --trusted-key. */
+ if (!rec.r.trust.ownertrust || (rec.r.trust.flags & 1))
continue;
p = rec.r.trust.fingerprint;
for (i=0; i < 20; i++, p++ )
@@ -204,6 +206,7 @@ import_ownertrust (ctrl_t ctrl, const char *fname )
log_info("setting ownertrust to %u\n", otrust );
}
rec.r.trust.ownertrust = otrust;
+ rec.r.trust.flags &= ~(rec.r.trust.flags & 1);
write_record (ctrl, &rec);
any = 1;
}