mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
parent
4730469cd8
commit
a6e5654b3d
@ -314,28 +314,22 @@
|
||||
unistr *comment;
|
||||
} srvsvc_NetShare1004;
|
||||
|
||||
typedef struct {
|
||||
uint32 count;
|
||||
[size_is(count)] srvsvc_NetShare1004 *array;
|
||||
} srvsvc_NetShareCtr1004;
|
||||
|
||||
typedef union {
|
||||
[case(0)] srvsvc_NetShareCtr0 *ctr0;
|
||||
[case(1)] srvsvc_NetShareCtr1 *ctr1;
|
||||
[case(2)] srvsvc_NetShareCtr2 *ctr2;
|
||||
[case(501)] srvsvc_NetShareCtr501 *ctr501;
|
||||
[case(502)] srvsvc_NetShareCtr502 *ctr502;
|
||||
[case(1004)] srvsvc_NetShareCtr1004 *ctr1004;
|
||||
[default] ;
|
||||
} srvsvc_NetShareCtr;
|
||||
} srvsvc_NetShareUnion;
|
||||
|
||||
WERROR srvsvc_NetShareEnumAll(
|
||||
[in] unistr *server_unc,
|
||||
[in,out] uint32 level,
|
||||
[in,out,switch_is(level)] srvsvc_NetShareCtr ctr,
|
||||
[in] uint32 preferred_len,
|
||||
[out] uint32 totalentries,
|
||||
[in,out] uint32 *resume_handle
|
||||
WERROR srvsvc_NetShareEnumAll (
|
||||
[in] unistr *server_unc,
|
||||
[in,out] uint32 level,
|
||||
[in,out,switch_is(level)] srvsvc_NetShareUnion ctr,
|
||||
[in] uint32 max_buffer,
|
||||
[out] uint32 totalentries,
|
||||
[in,out] uint32 *resume_handle
|
||||
);
|
||||
|
||||
/******************/
|
||||
@ -561,7 +555,7 @@
|
||||
WERROR srvsvc_NetShareEnum(
|
||||
[in] unistr *server_unc,
|
||||
[in,out] uint32 level,
|
||||
[in,out,switch_is(level)] srvsvc_NetShareCtr ctr,
|
||||
[in,out,switch_is(level)] srvsvc_NetShareUnion ctr,
|
||||
[in] uint32 preferred_len,
|
||||
[out] uint32 totalentries,
|
||||
[in,out] uint32 *resume_handle
|
||||
|
@ -877,41 +877,7 @@ done:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_push_srvsvc_NetShare1004(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetShare1004 *r)
|
||||
{
|
||||
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
|
||||
NDR_CHECK(ndr_push_struct_start(ndr));
|
||||
NDR_CHECK(ndr_push_align(ndr, 4));
|
||||
NDR_CHECK(ndr_push_ptr(ndr, r->comment));
|
||||
ndr_push_struct_end(ndr);
|
||||
buffers:
|
||||
if (!(ndr_flags & NDR_BUFFERS)) goto done;
|
||||
if (r->comment) {
|
||||
NDR_CHECK(ndr_push_unistr(ndr, r->comment));
|
||||
}
|
||||
done:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_push_srvsvc_NetShareCtr1004(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetShareCtr1004 *r)
|
||||
{
|
||||
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
|
||||
NDR_CHECK(ndr_push_struct_start(ndr));
|
||||
NDR_CHECK(ndr_push_align(ndr, 4));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->count));
|
||||
NDR_CHECK(ndr_push_ptr(ndr, r->array));
|
||||
ndr_push_struct_end(ndr);
|
||||
buffers:
|
||||
if (!(ndr_flags & NDR_BUFFERS)) goto done;
|
||||
if (r->array) {
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->count));
|
||||
NDR_CHECK(ndr_push_array(ndr, NDR_SCALARS|NDR_BUFFERS, r->array, sizeof(r->array[0]), r->count, (ndr_push_flags_fn_t)ndr_push_srvsvc_NetShare1004));
|
||||
}
|
||||
done:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_push_srvsvc_NetShareCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareCtr *r)
|
||||
NTSTATUS ndr_push_srvsvc_NetShareUnion(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareUnion *r)
|
||||
{
|
||||
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
|
||||
NDR_CHECK(ndr_push_struct_start(ndr));
|
||||
@ -936,10 +902,6 @@ NTSTATUS ndr_push_srvsvc_NetShareCtr(struct ndr_push *ndr, int ndr_flags, uint16
|
||||
NDR_CHECK(ndr_push_ptr(ndr, r->ctr502));
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
NDR_CHECK(ndr_push_ptr(ndr, r->ctr1004));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -978,12 +940,6 @@ buffers:
|
||||
}
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
if (r->ctr1004) {
|
||||
NDR_CHECK(ndr_push_srvsvc_NetShareCtr1004(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr1004));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -1000,8 +956,8 @@ NTSTATUS ndr_push_srvsvc_NetShareEnumAll(struct ndr_push *ndr, struct srvsvc_Net
|
||||
}
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
|
||||
NDR_CHECK(ndr_push_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->in.ctr));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.preferred_len));
|
||||
NDR_CHECK(ndr_push_srvsvc_NetShareUnion(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->in.ctr));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.max_buffer));
|
||||
NDR_CHECK(ndr_push_ptr(ndr, r->in.resume_handle));
|
||||
if (r->in.resume_handle) {
|
||||
NDR_CHECK(ndr_push_uint32(ndr, *r->in.resume_handle));
|
||||
@ -1352,7 +1308,7 @@ NTSTATUS ndr_push_srvsvc_NetShareEnum(struct ndr_push *ndr, struct srvsvc_NetSha
|
||||
}
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
|
||||
NDR_CHECK(ndr_push_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->in.ctr));
|
||||
NDR_CHECK(ndr_push_srvsvc_NetShareUnion(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->in.ctr));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.preferred_len));
|
||||
NDR_CHECK(ndr_push_ptr(ndr, r->in.resume_handle));
|
||||
if (r->in.resume_handle) {
|
||||
@ -2690,60 +2646,7 @@ done:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_pull_srvsvc_NetShare1004(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetShare1004 *r)
|
||||
{
|
||||
uint32 _ptr_comment;
|
||||
NDR_CHECK(ndr_pull_struct_start(ndr));
|
||||
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
|
||||
NDR_CHECK(ndr_pull_align(ndr, 4));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_comment));
|
||||
if (_ptr_comment) {
|
||||
NDR_ALLOC(ndr, r->comment);
|
||||
} else {
|
||||
r->comment = NULL;
|
||||
}
|
||||
ndr_pull_struct_end(ndr);
|
||||
buffers:
|
||||
if (!(ndr_flags & NDR_BUFFERS)) goto done;
|
||||
if (r->comment) {
|
||||
NDR_CHECK(ndr_pull_unistr(ndr, &r->comment));
|
||||
}
|
||||
done:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_pull_srvsvc_NetShareCtr1004(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetShareCtr1004 *r)
|
||||
{
|
||||
uint32 _ptr_array;
|
||||
NDR_CHECK(ndr_pull_struct_start(ndr));
|
||||
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
|
||||
NDR_CHECK(ndr_pull_align(ndr, 4));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &r->count));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_array));
|
||||
if (_ptr_array) {
|
||||
NDR_ALLOC(ndr, r->array);
|
||||
} else {
|
||||
r->array = NULL;
|
||||
}
|
||||
ndr_pull_struct_end(ndr);
|
||||
buffers:
|
||||
if (!(ndr_flags & NDR_BUFFERS)) goto done;
|
||||
if (r->array) {
|
||||
{
|
||||
uint32 _array_size;
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
|
||||
if (r->count > _array_size) {
|
||||
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, r->count);
|
||||
}
|
||||
}
|
||||
NDR_ALLOC_N_SIZE(ndr, r->array, r->count, sizeof(r->array[0]));
|
||||
NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->array, sizeof(r->array[0]), r->count, (ndr_pull_flags_fn_t)ndr_pull_srvsvc_NetShare1004));
|
||||
}
|
||||
done:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_pull_srvsvc_NetShareCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareCtr *r)
|
||||
NTSTATUS ndr_pull_srvsvc_NetShareUnion(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareUnion *r)
|
||||
{
|
||||
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
|
||||
NDR_CHECK(ndr_pull_struct_start(ndr));
|
||||
@ -2798,16 +2701,6 @@ NTSTATUS ndr_pull_srvsvc_NetShareCtr(struct ndr_pull *ndr, int ndr_flags, uint16
|
||||
}
|
||||
break; }
|
||||
|
||||
case 1004: {
|
||||
uint32 _ptr_ctr1004;
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr1004));
|
||||
if (_ptr_ctr1004) {
|
||||
NDR_ALLOC(ndr, r->ctr1004);
|
||||
} else {
|
||||
r->ctr1004 = NULL;
|
||||
}
|
||||
break; }
|
||||
|
||||
default: {
|
||||
break; }
|
||||
|
||||
@ -2846,12 +2739,6 @@ buffers:
|
||||
}
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
if (r->ctr1004) {
|
||||
NDR_CHECK(ndr_pull_srvsvc_NetShareCtr1004(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr1004));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -2869,7 +2756,7 @@ NTSTATUS ndr_pull_srvsvc_NetShareEnumAll(struct ndr_pull *ndr, struct srvsvc_Net
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_level));
|
||||
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in ctr");
|
||||
}
|
||||
NDR_CHECK(ndr_pull_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr));
|
||||
NDR_CHECK(ndr_pull_srvsvc_NetShareUnion(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &r->out.totalentries));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle));
|
||||
if (_ptr_resume_handle) {
|
||||
@ -3454,7 +3341,7 @@ NTSTATUS ndr_pull_srvsvc_NetShareEnum(struct ndr_pull *ndr, struct srvsvc_NetSha
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_level));
|
||||
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in ctr");
|
||||
}
|
||||
NDR_CHECK(ndr_pull_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr));
|
||||
NDR_CHECK(ndr_pull_srvsvc_NetShareUnion(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &r->out.totalentries));
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle));
|
||||
if (_ptr_resume_handle) {
|
||||
@ -4518,9 +4405,9 @@ void ndr_print_srvsvc_NetShareCtr1004(struct ndr_print *ndr, const char *name, s
|
||||
ndr->depth--;
|
||||
}
|
||||
|
||||
void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetShareCtr *r)
|
||||
void ndr_print_srvsvc_NetShareUnion(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetShareUnion *r)
|
||||
{
|
||||
ndr_print_union(ndr, name, level, "srvsvc_NetShareCtr");
|
||||
ndr_print_union(ndr, name, level, "srvsvc_NetShareUnion");
|
||||
switch (level) {
|
||||
case 0:
|
||||
ndr_print_ptr(ndr, "ctr0", r->ctr0);
|
||||
@ -4567,15 +4454,6 @@ void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, uint1
|
||||
ndr->depth--;
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
ndr_print_ptr(ndr, "ctr1004", r->ctr1004);
|
||||
ndr->depth++;
|
||||
if (r->ctr1004) {
|
||||
ndr_print_srvsvc_NetShareCtr1004(ndr, "ctr1004", r->ctr1004);
|
||||
}
|
||||
ndr->depth--;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -4596,8 +4474,8 @@ void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, i
|
||||
}
|
||||
ndr->depth--;
|
||||
ndr_print_uint32(ndr, "level", r->in.level);
|
||||
ndr_print_srvsvc_NetShareCtr(ndr, "ctr", r->in.level, &r->in.ctr);
|
||||
ndr_print_uint32(ndr, "preferred_len", r->in.preferred_len);
|
||||
ndr_print_srvsvc_NetShareUnion(ndr, "ctr", r->in.level, &r->in.ctr);
|
||||
ndr_print_uint32(ndr, "max_buffer", r->in.max_buffer);
|
||||
ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
|
||||
ndr->depth++;
|
||||
if (r->in.resume_handle) {
|
||||
@ -4610,7 +4488,7 @@ void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, i
|
||||
ndr_print_struct(ndr, "out", "srvsvc_NetShareEnumAll");
|
||||
ndr->depth++;
|
||||
ndr_print_uint32(ndr, "level", r->out.level);
|
||||
ndr_print_srvsvc_NetShareCtr(ndr, "ctr", r->in.level, &r->out.ctr);
|
||||
ndr_print_srvsvc_NetShareUnion(ndr, "ctr", r->in.level, &r->out.ctr);
|
||||
ndr_print_uint32(ndr, "totalentries", r->out.totalentries);
|
||||
ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
|
||||
ndr->depth++;
|
||||
@ -5343,7 +5221,7 @@ void ndr_print_srvsvc_NetShareEnum(struct ndr_print *ndr, const char *name, int
|
||||
}
|
||||
ndr->depth--;
|
||||
ndr_print_uint32(ndr, "level", r->in.level);
|
||||
ndr_print_srvsvc_NetShareCtr(ndr, "ctr", r->in.level, &r->in.ctr);
|
||||
ndr_print_srvsvc_NetShareUnion(ndr, "ctr", r->in.level, &r->in.ctr);
|
||||
ndr_print_uint32(ndr, "preferred_len", r->in.preferred_len);
|
||||
ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
|
||||
ndr->depth++;
|
||||
@ -5357,7 +5235,7 @@ void ndr_print_srvsvc_NetShareEnum(struct ndr_print *ndr, const char *name, int
|
||||
ndr_print_struct(ndr, "out", "srvsvc_NetShareEnum");
|
||||
ndr->depth++;
|
||||
ndr_print_uint32(ndr, "level", r->out.level);
|
||||
ndr_print_srvsvc_NetShareCtr(ndr, "ctr", r->in.level, &r->out.ctr);
|
||||
ndr_print_srvsvc_NetShareUnion(ndr, "ctr", r->in.level, &r->out.ctr);
|
||||
ndr_print_uint32(ndr, "totalentries", r->out.totalentries);
|
||||
ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
|
||||
ndr->depth++;
|
||||
|
@ -434,27 +434,26 @@ struct srvsvc_NetShareCtr1004 {
|
||||
struct srvsvc_NetShare1004 *array;
|
||||
};
|
||||
|
||||
union srvsvc_NetShareCtr {
|
||||
union srvsvc_NetShareUnion {
|
||||
/* [case(0)] */ struct srvsvc_NetShareCtr0 *ctr0;
|
||||
/* [case(1)] */ struct srvsvc_NetShareCtr1 *ctr1;
|
||||
/* [case(2)] */ struct srvsvc_NetShareCtr2 *ctr2;
|
||||
/* [case(501)] */ struct srvsvc_NetShareCtr501 *ctr501;
|
||||
/* [case(502)] */ struct srvsvc_NetShareCtr502 *ctr502;
|
||||
/* [case(1004)] */ struct srvsvc_NetShareCtr1004 *ctr1004;
|
||||
/* [case(default)] */ };
|
||||
|
||||
struct srvsvc_NetShareEnumAll {
|
||||
struct {
|
||||
const char *server_unc;
|
||||
uint32 level;
|
||||
union srvsvc_NetShareCtr ctr;
|
||||
uint32 preferred_len;
|
||||
union srvsvc_NetShareUnion ctr;
|
||||
uint32 max_buffer;
|
||||
uint32 *resume_handle;
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint32 level;
|
||||
union srvsvc_NetShareCtr ctr;
|
||||
union srvsvc_NetShareUnion ctr;
|
||||
uint32 totalentries;
|
||||
uint32 *resume_handle;
|
||||
WERROR result;
|
||||
@ -783,14 +782,14 @@ struct srvsvc_NetShareEnum {
|
||||
struct {
|
||||
const char *server_unc;
|
||||
uint32 level;
|
||||
union srvsvc_NetShareCtr ctr;
|
||||
union srvsvc_NetShareUnion ctr;
|
||||
uint32 preferred_len;
|
||||
uint32 *resume_handle;
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint32 level;
|
||||
union srvsvc_NetShareCtr ctr;
|
||||
union srvsvc_NetShareUnion ctr;
|
||||
uint32 totalentries;
|
||||
uint32 *resume_handle;
|
||||
WERROR result;
|
||||
|
@ -118,7 +118,7 @@ static BOOL test_NetSessEnum(struct dcerpc_pipe *p,
|
||||
}
|
||||
|
||||
static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct srvsvc_NetShareEnumAll r;
|
||||
@ -126,15 +126,18 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p,
|
||||
uint32 levels[] = {0, 1, 2, 501, 502, 1004};
|
||||
int i;
|
||||
BOOL ret = True;
|
||||
uint32 resume_handle;
|
||||
|
||||
ZERO_STRUCT(c0);
|
||||
|
||||
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
|
||||
r.in.ctr.ctr0 = &c0;
|
||||
r.in.ctr.ctr0->count = 0;
|
||||
r.in.ctr.ctr0->array = NULL;
|
||||
r.in.preferred_len = (uint32)-1;
|
||||
r.in.resume_handle = NULL;
|
||||
r.in.max_buffer = (uint32)-1;
|
||||
r.in.resume_handle = &resume_handle;
|
||||
r.out.resume_handle = &resume_handle;
|
||||
|
||||
for (i=0;i<ARRAY_SIZE(levels);i++) {
|
||||
resume_handle = 0;
|
||||
r.in.level = levels[i];
|
||||
printf("testing NetShareEnumAll level %u\n", r.in.level);
|
||||
status = dcerpc_srvsvc_NetShareEnumAll(p, mem_ctx, &r);
|
||||
|
Loading…
Reference in New Issue
Block a user