diff options
author | Neal H. Walfield <[email protected]> | 2015-10-21 10:52:56 +0000 |
---|---|---|
committer | Neal H. Walfield <[email protected]> | 2015-10-21 11:45:47 +0000 |
commit | 243f90afba87e99ca42e2451ac5cc59d00a044ac (patch) | |
tree | cbbc0aabfaab3713a5aafef32c01883576de431a | |
parent | dirmngr: Allow building with libassuan < 2.3. (diff) | |
download | gnupg-243f90afba87e99ca42e2451ac5cc59d00a044ac.tar.gz gnupg-243f90afba87e99ca42e2451ac5cc59d00a044ac.zip |
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 <[email protected]>
-rw-r--r-- | g10/trustdb.c | 21 | ||||
-rw-r--r-- | g10/trustdb.h | 2 |
2 files changed, 16 insertions, 7 deletions
diff --git a/g10/trustdb.c b/g10/trustdb.c index cadc7e96b..1be98b5f5 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -229,13 +229,8 @@ add_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 0; - } - } + if (tdb_keyid_is_utk (kid)) + return 0; k = new_key_item (); k->kid[0] = kid[0]; @@ -317,6 +312,18 @@ verify_own_keys(void) 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 ******************* diff --git a/g10/trustdb.h b/g10/trustdb.h index adb75d72c..718f7791c 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -111,6 +111,8 @@ void clean_key (kbnode_t keyblock, int noisy, int self_only, /*-- trustdb.c --*/ void tdb_register_trusted_keyid (u32 *keyid); 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 update_trustdb (void); int setup_trustdb( int level, const char *dbname ); |