diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-09-09 00:55:51 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-09-09 18:26:51 +0300 |
commit | 118df599ce139d72f77692415ab38efaebf0245c (patch) | |
tree | c64d38e9ca57bc11ad504c79c6a5c5bc3329e186 /source4/torture | |
parent | 3593298c7e095b0935bffe05e3b1e190abf91707 (diff) | |
download | samba-118df599ce139d72f77692415ab38efaebf0245c.tar.gz samba-118df599ce139d72f77692415ab38efaebf0245c.tar.bz2 samba-118df599ce139d72f77692415ab38efaebf0245c.zip |
s4-drs-test: Add 'reset' and 'replace' tests for drsuapi_DsReplicaUpdateRefs
At first I got the impression we are not handling those cases,
but after those tests surprisingly passed I saw that
we have correct behavior implemented in a helper function.
So I decided to commit those tests in case someone change the
strange-looking check for DRSUAPI_DRS_ADD_REF flag in
a function that handles delete operation :)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/drsuapi.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index 49202a6382..99f101c38e 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -492,7 +492,7 @@ static bool test_DsReplicaUpdateRefs(struct torture_context *tctx, "dcerpc_drsuapi_DsReplicaUpdateRefs"); /* 2. hopefully adding random replica dest should succeed */ - torture_comment(tctx, "add : %s\n", r.in.req.req1.dest_dsa_dns_name); + torture_comment(tctx, "add : %s\n", r.in.req.req1.dest_dsa_dns_name); r.in.req.req1.options = DRSUAPI_DRS_ADD_REF; status = dcerpc_drsuapi_DsReplicaUpdateRefs_r(p->binding_handle, tctx, &r); torture_drsuapi_assert_call_werr(tctx, p, @@ -500,15 +500,39 @@ static bool test_DsReplicaUpdateRefs(struct torture_context *tctx, "dcerpc_drsuapi_DsReplicaUpdateRefs"); /* 3. try adding same replica dest - should fail */ - torture_comment(tctx, "add : %s\n", r.in.req.req1.dest_dsa_dns_name); + torture_comment(tctx, "add : %s\n", r.in.req.req1.dest_dsa_dns_name); r.in.req.req1.options = DRSUAPI_DRS_ADD_REF; status = dcerpc_drsuapi_DsReplicaUpdateRefs_r(p->binding_handle, tctx, &r); torture_drsuapi_assert_call_werr(tctx, p, status, WERR_DS_DRA_REF_ALREADY_EXISTS, &r, "dcerpc_drsuapi_DsReplicaUpdateRefs"); - /* 4. delete random replicate added at step 2. */ - torture_comment(tctx, "delete: %s\n", r.in.req.req1.dest_dsa_dns_name); + /* 4. try resetting same replica dest - should succeed */ + torture_comment(tctx, "reset : %s\n", r.in.req.req1.dest_dsa_dns_name); + r.in.req.req1.options = DRSUAPI_DRS_DEL_REF | DRSUAPI_DRS_ADD_REF; + status = dcerpc_drsuapi_DsReplicaUpdateRefs_r(p->binding_handle, tctx, &r); + torture_drsuapi_assert_call_werr(tctx, p, + status, WERR_OK, &r, + "dcerpc_drsuapi_DsReplicaUpdateRefs"); + + /* 5. delete random replicate added at step 2. */ + torture_comment(tctx, "delete : %s\n", r.in.req.req1.dest_dsa_dns_name); + r.in.req.req1.options = DRSUAPI_DRS_DEL_REF; + status = dcerpc_drsuapi_DsReplicaUpdateRefs_r(p->binding_handle, tctx, &r); + torture_drsuapi_assert_call_werr(tctx, p, + status, WERR_OK, &r, + "dcerpc_drsuapi_DsReplicaUpdateRefs"); + + /* 6. try replace on non-existing replica dest - should succeed */ + torture_comment(tctx, "replace: %s\n", r.in.req.req1.dest_dsa_dns_name); + r.in.req.req1.options = DRSUAPI_DRS_DEL_REF | DRSUAPI_DRS_ADD_REF; + status = dcerpc_drsuapi_DsReplicaUpdateRefs_r(p->binding_handle, tctx, &r); + torture_drsuapi_assert_call_werr(tctx, p, + status, WERR_OK, &r, + "dcerpc_drsuapi_DsReplicaUpdateRefs"); + + /* 7. delete random replicate added at step 6. */ + torture_comment(tctx, "delete : %s\n", r.in.req.req1.dest_dsa_dns_name); r.in.req.req1.options = DRSUAPI_DRS_DEL_REF; status = dcerpc_drsuapi_DsReplicaUpdateRefs_r(p->binding_handle, tctx, &r); torture_drsuapi_assert_call_werr(tctx, p, |