X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb_db4.c;h=b36ce3f65dba9e18408c0b86c6e6f35c72600f6b;hb=8aefbded3634aff93af5aa094094ca87c0e64239;hp=288e467b6246f270aa22a3d60e79965f476395d3;hpb=46ebdd20784c242ca96b949813d90167349177d9;p=onak.git diff --git a/keydb_db4.c b/keydb_db4.c index 288e467..b36ce3f 100644 --- a/keydb_db4.c +++ b/keydb_db4.c @@ -772,7 +772,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; } @@ -826,7 +828,7 @@ static int db4_delete_key(struct onak_dbctx *dbctx, DB_GET_BOTH); if (ret == 0) { - ret = cursor->c_del(cursor, 0); + cursor->c_del(cursor, 0); } /* New style just uses the fingerprint as the data */ @@ -898,7 +900,7 @@ static int db4_delete_key(struct onak_dbctx *dbctx, DB_GET_BOTH); if (ret == 0) { - ret = cursor->c_del(cursor, 0); + cursor->c_del(cursor, 0); } /* New style mapping to fingerprint */ @@ -993,7 +995,7 @@ static int db4_delete_key(struct onak_dbctx *dbctx, DB_GET_BOTH); if (ret == 0) { - ret = cursor->c_del(cursor, 0); + cursor->c_del(cursor, 0); } /* Remove 32 bit keyid -> fingerprint mapping */ @@ -1032,13 +1034,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) { @@ -1085,7 +1087,7 @@ static int db4_delete_key(struct onak_dbctx *dbctx, DB_GET_BOTH); if (ret == 0) { - ret = cursor->c_del(cursor, 0); + cursor->c_del(cursor, 0); } /* Then delete new style fingerprint mapping */ @@ -1124,6 +1126,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);