aboutsummaryrefslogtreecommitdiffstats
path: root/g10/tdbio.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2012-01-20 03:33:51 +0000
committerDavid Shaw <[email protected]>2012-01-20 21:50:42 +0000
commitdeee8147aab086161c91e6aa6fb41d7148a630f6 (patch)
tree37259d29ecea3bfcb8418e2638763872f90686ba /g10/tdbio.c
parentestream: Fix unclean usage of realloc. (diff)
downloadgnupg-deee8147aab086161c91e6aa6fb41d7148a630f6.tar.gz
gnupg-deee8147aab086161c91e6aa6fb41d7148a630f6.zip
Changes to --min-cert-level should cause a trustdb rebuild (issue 1366)
* g10/gpgv.c, g10/trustdb.c (read_trust_options): Add min_cert_level * g10/trustdb.c (check_trustdb_stale): Request a rebuild if pending_check_trustdb is true (set when we detect a trustdb parameter has changed). * g10/keylist.c (public_key_list): Use 'l' in the "tru" with-colons listing for min_cert_level not matching. * g10/tdbio.c (tdbio_update_version_record, create_version_record, tdbio_db_matches_options, tdbio_dump_record, tdbio_read_record, tdbio_write_record): Add a byte for min_cert_level in the tdbio version record.
Diffstat (limited to 'g10/tdbio.c')
-rw-r--r--g10/tdbio.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/g10/tdbio.c b/g10/tdbio.c
index 1ab11f2e7..ef05cf2a8 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -1,5 +1,5 @@
-/* tdbio.c - trust databse I/O operations
- * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* tdbio.c - trust database I/O operations
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -445,6 +445,7 @@ tdbio_update_version_record (void)
rec.r.ver.completes = opt.completes_needed;
rec.r.ver.cert_depth = opt.max_cert_depth;
rec.r.ver.trust_model = opt.trust_model;
+ rec.r.ver.min_cert_level = opt.min_cert_level;
rc=tdbio_write_record(&rec);
}
@@ -467,6 +468,7 @@ create_version_record (void)
rec.r.ver.trust_model = opt.trust_model;
else
rec.r.ver.trust_model = TM_PGP;
+ rec.r.ver.min_cert_level = opt.min_cert_level;
rec.rectype = RECTYPE_VER;
rec.recnum = 0;
rc = tdbio_write_record( &rec );
@@ -713,7 +715,8 @@ tdbio_db_matches_options()
yes_no = vr.r.ver.marginals == opt.marginals_needed
&& vr.r.ver.completes == opt.completes_needed
&& vr.r.ver.cert_depth == opt.max_cert_depth
- && vr.r.ver.trust_model == opt.trust_model;
+ && vr.r.ver.trust_model == opt.trust_model
+ && vr.r.ver.min_cert_level == opt.min_cert_level;
}
return yes_no;
@@ -1143,13 +1146,14 @@ tdbio_dump_record( TRUSTREC *rec, FILE *fp )
case 0: fprintf(fp, "blank\n");
break;
case RECTYPE_VER: fprintf(fp,
- "version, td=%lu, f=%lu, m/c/d=%d/%d/%d tm=%d nc=%lu (%s)\n",
+ "version, td=%lu, f=%lu, m/c/d=%d/%d/%d tm=%d mcl=%d nc=%lu (%s)\n",
rec->r.ver.trusthashtbl,
rec->r.ver.firstfree,
rec->r.ver.marginals,
rec->r.ver.completes,
rec->r.ver.cert_depth,
rec->r.ver.trust_model,
+ rec->r.ver.min_cert_level,
rec->r.ver.nextcheck,
strtimestamp(rec->r.ver.nextcheck)
);
@@ -1245,7 +1249,8 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
rec->r.ver.completes = *p++;
rec->r.ver.cert_depth = *p++;
rec->r.ver.trust_model = *p++;
- p += 3;
+ rec->r.ver.min_cert_level = *p++;
+ p += 2;
rec->r.ver.created = buftoulong(p); p += 4;
rec->r.ver.nextcheck = buftoulong(p); p += 4;
p += 4;
@@ -1332,7 +1337,8 @@ tdbio_write_record( TRUSTREC *rec )
*p++ = rec->r.ver.completes;
*p++ = rec->r.ver.cert_depth;
*p++ = rec->r.ver.trust_model;
- p += 3;
+ *p++ = rec->r.ver.min_cert_level;
+ p += 2;
ulongtobuf(p, rec->r.ver.created); p += 4;
ulongtobuf(p, rec->r.ver.nextcheck); p += 4;
p += 4;