diff options
author | Günther Deschner <gd@samba.org> | 2008-11-17 17:14:19 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-11-18 16:04:46 +0100 |
commit | 677921b9a3176c3feb9f07b8a0ed9e887c3c46fc (patch) | |
tree | b5fc9ea2ef03105f72083720f660ec7df3ca2b18 | |
parent | eef8de5c887e013f5b05742a74fbb130596c62d3 (diff) | |
download | samba-677921b9a3176c3feb9f07b8a0ed9e887c3c46fc.tar.gz samba-677921b9a3176c3feb9f07b8a0ed9e887c3c46fc.tar.bz2 samba-677921b9a3176c3feb9f07b8a0ed9e887c3c46fc.zip |
s3-libnet-samsync: call init and close ops function where appropriate.
Guenther
-rw-r--r-- | source3/libnet/libnet_samsync.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source3/libnet/libnet_samsync.c b/source3/libnet/libnet_samsync.c index e57c2a5e11..ab7ca21bda 100644 --- a/source3/libnet/libnet_samsync.c +++ b/source3/libnet/libnet_samsync.c @@ -336,6 +336,7 @@ static NTSTATUS libnet_samsync_delta(enum netr_SamDatabaseID database_id, struct netr_ChangeLogEntry *e) { NTSTATUS result; + NTSTATUS callback_status; TALLOC_CTX *mem_ctx; const char *logon_server = ctx->cli->desthost; const char *computername = global_myname(); @@ -345,13 +346,26 @@ static NTSTATUS libnet_samsync_delta(enum netr_SamDatabaseID database_id, uint32_t sync_context = 0; const char *debug_str; DATA_BLOB session_key; + uint64_t sequence_num = 0; ZERO_STRUCT(return_authenticator); + if (!ctx->ops) { + return NT_STATUS_INVALID_PARAMETER; + } + if (!(mem_ctx = talloc_init("libnet_samsync"))) { return NT_STATUS_NO_MEMORY; } + if (ctx->ops->startup) { + result = ctx->ops->startup(mem_ctx, ctx, + database_id, &sequence_num); + if (!NT_STATUS_IS_OK(result)) { + goto out; + } + } + debug_str = samsync_debug_str(mem_ctx, ctx->mode, database_id); if (debug_str) { d_fprintf(stderr, "%s\n", debug_str); @@ -359,7 +373,6 @@ static NTSTATUS libnet_samsync_delta(enum netr_SamDatabaseID database_id, do { struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL; - NTSTATUS callback_status; netlogon_creds_client_step(ctx->cli->dc, &credential); @@ -425,6 +438,15 @@ static NTSTATUS libnet_samsync_delta(enum netr_SamDatabaseID database_id, } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); out: + + if (NT_STATUS_IS_OK(result) && ctx->ops->finish) { + callback_status = ctx->ops->finish(mem_ctx, ctx, + database_id, sequence_num); + if (!NT_STATUS_IS_OK(callback_status)) { + result = callback_status; + } + } + if (NT_STATUS_IS_ERR(result) && !ctx->error_message) { ctx->error_message = talloc_asprintf(ctx, |