]> the.earth.li Git - onak.git/blobdiff - keydb_file.c
Don't store a key if we can't get the keyid
[onak.git] / keydb_file.c
index 65e71f559d409b28bb7a9d341f398412788f6eef..4321a682ee762e4c51855858fb746851a0ed0fa2 100644 (file)
@@ -130,7 +130,10 @@ static int file_store_key(struct openpgp_publickey *publickey, bool intrans,
        int fd = -1;
        uint64_t keyid;
 
-       get_keyid(publickey, &keyid);
+       if (get_keyid(publickey, &keyid) != ONAK_E_OK) {
+               logthing(LOGTHING_ERROR, "Couldn't find key ID for key.");
+               return 0;
+       }
        snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
                        keyid & 0xFFFFFFFF);
        fd = open(keyfile, O_WRONLY | O_CREAT, 0664); // | O_EXLOCK);