summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-03-15 10:50:12 +0100
committerStefan Metzmacher <metze@samba.org>2010-03-16 15:35:28 +0100
commitdfa92d445fb568c4cae9c9853d0cd320b4aa0e35 (patch)
treeb990b618ffe732eff909d0dd57d23341deb862c1 /source4/torture
parentb0ea3248a4e6d384608330e1033e7fd9cf92c5c6 (diff)
downloadsamba-dfa92d445fb568c4cae9c9853d0cd320b4aa0e35.tar.gz
samba-dfa92d445fb568c4cae9c9853d0cd320b4aa0e35.tar.bz2
samba-dfa92d445fb568c4cae9c9853d0cd320b4aa0e35.zip
s4:torture/rpc/svcctl.c: make use of dcerpc_binding_handle stubs
metze
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/svcctl.c143
1 files changed, 80 insertions, 63 deletions
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index ce6a0853ab..23bf4399fa 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -27,7 +27,9 @@
#define TORTURE_DEFAULT_SERVICE "Spooler"
-static bool test_OpenSCManager(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
+static bool test_OpenSCManager(struct dcerpc_binding_handle *b,
+ struct torture_context *tctx,
+ struct policy_handle *h)
{
struct svcctl_OpenSCManagerW r;
@@ -37,27 +39,32 @@ static bool test_OpenSCManager(struct dcerpc_pipe *p, struct torture_context *tc
r.out.handle = h;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_OpenSCManagerW(p, tctx, &r),
+ dcerpc_svcctl_OpenSCManagerW_r(b, tctx, &r),
"OpenSCManager failed!");
return true;
}
-static bool test_CloseServiceHandle(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
+static bool test_CloseServiceHandle(struct dcerpc_binding_handle *b,
+ struct torture_context *tctx,
+ struct policy_handle *h)
{
struct svcctl_CloseServiceHandle r;
r.in.handle = h;
r.out.handle = h;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_CloseServiceHandle(p, tctx, &r),
+ dcerpc_svcctl_CloseServiceHandle_r(b, tctx, &r),
"CloseServiceHandle failed");
return true;
}
-static bool test_OpenService(struct dcerpc_pipe *p, struct torture_context *tctx,
- struct policy_handle *h, const char *name, struct policy_handle *s)
+static bool test_OpenService(struct dcerpc_binding_handle *b,
+ struct torture_context *tctx,
+ struct policy_handle *h,
+ const char *name,
+ struct policy_handle *s)
{
struct svcctl_OpenServiceW r;
@@ -67,7 +74,7 @@ static bool test_OpenService(struct dcerpc_pipe *p, struct torture_context *tctx
r.out.handle = s;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_OpenServiceW(p, tctx, &r),
+ dcerpc_svcctl_OpenServiceW_r(b, tctx, &r),
"OpenServiceW failed!");
torture_assert_werr_ok(tctx, r.out.result, "OpenServiceW failed!");
@@ -82,24 +89,25 @@ static bool test_QueryServiceStatus(struct torture_context *tctx,
struct policy_handle h, s;
struct SERVICE_STATUS service_status;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = p->binding_handle;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
r.in.handle = &s;
r.out.service_status = &service_status;
- status = dcerpc_svcctl_QueryServiceStatus(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceStatus_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceStatus failed!");
torture_assert_werr_ok(tctx, r.out.result, "QueryServiceStatus failed!");
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -110,16 +118,17 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
struct svcctl_QueryServiceStatusEx r;
struct policy_handle h, s;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = p->binding_handle;
uint32_t info_level = SVC_STATUS_PROCESS_INFO;
uint8_t *buffer;
uint32_t offered = 0;
uint32_t needed = 0;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
buffer = talloc(tctx, uint8_t);
@@ -130,7 +139,7 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
r.out.buffer = buffer;
r.out.needed = &needed;
- status = dcerpc_svcctl_QueryServiceStatusEx(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceStatusEx_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceStatusEx failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
@@ -138,15 +147,15 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
- status = dcerpc_svcctl_QueryServiceStatusEx(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceStatusEx_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceStatusEx failed!");
torture_assert_werr_ok(tctx, r.out.result, "QueryServiceStatusEx failed!");
}
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -159,14 +168,15 @@ static bool test_QueryServiceConfigW(struct torture_context *tctx,
struct QUERY_SERVICE_CONFIG query;
struct policy_handle h, s;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = p->binding_handle;
uint32_t offered = 0;
uint32_t needed = 0;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
r.in.handle = &s;
@@ -174,21 +184,21 @@ static bool test_QueryServiceConfigW(struct torture_context *tctx,
r.out.query = &query;
r.out.needed = &needed;
- status = dcerpc_svcctl_QueryServiceConfigW(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceConfigW_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfigW failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
r.in.offered = needed;
- status = dcerpc_svcctl_QueryServiceConfigW(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceConfigW_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfigW failed!");
}
torture_assert_werr_ok(tctx, r.out.result, "QueryServiceConfigW failed!");
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -199,16 +209,17 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
struct svcctl_QueryServiceConfig2W r;
struct policy_handle h, s;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = p->binding_handle;
uint32_t info_level = SERVICE_CONFIG_DESCRIPTION;
uint8_t *buffer;
uint32_t offered = 0;
uint32_t needed = 0;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
buffer = talloc(tctx, uint8_t);
@@ -219,7 +230,7 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
r.out.buffer = buffer;
r.out.needed = &needed;
- status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceConfig2W_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
@@ -227,7 +238,7 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
- status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceConfig2W_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
torture_assert_werr_ok(tctx, r.out.result, "QueryServiceConfig2W failed!");
}
@@ -237,7 +248,7 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
r.out.buffer = buffer;
r.out.needed = &needed;
- status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceConfig2W_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
@@ -245,15 +256,15 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
- status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
+ status = dcerpc_svcctl_QueryServiceConfig2W_r(b, 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))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -264,14 +275,15 @@ static bool test_QueryServiceObjectSecurity(struct torture_context *tctx,
{
struct svcctl_QueryServiceObjectSecurity r;
struct policy_handle h, s;
+ struct dcerpc_binding_handle *b = p->binding_handle;
uint8_t *buffer;
uint32_t needed;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
r.in.handle = &s;
@@ -281,7 +293,7 @@ static bool test_QueryServiceObjectSecurity(struct torture_context *tctx,
r.out.needed = &needed;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_QueryServiceObjectSecurity(p, tctx, &r),
+ dcerpc_svcctl_QueryServiceObjectSecurity_r(b, tctx, &r),
"QueryServiceObjectSecurity failed!");
torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
"QueryServiceObjectSecurity failed!");
@@ -289,7 +301,7 @@ static bool test_QueryServiceObjectSecurity(struct torture_context *tctx,
r.in.security_flags = SECINFO_DACL;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_QueryServiceObjectSecurity(p, tctx, &r),
+ dcerpc_svcctl_QueryServiceObjectSecurity_r(b, tctx, &r),
"QueryServiceObjectSecurity failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
@@ -297,16 +309,16 @@ static bool test_QueryServiceObjectSecurity(struct torture_context *tctx,
buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_QueryServiceObjectSecurity(p, tctx, &r),
+ dcerpc_svcctl_QueryServiceObjectSecurity_r(b, tctx, &r),
"QueryServiceObjectSecurity failed!");
}
torture_assert_werr_ok(tctx, r.out.result, "QueryServiceObjectSecurity failed!");
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -317,11 +329,12 @@ static bool test_StartServiceW(struct torture_context *tctx,
{
struct svcctl_StartServiceW r;
struct policy_handle h, s;
+ struct dcerpc_binding_handle *b = p->binding_handle;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
r.in.handle = &s;
@@ -329,16 +342,16 @@ static bool test_StartServiceW(struct torture_context *tctx,
r.in.Arguments = NULL;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_StartServiceW(p, tctx, &r),
+ dcerpc_svcctl_StartServiceW_r(b, tctx, &r),
"StartServiceW failed!");
torture_assert_werr_equal(tctx, r.out.result,
WERR_SERVICE_ALREADY_RUNNING,
"StartServiceW failed!");
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -350,11 +363,12 @@ static bool test_ControlService(struct torture_context *tctx,
struct svcctl_ControlService r;
struct policy_handle h, s;
struct SERVICE_STATUS service_status;
+ struct dcerpc_binding_handle *b = p->binding_handle;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
r.in.handle = &s;
@@ -362,15 +376,15 @@ static bool test_ControlService(struct torture_context *tctx,
r.out.service_status = &service_status;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_ControlService(p, tctx, &r),
+ dcerpc_svcctl_ControlService_r(b, tctx, &r),
"ControlService failed!");
torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
"ControlService failed!");
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -386,8 +400,9 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
struct ENUM_SERVICE_STATUSW *service = NULL;
uint32_t needed = 0;
uint32_t services_returned = 0;
+ struct dcerpc_binding_handle *b = p->binding_handle;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
r.in.handle = &h;
@@ -400,7 +415,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
r.out.services_returned = &services_returned;
r.out.needed = &needed;
- status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
+ status = dcerpc_svcctl_EnumServicesStatusW_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
@@ -408,7 +423,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
r.in.offered = needed;
r.out.service = talloc_array(tctx, uint8_t, needed);
- status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
+ status = dcerpc_svcctl_EnumServicesStatusW_r(b, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
torture_assert_werr_ok(tctx, r.out.result, "EnumServicesStatus failed");
@@ -447,7 +462,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
service[i].status.type, service[i].status.state);
}
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
@@ -464,11 +479,12 @@ static bool test_EnumDependentServicesW(struct torture_context *tctx,
uint32_t states[] = { SERVICE_STATE_ACTIVE,
SERVICE_STATE_INACTIVE,
SERVICE_STATE_ALL };
+ struct dcerpc_binding_handle *b = p->binding_handle;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_OpenService(p, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
return false;
r.in.service = &s;
@@ -479,7 +495,7 @@ static bool test_EnumDependentServicesW(struct torture_context *tctx,
r.out.needed = &needed;
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r),
+ dcerpc_svcctl_EnumDependentServicesW_r(b, tctx, &r),
"EnumDependentServicesW failed!");
torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
@@ -490,7 +506,7 @@ static bool test_EnumDependentServicesW(struct torture_context *tctx,
r.in.state = states[i];
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r),
+ dcerpc_svcctl_EnumDependentServicesW_r(b, tctx, &r),
"EnumDependentServicesW failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
@@ -498,7 +514,7 @@ static bool test_EnumDependentServicesW(struct torture_context *tctx,
r.out.service_status = talloc_array(tctx, uint8_t, needed);
torture_assert_ntstatus_ok(tctx,
- dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r),
+ dcerpc_svcctl_EnumDependentServicesW_r(b, tctx, &r),
"EnumDependentServicesW failed!");
}
@@ -507,24 +523,25 @@ static bool test_EnumDependentServicesW(struct torture_context *tctx,
"EnumDependentServicesW failed");
}
- if (!test_CloseServiceHandle(p, tctx, &s))
+ if (!test_CloseServiceHandle(b, tctx, &s))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;
}
static bool test_SCManager(struct torture_context *tctx,
- struct dcerpc_pipe *p)
+ struct dcerpc_pipe *p)
{
struct policy_handle h;
+ struct dcerpc_binding_handle *b = p->binding_handle;
- if (!test_OpenSCManager(p, tctx, &h))
+ if (!test_OpenSCManager(b, tctx, &h))
return false;
- if (!test_CloseServiceHandle(p, tctx, &h))
+ if (!test_CloseServiceHandle(b, tctx, &h))
return false;
return true;