X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb_keyd.c;h=e8f9961b79a6d2f9364ec53e6dd42abe70953ec5;hb=70842462a490e56a607a48b2d27807816c4d8a80;hp=acbdcff14cb2d96fbbeaad66caa19cc27642a48a;hpb=0c120d1895d25b59abe338862189be1b87447569;p=onak.git diff --git a/keydb_keyd.c b/keydb_keyd.c index acbdcff..e8f9961 100644 --- a/keydb_keyd.c +++ b/keydb_keyd.c @@ -13,8 +13,7 @@ * more details. * * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * this program. If not, see . */ #include @@ -188,19 +187,19 @@ static int keyd_fetch_key_fp(struct onak_dbctx *dbctx, /** * delete_key - Given a keyid delete the key from storage. -* @keyid: The keyid to delete. + * @fp: The fingerprint of the key to delete. * @intrans: If we're already in a transaction. * * This function deletes a public key from whatever storage mechanism we * are using. Returns 0 if the key existed. */ static int keyd_delete_key(struct onak_dbctx *dbctx, - uint64_t keyid, bool intrans) + struct openpgp_fingerprint *fp, bool intrans) { int keyd_fd = (intptr_t) dbctx->priv; if (keyd_send_cmd(keyd_fd, KEYD_CMD_DELETE)) { - write(keyd_fd, &keyid, sizeof(keyid)); + write(keyd_fd, fp, sizeof(*fp)); } return 0; @@ -362,31 +361,6 @@ static int keyd_fetch_key_skshash(struct onak_dbctx *dbctx, return (count > 0) ? 1 : 0; } - -/** - * getfullkeyid - Maps a 32bit key id to a 64bit one. - * @keyid: The 32bit keyid. - * - * This function maps a 32bit key id to the full 64bit one. It returns the - * full keyid. If the key isn't found a keyid of 0 is returned. - */ -static uint64_t keyd_getfullkeyid(struct onak_dbctx *dbctx, uint64_t keyid) -{ - int keyd_fd = (intptr_t) dbctx->priv; - uint32_t cmd = KEYD_CMD_GETFULLKEYID; - - if (keyd_send_cmd(keyd_fd, KEYD_CMD_GETFULLKEYID)) { - write(keyd_fd, &keyid, sizeof(keyid)); - read(keyd_fd, &cmd, sizeof(cmd)); - if (cmd != sizeof(keyid)) { - return 0; - } - read(keyd_fd, &keyid, sizeof(keyid)); - } - - return keyid; -} - /** * iterate_keys - call a function once for each key in the db. * @iterfunc: The function to call. @@ -595,7 +569,6 @@ struct onak_dbctx *keydb_keyd_init(struct onak_db_config *dbcfg, bool readonly) dbctx->getkeysigs = generic_getkeysigs; dbctx->cached_getkeysigs = generic_cached_getkeysigs; dbctx->keyid2uid = generic_keyid2uid; - dbctx->getfullkeyid = keyd_getfullkeyid; dbctx->iterate_keys = keyd_iterate_keys; return dbctx;