#include "charfuncs.h"
#include "keydb.h"
#include "keyid.h"
-#include "keyindex.h"
+#include "decodekey.h"
#include "keystructs.h"
#include "mem.h"
#include "onak-conf.h"
char buf[1024];
int ret = 0;
- strcpy(buf, config.db2_dbpath);
+ strcpy(buf, config.db_dir);
strcat(buf, "/keydb.db");
ret = db_create(&dbconn, NULL, 0);
exit(1);
}
- strcpy(buf, config.db2_dbpath);
+ strcpy(buf, config.db_dir);
strcat(buf, "/worddb");
ret = db_create(&worddb, NULL, 0);
read_openpgp_stream(buffer_fetchchar, &fetchbuf,
&packets);
parse_keys(packets, publickey);
+ free_packet_list(packets);
+ packets = NULL;
numkeys++;
} else if (ret != DB_NOTFOUND) {
dbconn->err(dbconn, ret, "Problem retrieving key");
llfind(keylist, data.data,
worddb_cmp) != NULL) {
newkeylist = lladd(newkeylist, data.data);
+ data.data = NULL;
} else {
free(data.data);
data.data = NULL;
llfree(keylist, free);
keylist = newkeylist;
newkeylist = NULL;
+ if (data.data != NULL) {
+ free(data.data);
+ data.data = NULL;
+ }
}
+ llfree(wordlist, NULL);
+ wordlist = NULL;
- for (newkeylist = keylist; newkeylist != NULL;
+ for (newkeylist = keylist;
+ newkeylist != NULL && numkeys < config.maxkeys;
newkeylist = newkeylist->next) {
keyid = 0;
dbconn->err(dbconn, ret, "Problem storing key");
}
+ free(storebuf.buffer);
+ storebuf.buffer = NULL;
+ storebuf.size = 0;
+ storebuf.offset = 0;
+
+ free_packet_list(packets);
+ packets = NULL;
+
/*
* Walk through our uids storing the words into the db with the keyid.
*/