]> git.sommitrealweird.co.uk Git - onak.git/commitdiff
Fix PostgreSQL backend compilation
authorJonathan McDowell <noodles@earth.li>
Sun, 29 Sep 2013 21:51:18 +0000 (22:51 +0100)
committerJonathan McDowell <noodles@earth.li>
Sun, 29 Sep 2013 21:51:18 +0000 (22:51 +0100)
This got missed with the changes to get_keyid.

keydb_pg.c

index 8e0543b9f061210c5afda582f889d1d0009156cc..1ec0a1a570e16fb0c71397a7055b2207dc213944 100644 (file)
@@ -369,12 +369,15 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
        char *primary = NULL;
        char *safeuid = NULL;
        int i;
+       uint64_t keyid;
 
        if (!intrans) {
                result = PQexec(dbconn, "BEGIN");
                PQclear(result);
        }
 
+       get_keyid(publickey, &keyid);
+
        /*
         * Delete the key if we already have it.
         *
@@ -384,7 +387,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
         * it definitely needs updated.
         */
        if (update) {
-               pg_delete_key(get_keyid(publickey), true);
+               pg_delete_key(keyid, true);
        }
 
        next = publickey->next;
@@ -406,7 +409,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
        snprintf(statement, 1023, 
                        "INSERT INTO onak_keys (keyid, keydata) VALUES "
                        "('%" PRIX64 "', '%d')", 
-                       get_keyid(publickey),
+                       keyid,
                        key_oid);
        result = PQexec(dbconn, statement);
 
@@ -429,7 +432,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
                                        "INSERT INTO onak_uids "
                                        "(keyid, uid, pri) "
                                        "VALUES ('%" PRIX64 "', '%s', '%c')",
-                                       get_keyid(publickey),
+                                       keyid,
                                        safeuid,
                                        (uids[i] == primary) ? 't' : 'f');
                                result = PQexec(dbconn, statement);
@@ -464,7 +467,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
                                "INSERT INTO onak_sigs (signer, signee) "
                                "VALUES ('%" PRIX64 "', '%" PRIX64 "')",
                                sig_keyid(packets->packet),
-                               get_keyid(publickey));
+                               keyid);
                        result = PQexec(dbconn, statement);
                        PQclear(result);
                }