Commit bc03e275 authored by Mark Karpilovskij's avatar Mark Karpilovskij Committed by Daniel Salzman

kaspdb: fix failing key deletion and delete all relevant data

parent bfdb41eb
......@@ -471,26 +471,18 @@ int kasp_db_delete_all(kasp_db_t *db, const knot_dname_t *zone_name)
WALK_LIST(n, allkeys) {
key_params_t *parm = n->d;
knot_db_val_t key = make_key(KASPDBKEY_PARAMS, zone_name, parm->id);
ret = db_api->del(txn, &key);
(void)db_api->del(txn, &key);
free_key(&key);
free(parm->id);
free(parm->public_key.data);
memset(parm, 0, sizeof(*parm));
if (ret != KNOT_EOK) {
break;
}
}
ptrlist_deep_free(&allkeys, NULL);
if (ret == KNOT_EOK) {
knot_db_val_t key = make_key(KASPDBKEY_NSEC3SALT, zone_name, NULL);
ret = db_api->del(txn, &key);
for (keyclass_t keyclass = KASPDBKEY_NSEC3SALT; keyclass <= KASPDBKEY_LASTSIGNEDSERIAL; keyclass++) {
knot_db_val_t key = make_key(keyclass, zone_name, NULL);
(void)db_api->del(txn, &key);
free_key(&key);
if (ret == KNOT_EOK) {
key = make_key(KASPDBKEY_NSEC3TIME, zone_name, NULL);
ret = db_api->del(txn, &key);
free_key(&key);
}
}
with_txn_end(NULL, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment