]> the.earth.li Git - onak.git/blobdiff - keydb_fs.c
Add test for blacklisting functionality
[onak.git] / keydb_fs.c
index 01874ee4188da6e1d483a8fffb7bc7115e47ba70..f8d55dc8233dd80a2b92e6878abee3719dc67cd0 100644 (file)
@@ -379,8 +379,13 @@ static int fs_store_key(struct onak_dbctx *dbctx,
                }
 
                get_skshash(publickey, &hash);
-               hashid = (hash.hash[0] << 24) + (hash.hash[1] << 16) +
-                               (hash.hash[2] << 8) + hash.hash[3];
+               hashid = hash.hash[0];
+               hashid <<= 8;
+               hashid |= hash.hash[1];
+               hashid <<= 8;
+               hashid |= hash.hash[2];
+               hashid <<= 8;
+               hashid |= hash.hash[3];
                prove_path_to(hashid, "skshash", dbctx->config->location);
                skshashpath(wbuffer, sizeof(wbuffer), &hash,
                        dbctx->config->location);
@@ -435,6 +440,8 @@ static int fs_delete_key(struct onak_dbctx *dbctx,
 
                        wl = wl->next;
                }
+               llfree(wordlist, free);
+               wordlist = NULL;
 
                subkeyids = keysubkeys(pk);
                i = 0;
@@ -463,6 +470,8 @@ static int fs_delete_key(struct onak_dbctx *dbctx,
        keypath(buffer, sizeof(buffer), keyid, dbctx->config->location);
        unlink(buffer);
 
+       free_publickey(pk);
+
        if (!intrans)
                fs_endtrans(dbctx);
        return 1;