1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

dsdb: move tombstone lifetime calculation out of dsdb_garbage_collect_tombstones()

This will allow it to be specified by the caller when we add python bindings

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12382
(cherry picked from commit 824220e9bd7ffb9457ffc5a5bf0b5d279146f85c)
This commit is contained in:
Andrew Bartlett 2016-08-29 19:02:39 +12:00 committed by Karolin Seeger
parent 6a2ed191fb
commit 8f4f4fbcb4
3 changed files with 14 additions and 10 deletions

View File

@ -36,16 +36,10 @@ NTSTATUS dsdb_garbage_collect_tombstones(TALLOC_CTX *mem_ctx, struct loadparm_co
struct ldb_context *samdb,
struct dsdb_ldb_dn_list_node *part,
time_t current_time,
bool do_fs)
bool do_fs,
uint32_t tombstoneLifetime)
{
int ret;
uint32_t tombstoneLifetime;
ret = dsdb_tombstone_lifetime(samdb, &tombstoneLifetime);
if (ret != LDB_SUCCESS) {
DEBUG(1,(__location__ ": Failed to get tombstone lifetime\n"));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
for (; part != NULL; part = part->next) {
struct ldb_dn *do_dn;

View File

@ -28,4 +28,5 @@ NTSTATUS dsdb_garbage_collect_tombstones(TALLOC_CTX *mem_ctx, struct loadparm_co
struct ldb_context *samdb,
struct dsdb_ldb_dn_list_node *part,
time_t current_time,
bool do_fs);
bool do_fs,
uint32_t tombstoneLifetime);

View File

@ -601,7 +601,9 @@ WERROR kccsrv_periodic_schedule(struct kccsrv_service *service, uint32_t next_in
*/
static NTSTATUS kccsrv_check_deleted(struct kccsrv_service *s, TALLOC_CTX *mem_ctx)
{
int ret;
bool do_fs = false;
uint32_t tombstoneLifetime;
time_t current = time(NULL);
time_t interval = lpcfg_parm_int(s->task->lp_ctx, NULL, "kccsrv",
"check_deleted_full_scan_interval", 86400);
@ -629,8 +631,15 @@ static NTSTATUS kccsrv_check_deleted(struct kccsrv_service *s, TALLOC_CTX *mem_c
s->last_full_scan_deleted_check = current - ((9 * interval) / 10);
}
ret = dsdb_tombstone_lifetime(s->samdb, &tombstoneLifetime);
if (ret != LDB_SUCCESS) {
DEBUG(1,(__location__ ": Failed to get tombstone lifetime\n"));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
return dsdb_garbage_collect_tombstones(mem_ctx, s->task->lp_ctx, s->samdb,
s->partitions, current, do_fs);
s->partitions, current, do_fs,
tombstoneLifetime);
}
static void kccsrv_periodic_run(struct kccsrv_service *service)