aboutsummaryrefslogtreecommitdiffstats
path: root/g10/tdbio.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-12-04 06:06:56 +0000
committerDavid Shaw <[email protected]>2002-12-04 06:06:56 +0000
commit60fce379da1198688eeec996e12eebabd067a2ed (patch)
tree3970a2ec1f6e2e088450a41df19e49d2c698b13c /g10/tdbio.c
parent* tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Store trust (diff)
downloadgnupg-60fce379da1198688eeec996e12eebabd067a2ed.tar.gz
gnupg-60fce379da1198688eeec996e12eebabd067a2ed.zip
* trustdb.c (validate_keys): Show trust parameters when building trustdb,
and make sure that the version record update was successful. (init_trustdb): If the current parameters aren't what was used for building the trustdb, the trustdb is invalid. * tbio.c (tdbio_db_matches_options): Update to work with new trustdbs.
Diffstat (limited to '')
-rw-r--r--g10/tdbio.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/g10/tdbio.c b/g10/tdbio.c
index 45fae047c..993cb06f3 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -639,36 +639,25 @@ create_hashtable( TRUSTREC *vr, int type )
int
tdbio_db_matches_options()
{
- static int yes_no = -1;
+ static int yes_no = -1;
- if( yes_no == -1 ) {
- TRUSTREC vr;
- int rc;
-
- rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
- if( rc )
- log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ if( yes_no == -1 )
+ {
+ TRUSTREC vr;
+ int rc;
- if( !vr.r.ver.marginals && !vr.r.ver.completes
- && !vr.r.ver.cert_depth )
- { /* special hack for trustdbs created by old versions of GnuPG */
- vr.r.ver.marginals = opt.marginals_needed;
- vr.r.ver.completes = opt.completes_needed;
- vr.r.ver.cert_depth = opt.max_cert_depth;
- rc = tdbio_write_record( &vr );
- if( !rc && !in_transaction )
- rc = tdbio_sync();
- if( rc )
- log_error( _("%s: error writing version record: %s\n"),
- db_name, g10_errstr(rc) );
- }
+ rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
+ if( rc )
+ log_fatal( _("%s: error reading version record: %s\n"),
+ db_name, g10_errstr(rc) );
- 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;
+ 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;
}
- return yes_no;
+
+ return yes_no;
}