1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

ldb_tdb: Clean up index records on ltdb_index_add_new() failure.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2017-09-08 18:07:51 +12:00
parent 83bc607463
commit 29c303f21b

View File

@ -2038,10 +2038,29 @@ int ltdb_index_add_new(struct ldb_module *module,
ret = ltdb_index_add_all(module, ltdb, msg);
if (ret != LDB_SUCCESS) {
/*
* Because we can't trust the caller to be doing
* transactions properly, clean up any index for this
* entry rather than relying on a transaction
* cleanup
*/
ltdb_index_delete(module, msg);
return ret;
}
return ltdb_index_onelevel(module, msg, 1);
ret = ltdb_index_onelevel(module, msg, 1);
if (ret != LDB_SUCCESS) {
/*
* Because we can't trust the caller to be doing
* transactions properly, clean up any index for this
* entry rather than relying on a transaction
* cleanup
*/
ltdb_index_delete(module, msg);
return ret;
}
return ret;
}