diff options
-rw-r--r-- | source3/librpc/idl/srvsvc.idl | 8 | ||||
-rw-r--r-- | source4/librpc/idl/srvsvc.idl | 10 | ||||
-rw-r--r-- | source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 42 | ||||
-rw-r--r-- | source4/torture/rpc/srvsvc.c | 29 |
4 files changed, 57 insertions, 32 deletions
diff --git a/source3/librpc/idl/srvsvc.idl b/source3/librpc/idl/srvsvc.idl index f917065b09..4304dbed96 100644 --- a/source3/librpc/idl/srvsvc.idl +++ b/source3/librpc/idl/srvsvc.idl @@ -1291,12 +1291,16 @@ import "security.idl", "svcctl.idl"; [default]; } srvsvc_NetTransportCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetTransportCtr ctr; + } srvsvc_NetTransportInfoCtr; + /******************/ /* Function: 0x1a */ WERROR srvsvc_NetTransportEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out,ref] uint32 *level, - [in,out,ref,switch_is(*level)] srvsvc_NetTransportCtr *transports, + [in,out,ref] srvsvc_NetTransportInfoCtr *transports, [in] uint32 max_buffer, [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index 1784fd9383..d636cdcea3 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -1285,14 +1285,18 @@ import "security.idl", "svcctl.idl"; [default]; } srvsvc_NetTransportCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetTransportCtr ctr; + } srvsvc_NetTransportInfoCtr; + /******************/ /* Function: 0x1a */ WERROR srvsvc_NetTransportEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetTransportCtr transports, + [in,out,ref] srvsvc_NetTransportInfoCtr *transports, [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 19051c9c3e..f0da2b099d 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1617,48 +1617,50 @@ static WERROR dcesrv_srvsvc_NetTransportAdd(struct dcesrv_call_state *dce_call, static WERROR dcesrv_srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + r->out.transports->level = r->in.transports->level; + *r->out.totalentries = 0; + if (r->out.resume_handle) { + *r->out.resume_handle = 0; + } - switch (r->in.level) { + switch (r->in.transports->level) { case 0: { - r->out.transports.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr0); + r->out.transports->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr0); - r->out.transports.ctr0->count = 0; - r->out.transports.ctr0->array = NULL; + r->out.transports->ctr.ctr0->count = 0; + r->out.transports->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.transports.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr1); + r->out.transports->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr1); - r->out.transports.ctr1->count = 0; - r->out.transports.ctr1->array = NULL; + r->out.transports->ctr.ctr1->count = 0; + r->out.transports->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } case 2: { - r->out.transports.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr2); + r->out.transports->ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr2); - r->out.transports.ctr2->count = 0; - r->out.transports.ctr2->array = NULL; + r->out.transports->ctr.ctr2->count = 0; + r->out.transports->ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; } case 3: { - r->out.transports.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr3); + r->out.transports->ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr3); - r->out.transports.ctr3->count = 0; - r->out.transports.ctr3->array = NULL; + r->out.transports->ctr.ctr3->count = 0; + r->out.transports->ctr.ctr3->array = NULL; return WERR_NOT_SUPPORTED; } diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 3e584aaba5..a6536faec7 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -826,21 +826,36 @@ static bool test_NetTransportEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetTransportEnum r; - struct srvsvc_NetTransportCtr0 c0; + struct srvsvc_NetTransportInfoCtr transports; + struct srvsvc_NetTransportCtr0 ctr0; + struct srvsvc_NetTransportCtr1 ctr1; + + uint32_t totalentries = 0; uint32_t levels[] = {0, 1}; int i; + ZERO_STRUCT(transports); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s", dcerpc_server_name(p)); - r.in.transports.ctr0 = &c0; - r.in.transports.ctr0->count = 0; - r.in.transports.ctr0->array = NULL; + r.in.transports = &transports; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.transports = &transports; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetTransportEnum level %u\n", r.in.level); + transports.level = levels[i]; + switch (transports.level) { + case 0: + ZERO_STRUCT(ctr0); + transports.ctr.ctr0 = &ctr0; + break; + case 1: + ZERO_STRUCT(ctr1); + transports.ctr.ctr1 = &ctr1; + break; + } + torture_comment(tctx, "testing NetTransportEnum level %u\n", transports.level); status = dcerpc_srvsvc_NetTransportEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetTransportEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { |