added netr_DatabaseSync2()
authorAndrew Tridgell <tridge@samba.org>
Tue, 2 Dec 2003 12:01:10 +0000 (12:01 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 2 Dec 2003 12:01:10 +0000 (12:01 +0000)
source/librpc/idl/netlogon.idl
source/torture/rpc/netlogon.c

index 548209e0f4dd56fa8e15b875f9e21d6ae34fc9ed..b4506c6db739a428755589fef9c895726f5b91a2 100644 (file)
@@ -750,23 +750,23 @@ interface netlogon
                [in,out,ref] uint32 *negotiate_flags
                );
 
-#if 0
 
        /*****************/
        /* Function 0x10 */
 
        NTSTATUS netr_DatabaseSync2(
-               [in][string][ref] wchar_t *logon_server, # REF!!!
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [in] uint32 database_id,
-               [in] uint16 restart_state,
-               [in][out][ref] uint32 *sync_context,
-               [in] uint32 preferredmaximumlength,
-               [out] netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [in]     unistr logon_server,
+               [in]     unistr computername,
+               [in]     netr_Authenticator credential,
+               [in,out] netr_Authenticator return_authenticator,
+               [in]     uint32 database_id,
+               [in]     uint16 restart_state,
+               [in,out] uint32 sync_context,
+               [in]     uint32 preferredmaximumlength,
+               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
+#if 0
 
        /*****************/
        /* Function 0x11 */
index b5a981c531b1b8c63483815e8b92d26d37ea4e85..e7d77b35d16850cd2749d542047383021e75f633 100644 (file)
@@ -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;