mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-11 22:01:08 +02:00
gpg: Pass CTRL arg to get_trusthashrec.
* g10/tdbio.c (get_trusthashrec): Add arg CTRL. (tdbio_search_trust_byfpr): Ditto. (tdbio_search_trust_bypk): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
403aa70c52
commit
a750ebebf3
@ -189,7 +189,7 @@ import_ownertrust (ctrl_t ctrl, const char *fname )
|
|||||||
while (fprlen < 20)
|
while (fprlen < 20)
|
||||||
fpr[fprlen++] = 0;
|
fpr[fprlen++] = 0;
|
||||||
|
|
||||||
rc = tdbio_search_trust_byfpr (fpr, &rec);
|
rc = tdbio_search_trust_byfpr (ctrl, fpr, &rec);
|
||||||
if( !rc ) { /* found: update */
|
if( !rc ) { /* found: update */
|
||||||
if (rec.r.trust.ownertrust != otrust)
|
if (rec.r.trust.ownertrust != otrust)
|
||||||
{
|
{
|
||||||
|
16
g10/tdbio.c
16
g10/tdbio.c
@ -974,10 +974,12 @@ tdbio_write_nextcheck (ctrl_t ctrl, ulong stamp)
|
|||||||
* Return: record number
|
* Return: record number
|
||||||
*/
|
*/
|
||||||
static ulong
|
static ulong
|
||||||
get_trusthashrec(void)
|
get_trusthashrec (ctrl_t ctrl)
|
||||||
{
|
{
|
||||||
static ulong trusthashtbl; /* Record number of the trust hashtable. */
|
static ulong trusthashtbl; /* Record number of the trust hashtable. */
|
||||||
|
|
||||||
|
(void)ctrl;
|
||||||
|
|
||||||
if (!trusthashtbl)
|
if (!trusthashtbl)
|
||||||
{
|
{
|
||||||
TRUSTREC vr;
|
TRUSTREC vr;
|
||||||
@ -1388,7 +1390,7 @@ lookup_hashtable (ulong table, const byte *key, size_t keylen,
|
|||||||
static int
|
static int
|
||||||
update_trusthashtbl (ctrl_t ctrl, TRUSTREC *tr)
|
update_trusthashtbl (ctrl_t ctrl, TRUSTREC *tr)
|
||||||
{
|
{
|
||||||
return upd_hashtable (ctrl, get_trusthashrec (),
|
return upd_hashtable (ctrl, get_trusthashrec (ctrl),
|
||||||
tr->r.trust.fingerprint, 20, tr->recnum);
|
tr->r.trust.fingerprint, 20, tr->recnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,7 +1732,7 @@ tdbio_delete_record (ctrl_t ctrl, ulong recnum)
|
|||||||
;
|
;
|
||||||
else if (rec.rectype == RECTYPE_TRUST)
|
else if (rec.rectype == RECTYPE_TRUST)
|
||||||
{
|
{
|
||||||
rc = drop_from_hashtable (ctrl, get_trusthashrec(),
|
rc = drop_from_hashtable (ctrl, get_trusthashrec (ctrl),
|
||||||
rec.r.trust.fingerprint, 20, rec.recnum);
|
rec.r.trust.fingerprint, 20, rec.recnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1852,12 +1854,12 @@ cmp_trec_fpr ( const void *fpr, const TRUSTREC *rec )
|
|||||||
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
||||||
*/
|
*/
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
tdbio_search_trust_byfpr (const byte *fingerprint, TRUSTREC *rec)
|
tdbio_search_trust_byfpr (ctrl_t ctrl, const byte *fingerprint, TRUSTREC *rec)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Locate the trust record using the hash table */
|
/* Locate the trust record using the hash table */
|
||||||
rc = lookup_hashtable (get_trusthashrec(), fingerprint, 20,
|
rc = lookup_hashtable (get_trusthashrec (ctrl), fingerprint, 20,
|
||||||
cmp_trec_fpr, fingerprint, rec );
|
cmp_trec_fpr, fingerprint, rec );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -1870,7 +1872,7 @@ tdbio_search_trust_byfpr (const byte *fingerprint, TRUSTREC *rec)
|
|||||||
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
||||||
*/
|
*/
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
tdbio_search_trust_bypk (PKT_public_key *pk, TRUSTREC *rec)
|
tdbio_search_trust_bypk (ctrl_t ctrl, PKT_public_key *pk, TRUSTREC *rec)
|
||||||
{
|
{
|
||||||
byte fingerprint[MAX_FINGERPRINT_LEN];
|
byte fingerprint[MAX_FINGERPRINT_LEN];
|
||||||
size_t fingerlen;
|
size_t fingerlen;
|
||||||
@ -1878,7 +1880,7 @@ tdbio_search_trust_bypk (PKT_public_key *pk, TRUSTREC *rec)
|
|||||||
fingerprint_from_pk( pk, fingerprint, &fingerlen );
|
fingerprint_from_pk( pk, fingerprint, &fingerlen );
|
||||||
for (; fingerlen < 20; fingerlen++)
|
for (; fingerlen < 20; fingerlen++)
|
||||||
fingerprint[fingerlen] = 0;
|
fingerprint[fingerlen] = 0;
|
||||||
return tdbio_search_trust_byfpr (fingerprint, rec);
|
return tdbio_search_trust_byfpr (ctrl, fingerprint, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,8 +110,10 @@ int tdbio_end_transaction(void);
|
|||||||
int tdbio_cancel_transaction(void);
|
int tdbio_cancel_transaction(void);
|
||||||
int tdbio_delete_record (ctrl_t ctrl, ulong recnum);
|
int tdbio_delete_record (ctrl_t ctrl, ulong recnum);
|
||||||
ulong tdbio_new_recnum (ctrl_t ctrl);
|
ulong tdbio_new_recnum (ctrl_t ctrl);
|
||||||
gpg_error_t tdbio_search_trust_byfpr (const byte *fingerprint, TRUSTREC *rec);
|
gpg_error_t tdbio_search_trust_byfpr (ctrl_t ctrl, const byte *fingerprint,
|
||||||
gpg_error_t tdbio_search_trust_bypk (PKT_public_key *pk, TRUSTREC *rec);
|
TRUSTREC *rec);
|
||||||
|
gpg_error_t tdbio_search_trust_bypk (ctrl_t ctrl, PKT_public_key *pk,
|
||||||
|
TRUSTREC *rec);
|
||||||
|
|
||||||
void tdbio_how_to_fix (void);
|
void tdbio_how_to_fix (void);
|
||||||
void tdbio_invalid(void);
|
void tdbio_invalid(void);
|
||||||
|
@ -649,7 +649,7 @@ read_trust_record (ctrl_t ctrl, PKT_public_key *pk, TRUSTREC *rec)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
init_trustdb (ctrl, 0);
|
init_trustdb (ctrl, 0);
|
||||||
rc = tdbio_search_trust_bypk (pk, rec);
|
rc = tdbio_search_trust_bypk (ctrl, pk, rec);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
if (gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
|
if (gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user