1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4-srvsvc: merge srvsvc_NetCharDevEnum from s3 idl.

Guenther
This commit is contained in:
Günther Deschner 2008-10-30 16:34:28 +01:00
parent 439f197a68
commit 07f1bb3abc
3 changed files with 44 additions and 24 deletions

View File

@ -51,14 +51,18 @@ import "security.idl", "svcctl.idl";
[default] ; [default] ;
} srvsvc_NetCharDevCtr; } srvsvc_NetCharDevCtr;
typedef struct {
uint32 level;
[switch_is(level)] srvsvc_NetCharDevCtr ctr;
} srvsvc_NetCharDevInfoCtr;
/******************/ /******************/
/* Function: 0x00 */ /* Function: 0x00 */
WERROR srvsvc_NetCharDevEnum( WERROR srvsvc_NetCharDevEnum(
[in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *server_unc,
[in,out] uint32 level, [in,out,ref] srvsvc_NetCharDevInfoCtr *info_ctr,
[in,out,switch_is(level)] srvsvc_NetCharDevCtr ctr,
[in] uint32 max_buffer, [in] uint32 max_buffer,
[out] uint32 totalentries, [out,ref] uint32 *totalentries,
[in,out,unique] uint32 *resume_handle [in,out,unique] uint32 *resume_handle
); );
@ -684,6 +688,7 @@ import "security.idl", "svcctl.idl";
uint32 sessreqs; uint32 sessreqs;
uint32 opensearch; uint32 opensearch;
uint32 activelocks; uint32 activelocks;
uint32 numreqbufs;
uint32 sizereqbufs; uint32 sizereqbufs;
uint32 numbigbufs; uint32 numbigbufs;
uint32 numfiletasks; uint32 numfiletasks;
@ -717,6 +722,7 @@ import "security.idl", "svcctl.idl";
uint32 sessreqs; uint32 sessreqs;
uint32 opensearch; uint32 opensearch;
uint32 activelocks; uint32 activelocks;
uint32 numreqbufs;
uint32 sizereqbufs; uint32 sizereqbufs;
uint32 numbigbufs; uint32 numbigbufs;
uint32 numfiletasks; uint32 numfiletasks;

View File

@ -45,26 +45,24 @@
static WERROR dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, static WERROR dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct srvsvc_NetCharDevEnum *r) struct srvsvc_NetCharDevEnum *r)
{ {
r->out.level = r->in.level; *r->out.totalentries = 0;
r->out.totalentries = 0;
r->out.resume_handle = NULL;
switch (r->in.level) { switch (r->in.info_ctr->level) {
case 0: case 0:
r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr0); r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr0);
W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr0);
r->out.ctr.ctr0->count = 0; r->out.info_ctr->ctr.ctr0->count = 0;
r->out.ctr.ctr0->array = NULL; r->out.info_ctr->ctr.ctr0->array = NULL;
return WERR_NOT_SUPPORTED; return WERR_NOT_SUPPORTED;
case 1: case 1:
r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr1); r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr1);
W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr1);
r->out.ctr.ctr1->count = 0; r->out.info_ctr->ctr.ctr1->count = 0;
r->out.ctr.ctr1->array = NULL; r->out.info_ctr->ctr.ctr1->array = NULL;
return WERR_NOT_SUPPORTED; return WERR_NOT_SUPPORTED;

View File

@ -81,23 +81,39 @@ static bool test_NetCharDevEnum(struct torture_context *tctx,
{ {
NTSTATUS status; NTSTATUS status;
struct srvsvc_NetCharDevEnum r; struct srvsvc_NetCharDevEnum r;
struct srvsvc_NetCharDevInfoCtr info_ctr;
struct srvsvc_NetCharDevCtr0 c0; struct srvsvc_NetCharDevCtr0 c0;
struct srvsvc_NetCharDevCtr0 c1;
uint32_t totalentries = 0;
uint32_t levels[] = {0, 1}; uint32_t levels[] = {0, 1};
int i; int i;
ZERO_STRUCT(info_ctr);
r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p));
r.in.ctr.ctr0 = &c0; r.in.info_ctr = &info_ctr;
r.in.ctr.ctr0->count = 0;
r.in.ctr.ctr0->array = NULL;
r.in.max_buffer = (uint32_t)-1; r.in.max_buffer = (uint32_t)-1;
r.in.resume_handle = NULL; r.in.resume_handle = NULL;
r.out.info_ctr = &info_ctr;
r.out.totalentries = &totalentries;
for (i=0;i<ARRAY_SIZE(levels);i++) { for (i=0;i<ARRAY_SIZE(levels);i++) {
int j; int j;
ZERO_STRUCT(r.out); info_ctr.level = levels[i];
r.in.level = levels[i];
torture_comment(tctx, "testing NetCharDevEnum level %u\n", r.in.level); switch(info_ctr.level) {
case 0:
ZERO_STRUCT(c0);
info_ctr.ctr.ctr0 = &c0;
break;
case 1:
ZERO_STRUCT(c1);
info_ctr.ctr.ctr0 = &c1;
break;
}
torture_comment(tctx, "testing NetCharDevEnum level %u\n", info_ctr.level);
status = dcerpc_srvsvc_NetCharDevEnum(p, tctx, &r); status = dcerpc_srvsvc_NetCharDevEnum(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "NetCharDevEnum failed"); torture_assert_ntstatus_ok(tctx, status, "NetCharDevEnum failed");
if (!W_ERROR_IS_OK(r.out.result)) { if (!W_ERROR_IS_OK(r.out.result)) {
@ -106,10 +122,10 @@ static bool test_NetCharDevEnum(struct torture_context *tctx,
} }
/* call test_NetCharDevGetInfo and test_NetCharDevControl for each returned share */ /* call test_NetCharDevGetInfo and test_NetCharDevControl for each returned share */
if (r.in.level == 1) { if (info_ctr.level == 1) {
for (j=0;j<r.out.ctr.ctr1->count;j++) { for (j=0;j<r.out.info_ctr->ctr.ctr1->count;j++) {
const char *device; const char *device;
device = r.out.ctr.ctr1->array[j].device; device = r.out.info_ctr->ctr.ctr1->array[j].device;
if (!test_NetCharDevGetInfo(p, tctx, device)) { if (!test_NetCharDevGetInfo(p, tctx, device)) {
return false; return false;
} }