From d1340df8b80c4dbe9f37dffa315a26396ed4f93f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 30 Oct 2008 16:49:21 +0100 Subject: s4-srvsvc: merge srvsvc_NetCharDevQEnum from s3 idl. Guenther --- source4/librpc/idl/srvsvc.idl | 10 +++++++--- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 22 ++++++++++----------- source4/torture/rpc/srvsvc.c | 33 ++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index 43f2004c23..e3b1833e92 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -120,15 +120,19 @@ import "security.idl", "svcctl.idl"; [default] ; } srvsvc_NetCharDevQCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevQCtr ctr; + } srvsvc_NetCharDevQInfoCtr; + /******************/ /* Function: 0x03 */ WERROR srvsvc_NetCharDevQEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *user, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetCharDevQCtr ctr, + [in,out,ref] srvsvc_NetCharDevQInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index ce6172b2e7..5acddbc8ba 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -115,28 +115,26 @@ static WERROR dcesrv_srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call static WERROR dcesrv_srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: { - r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr0); - r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = NULL; + r->out.info_ctr->ctr.ctr0->count = 0; + r->out.info_ctr->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); + r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr1); - r->out.ctr.ctr1->count = 0; - r->out.ctr.ctr1->array = NULL; + r->out.info_ctr->ctr.ctr1->count = 0; + r->out.info_ctr->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index aa10955a37..cda2d44e71 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -228,24 +228,39 @@ static bool test_NetCharDevQEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetCharDevQEnum r; + struct srvsvc_NetCharDevQInfoCtr info_ctr; struct srvsvc_NetCharDevQCtr0 c0; + struct srvsvc_NetCharDevQCtr1 c1; + uint32_t totalentries = 0; uint32_t levels[] = {0, 1}; int i; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.user = talloc_asprintf(tctx,"%s","Administrator"); - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;icount;j++) { + if (info_ctr.level == 1) { + for (j=0;jctr.ctr1->count;j++) { const char *device; - device = r.out.ctr.ctr1->array[j].device; + device = r.out.info_ctr->ctr.ctr1->array[j].device; if (!test_NetCharDevQGetInfo(p, tctx, device)) { return false; } -- cgit