summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-02 12:01:10 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-02 12:01:10 +0000
commitde32d669c6b7eb0053b843726e9520b1e20c85f6 (patch)
treea315965175312150017051008770ed6eb46c0b9d /source4/torture/rpc
parent9ebe4489e7211c2c191347cb348f123863d8e537 (diff)
downloadsamba-de32d669c6b7eb0053b843726e9520b1e20c85f6.tar.gz
samba-de32d669c6b7eb0053b843726e9520b1e20c85f6.tar.bz2
samba-de32d669c6b7eb0053b843726e9520b1e20c85f6.zip
added netr_DatabaseSync2()
(This used to be commit 0f6af0c4bde0eb3758192b74dab797b558c944a1)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/netlogon.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index b5a981c531..e7d77b35d1 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -646,6 +646,57 @@ static BOOL test_LogonControl2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
}
+/*
+ try a netlogon DatabaseSync2
+*/
+static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct netr_DatabaseSync2 r;
+ struct netr_CredentialState creds;
+ const uint32 database_ids[] = {0, 1, 2};
+ int i;
+ BOOL ret = True;
+
+ if (!test_SetupCredentials2(p, mem_ctx, &creds)) {
+ return False;
+ }
+
+ r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.computername = lp_netbios_name();
+ r.in.preferredmaximumlength = (uint32)-1;
+ ZERO_STRUCT(r.in.return_authenticator);
+
+ for (i=0;i<ARRAY_SIZE(database_ids);i++) {
+ r.in.sync_context = 0;
+ r.in.database_id = database_ids[i];
+ r.in.restart_state = 0;
+
+ printf("Testing DatabaseSync2 of id %d\n", r.in.database_id);
+
+ do {
+ creds_client_authenticator(&creds, &r.in.credential);
+
+ status = dcerpc_netr_DatabaseSync2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status) &&
+ !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
+ printf("DatabaseSync2 - %s\n", nt_errstr(status));
+ ret = False;
+ break;
+ }
+
+ if (!creds_client_check(&creds, &r.out.return_authenticator.cred)) {
+ printf("Credential chaining failed\n");
+ }
+
+ r.in.sync_context = r.out.sync_context;
+ } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
+ }
+
+ return ret;
+}
+
+
BOOL torture_rpc_netlogon(int dummy)
{
NTSTATUS status;
@@ -713,6 +764,10 @@ BOOL torture_rpc_netlogon(int dummy)
ret = False;
}
+ if (!test_DatabaseSync2(p, mem_ctx)) {
+ ret = False;
+ }
+
torture_rpc_close(p);
return ret;