mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Factor out code into a standalone function.
* g10/trustdb.c (tdb_keyid_is_utk): New function. (add_utk): Use it. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
parent
a79045e38d
commit
243f90afba
@ -229,13 +229,8 @@ add_utk (u32 *kid)
|
|||||||
{
|
{
|
||||||
struct key_item *k;
|
struct key_item *k;
|
||||||
|
|
||||||
for (k = utk_list; k; k = k->next)
|
if (tdb_keyid_is_utk (kid))
|
||||||
{
|
return 0;
|
||||||
if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
k = new_key_item ();
|
k = new_key_item ();
|
||||||
k->kid[0] = kid[0];
|
k->kid[0] = kid[0];
|
||||||
@ -317,6 +312,18 @@ verify_own_keys(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns whether KID is on the list of ultimately trusted keys. */
|
||||||
|
int
|
||||||
|
tdb_keyid_is_utk (u32 *kid)
|
||||||
|
{
|
||||||
|
struct key_item *k;
|
||||||
|
|
||||||
|
for (k = utk_list; k; k = k->next)
|
||||||
|
if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************
|
/*********************************************
|
||||||
*********** TrustDB stuff *******************
|
*********** TrustDB stuff *******************
|
||||||
|
@ -111,6 +111,8 @@ void clean_key (kbnode_t keyblock, int noisy, int self_only,
|
|||||||
/*-- trustdb.c --*/
|
/*-- trustdb.c --*/
|
||||||
void tdb_register_trusted_keyid (u32 *keyid);
|
void tdb_register_trusted_keyid (u32 *keyid);
|
||||||
void tdb_register_trusted_key (const char *string);
|
void tdb_register_trusted_key (const char *string);
|
||||||
|
/* Returns whether KID is on the list of ultimately trusted keys. */
|
||||||
|
int tdb_keyid_is_utk (u32 *kid);
|
||||||
void check_trustdb (void);
|
void check_trustdb (void);
|
||||||
void update_trustdb (void);
|
void update_trustdb (void);
|
||||||
int setup_trustdb( int level, const char *dbname );
|
int setup_trustdb( int level, const char *dbname );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user