From d31150a34f1b07b543aa26074d761ef9371576af Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Aug 2004 23:06:15 +0000 Subject: r1642: Torture test for EnumServicesStatus, almost finished. (This used to be commit fb2ca1f4cde014c93a0741b8ba03d2d9caffd8df) --- source4/torture/rpc/svcctl.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'source4') diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c index 062fcdf584..d33639e3a5 100644 --- a/source4/torture/rpc/svcctl.c +++ b/source4/torture/rpc/svcctl.c @@ -27,15 +27,18 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, int i; NTSTATUS status; uint32 resume_handle = 0; - struct ENUM_SERVICE_STATUS *service = talloc_p(mem_ctx, struct ENUM_SERVICE_STATUS); + struct ENUM_SERVICE_STATUS *service = NULL; + uint32 needed, sr; r.in.handle = h; r.in.type = SERVICE_TYPE_WIN32; r.in.state = SERVICE_STATE_ALL; - r.in.buf_size = sizeof(struct ENUM_SERVICE_STATUS); + r.in.buf_size = 0; r.in.resume_handle = &resume_handle; - r.out.service = service; + r.out.service = NULL; r.out.resume_handle = &resume_handle; + r.out.services_returned = 0; + r.out.bytes_needed = 0; status = dcerpc_svcctl_EnumServicesStatus(p, mem_ctx, &r); @@ -45,9 +48,8 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { - r.in.buf_size = r.out.bytes_needed + sizeof(struct ENUM_SERVICE_STATUS); - service = talloc_realloc(mem_ctx, service, r.in.buf_size); - r.out.service = service; + r.in.buf_size = r.out.bytes_needed; + r.out.service = talloc(mem_ctx, r.out.bytes_needed); status = dcerpc_svcctl_EnumServicesStatus(p, mem_ctx, &r); @@ -60,10 +62,11 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("EnumServicesStatus failed\n"); return False; } + service = (struct ENUM_SERVICE_STATUS *)r.out.service; } for(i = 0; i < r.out.services_returned; i++) { - printf("%s - %s\n", service[i].service_name, service[i].display_name); + printf("Type: %d, State: %d\n", service[i].status.type, service[i].status.state); } return True; -- cgit