summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/srvsvc.idl5
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c46
-rw-r--r--source4/torture/rpc/srvsvc.c43
3 files changed, 61 insertions, 33 deletions
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl
index a3b46c218a..bbabd8e2dc 100644
--- a/source4/librpc/idl/srvsvc.idl
+++ b/source4/librpc/idl/srvsvc.idl
@@ -380,10 +380,9 @@ import "security.idl", "svcctl.idl";
[in,unique] [string,charset(UTF16)] uint16 *server_unc,
[in,unique] [string,charset(UTF16)] uint16 *client,
[in,unique] [string,charset(UTF16)] uint16 *user,
- [in,out] uint32 level,
- [in,out,switch_is(level)] srvsvc_NetSessCtr ctr,
+ [in,out,ref] srvsvc_NetSessInfoCtr *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 5827193a3f..bdb617a72a 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -335,58 +335,56 @@ static WERROR dcesrv_srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TAL
static WERROR dcesrv_srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct srvsvc_NetSessEnum *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_NetSessCtr0);
- W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0);
+ r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetSessCtr0);
+ 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_NetSessCtr1);
- W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1);
+ r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetSessCtr1);
+ 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;
}
case 2:
{
- r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetSessCtr2);
- W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2);
+ r->out.info_ctr->ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetSessCtr2);
+ W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr2);
- r->out.ctr.ctr2->count = 0;
- r->out.ctr.ctr2->array = NULL;
+ r->out.info_ctr->ctr.ctr2->count = 0;
+ r->out.info_ctr->ctr.ctr2->array = NULL;
return WERR_NOT_SUPPORTED;
}
case 10:
{
- r->out.ctr.ctr10 = talloc(mem_ctx, struct srvsvc_NetSessCtr10);
- W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr10);
+ r->out.info_ctr->ctr.ctr10 = talloc(mem_ctx, struct srvsvc_NetSessCtr10);
+ W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr10);
- r->out.ctr.ctr2->count = 0;
- r->out.ctr.ctr2->array = NULL;
+ r->out.info_ctr->ctr.ctr10->count = 0;
+ r->out.info_ctr->ctr.ctr10->array = NULL;
return WERR_NOT_SUPPORTED;
}
case 502:
{
- r->out.ctr.ctr502 = talloc(mem_ctx, struct srvsvc_NetSessCtr502);
- W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502);
+ r->out.info_ctr->ctr.ctr502 = talloc(mem_ctx, struct srvsvc_NetSessCtr502);
+ W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr502);
- r->out.ctr.ctr2->count = 0;
- r->out.ctr.ctr2->array = NULL;
+ r->out.info_ctr->ctr.ctr502->count = 0;
+ r->out.info_ctr->ctr.ctr502->array = NULL;
return WERR_NOT_SUPPORTED;
}
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index c3dd5b0e6f..783dfd328b 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -391,23 +391,54 @@ static bool test_NetSessEnum(struct torture_context *tctx,
{
NTSTATUS status;
struct srvsvc_NetSessEnum r;
+ struct srvsvc_NetSessInfoCtr info_ctr;
struct srvsvc_NetSessCtr0 c0;
+ struct srvsvc_NetSessCtr1 c1;
+ struct srvsvc_NetSessCtr2 c2;
+ struct srvsvc_NetSessCtr10 c10;
+ struct srvsvc_NetSessCtr502 c502;
+ uint32_t totalentries = 0;
uint32_t levels[] = {0, 1, 2, 10, 502};
int i;
+ ZERO_STRUCT(info_ctr);
+
r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p));
r.in.client = NULL;
r.in.user = NULL;
- 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;i<ARRAY_SIZE(levels);i++) {
- ZERO_STRUCT(r.out);
- r.in.level = levels[i];
- torture_comment(tctx, "testing NetSessEnum level %u\n", r.in.level);
+ info_ctr.level = levels[i];
+
+ switch (info_ctr.level) {
+ case 0:
+ ZERO_STRUCT(c0);
+ info_ctr.ctr.ctr0 = &c0;
+ break;
+ case 1:
+ ZERO_STRUCT(c1);
+ info_ctr.ctr.ctr1 = &c1;
+ break;
+ case 2:
+ ZERO_STRUCT(c2);
+ info_ctr.ctr.ctr2 = &c2;
+ break;
+ case 10:
+ ZERO_STRUCT(c10);
+ info_ctr.ctr.ctr10 = &c10;
+ break;
+ case 502:
+ ZERO_STRUCT(c502);
+ info_ctr.ctr.ctr502 = &c502;
+ break;
+ }
+
+ torture_comment(tctx, "testing NetSessEnum level %u\n", info_ctr.level);
status = dcerpc_srvsvc_NetSessEnum(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "NetSessEnum failed");
if (!W_ERROR_IS_OK(r.out.result)) {