]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - keydb_pg.c
Make keyd background itself by default
[onak.git] / keydb_pg.c
index 25881c0820e1c09d8992b88d6947edd0e260e274..85ea50060b5b12a58cad35badabb066d9d9043a8 100644 (file)
@@ -218,7 +218,7 @@ static int pg_fetch_key_text(const char *search,
 
        newsearch = malloc(strlen(search) * 2 + 1);
        memset(newsearch, 0, strlen(search) * 2 + 1);
 
        newsearch = malloc(strlen(search) * 2 + 1);
        memset(newsearch, 0, strlen(search) * 2 + 1);
-       PQescapeString(newsearch, search, strlen(search));
+       PQescapeStringConn(dbconn, newsearch, search, strlen(search), NULL);
        snprintf(statement, 1023,
                        "SELECT DISTINCT onak_keys.keydata FROM onak_keys, "
                        "onak_uids WHERE onak_keys.keyid = onak_uids.keyid "
        snprintf(statement, 1023,
                        "SELECT DISTINCT onak_keys.keydata FROM onak_keys, "
                        "onak_uids WHERE onak_keys.keyid = onak_uids.keyid "
@@ -408,8 +408,8 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
                        safeuid = malloc(strlen(uids[i]) * 2 + 1);
                        if (safeuid != NULL) {
                                memset(safeuid, 0, strlen(uids[i]) * 2 + 1);
                        safeuid = malloc(strlen(uids[i]) * 2 + 1);
                        if (safeuid != NULL) {
                                memset(safeuid, 0, strlen(uids[i]) * 2 + 1);
-                               PQescapeString(safeuid, uids[i],
-                                               strlen(uids[i]));
+                               PQescapeStringConn(dbconn, safeuid, uids[i],
+                                               strlen(uids[i]), NULL);
 
                                snprintf(statement, 1023,
                                        "INSERT INTO onak_uids "
 
                                snprintf(statement, 1023,
                                        "INSERT INTO onak_uids "
@@ -608,7 +608,7 @@ static int pg_iterate_keys(void (*iterfunc)(void *ctx,
                        } else {
                                read_openpgp_stream(keydb_fetchchar, &fd,
                                                &packets, 0);
                        } else {
                                read_openpgp_stream(keydb_fetchchar, &fd,
                                                &packets, 0);
-                               parse_keys(packets, key);
+                               parse_keys(packets, &key);
                                lo_close(dbconn, fd);
 
                                iterfunc(ctx, key);
                                lo_close(dbconn, fd);
 
                                iterfunc(ctx, key);