X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;ds=sidebyside;f=keydb_file.c;h=ded6a9e2e0c8e9db23f245b93e02a20f67e3a369;hb=dfab9e96ee1fa4a10acf9c1cf644d7a4366a5af6;hp=e0ed610e33cd7b976df43c01d9e5e8a216816fe9;hpb=8e0907be1d73011075a99a0c029c56664e12843e;p=onak.git
diff --git a/keydb_file.c b/keydb_file.c
index e0ed610..ded6a9e 100644
--- a/keydb_file.c
+++ b/keydb_file.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
@@ -22,6 +21,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -31,9 +32,9 @@
#include "keydb.h"
#include "keyid.h"
#include "keystructs.h"
-#include "ll.h"
#include "log.h"
#include "mem.h"
+#include "onak.h"
#include "onak-conf.h"
#include "parsekey.h"
@@ -142,20 +143,20 @@ static int file_store_key(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 file_delete_key(struct onak_dbctx *dbctx,
- uint64_t keyid, bool intrans)
+ struct openpgp_fingerprint *fp, bool intrans)
{
char *db_dir = (char *) dbctx->priv;
char keyfile[1024];
snprintf(keyfile, 1023, "%s/0x%" PRIX64, db_dir,
- keyid & 0xFFFFFFFF);
+ fingerprint2keyid(fp) & 0xFFFFFFFF);
return unlink(keyfile);
}
@@ -243,7 +244,6 @@ static int file_iterate_keys(struct onak_dbctx *dbctx,
*/
#define NEED_KEYID2UID 1
#define NEED_GETKEYSIGS 1
-#define NEED_GETFULLKEYID 1
#define NEED_UPDATEKEYS 1
#define NEED_GET_FP 1
#include "keydb.c"
@@ -270,7 +270,7 @@ static void file_cleanupdb(struct onak_dbctx *dbctx)
*
* This is just a no-op for flat file access.
*/
-struct onak_dbctx *keydb_file_init(bool readonly)
+struct onak_dbctx *keydb_file_init(struct onak_db_config *dbcfg, bool readonly)
{
struct onak_dbctx *dbctx;
@@ -279,7 +279,8 @@ struct onak_dbctx *keydb_file_init(bool readonly)
return NULL;
}
- dbctx->priv = strdup(config.db_dir);
+ dbctx->config = dbcfg;
+ dbctx->priv = strdup(dbcfg->location);
dbctx->cleanupdb = file_cleanupdb;
dbctx->starttrans = file_starttrans;
@@ -293,7 +294,6 @@ struct onak_dbctx *keydb_file_init(bool readonly)
dbctx->getkeysigs = generic_getkeysigs;
dbctx->cached_getkeysigs = generic_cached_getkeysigs;
dbctx->keyid2uid = generic_keyid2uid;
- dbctx->getfullkeyid = generic_getfullkeyid;
dbctx->iterate_keys = file_iterate_keys;
return dbctx;