summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-01-09 16:16:11 +0100
committerGünther Deschner <gd@samba.org>2009-01-09 17:08:18 +0100
commitf2dd351a1e63f57e030a7b6e8660fcf43e401e9d (patch)
tree1a5748f03b18019f9f3623fd8ccceaa418595cf6 /source4
parentb516a2abcadb4a58fe7058ddbb4e38f53a467426 (diff)
downloadsamba-f2dd351a1e63f57e030a7b6e8660fcf43e401e9d.tar.gz
samba-f2dd351a1e63f57e030a7b6e8660fcf43e401e9d.tar.bz2
samba-f2dd351a1e63f57e030a7b6e8660fcf43e401e9d.zip
s4-smbtorture: print hand-decoded service status array in svcctl torture test.
Guenther
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/config.mk2
-rw-r--r--source4/torture/rpc/svcctl.c30
2 files changed, 29 insertions, 3 deletions
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index c26aeeb8fb..5bbdfaf4d8 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -197,7 +197,7 @@ NDR_SRVSVC_OBJ_FILES = ../librpc/gen_ndr/ndr_srvsvc.o
[SUBSYSTEM::NDR_SVCCTL]
PUBLIC_DEPENDENCIES = LIBNDR
-NDR_SVCCTL_OBJ_FILES = ../librpc/gen_ndr/ndr_svcctl.o
+NDR_SVCCTL_OBJ_FILES = ../librpc/gen_ndr/ndr_svcctl.o ../librpc/ndr/ndr_svcctl.o
PUBLIC_HEADERS += $(addprefix ../librpc/gen_ndr/, ndr_svcctl.h svcctl.h)
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index ea1534069c..a4b9e6bed1 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -22,7 +22,9 @@
#include "includes.h"
#include "torture/torture.h"
#include "librpc/gen_ndr/ndr_svcctl_c.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
#include "torture/rpc/rpc.h"
+#include "param/param.h"
static bool test_OpenSCManager(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
{
@@ -220,12 +222,36 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
torture_assert_werr_ok(tctx, r.out.result, "EnumServicesStatus failed");
+ }
+
+ if (services_returned > 0) {
+
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob;
+ struct ndr_pull *ndr;
+
+ blob.length = r.in.buf_size;
+ blob.data = talloc_steal(tctx, r.out.service);
- service = (struct ENUM_SERVICE_STATUSW *)r.out.service;
+ ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx));
+
+ service = talloc_array(tctx, struct ENUM_SERVICE_STATUSW, services_returned);
+ if (!service) {
+ return false;
+ }
+
+ ndr_err = ndr_pull_ENUM_SERVICE_STATUSW_array(
+ ndr, services_returned, service);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return false;
+ }
}
for(i = 0; i < services_returned; i++) {
- printf("Type: %d, State: %d\n", service[i].status.type, service[i].status.state);
+
+ printf("%-20s \"%s\", Type: %d, State: %d\n",
+ service[i].service_name, service[i].display_name,
+ service[i].status.type, service[i].status.state);
}
if (!test_CloseServiceHandle(p, tctx, &h))