X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb%2Fkeydb_hkp.c;h=fd235d3add3587a13b8bce08cd41c5f75a12e0f4;hb=f67f09be8979050e73855b6551da83ca48dde950;hp=79d5c4b302e30d433a63664092fedba9895b2bc4;hpb=51c1a7dd950efef6a4d00df1878341777f8064ff;p=onak.git diff --git a/keydb/keydb_hkp.c b/keydb/keydb_hkp.c index 79d5c4b..fd235d3 100644 --- a/keydb/keydb_hkp.c +++ b/keydb/keydb_hkp.c @@ -107,7 +107,7 @@ static size_t hkp_curl_recv_data(void *buffer, size_t size, size_t nmemb, static int hkp_fetch_key_url(struct onak_dbctx *dbctx, char *url, struct openpgp_publickey **publickey, - bool intrans) + __unused bool intrans) { struct onak_hkp_dbctx *privctx = (struct onak_hkp_dbctx *) dbctx->priv; struct openpgp_packet_list *packets = NULL; @@ -143,31 +143,13 @@ static int hkp_fetch_key_url(struct onak_dbctx *dbctx, return count; } -/** - * hkp_fetch_key_id - Given a keyid fetch the key from HKP server. - */ -static int hkp_fetch_key_id(struct onak_dbctx *dbctx, - uint64_t keyid, - struct openpgp_publickey **publickey, - bool intrans) -{ - struct onak_hkp_dbctx *privctx = (struct onak_hkp_dbctx *) dbctx->priv; - char keyurl[1024]; - - snprintf(keyurl, sizeof(keyurl), - "%s/lookup?op=get&search=0x%08" PRIX64, - privctx->hkpbase, keyid); - - return (hkp_fetch_key_url(dbctx, keyurl, publickey, intrans)); -} - /** * hkp_fetch_key_fp - Given a fingerprint fetch the key from HKP server. */ static int hkp_fetch_key_fp(struct onak_dbctx *dbctx, struct openpgp_fingerprint *fingerprint, struct openpgp_publickey **publickey, - bool intrans) + __unused bool intrans) { struct onak_hkp_dbctx *privctx = (struct onak_hkp_dbctx *) dbctx->priv; char keyurl[1024]; @@ -191,6 +173,24 @@ static int hkp_fetch_key_fp(struct onak_dbctx *dbctx, return (hkp_fetch_key_url(dbctx, keyurl, publickey, intrans)); } +/** + * hkp_fetch_key_id - Given a keyid fetch the key from HKP server. + */ +static int hkp_fetch_key_id(struct onak_dbctx *dbctx, + uint64_t keyid, + struct openpgp_publickey **publickey, + bool intrans) +{ + struct onak_hkp_dbctx *privctx = (struct onak_hkp_dbctx *) dbctx->priv; + char keyurl[1024]; + + snprintf(keyurl, sizeof(keyurl), + "%s/lookup?op=get&search=0x%08" PRIX64, + privctx->hkpbase, keyid); + + return (hkp_fetch_key_url(dbctx, keyurl, publickey, intrans)); +} + /** * fetch_key_text - Tries to find the keys that contain the supplied text. * @search: The text to search for. @@ -223,8 +223,9 @@ static int hkp_fetch_key_text(struct onak_dbctx *dbctx, * */ static int hkp_store_key(struct onak_dbctx *dbctx, - struct openpgp_publickey *publickey, bool intrans, - bool update) + struct openpgp_publickey *publickey, + __unused bool intrans, + __unused bool update) { struct onak_hkp_dbctx *privctx = (struct onak_hkp_dbctx *) dbctx->priv; struct openpgp_packet_list *packets = NULL; @@ -276,8 +277,8 @@ static int hkp_store_key(struct onak_dbctx *dbctx, * * No op for HKP. */ -static int hkp_delete_key(struct onak_dbctx *dbctx, - struct openpgp_fingerprint *fp, bool intrans) +static int hkp_delete_key(__unused struct onak_dbctx *dbctx, + __unused struct openpgp_fingerprint *fp, __unused bool intrans) { return -1; } @@ -289,9 +290,9 @@ static int hkp_delete_key(struct onak_dbctx *dbctx, * * Not applicable for HKP backend. */ -static int hkp_iterate_keys(struct onak_dbctx *dbctx, - void (*iterfunc)(void *ctx, struct openpgp_publickey *key), - void *ctx) +static int hkp_iterate_keys(__unused struct onak_dbctx *dbctx, + __unused void (*iterfunc)(void *ctx, struct openpgp_publickey *key), + __unused void *ctx) { return 0; } @@ -301,7 +302,7 @@ static int hkp_iterate_keys(struct onak_dbctx *dbctx, * * This is just a no-op for HKP access. */ -static bool hkp_starttrans(struct onak_dbctx *dbctx) +static bool hkp_starttrans(__unused struct onak_dbctx *dbctx) { return true; } @@ -311,7 +312,7 @@ static bool hkp_starttrans(struct onak_dbctx *dbctx) * * This is just a no-op for HKP access. */ -static void hkp_endtrans(struct onak_dbctx *dbctx) +static void hkp_endtrans(__unused struct onak_dbctx *dbctx) { return; } @@ -322,6 +323,7 @@ static void hkp_endtrans(struct onak_dbctx *dbctx) #define NEED_KEYID2UID 1 #define NEED_GETKEYSIGS 1 #define NEED_UPDATEKEYS 1 +#define NEED_GET 1 #include "keydb.c" /** @@ -347,7 +349,8 @@ static void hkp_cleanupdb(struct onak_dbctx *dbctx) * * We initialize CURL here. */ -struct onak_dbctx *keydb_hkp_init(struct onak_db_config *dbcfg, bool readonly) +struct onak_dbctx *keydb_hkp_init(struct onak_db_config *dbcfg, + __unused bool readonly) { struct onak_dbctx *dbctx; struct onak_hkp_dbctx *privctx; @@ -363,8 +366,9 @@ struct onak_dbctx *keydb_hkp_init(struct onak_db_config *dbcfg, bool readonly) dbctx->cleanupdb = hkp_cleanupdb; dbctx->starttrans = hkp_starttrans; dbctx->endtrans = hkp_endtrans; - dbctx->fetch_key_id = hkp_fetch_key_id; + dbctx->fetch_key = generic_fetch_key; dbctx->fetch_key_fp = hkp_fetch_key_fp; + dbctx->fetch_key_id = hkp_fetch_key_id; dbctx->fetch_key_text = hkp_fetch_key_text; dbctx->store_key = hkp_store_key; dbctx->update_keys = generic_update_keys;