summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-06-11 15:11:01 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-06-11 17:46:34 +0300
commit84fb3ed8a5e6cb253ec1e461185b0b68e57cf21a (patch)
tree7cabc35f18b86a843bd08b66904e7e60205a621c
parent8714f130e5de2738e8fd430385f236f2e360967e (diff)
downloadsamba-84fb3ed8a5e6cb253ec1e461185b0b68e57cf21a.tar.gz
samba-84fb3ed8a5e6cb253ec1e461185b0b68e57cf21a.tar.bz2
samba-84fb3ed8a5e6cb253ec1e461185b0b68e57cf21a.zip
s4/test-libnet: Move LSA close handle function to a common location
-rw-r--r--source4/torture/libnet/libnet_group.c22
-rw-r--r--source4/torture/libnet/libnet_user.c22
-rw-r--r--source4/torture/libnet/utils.c22
3 files changed, 26 insertions, 40 deletions
diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c
index 0d8249f9f3..6f4aa0eab6 100644
--- a/source4/torture/libnet/libnet_group.c
+++ b/source4/torture/libnet/libnet_group.c
@@ -32,25 +32,6 @@
#define TEST_GROUPNAME "libnetgrouptest"
-static bool test_lsa_close(struct torture_context *tctx,
- struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
- struct policy_handle *domain_handle)
-{
- struct lsa_Close r;
-
- r.in.handle = domain_handle;
- r.out.handle = domain_handle;
-
- torture_assert_ntstatus_ok(tctx,
- dcerpc_lsa_Close_r(b, mem_ctx, &r),
- "Close lsa domain failed");
- torture_assert_ntstatus_ok(tctx, r.out.result,
- "Close lsa domain failed");
-
- return true;
-}
-
-
bool torture_groupinfo_api(struct torture_context *torture)
{
const char *name = TEST_GROUPNAME;
@@ -170,7 +151,8 @@ bool torture_grouplist(struct torture_context *torture)
ret = false;
}
- if (!test_lsa_close(torture, ctx->lsa.pipe->binding_handle, mem_ctx, &ctx->lsa.handle)) {
+ if (!test_lsa_close_handle(torture,
+ ctx->lsa.pipe->binding_handle, mem_ctx, &ctx->lsa.handle)) {
torture_comment(torture, "lsa domain close failed\n");
ret = false;
}
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index d9e39eb942..6850b0e7f3 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -31,25 +31,6 @@
-static bool test_lsa_close(struct torture_context *tctx,
- struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
- struct policy_handle *domain_handle)
-{
- struct lsa_Close r;
-
- r.in.handle = domain_handle;
- r.out.handle = domain_handle;
-
- torture_assert_ntstatus_ok(tctx,
- dcerpc_lsa_Close_r(b, mem_ctx, &r),
- "Close lsa domain failed");
- torture_assert_ntstatus_ok(tctx, r.out.result,
- "Close lsa domain failed");
-
- return true;
-}
-
-
bool torture_createuser(struct torture_context *torture)
{
NTSTATUS status;
@@ -531,7 +512,8 @@ bool torture_userlist(struct torture_context *torture)
goto done;
}
- if (!test_lsa_close(torture, ctx->lsa.pipe->binding_handle, mem_ctx, &ctx->lsa.handle)) {
+ if (!test_lsa_close_handle(torture,
+ ctx->lsa.pipe->binding_handle, mem_ctx, &ctx->lsa.handle)) {
torture_comment(torture, "lsa domain close failed\n");
ret = false;
}
diff --git a/source4/torture/libnet/utils.c b/source4/torture/libnet/utils.c
index 486f04451b..7c254d634a 100644
--- a/source4/torture/libnet/utils.c
+++ b/source4/torture/libnet/utils.c
@@ -434,6 +434,28 @@ bool test_samr_close_handle(struct torture_context *tctx,
}
/**
+ * Closes LSA handle obtained from Connect, Open Group, etc
+ */
+bool test_lsa_close_handle(struct torture_context *tctx,
+ struct dcerpc_binding_handle *b,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *lsa_handle)
+{
+ struct lsa_Close r;
+
+ r.in.handle = lsa_handle;
+ r.out.handle = lsa_handle;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_lsa_Close_r(b, mem_ctx, &r),
+ "Close LSA handle RPC call failed");
+ torture_assert_ntstatus_ok(tctx, r.out.result,
+ "Close LSA handle failed");
+
+ return true;
+}
+
+/**
* Create and initialize libnet_context Context.
* Use this function in cases where we need to have SAMR and LSA pipes
* of libnet_context to be connected before executing any other