diff options
author | Günther Deschner <gd@samba.org> | 2015-07-01 16:58:06 +0200 |
---|---|---|
committer | José A. Rivera <jarrpa@samba.org> | 2015-08-04 19:11:17 +0200 |
commit | 1f516287ef0cbd5efe8969899c5a90c36c80ceef (patch) | |
tree | 3b32817d57bde82cb8a70c2284d808c96c6a4441 /source4 | |
parent | 95eb6db580678a29b1f5f30a9567ea449a43d75a (diff) | |
download | samba-1f516287ef0cbd5efe8969899c5a90c36c80ceef.tar.gz |
s4-torture: add more tests for clusapi_OpenResource().
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: José A. Rivera <jarrpa@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rpc/clusapi.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c index f6f3ff5b9b6..b3a7369b924 100644 --- a/source4/torture/rpc/clusapi.c +++ b/source4/torture/rpc/clusapi.c @@ -387,10 +387,12 @@ static bool test_SetQuorumResource(struct torture_context *tctx, return true; } -bool test_OpenResource_int(struct torture_context *tctx, - struct dcerpc_pipe *p, - const char *lpszResourceName, - struct policy_handle *hResource) +static bool test_OpenResource_int_exp(struct torture_context *tctx, + struct dcerpc_pipe *p, + const char *lpszResourceName, + struct policy_handle *hResource, + WERROR expected_Status, + WERROR expected_rpc_status) { struct dcerpc_binding_handle *b = p->binding_handle; struct clusapi_OpenResource r; @@ -405,13 +407,27 @@ bool test_OpenResource_int(struct torture_context *tctx, torture_assert_ntstatus_ok(tctx, dcerpc_clusapi_OpenResource_r(b, tctx, &r), "OpenResource failed"); - torture_assert_werr_ok(tctx, - *r.out.Status, + torture_assert_werr_equal(tctx, + *r.out.Status, expected_Status, + "OpenResource failed"); + torture_assert_werr_equal(tctx, + *r.out.rpc_status, expected_rpc_status, "OpenResource failed"); return true; } +bool test_OpenResource_int(struct torture_context *tctx, + struct dcerpc_pipe *p, + const char *lpszResourceName, + struct policy_handle *hResource) +{ + return test_OpenResource_int_exp(tctx, p, + lpszResourceName, + hResource, + WERR_OK, WERR_OK); +} + static bool test_OpenResourceEx_int(struct torture_context *tctx, struct dcerpc_pipe *p, const char *lpszResourceName, @@ -476,6 +492,22 @@ static bool test_OpenResource(struct torture_context *tctx, test_CloseResource_int(tctx, t->p, &hResource); + if (!test_OpenResource_int_exp(tctx, t->p, "", &hResource, WERR_RESOURCE_NOT_FOUND, WERR_OK)) { + return false; + } + + torture_assert(tctx, + ndr_policy_handle_empty(&hResource), + "expected empty policy handle"); + + if (!test_OpenResource_int_exp(tctx, t->p, "jfUF38fjSNcfn", &hResource, WERR_RESOURCE_NOT_FOUND, WERR_OK)) { + return false; + } + + torture_assert(tctx, + ndr_policy_handle_empty(&hResource), + "expected empty policy handle"); + return true; } |