mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* 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.
This commit is contained in:
parent
3b7ca1faa5
commit
60fce379da
@ -1,3 +1,14 @@
|
|||||||
|
2002-12-04 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2002-12-03 David Shaw <dshaw@jabberwocky.com>
|
2002-12-03 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Store
|
* tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Store
|
||||||
|
41
g10/tdbio.c
41
g10/tdbio.c
@ -639,36 +639,25 @@ create_hashtable( TRUSTREC *vr, int type )
|
|||||||
int
|
int
|
||||||
tdbio_db_matches_options()
|
tdbio_db_matches_options()
|
||||||
{
|
{
|
||||||
static int yes_no = -1;
|
static int yes_no = -1;
|
||||||
|
|
||||||
if( yes_no == -1 ) {
|
if( yes_no == -1 )
|
||||||
TRUSTREC vr;
|
{
|
||||||
int rc;
|
TRUSTREC vr;
|
||||||
|
int rc;
|
||||||
|
|
||||||
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
|
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
|
||||||
if( rc )
|
if( rc )
|
||||||
log_fatal( _("%s: error reading version record: %s\n"),
|
log_fatal( _("%s: error reading version record: %s\n"),
|
||||||
db_name, g10_errstr(rc) );
|
db_name, g10_errstr(rc) );
|
||||||
|
|
||||||
if( !vr.r.ver.marginals && !vr.r.ver.completes
|
yes_no = vr.r.ver.marginals == opt.marginals_needed
|
||||||
&& !vr.r.ver.cert_depth )
|
&& vr.r.ver.completes == opt.completes_needed
|
||||||
{ /* special hack for trustdbs created by old versions of GnuPG */
|
&& vr.r.ver.cert_depth == opt.max_cert_depth
|
||||||
vr.r.ver.marginals = opt.marginals_needed;
|
&& vr.r.ver.trust_model == opt.trust_model;
|
||||||
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) );
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
return yes_no;
|
|
||||||
|
return yes_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,6 +424,9 @@ init_trustdb()
|
|||||||
BUG();
|
BUG();
|
||||||
if( rc )
|
if( rc )
|
||||||
log_fatal("can't init trustdb: %s\n", g10_errstr(rc) );
|
log_fatal("can't init trustdb: %s\n", g10_errstr(rc) );
|
||||||
|
|
||||||
|
if(!tdbio_db_matches_options())
|
||||||
|
pending_check_trustdb=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1776,6 +1779,11 @@ validate_keys (int interactive)
|
|||||||
klist = utk_list;
|
klist = utk_list;
|
||||||
kdb = keydb_new (0);
|
kdb = keydb_new (0);
|
||||||
|
|
||||||
|
log_info(_("%d marginal(s) needed, %d complete(s) needed, %s trust model\n"),
|
||||||
|
opt.marginals_needed,opt.completes_needed,
|
||||||
|
opt.trust_model==TM_CLASSIC?"Classic":
|
||||||
|
opt.trust_model==TM_OPENPGP?"OpenPGP":"unknown");
|
||||||
|
|
||||||
for (depth=0; depth < opt.max_cert_depth; depth++)
|
for (depth=0; depth < opt.max_cert_depth; depth++)
|
||||||
{
|
{
|
||||||
/* See whether we should assign ownertrust values to the keys in
|
/* See whether we should assign ownertrust values to the keys in
|
||||||
@ -1912,7 +1920,14 @@ validate_keys (int interactive)
|
|||||||
log_info (_("next trustdb check due at %s\n"),
|
log_info (_("next trustdb check due at %s\n"),
|
||||||
strtimestamp (next_expire));
|
strtimestamp (next_expire));
|
||||||
}
|
}
|
||||||
tdbio_update_version_record();
|
|
||||||
|
if(tdbio_update_version_record()!=0)
|
||||||
|
{
|
||||||
|
log_error(_("unable to update trustdb version record: "
|
||||||
|
"write failed: %s\n"), g10_errstr(rc));
|
||||||
|
tdbio_invalid();
|
||||||
|
}
|
||||||
|
|
||||||
do_sync ();
|
do_sync ();
|
||||||
pending_check_trustdb = 0;
|
pending_check_trustdb = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user