X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb_db4.c;h=aa2f229c01c3c4fc5f3e6d7dd1bd69b6e3045c18;hb=fd9ca85878543771a7f09afd821a5a5511e71aea;hp=288e467b6246f270aa22a3d60e79965f476395d3;hpb=46ebdd20784c242ca96b949813d90167349177d9;p=onak.git
diff --git a/keydb_db4.c b/keydb_db4.c
index 288e467..aa2f229 100644
--- a/keydb_db4.c
+++ b/keydb_db4.c
@@ -13,8 +13,7 @@
* more details.
*
* You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program. If not, see .
*/
#include
@@ -23,6 +22,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -37,7 +38,9 @@
#include "decodekey.h"
#include "keystructs.h"
#include "mem.h"
+#include "ll.h"
#include "log.h"
+#include "onak.h"
#include "onak-conf.h"
#include "parsekey.h"
#include "wordlist.h"
@@ -161,16 +164,18 @@ static void db4_endtrans(struct onak_dbctx *dbctx)
* we're running with a newer version of db4 than the database was
* created with.
*/
-static int db4_upgradedb(struct onak_db4_dbctx *privctx)
+static int db4_upgradedb(struct onak_dbctx *dbctx)
{
+ struct onak_db4_dbctx *privctx = (struct onak_db4_dbctx *) dbctx->priv;
DB *curdb = NULL;
int ret;
int i;
char buf[1024];
int lockfile_fd;
struct stat statbuf;
+ ssize_t written;
- snprintf(buf, sizeof(buf) - 1, "%s/%s", config.db_dir,
+ snprintf(buf, sizeof(buf) - 1, "%s/%s", dbctx->config->location,
DB4_UPGRADE_FILE);
lockfile_fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0600);
if (lockfile_fd < 0) {
@@ -184,21 +189,29 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
}
}
snprintf(buf, sizeof(buf) - 1, "%d", getpid());
- write(lockfile_fd, buf, strlen(buf));
+ written = write(lockfile_fd, buf, strlen(buf));
close(lockfile_fd);
+ if (written != strlen(buf)) {
+ logthing(LOGTHING_CRITICAL, "Couldn't write PID to lockfile: "
+ "%s", strerror(errno));
+ snprintf(buf, sizeof(buf) - 1, "%s/%s", dbctx->config->location,
+ DB4_UPGRADE_FILE);
+ unlink(buf);
+ return -1;
+ }
logthing(LOGTHING_NOTICE, "Upgrading DB4 database");
ret = db_env_create(&privctx->dbenv, 0);
if (ret == 0) {
privctx->dbenv->set_errcall(privctx->dbenv, &db4_errfunc);
- privctx->dbenv->remove(privctx->dbenv, config.db_dir, 0);
+ privctx->dbenv->remove(privctx->dbenv, dbctx->config->location, 0);
privctx->dbenv = NULL;
}
for (i = 0; i < privctx->numdbs; i++) {
ret = db_create(&curdb, NULL, 0);
if (ret == 0) {
snprintf(buf, sizeof(buf) - 1, "%s/keydb.%d.db",
- config.db_dir, i);
+ dbctx->config->location, i);
logthing(LOGTHING_DEBUG, "Upgrading %s", buf);
curdb->upgrade(curdb, buf, 0);
curdb->close(curdb, 0);
@@ -211,7 +224,7 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
ret = db_create(&curdb, NULL, 0);
if (ret == 0) {
- snprintf(buf, sizeof(buf) - 1, "%s/worddb", config.db_dir);
+ snprintf(buf, sizeof(buf) - 1, "%s/worddb", dbctx->config->location);
logthing(LOGTHING_DEBUG, "Upgrading %s", buf);
curdb->upgrade(curdb, buf, 0);
curdb->close(curdb, 0);
@@ -223,7 +236,7 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
ret = db_create(&curdb, NULL, 0);
if (ret == 0) {
- snprintf(buf, sizeof(buf) - 1, "%s/id32db", config.db_dir);
+ snprintf(buf, sizeof(buf) - 1, "%s/id32db", dbctx->config->location);
logthing(LOGTHING_DEBUG, "Upgrading %s", buf);
curdb->upgrade(curdb, buf, 0);
curdb->close(curdb, 0);
@@ -235,7 +248,7 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
ret = db_create(&curdb, NULL, 0);
if (ret == 0) {
- snprintf(buf, sizeof(buf) - 1, "%s/id64db", config.db_dir);
+ snprintf(buf, sizeof(buf) - 1, "%s/id64db", dbctx->config->location);
logthing(LOGTHING_DEBUG, "Upgrading %s", buf);
curdb->upgrade(curdb, buf, 0);
curdb->close(curdb, 0);
@@ -247,7 +260,7 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
ret = db_create(&curdb, NULL, 0);
if (ret == 0) {
- snprintf(buf, sizeof(buf) - 1, "%s/skshashdb", config.db_dir);
+ snprintf(buf, sizeof(buf) - 1, "%s/skshashdb", dbctx->config->location);
logthing(LOGTHING_DEBUG, "Upgrading %s", buf);
curdb->upgrade(curdb, buf, 0);
curdb->close(curdb, 0);
@@ -259,7 +272,7 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
ret = db_create(&curdb, NULL, 0);
if (ret == 0) {
- snprintf(buf, sizeof(buf) - 1, "%s/subkeydb", config.db_dir);
+ snprintf(buf, sizeof(buf) - 1, "%s/subkeydb", dbctx->config->location);
logthing(LOGTHING_DEBUG, "Upgrading %s", buf);
curdb->upgrade(curdb, buf, 0);
curdb->close(curdb, 0);
@@ -269,7 +282,7 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
db_strerror(ret));
}
- snprintf(buf, sizeof(buf) - 1, "%s/%s", config.db_dir,
+ snprintf(buf, sizeof(buf) - 1, "%s/%s", dbctx->config->location,
DB4_UPGRADE_FILE);
unlink(buf);
@@ -281,7 +294,11 @@ static int db4_upgradedb(struct onak_db4_dbctx *privctx)
* @keyid: The 32bit keyid.
*
* This function maps a 32bit key id to the full 64bit one. It returns the
- * full keyid. If the key isn't found a keyid of 0 is returned.
+ * first full keyid that has this short keyid. If the key isn't found a
+ * keyid of 0 is returned.
+ *
+ * FIXME: This should either return the fingerprint or ideally go away
+ * entirely.
*/
static uint64_t db4_getfullkeyid(struct onak_dbctx *dbctx, uint64_t keyid)
{
@@ -316,14 +333,11 @@ static uint64_t db4_getfullkeyid(struct onak_dbctx *dbctx, uint64_t keyid)
DB_SET);
if (ret == 0) {
- if (data.size == 8) {
- keyid = * (uint64_t *) data.data;
- } else {
- keyid = 0;
- for (i = 12; i < 20; i++) {
- keyid <<= 8;
- keyid |= ((uint8_t *) data.data)[i];
- }
+ keyid = 0;
+ /* Only works for v4, not v3 or v5 */
+ for (i = 12; i < 20; i++) {
+ keyid <<= 8;
+ keyid |= ((uint8_t *) data.data)[i];
}
if (data.data != NULL) {
@@ -452,87 +466,68 @@ static int db4_fetch_key_id(struct onak_dbctx *dbctx, uint64_t keyid,
struct onak_db4_dbctx *privctx = (struct onak_db4_dbctx *) dbctx->priv;
struct openpgp_packet_list *packets = NULL;
DBT key, data;
+ DBC *cursor = NULL;
int ret = 0;
int numkeys = 0;
- struct buffer_ctx fetchbuf;
+ uint32_t shortkeyid = 0;
struct openpgp_fingerprint fingerprint;
+ bool first;
- if (keyid < 0x100000000LL) {
- keyid = db4_getfullkeyid(dbctx, keyid);
+ if (!intrans) {
+ db4_starttrans(dbctx);
}
- memset(&key, 0, sizeof(key));
- memset(&data, 0, sizeof(data));
+ /* If the key ID fits in 32 bits assume it's a short key id */
+ if (keyid < 0x100000000LL) {
+ ret = privctx->id32db->cursor(privctx->id32db,
+ privctx->txn,
+ &cursor,
+ 0); /* flags */
- data.size = 0;
- data.data = NULL;
+ shortkeyid = keyid & 0xFFFFFFFF;
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ key.data = &shortkeyid;
+ key.size = sizeof(shortkeyid);
+ } else {
+ ret = privctx->id64db->cursor(privctx->id64db,
+ privctx->txn,
+ &cursor,
+ 0); /* flags*/
- key.size = sizeof(keyid);
- key.data = &keyid;
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ key.data = &keyid;
+ key.size = sizeof(keyid);
+ }
- if (!intrans) {
- db4_starttrans(dbctx);
+ if (ret != 0) {
+ return 0;
}
- /*
- * First we try a legacy stored key where we used the 64 bit key ID
- * as the DB key.
- */
- ret = keydb_id(privctx, keyid)->get(keydb_id(privctx, keyid),
- privctx->txn,
- &key,
- &data,
- 0); /* flags*/
+ memset(&data, 0, sizeof(data));
+ data.ulen = MAX_FINGERPRINT_LEN;
+ data.data = fingerprint.fp;
+ data.flags = DB_DBT_USERMEM;
+
+ first = true;
+ while (cursor->c_get(cursor, &key, &data,
+ first ? DB_SET : DB_NEXT_DUP) == 0) {
+ /* We got a match; retrieve the actual key */
+ fingerprint.length = data.size;
+
+ if (db4_fetch_key_fp(dbctx, &fingerprint,
+ publickey, true))
+ numkeys++;
- if (ret == DB_NOTFOUND) {
- /* If we didn't find the key ID try the 64 bit map DB */
- memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
data.ulen = MAX_FINGERPRINT_LEN;
data.data = fingerprint.fp;
data.flags = DB_DBT_USERMEM;
- key.size = sizeof(keyid);
- key.data = &keyid;
-
- ret = privctx->id64db->get(privctx->id64db,
- privctx->txn,
- &key,
- &data,
- 0); /* flags*/
-
- if (ret == 0) {
- /* We got a match; retrieve the actual key */
- fingerprint.length = data.size;
-
- memset(&key, 0, sizeof(key));
- memset(&data, 0, sizeof(data));
- key.size = fingerprint.length;
- key.data = fingerprint.fp;
-
- ret = keydb_fp(privctx, &fingerprint)->get(
- keydb_fp(privctx, &fingerprint),
- privctx->txn,
- &key,
- &data,
- 0); /* flags*/
- }
- }
-
- if (ret == 0) {
- fetchbuf.buffer = data.data;
- fetchbuf.offset = 0;
- fetchbuf.size = data.size;
- read_openpgp_stream(buffer_fetchchar, &fetchbuf,
- &packets, 0);
- parse_keys(packets, publickey);
- free_packet_list(packets);
- packets = NULL;
- numkeys++;
- } else if (ret != DB_NOTFOUND) {
- logthing(LOGTHING_ERROR,
- "Problem retrieving key: %s",
- db_strerror(ret));
+ first = false;
}
+ cursor->c_close(cursor);
+ cursor = NULL;
if (!intrans) {
db4_endtrans(dbctx);
@@ -602,18 +597,9 @@ static int db4_fetch_key_text(struct onak_dbctx *dbctx, const char *search,
while (ret == 0 && strncmp(key.data, curword->object,
key.size) == 0 &&
((char *) curword->object)[key.size] == 0) {
- if (data.size == 12) {
- /* Old style creation + key id */
- fingerprint.length = 8;
- for (i = 4; i < 12; i++) {
- fingerprint.fp[i - 4] =
- ((unsigned char *)
- data.data)[i];
- }
- } else {
- fingerprint.length = data.size;
- memcpy(fingerprint.fp, data.data, data.size);
- }
+
+ fingerprint.length = data.size;
+ memcpy(fingerprint.fp, data.data, data.size);
/*
* Only add the keys containing this word if this is
@@ -656,20 +642,9 @@ static int db4_fetch_key_text(struct onak_dbctx *dbctx, const char *search,
db4_starttrans(dbctx);
for (i = 0; i < keylist.count; i++) {
- if (keylist.keys[i].length == 8) {
- keyid = 0;
- for (int j = 0; j < 8; j++) {
- keyid <<= 8;
- keyid |= keylist.keys[i].fp[j];
- }
- numkeys += db4_fetch_key_id(dbctx, keyid,
- publickey,
- true);
- } else {
- numkeys += db4_fetch_key_fp(dbctx, &keylist.keys[i],
- publickey,
- true);
- }
+ numkeys += db4_fetch_key_fp(dbctx, &keylist.keys[i],
+ publickey,
+ true);
}
array_free(&keylist);
free(searchtext);
@@ -705,7 +680,9 @@ static int db4_fetch_key_skshash(struct onak_dbctx *dbctx,
memset(&data, 0, sizeof(data));
key.data = (void *) hash->hash;
key.size = sizeof(hash->hash);
- data.flags = DB_DBT_MALLOC;
+ data.ulen = MAX_FINGERPRINT_LEN;
+ data.data = fingerprint.fp;
+ data.flags = DB_DBT_USERMEM;
ret = cursor->c_get(cursor,
&key,
@@ -713,22 +690,9 @@ static int db4_fetch_key_skshash(struct onak_dbctx *dbctx,
DB_SET);
if (ret == 0) {
- if (data.size == 8) {
- /* Legacy key ID record */
- keyid = *(uint64_t *) data.data;
- count = db4_fetch_key_id(dbctx, keyid, publickey,
- false);
- } else {
- fingerprint.length = data.size;
- memcpy(fingerprint.fp, data.data, data.size);
- count = db4_fetch_key_fp(dbctx, &fingerprint,
- publickey, false);
- }
-
- if (data.data != NULL) {
- free(data.data);
- data.data = NULL;
- }
+ fingerprint.length = data.size;
+ count = db4_fetch_key_fp(dbctx, &fingerprint,
+ publickey, false);
}
cursor->c_close(cursor);
@@ -772,7 +736,9 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
}
if (db4_fetch_key_id(dbctx, keyid, &publickey, true) == 0) {
- db4_endtrans(dbctx);
+ if (!intrans) {
+ db4_endtrans(dbctx);
+ }
return 1;
}
@@ -804,32 +770,9 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
data.size = sizeof(worddb_data);
/*
- * Old format word db data was the key creation time
- * followed by the 64 bit key id.
+ * New style uses the fingerprint as the data
+ * Old (unsupported) style was the 64 bit keyid
*/
- worddb_data[ 0] = publickey->publickey->data[1];
- worddb_data[ 1] = publickey->publickey->data[2];
- worddb_data[ 2] = publickey->publickey->data[3];
- worddb_data[ 3] = publickey->publickey->data[4];
- worddb_data[ 4] = (keyid >> 56) & 0xFF;
- worddb_data[ 5] = (keyid >> 48) & 0xFF;
- worddb_data[ 6] = (keyid >> 40) & 0xFF;
- worddb_data[ 7] = (keyid >> 32) & 0xFF;
- worddb_data[ 8] = (keyid >> 24) & 0xFF;
- worddb_data[ 9] = (keyid >> 16) & 0xFF;
- worddb_data[10] = (keyid >> 8) & 0xFF;
- worddb_data[11] = keyid & 0xFF;
-
- ret = cursor->c_get(cursor,
- &key,
- &data,
- DB_GET_BOTH);
-
- if (ret == 0) {
- ret = cursor->c_del(cursor, 0);
- }
-
- /* New style just uses the fingerprint as the data */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = curword->object;
@@ -882,26 +825,9 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
&cursor64,
0); /* flags */
+ /* 32 bit short key mapping to fingerprint */
shortkeyid = keyid & 0xFFFFFFFF;
- /* Old style mapping to 64 bit key id */
- memset(&key, 0, sizeof(key));
- memset(&data, 0, sizeof(data));
- key.data = &shortkeyid;
- key.size = sizeof(shortkeyid);
- data.data = &keyid;
- data.size = sizeof(keyid);
-
- ret = cursor->c_get(cursor,
- &key,
- &data,
- DB_GET_BOTH);
-
- if (ret == 0) {
- ret = cursor->c_del(cursor, 0);
- }
-
- /* New style mapping to fingerprint */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = &shortkeyid;
@@ -979,23 +905,6 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
shortkeyid = subkeyid & 0xFFFFFFFF;
- /* Remove 32 bit keyid -> 64 bit keyid mapping */
- memset(&key, 0, sizeof(key));
- memset(&data, 0, sizeof(data));
- key.data = &shortkeyid;
- key.size = sizeof(shortkeyid);
- data.data = &keyid;
- data.size = sizeof(keyid);
-
- ret = cursor->c_get(cursor,
- &key,
- &data,
- DB_GET_BOTH);
-
- if (ret == 0) {
- ret = cursor->c_del(cursor, 0);
- }
-
/* Remove 32 bit keyid -> fingerprint mapping */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
@@ -1032,13 +941,13 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
data.data = fingerprint.fp;
data.size = fingerprint.length;
- ret = cursor->c_get(cursor,
+ ret = cursor64->c_get(cursor64,
&key,
&data,
DB_GET_BOTH);
if (ret == 0) {
- ret = cursor->c_del(cursor, 0);
+ ret = cursor64->c_del(cursor64, 0);
}
if (ret != 0 && ret != DB_NOTFOUND) {
@@ -1071,24 +980,7 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
if (ret == 0) {
get_skshash(publickey, &hash);
- /* First delete old style keyid mapping */
- memset(&key, 0, sizeof(key));
- memset(&data, 0, sizeof(data));
- key.data = hash.hash;
- key.size = sizeof(hash.hash);
- data.data = &keyid;
- data.size = sizeof(keyid);
-
- ret = cursor->c_get(cursor,
- &key,
- &data,
- DB_GET_BOTH);
-
- if (ret == 0) {
- ret = cursor->c_del(cursor, 0);
- }
-
- /* Then delete new style fingerprint mapping */
+ /* Remove SKS hash -> fingerprint mapping */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = hash.hash;
@@ -1124,6 +1016,16 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
publickey = NULL;
if (!deadlock) {
+ key.data = fingerprint.fp;
+ key.size = fingerprint.length;
+
+ keydb_fp(privctx, &fingerprint)->del(keydb_fp(privctx,
+ &fingerprint),
+ privctx->txn,
+ &key,
+ 0); /* flags */
+
+ /* Delete old style 64 bit keyid */
key.data = &keyid;
key.size = sizeof(keyid);
@@ -1218,8 +1120,8 @@ static int db4_store_key(struct onak_dbctx *dbctx,
write_openpgp_stream(buffer_putchar, &storebuf, packets);
/*
- * Now we have the key data store it in the DB; the keyid is
- * the key.
+ * Now we have the key data store it in the DB; the fingerprint
+ * is the key.
*/
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
@@ -1253,7 +1155,8 @@ static int db4_store_key(struct onak_dbctx *dbctx,
}
/*
- * Walk through our uids storing the words into the db with the keyid.
+ * Walk through our uids storing the words into the db with the
+ * fingerprint.
*/
if (!deadlock) {
uids = keyuids(publickey, &primary);
@@ -1605,7 +1508,7 @@ static void db4_cleanupdb(struct onak_dbctx *dbctx)
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
-struct onak_dbctx *keydb_db4_init(bool readonly)
+struct onak_dbctx *keydb_db4_init(struct onak_db_config *dbcfg, bool readonly)
{
char buf[1024];
FILE *numdb = NULL;
@@ -1621,6 +1524,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
if (dbctx == NULL) {
return NULL;
}
+ dbctx->config = dbcfg;
dbctx->priv = privctx = calloc(1, sizeof(*privctx));
if (privctx == NULL) {
free(dbctx);
@@ -1630,7 +1534,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
/* Default to 16 key data DBs */
privctx->numdbs = 16;
- snprintf(buf, sizeof(buf) - 1, "%s/%s", config.db_dir,
+ snprintf(buf, sizeof(buf) - 1, "%s/%s", dbcfg->location,
DB4_UPGRADE_FILE);
ret = stat(buf, &statbuf);
while ((ret == 0) || (errno != ENOENT)) {
@@ -1645,7 +1549,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
}
ret = 0;
- snprintf(buf, sizeof(buf) - 1, "%s/num_keydb", config.db_dir);
+ snprintf(buf, sizeof(buf) - 1, "%s/num_keydb", dbcfg->location);
numdb = fopen(buf, "r");
if (numdb != NULL) {
if (fgets(buf, sizeof(buf), numdb) != NULL) {
@@ -1685,12 +1589,14 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
* Up the number of locks we're allowed at once. We base this on
* the maximum number of keys we're going to return.
*/
- maxlocks = config.maxkeys * 16;
- if (maxlocks < 1000) {
- maxlocks = 1000;
+ if (ret == 0) {
+ maxlocks = config.maxkeys * 16;
+ if (maxlocks < 1000) {
+ maxlocks = 1000;
+ }
+ privctx->dbenv->set_lk_max_locks(privctx->dbenv, maxlocks);
+ privctx->dbenv->set_lk_max_objects(privctx->dbenv, maxlocks);
}
- privctx->dbenv->set_lk_max_locks(privctx->dbenv, maxlocks);
- privctx->dbenv->set_lk_max_objects(privctx->dbenv, maxlocks);
/*
* Enable deadlock detection so that we don't block indefinitely on
@@ -1707,7 +1613,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
}
if (ret == 0) {
- ret = privctx->dbenv->open(privctx->dbenv, config.db_dir,
+ ret = privctx->dbenv->open(privctx->dbenv, dbcfg->location,
DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_LOCK |
DB_INIT_TXN |
DB_CREATE,
@@ -1716,7 +1622,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
if (ret == DB_VERSION_MISMATCH) {
privctx->dbenv->close(privctx->dbenv, 0);
privctx->dbenv = NULL;
- ret = db4_upgradedb(privctx);
+ ret = db4_upgradedb(dbctx);
if (ret == 0) {
ret = db_env_create(&privctx->dbenv, 0);
}
@@ -1726,7 +1632,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
privctx->dbenv->set_lk_detect(privctx->dbenv,
DB_LOCK_DEFAULT);
ret = privctx->dbenv->open(privctx->dbenv,
- config.db_dir,
+ dbcfg->location,
DB_INIT_LOG | DB_INIT_MPOOL |
DB_INIT_LOCK | DB_INIT_TXN |
DB_CREATE | DB_RECOVER,
@@ -1745,7 +1651,7 @@ struct onak_dbctx *keydb_db4_init(bool readonly)
if (ret != 0) {
logthing(LOGTHING_CRITICAL,
"Error opening db environment: %s (%s)",
- config.db_dir,
+ dbcfg->location,
db_strerror(ret));
if (privctx->dbenv != NULL) {
privctx->dbenv->close(privctx->dbenv, 0);