summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-11-14 11:36:47 +0100
committerGünther Deschner <gd@samba.org>2008-11-17 13:17:07 +0100
commit2409f216cfb74079687929d670b8ebc29e54a038 (patch)
treea59e6324bb1eb537f007e0392af0ade90be039ea /source4
parentabbd539082022166b7e3a222eb3dc050b3ae7279 (diff)
downloadsamba-2409f216cfb74079687929d670b8ebc29e54a038.tar.gz
samba-2409f216cfb74079687929d670b8ebc29e54a038.tar.bz2
samba-2409f216cfb74079687929d670b8ebc29e54a038.zip
s4-smbtorture: add test for svcctl_QueryServiceConfig2W.
Guenther
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/svcctl.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index 4c5ccd75ee..0e440a3621 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -118,6 +118,53 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
return true;
}
+static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerpc_pipe *p)
+{
+ struct svcctl_QueryServiceConfig2W r;
+ struct policy_handle h, s;
+ NTSTATUS status;
+
+ uint32_t info_level = 0;
+ uint8_t *buffer;
+ uint32_t buf_size = 0;
+ uint32_t bytes_needed = 0;
+
+ if (!test_OpenSCManager(p, tctx, &h))
+ return false;
+
+ if (!test_OpenService(p, tctx, &h, "Netlogon", &s))
+ return false;
+
+ buffer = talloc(tctx, uint8_t);
+
+ r.in.handle = &s;
+ r.in.info_level = 1;
+ r.in.buf_size = buf_size;
+ r.out.buffer = buffer;
+ r.out.bytes_needed = &bytes_needed;
+
+ status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
+
+ if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ r.in.buf_size = bytes_needed;
+ buffer = talloc_array(tctx, uint8_t, bytes_needed);
+ r.out.buffer = buffer;
+
+ status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
+ torture_assert_werr_ok(tctx, r.out.result, "QueryServiceConfig2W failed!");
+ }
+
+ if (!test_CloseServiceHandle(p, tctx, &s))
+ return false;
+
+ if (!test_CloseServiceHandle(p, tctx, &h))
+ return false;
+
+ return true;
+}
+
static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_pipe *p)
{
struct svcctl_EnumServicesStatusW r;
@@ -195,6 +242,8 @@ struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
test_EnumServicesStatus);
torture_rpc_tcase_add_test(tcase, "QueryServiceStatusEx",
test_QueryServiceStatusEx);
+ torture_rpc_tcase_add_test(tcase, "QueryServiceConfig2W",
+ test_QueryServiceConfig2W);
return suite;
}