diff options
author | Günther Deschner <gd@samba.org> | 2008-02-15 14:11:20 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-02-15 14:11:20 +0100 |
commit | eafec423b78f91f97793e26b6dd0c2a27c557d19 (patch) | |
tree | 69311010e3378cfe227f5d229cc514a0b967277f /source3/rpcclient | |
parent | 13f9cd938d2cfc8dc270314aa3ee6a8b80de90fd (diff) | |
download | samba-eafec423b78f91f97793e26b6dd0c2a27c557d19.tar.gz samba-eafec423b78f91f97793e26b6dd0c2a27c557d19.tar.bz2 samba-eafec423b78f91f97793e26b6dd0c2a27c557d19.zip |
Use rpccli_netr_DatabaseSync2() in rpcclient.
Guenther
(This used to be commit 042173b00e023b4d4e7739524e24baa8803850bd)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index cf52da7c9f..49098b12e4 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -554,37 +554,66 @@ static void display_sam_sync(struct netr_DELTA_ENUM_ARRAY *r) /* Perform sam synchronisation */ -static NTSTATUS cmd_netlogon_sam_sync(struct rpc_pipe_client *cli, +static NTSTATUS cmd_netlogon_sam_sync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint32 database_id = 0, num_deltas; - SAM_DELTA_HDR *hdr_deltas; - SAM_DELTA_CTR *deltas; + const char *logon_server = cli->cli->desthost; + const char *computername = global_myname(); + struct netr_Authenticator credential; + struct netr_Authenticator return_authenticator; + enum netr_SamDatabaseID database_id = SAM_DATABASE_DOMAIN; + uint16_t restart_state = 0; + uint32_t sync_context = 0; if (argc > 2) { fprintf(stderr, "Usage: %s [database_id]\n", argv[0]); return NT_STATUS_OK; } - if (argc == 2) - database_id = atoi(argv[1]); + if (argc == 2) { + database_id = atoi(argv[1]); + } + + /* Synchronise sam database */ + + do { + struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL; - /* Synchronise sam database */ + netlogon_creds_client_step(cli->dc, &credential); - result = rpccli_netlogon_sam_sync(cli, mem_ctx, database_id, - 0, &num_deltas, &hdr_deltas, &deltas); + result = rpccli_netr_DatabaseSync2(cli, mem_ctx, + logon_server, + computername, + &credential, + &return_authenticator, + database_id, + restart_state, + &sync_context, + &delta_enum_array, + 0xffff); - if (!NT_STATUS_IS_OK(result)) - goto done; + /* Check returned credentials. */ + if (!netlogon_creds_client_check(cli->dc, + &return_authenticator.cred)) { + DEBUG(0,("credentials chain check failed\n")); + return NT_STATUS_ACCESS_DENIED; + } - /* Display results */ + if (NT_STATUS_IS_ERR(result)) { + break; + } -/* display_sam_sync(num_deltas, hdr_deltas, deltas); */ + /* Display results */ - done: - return result; + display_sam_sync(delta_enum_array); + + TALLOC_FREE(delta_enum_array); + + } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); + + return result; } /* Perform sam delta synchronisation */ |