]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - keydb_db2.c
cscvs to tla changeset 59
[onak.git] / keydb_db2.c
index a30b62c43ba3b27413263372315641073d491191..0c597c4b1b1e00584db0c6ebdf7ee50f370ac178 100644 (file)
@@ -21,6 +21,7 @@
 #include "keyid.h"
 #include "keyindex.h"
 #include "keystructs.h"
 #include "keyid.h"
 #include "keyindex.h"
 #include "keystructs.h"
+#include "log.h"
 #include "mem.h"
 #include "onak-conf.h"
 #include "parsekey.h"
 #include "mem.h"
 #include "onak-conf.h"
 #include "parsekey.h"
@@ -78,7 +79,7 @@ void initdb(void)
         */
        db2_env.mp_size = 20 * 1024 * 1024;
 
         */
        db2_env.mp_size = 20 * 1024 * 1024;
 
-       ret = db_appinit(config.db2_dbpath, NULL,
+       ret = db_appinit(config.db_dir, NULL,
                        &db2_env, DB_INIT_MPOOL|DB_INIT_LOCK);
        if (!ret) {
                db2_keydbfiles = (DB **) malloc(sizeof (DB *) * db2_numdb);
                        &db2_env, DB_INIT_MPOOL|DB_INIT_LOCK);
        if (!ret) {
                db2_keydbfiles = (DB **) malloc(sizeof (DB *) * db2_numdb);
@@ -91,13 +92,15 @@ void initdb(void)
                                        &db2_env, &keydbinfo,
                                        &db2_keydbfiles[i]);
                        if (ret) {
                                        &db2_env, &keydbinfo,
                                        &db2_keydbfiles[i]);
                        if (ret) {
-                               fprintf(stderr, "Error opening db file %d (errno %d)\n",
+                               logthing(LOGTHING_CRITICAL,
+                                       "Error opening db file %d (errno %d)",
                                        i, ret);
                                exit(1);
                        }
                }
        } else {
                                        i, ret);
                                exit(1);
                        }
                }
        } else {
-               fprintf(stderr, "Error initializing db (%d).\n", ret);
+               logthing(LOGTHING_CRITICAL, "Error initializing db (%d).",
+                               ret);
                exit(1);
        }
 }
                exit(1);
        }
 }
@@ -183,6 +186,8 @@ int fetch_key(uint64_t keyid, struct openpgp_publickey **publickey,
                fetchbuf.size = data.size;
                read_openpgp_stream(buffer_fetchchar, &fetchbuf, &packets);
                parse_keys(packets, publickey);
                fetchbuf.size = data.size;
                read_openpgp_stream(buffer_fetchchar, &fetchbuf, &packets);
                parse_keys(packets, publickey);
+               free_packet_list(packets);
+               packets = NULL;
        }
 
        return (!ret);
        }
 
        return (!ret);