mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: Cleanup error code path in case of a bad trustdb.
* g10/tdbio.c (tdbio_read_record): Fix returning of the error. -- Actually the returned error will anyway be GPG_ERR_TRUSTDB but the old code was not correct. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
bf06d04f53
commit
f170240ef7
54
g10/tdbio.c
54
g10/tdbio.c
@ -1487,34 +1487,36 @@ tdbio_read_record (ulong recnum, TRUSTREC *rec, int expected)
|
|||||||
{
|
{
|
||||||
log_error (_("%s: not a trustdb file\n"), db_name );
|
log_error (_("%s: not a trustdb file\n"), db_name );
|
||||||
err = gpg_error (GPG_ERR_TRUSTDB);
|
err = gpg_error (GPG_ERR_TRUSTDB);
|
||||||
/* FIXME ^ */
|
|
||||||
}
|
}
|
||||||
p += 2; /* skip "gpg" */
|
else
|
||||||
rec->r.ver.version = *p++;
|
|
||||||
rec->r.ver.marginals = *p++;
|
|
||||||
rec->r.ver.completes = *p++;
|
|
||||||
rec->r.ver.cert_depth = *p++;
|
|
||||||
rec->r.ver.trust_model = *p++;
|
|
||||||
rec->r.ver.min_cert_level = *p++;
|
|
||||||
p += 2;
|
|
||||||
rec->r.ver.created = buf32_to_ulong(p); p += 4;
|
|
||||||
rec->r.ver.nextcheck = buf32_to_ulong(p); p += 4;
|
|
||||||
p += 4;
|
|
||||||
p += 4;
|
|
||||||
rec->r.ver.firstfree =buf32_to_ulong(p); p += 4;
|
|
||||||
p += 4;
|
|
||||||
rec->r.ver.trusthashtbl =buf32_to_ulong(p); p += 4;
|
|
||||||
if (recnum)
|
|
||||||
{
|
{
|
||||||
log_error( _("%s: version record with recnum %lu\n"), db_name,
|
p += 2; /* skip "gpg" */
|
||||||
(ulong)recnum );
|
rec->r.ver.version = *p++;
|
||||||
err = gpg_error (GPG_ERR_TRUSTDB);
|
rec->r.ver.marginals = *p++;
|
||||||
}
|
rec->r.ver.completes = *p++;
|
||||||
else if (rec->r.ver.version != 3)
|
rec->r.ver.cert_depth = *p++;
|
||||||
{
|
rec->r.ver.trust_model = *p++;
|
||||||
log_error( _("%s: invalid file version %d\n"), db_name,
|
rec->r.ver.min_cert_level = *p++;
|
||||||
rec->r.ver.version );
|
p += 2;
|
||||||
err = gpg_error (GPG_ERR_TRUSTDB);
|
rec->r.ver.created = buf32_to_ulong(p); p += 4;
|
||||||
|
rec->r.ver.nextcheck = buf32_to_ulong(p); p += 4;
|
||||||
|
p += 4;
|
||||||
|
p += 4;
|
||||||
|
rec->r.ver.firstfree =buf32_to_ulong(p); p += 4;
|
||||||
|
p += 4;
|
||||||
|
rec->r.ver.trusthashtbl =buf32_to_ulong(p); p += 4;
|
||||||
|
if (recnum)
|
||||||
|
{
|
||||||
|
log_error( _("%s: version record with recnum %lu\n"), db_name,
|
||||||
|
(ulong)recnum );
|
||||||
|
err = gpg_error (GPG_ERR_TRUSTDB);
|
||||||
|
}
|
||||||
|
else if (rec->r.ver.version != 3)
|
||||||
|
{
|
||||||
|
log_error( _("%s: invalid file version %d\n"), db_name,
|
||||||
|
rec->r.ver.version );
|
||||||
|
err = gpg_error (GPG_ERR_TRUSTDB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user