s4-netlogon: merge netr_DatabaseDeltas from s3 idl.
authorGünther Deschner <gd@samba.org>
Mon, 27 Oct 2008 23:38:44 +0000 (00:38 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 29 Oct 2008 07:57:28 +0000 (08:57 +0100)
Guenther

source4/librpc/idl/netlogon.idl
source4/torture/rpc/netlogon.c
source4/torture/rpc/samsync.c

index 7cb83b3d691eff0a3cad77e5d0b00ae67472801b..87ddd4704cb70aea9c2d8c34ff09abac40275e98 100644 (file)
@@ -724,12 +724,12 @@ interface netlogon
        NTSTATUS netr_DatabaseDeltas(
                [in]      [string,charset(UTF16)] uint16 logon_server[],
                [in]      [string,charset(UTF16)] uint16 computername[],
-               [in]      netr_Authenticator credential,
-               [in,out]  netr_Authenticator return_authenticator,
+               [in,ref]  netr_Authenticator *credential,
+               [in,out,ref]  netr_Authenticator *return_authenticator,
                [in]      netr_SamDatabaseID database_id,
-               [in,out]  udlong sequence_num,
-               [in]      uint32 preferredmaximumlength,
-               [out,unique] netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [in,out,ref]  udlong *sequence_num,
+               [out,ref]     netr_DELTA_ENUM_ARRAY **delta_enum_array,
+               [in]      uint32 preferredmaximumlength
                );
 
 
index 232d10323c201fbfc8bb543bcef518a75690bb69..6580761aec11a73c12204e54ce9d3faf5341987e 100644 (file)
@@ -750,6 +750,9 @@ static bool test_DatabaseDeltas(struct torture_context *tctx,
        NTSTATUS status;
        struct netr_DatabaseDeltas r;
        struct creds_CredentialState *creds;
+       struct netr_Authenticator credential;
+       struct netr_Authenticator return_authenticator;
+       struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL;
        const uint32_t database_ids[] = {0, 1, 2}; 
        int i;
 
@@ -761,20 +764,22 @@ static bool test_DatabaseDeltas(struct torture_context *tctx,
        r.in.computername = TEST_MACHINE_NAME;
        r.in.preferredmaximumlength = (uint32_t)-1;
        ZERO_STRUCT(r.in.return_authenticator);
+       r.out.return_authenticator = &return_authenticator;
+       r.out.delta_enum_array = &delta_enum_array;
 
        for (i=0;i<ARRAY_SIZE(database_ids);i++) {
                r.in.database_id = database_ids[i];
-               r.in.sequence_num = sequence_nums[r.in.database_id];
+               r.in.sequence_num = &sequence_nums[r.in.database_id];
 
-               if (r.in.sequence_num == 0) continue;
+               if (*r.in.sequence_num == 0) continue;
 
-               r.in.sequence_num -= 1;
+               *r.in.sequence_num -= 1;
 
                torture_comment(tctx, "Testing DatabaseDeltas of id %d at %llu\n", 
-                      r.in.database_id, (unsigned long long)r.in.sequence_num);
+                      r.in.database_id, (unsigned long long)*r.in.sequence_num);
 
                do {
-                       creds_client_authenticator(creds, &r.in.credential);
+                       creds_client_authenticator(creds, &credential);
 
                        status = dcerpc_netr_DatabaseDeltas(p, tctx, &r);
                        if (NT_STATUS_EQUAL(status, 
@@ -788,11 +793,11 @@ static bool test_DatabaseDeltas(struct torture_context *tctx,
 
                        torture_assert_ntstatus_ok(tctx, status, "DatabaseDeltas");
 
-                       if (!creds_client_check(creds, &r.out.return_authenticator.cred)) {
+                       if (!creds_client_check(creds, &return_authenticator.cred)) {
                                torture_comment(tctx, "Credential chaining failed\n");
                        }
 
-                       r.in.sequence_num++;
+                       (*r.in.sequence_num)++;
                } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
        }
 
index fdd86da28cdce0730b989d9f0ca77ce8db93c196..88101912e6b833b435d7f49c88bb91e4fd4b1c98 100644 (file)
@@ -1313,34 +1313,45 @@ static bool test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX
        NTSTATUS status;
        TALLOC_CTX *loop_ctx;
        struct netr_DatabaseDeltas r;
+       struct netr_Authenticator credential;
+       struct netr_Authenticator return_authenticator;
+       struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL;
        const uint32_t database_ids[] = {0, 1, 2}; 
        int i;
        bool ret = true;
 
+       ZERO_STRUCT(return_authenticator);
+
        r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(samsync_state->p));
        r.in.computername = TEST_MACHINE_NAME;
+       r.in.credential = &credential;
        r.in.preferredmaximumlength = (uint32_t)-1;
-       ZERO_STRUCT(r.in.return_authenticator);
+       r.in.return_authenticator = &return_authenticator;
+       r.out.return_authenticator = &return_authenticator;
+       r.out.delta_enum_array = &delta_enum_array;
 
        for (i=0;i<ARRAY_SIZE(database_ids);i++) {
+
+               uint64_t seq_num = samsync_state->seq_num[i];
+
                r.in.database_id = database_ids[i];
-               r.in.sequence_num = samsync_state->seq_num[i];
+               r.in.sequence_num = &seq_num;
+               r.out.sequence_num = &seq_num;
 
-               if (r.in.sequence_num == 0) continue;
+               if (seq_num == 0) continue;
 
                /* this shows that the bdc doesn't need to do a single call for
                 * each seqnumber, and the pdc doesn't need to know about old values
                 * -- metze
                 */
-               r.in.sequence_num -= 10;
-
+               seq_num -= 10;
 
                printf("Testing DatabaseDeltas of id %d at %llu\n", 
-                      r.in.database_id, (long long)r.in.sequence_num);
+                      r.in.database_id, (long long)seq_num);
 
                do {
                        loop_ctx = talloc_named(mem_ctx, 0, "test_DatabaseDeltas loop context");
-                       creds_client_authenticator(samsync_state->creds, &r.in.credential);
+                       creds_client_authenticator(samsync_state->creds, &credential);
 
                        status = dcerpc_netr_DatabaseDeltas(samsync_state->p, loop_ctx, &r);
                        if (!NT_STATUS_IS_OK(status) &&
@@ -1350,11 +1361,11 @@ static bool test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX
                                ret = false;
                        }
 
-                       if (!creds_client_check(samsync_state->creds, &r.out.return_authenticator.cred)) {
+                       if (!creds_client_check(samsync_state->creds, &return_authenticator.cred)) {
                                printf("Credential chaining failed\n");
                        }
 
-                       r.in.sequence_num++;
+                       seq_num++;
                        talloc_free(loop_ctx);
                } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
        }