From 16c2190b149a2232aa49a16a41e570410edd2eaf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jul 2008 17:12:04 +0200 Subject: dssync: replace the processing_fn by startup/process/finish ops. This remove static a variable for the keytab context in the keytab processing function and simplifies the signature. The keytab context is instead in the new private data member of the dssync_context struct. This is in preparation of adding support for keeping track of the up-to-date-ness vector, in order to be able to sync diffs instead of the whole database. Michael (This used to be commit c51c3339f35e3bd921080d2e226e2422fc23e1e6) --- source3/libnet/libnet_dssync.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index b55e6d1906..f33369ee4b 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -355,6 +355,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, nc.guid = GUID_zero(); nc.sid = null_sid; + status = ctx->ops->startup(ctx, mem_ctx); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call startup operation: %s", + nt_errstr(status)); + goto out; + } + req.req8.naming_context = &nc; req.req8.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | @@ -423,12 +431,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, last_query = false; } - if (ctx->processing_fn) { - status = ctx->processing_fn(mem_ctx, - ctr1->first_object, - &ctr1->mapping_ctr, - last_query, - ctx); + if (ctx->ops->process_objects) { + status = ctx->ops->process_objects(ctx, mem_ctx, + ctr1->first_object, + &ctr1->mapping_ctr); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call processing function: %s", @@ -466,12 +472,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, last_query = false; } - if (ctx->processing_fn) { - status = ctx->processing_fn(mem_ctx, - ctr6->first_object, - &ctr6->mapping_ctr, - last_query, - ctx); + if (ctx->ops->process_objects) { + status = ctx->ops->process_objects(ctx, mem_ctx, + ctr6->first_object, + &ctr6->mapping_ctr); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call processing function: %s", @@ -485,6 +489,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } } + status = ctx->ops->finish(ctx, mem_ctx); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call finishing operation: %s", + nt_errstr(status)); + goto out; + } + break; } -- cgit