1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

switched to a new way of handling unions, so that we can handle

alignment correctly for unions that have non-uint16 discriminants

fixed the union handling in srvsvc.idl. (metze, please take a look at
the changes, your IDL did match what was one the wire in most cases,
but isn't the way IDL is usually coded)
(This used to be commit 7b5d028729)
This commit is contained in:
Andrew Tridgell 2003-11-19 22:10:20 +00:00
parent 5a51af0685
commit 10ee36bede
18 changed files with 373 additions and 963 deletions

View File

@ -60,6 +60,10 @@ interface rpcecho
echo_info1 info1;
} echo_info6;
typedef union {
[case(1)] echo_info1 info1;
} echo_XXX;
typedef struct {
uint8 v1;
echo_info4 info4;
@ -76,7 +80,7 @@ interface rpcecho
} echo_Info;
NTSTATUS TestCall2 (
[in] uint16 level,
[in] uint32 level,
[out,switch_is(level)] echo_Info *info
);
}

View File

@ -77,22 +77,17 @@
typedef struct {
} srvsvc_NetConnCtrDefault;
typedef [nodiscriminant,public] union {
typedef union {
case(0) srvsvc_NetConnCtr0 *ctr0;
case(1) srvsvc_NetConnCtr1 *ctr1;
default srvsvc_NetConnCtrDefault ctrDefault;
} srvsvc_NetConnSubCtr;
typedef struct {
uint32 level;
uint32 level2;
[switch_is(level)] srvsvc_NetConnSubCtr subctr;
} srvsvc_NetConnCtr;
WERROR srvsvc_NetConnEnum(
[in] unistr *server_unc,
[in] unistr *path,
[in,out] srvsvc_NetConnCtr ctr,
[in,out] uint32 level,
[in,out,switch_is(level)] srvsvc_NetConnCtr ctr,
[in] uint32 preferred_len,
[out] uint32 total,
[in,out] uint32 *resume_handle
@ -126,23 +121,18 @@
typedef struct {
} srvsvc_NetFileCtrDefault;
typedef [nodiscriminant,public] union {
typedef union {
case(2) srvsvc_NetFileCtr2 *ctr2;
case(3) srvsvc_NetFileCtr3 *ctr3;
default srvsvc_NetFileCtrDefault ctrDefault;
} srvsvc_NetFileSubCtr;
typedef struct {
uint32 level;
uint32 level2;
[switch_is(level)] srvsvc_NetFileSubCtr subctr;
} srvsvc_NetFileCtr;
WERROR srvsvc_NetFileEnum(
[in] unistr *server_unc,
[in] unistr *path,
[in] unistr *user,
[in,out] srvsvc_NetFileCtr ctr,
[in,out] uint32 level,
[in,out,switch_is(level)] srvsvc_NetFileCtr ctr,
[in] uint32 preferred_len,
[out] uint32 total,
[in,out] uint32 *resume_handle
@ -230,26 +220,21 @@
typedef struct {
} srvsvc_NetSessCtrDefault;
typedef [nodiscriminant,public] union {
typedef union {
case(0) srvsvc_NetSessCtr0 *ctr0;
case(1) srvsvc_NetSessCtr1 *ctr1;
case(2) srvsvc_NetSessCtr2 *ctr2;
case(10) srvsvc_NetSessCtr10 *ctr10;
case(502) srvsvc_NetSessCtr502 *ctr502;
default srvsvc_NetSessCtrDefault ctrDefault;
} srvsvc_NetSessSubCtr;
typedef struct {
uint32 level;
uint32 level2;
[switch_is(level)] srvsvc_NetSessSubCtr subctr;
} srvsvc_NetSessCtr;
WERROR srvsvc_NetSessEnum(
[in] unistr *server_unc,
[in] unistr *client,
[in] unistr *user,
[in,out] srvsvc_NetSessCtr ctr,
[in,out] uint32 level,
[in,out,switch_is(level)] srvsvc_NetSessCtr ctr,
[in] uint32 preferred_len,
[out] uint32 total,
[in,out] uint32 *resume_handle
@ -337,24 +322,19 @@
typedef struct {
} srvsvc_NetShareCtrDefault;
typedef [nodiscriminant,public] union {
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;
default srvsvc_NetShareCtrDefault ctrDefault;
} srvsvc_NetShareSubCtr;
typedef struct {
uint32 level;
[switch_is(level)] srvsvc_NetShareSubCtr subctr;
} srvsvc_NetShareCtr;
WERROR srvsvc_NetShareEnumAll(
[in] unistr *server_unc,
[in] uint32 level,
[in,out] srvsvc_NetShareCtr ctr,
[in,out] uint32 level,
[in,out,switch_is(level)] srvsvc_NetShareCtr ctr,
[in] uint32 preferred_len,
[out] uint32 totalentries,
[in,out] uint32 *resume_handle
@ -441,7 +421,7 @@
typedef struct {
} srvsvc_NetDiskCtrDefault;
typedef [nodiscriminant,public] union {
typedef union {
case(0) srvsvc_NetDiskCtr0 ctr0;
case(1) srvsvc_NetDiskCtr1 ctr1;
case(2) srvsvc_NetDiskCtr2 ctr2;
@ -522,22 +502,17 @@
typedef struct {
} srvsvc_NetTransportCtrDefault;
typedef [nodiscriminant,public] union {
typedef union {
case(0) srvsvc_NetTransportCtr0 *ctr0;
case(1) srvsvc_NetTransportCtr1 *ctr1;
case(2) srvsvc_NetTransportCtr2 *ctr2;
default srvsvc_NetTransportCtrDefault ctrDefault;
} srvsvc_NetTransportSubCtr;
typedef struct {
uint32 level;
uint32 level2;
[switch_is(level)] srvsvc_NetTransportSubCtr subctr;
} srvsvc_NetTransportCtr;
WERROR srvsvc_NetTransportEnum(
[in] unistr *server_unc,
[in,out] srvsvc_NetTransportCtr ctr,
[in,out] uint32 level,
[in,out,switch_is(level)] srvsvc_NetTransportCtr ctr,
[in] uint32 preferred_len,
[out] uint32 total,
[in,out] uint32 *resume_handle
@ -594,8 +569,8 @@
total entries ... */
WERROR srvsvc_NetShareEnum(
[in] unistr *server_unc,
[in] uint32 level,
[in,out] srvsvc_NetShareCtr ctr,
[in,out] uint32 level,
[in,out,switch_is(level)] srvsvc_NetShareCtr ctr,
[in] uint32 preferred_len,
[out] uint32 totalentries,
[in,out] uint32 *resume_handle

View File

@ -179,11 +179,11 @@ typedef NTSTATUS (*ndr_pull_fn_t)(struct ndr_pull *, void *);
typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, void *);
typedef NTSTATUS (*ndr_push_const_fn_t)(struct ndr_push *, int ndr_flags, const void *);
typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
typedef NTSTATUS (*ndr_push_union_fn_t)(struct ndr_push *, int ndr_flags, uint16, void *);
typedef NTSTATUS (*ndr_pull_union_fn_t)(struct ndr_pull *, int ndr_flags, uint16 *, void *);
typedef NTSTATUS (*ndr_push_union_fn_t)(struct ndr_push *, int ndr_flags, uint32, void *);
typedef NTSTATUS (*ndr_pull_union_fn_t)(struct ndr_pull *, int ndr_flags, uint32, void *);
typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *);
typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, void *);
typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint16, void *);
typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32, void *);
/* now pull in the individual parsers */
#include "librpc/ndr/ndr_basic.h"

View File

@ -318,9 +318,9 @@ void ndr_print_debug(void (*fn)(struct ndr_print *, const char *, void *),
/*
a useful helper function for printing idl unions via DEBUG()
*/
void ndr_print_union_debug(void (*fn)(struct ndr_print *, const char *, uint16, void *),
void ndr_print_union_debug(void (*fn)(struct ndr_print *, const char *, uint32, void *),
const char *name,
uint16 level,
uint32 level,
void *ptr)
{
struct ndr_print ndr;
@ -427,9 +427,9 @@ NTSTATUS ndr_pull_subcontext_flags_fn(struct ndr_pull *ndr,
}
NTSTATUS ndr_pull_subcontext_union_fn(struct ndr_pull *ndr,
uint16 *level,
uint32 level,
void *base,
NTSTATUS (*fn)(struct ndr_pull *, int , uint16 *, void *))
NTSTATUS (*fn)(struct ndr_pull *, int , uint32 , void *))
{
uint32 size;
struct ndr_pull ndr2;
@ -562,15 +562,15 @@ NTSTATUS ndr_push_relative(struct ndr_push *ndr, int ndr_flags, const void *p,
/*
pull a union from a blob using NDR
*/
NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint16 level, void *p,
NTSTATUS (*fn)(struct ndr_pull *, int ndr_flags, uint16 *, void *))
NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint32 level, void *p,
NTSTATUS (*fn)(struct ndr_pull *, int ndr_flags, uint32, void *))
{
struct ndr_pull *ndr;
ndr = ndr_pull_init_blob(blob, mem_ctx);
if (!ndr) {
return NT_STATUS_NO_MEMORY;
}
return fn(ndr, NDR_SCALARS|NDR_BUFFERS, &level, p);
return fn(ndr, NDR_SCALARS|NDR_BUFFERS, level, p);
}
/*

View File

@ -323,7 +323,6 @@ NTSTATUS ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_flags, uint16 level
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_push_struct_start(ndr));
NDR_CHECK(ndr_push_uint16(ndr, level));
switch (level) {
case 1:
NDR_CHECK(ndr_push_ptr(ndr, r->info1));
@ -405,10 +404,12 @@ NTSTATUS ndr_push_dfs_EnumStruct(struct ndr_push *ndr, int ndr_flags, struct dfs
NDR_CHECK(ndr_push_struct_start(ndr));
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, r->level));
NDR_CHECK(ndr_push_uint32(ndr, r->level));
NDR_CHECK(ndr_push_dfs_EnumInfo(ndr, NDR_SCALARS, r->level, &r->e));
ndr_push_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
NDR_CHECK(ndr_push_uint32(ndr, r->level));
NDR_CHECK(ndr_push_dfs_EnumInfo(ndr, NDR_BUFFERS, r->level, &r->e));
done:
return NT_STATUS_OK;
@ -751,12 +752,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_dfs_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union dfs_Info *r)
NTSTATUS ndr_pull_dfs_Info(struct ndr_pull *ndr, int ndr_flags, uint16 level, union dfs_Info *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
uint32 _ptr_info1;
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info1));
@ -848,12 +848,12 @@ NTSTATUS ndr_pull_dfs_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level, u
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
if (r->info1) {
NDR_CHECK(ndr_pull_dfs_Info1(ndr, NDR_SCALARS|NDR_BUFFERS, r->info1));
@ -909,7 +909,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -917,10 +917,12 @@ done:
NTSTATUS ndr_pull_dfs_GetInfo(struct ndr_pull *ndr, struct dfs_GetInfo *r)
{
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_dfs_Info(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, &r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint32 _level;
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 info");
}
NDR_CHECK(ndr_pull_dfs_Info(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.info));
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
return NT_STATUS_OK;
@ -1112,12 +1114,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union dfs_EnumInfo *r)
NTSTATUS ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint16 level, union dfs_EnumInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
uint32 _ptr_info1;
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info1));
@ -1179,12 +1180,12 @@ NTSTATUS ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *leve
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
if (r->info1) {
NDR_CHECK(ndr_pull_dfs_EnumArray1(ndr, NDR_SCALARS|NDR_BUFFERS, r->info1));
@ -1222,7 +1223,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -1234,17 +1235,21 @@ NTSTATUS ndr_pull_dfs_EnumStruct(struct ndr_pull *ndr, int ndr_flags, struct dfs
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, &r->level));
{ uint16 _level = r->level;
NDR_CHECK(ndr_pull_dfs_EnumInfo(ndr, NDR_SCALARS, &_level, &r->e));
if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in e");
if ((NDR_SCALARS) & NDR_SCALARS) {
uint32 _level;
NDR_CHECK(ndr_pull_uint32(ndr, &_level));
if (_level != r->level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in e");
}
NDR_CHECK(ndr_pull_dfs_EnumInfo(ndr, NDR_SCALARS, r->level, &r->e));
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
{ uint16 _level = r->level;
NDR_CHECK(ndr_pull_dfs_EnumInfo(ndr, NDR_BUFFERS, &_level, &r->e));
if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in e");
if ((NDR_BUFFERS) & NDR_SCALARS) {
uint32 _level;
NDR_CHECK(ndr_pull_uint32(ndr, &_level));
if (_level != r->level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in e");
}
NDR_CHECK(ndr_pull_dfs_EnumInfo(ndr, NDR_BUFFERS, r->level, &r->e));
done:
return NT_STATUS_OK;
}

View File

@ -50,7 +50,7 @@ NTSTATUS ndr_push_TestCall(struct ndr_push *ndr, struct TestCall *r)
NTSTATUS ndr_push_TestCall2(struct ndr_push *ndr, struct TestCall2 *r)
{
NDR_CHECK(ndr_push_uint16(ndr, r->in.level));
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
return NT_STATUS_OK;
}
@ -187,7 +187,7 @@ NTSTATUS ndr_pull_echo_info6(struct ndr_pull *ndr, int ndr_flags, struct echo_in
{
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_align(ndr, 1));
NDR_CHECK(ndr_pull_uint8(ndr, &r->v1));
NDR_CHECK(ndr_pull_echo_info1(ndr, NDR_SCALARS, &r->info1));
ndr_pull_struct_end(ndr);
@ -202,7 +202,7 @@ NTSTATUS ndr_pull_echo_info7(struct ndr_pull *ndr, int ndr_flags, struct echo_in
{
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_align(ndr, 8));
NDR_CHECK(ndr_pull_uint8(ndr, &r->v1));
NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4));
ndr_pull_struct_end(ndr);
@ -213,12 +213,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_echo_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union echo_Info *r)
NTSTATUS ndr_pull_echo_Info(struct ndr_pull *ndr, int ndr_flags, uint16 level, union echo_Info *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_echo_info1(ndr, NDR_SCALARS, &r->info1));
break; }
@ -248,12 +247,12 @@ NTSTATUS ndr_pull_echo_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level,
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_echo_info1(ndr, NDR_BUFFERS, &r->info1));
break;
@ -283,7 +282,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -299,10 +298,12 @@ NTSTATUS ndr_pull_TestCall2(struct ndr_pull *ndr, struct TestCall2 *r)
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_echo_Info(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint32 _level;
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 info");
}
NDR_CHECK(ndr_pull_echo_Info(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->out.info));
}
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
@ -483,6 +484,19 @@ void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, struct echo_i
ndr->depth--;
}
void ndr_print_echo_XXX(struct ndr_print *ndr, const char *name, uint16 level, union echo_XXX *r)
{
ndr_print_union(ndr, name, level, "echo_XXX");
switch (level) {
case 1:
ndr_print_echo_info1(ndr, "info1", &r->info1);
break;
default:
ndr_print_bad_level(ndr, name, level);
}
}
void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, struct echo_info7 *r)
{
ndr_print_struct(ndr, name, "echo_info7");
@ -536,7 +550,7 @@ void ndr_print_TestCall2(struct ndr_print *ndr, const char *name, int flags, str
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "TestCall2");
ndr->depth++;
ndr_print_uint16(ndr, "level", r->in.level);
ndr_print_uint32(ndr, "level", r->in.level);
ndr->depth--;
}
if (flags & NDR_OUT) {

View File

@ -94,6 +94,10 @@ struct echo_info6 {
struct echo_info1 info1;
};
union echo_XXX {
/* [case(1)] */ struct echo_info1 info1;
};
struct echo_info7 {
uint8 v1;
struct echo_info4 info4;
@ -111,7 +115,7 @@ union echo_Info {
struct TestCall2 {
struct {
uint16 level;
uint32 level;
} in;
struct {

View File

@ -878,12 +878,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union lsa_PolicyInformation *r)
NTSTATUS ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, int ndr_flags, uint16 level, union lsa_PolicyInformation *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_lsa_AuditLogInfo(ndr, NDR_SCALARS, &r->audit_log));
break; }
@ -933,12 +932,12 @@ NTSTATUS ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, int ndr_flags, uin
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_lsa_AuditLogInfo(ndr, NDR_BUFFERS, &r->audit_log));
break;
@ -988,7 +987,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -1004,10 +1003,12 @@ NTSTATUS ndr_pull_lsa_QueryInfoPolicy(struct ndr_pull *ndr, struct lsa_QueryInfo
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint16 _level;
NDR_CHECK(ndr_pull_uint16(ndr, &_level));
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
}
NDR_CHECK(ndr_pull_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->out.info));
}
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));

View File

@ -886,12 +886,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_DomainInfo *r)
NTSTATUS ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, uint16 level, union samr_DomainInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, &r->info1));
break; }
@ -941,12 +940,12 @@ NTSTATUS ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *l
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_BUFFERS, &r->info1));
break;
@ -996,7 +995,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -1012,10 +1011,12 @@ NTSTATUS ndr_pull_samr_QueryDomainInfo(struct ndr_pull *ndr, struct samr_QueryDo
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint16 _level;
NDR_CHECK(ndr_pull_uint16(ndr, &_level));
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
}
NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->out.info));
}
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
@ -1238,12 +1239,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_samr_GroupInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_GroupInfo *r)
NTSTATUS ndr_pull_samr_GroupInfo(struct ndr_pull *ndr, int ndr_flags, uint16 level, union samr_GroupInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all));
break; }
@ -1261,12 +1261,12 @@ NTSTATUS ndr_pull_samr_GroupInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *le
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all));
break;
@ -1284,7 +1284,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -1300,10 +1300,12 @@ NTSTATUS ndr_pull_samr_QueryGroupInfo(struct ndr_pull *ndr, struct samr_QueryGro
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint16 _level;
NDR_CHECK(ndr_pull_uint16(ndr, &_level));
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
}
NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->out.info));
}
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
@ -1405,12 +1407,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_samr_AliasInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_AliasInfo *r)
NTSTATUS ndr_pull_samr_AliasInfo(struct ndr_pull *ndr, int ndr_flags, uint16 level, union samr_AliasInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_SCALARS, &r->all));
break; }
@ -1424,12 +1425,12 @@ NTSTATUS ndr_pull_samr_AliasInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *le
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_BUFFERS, &r->all));
break;
@ -1443,7 +1444,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -1459,10 +1460,12 @@ NTSTATUS ndr_pull_samr_QueryAliasInfo(struct ndr_pull *ndr, struct samr_QueryAli
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint16 _level;
NDR_CHECK(ndr_pull_uint16(ndr, &_level));
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
}
NDR_CHECK(ndr_pull_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->out.info));
}
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
@ -1984,12 +1987,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_UserInfo *r)
NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint16 level, union samr_UserInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_samr_UserInfo1(ndr, NDR_SCALARS, &r->info1));
break; }
@ -2063,12 +2065,12 @@ NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *lev
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_samr_UserInfo1(ndr, NDR_BUFFERS, &r->info1));
break;
@ -2142,7 +2144,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -2158,10 +2160,12 @@ NTSTATUS ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, struct samr_QueryUser
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint16 _level;
NDR_CHECK(ndr_pull_uint16(ndr, &_level));
if (_level != r->in.level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
}
NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->out.info));
}
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));

View File

@ -791,7 +791,6 @@ NTSTATUS ndr_push_spoolss_UserLevel(struct ndr_push *ndr, int ndr_flags, uint16
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_push_struct_start(ndr));
NDR_CHECK(ndr_push_uint16(ndr, level));
switch (level) {
case 1:
NDR_CHECK(ndr_push_ptr(ndr, r->level1));
@ -830,6 +829,7 @@ NTSTATUS ndr_push_spoolss_OpenPrinterEx(struct ndr_push *ndr, struct spoolss_Ope
NDR_CHECK(ndr_push_spoolss_DevmodeContainer(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.devmode_ctr));
NDR_CHECK(ndr_push_uint32(ndr, r->in.access_required));
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
NDR_CHECK(ndr_push_spoolss_UserLevel(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->in.userlevel));
return NT_STATUS_OK;
@ -1171,11 +1171,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_PrinterInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union spoolss_PrinterInfo *r)
NTSTATUS ndr_pull_spoolss_PrinterInfo(struct ndr_pull *ndr, int ndr_flags, uint16 level, union spoolss_PrinterInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
switch (*level) {
switch (level) {
case 1: {
NDR_CHECK(ndr_pull_spoolss_PrinterInfo1(ndr, NDR_SCALARS, &r->info1));
break; }
@ -1205,12 +1205,12 @@ NTSTATUS ndr_pull_spoolss_PrinterInfo(struct ndr_pull *ndr, int ndr_flags, uint1
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 1:
NDR_CHECK(ndr_pull_spoolss_PrinterInfo1(ndr, NDR_BUFFERS, &r->info1));
break;
@ -1240,7 +1240,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -1337,10 +1337,7 @@ NTSTATUS ndr_pull_spoolss_GetPrinter(struct ndr_pull *ndr, struct spoolss_GetPri
r->out.info = NULL;
}
if (r->out.info) {
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_subcontext_union_fn(ndr, &_level, r->out.info, (ndr_pull_union_fn_t) ndr_pull_spoolss_PrinterInfo));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
}
NDR_CHECK(ndr_pull_subcontext_union_fn(ndr, r->in.level, r->out.info, (ndr_pull_union_fn_t) ndr_pull_spoolss_PrinterInfo));
}
NDR_CHECK(ndr_pull_uint32(ndr, r->out.buf_size));
NDR_CHECK(ndr_pull_WERROR(ndr, &r->out.result));

View File

@ -25,7 +25,7 @@
#include "includes.h"
NTSTATUS pull_spoolss_PrinterInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
uint16 level, uint32 count,
uint32 level, uint32 count,
union spoolss_PrinterInfo **info)
{
int i;
@ -36,7 +36,7 @@ NTSTATUS pull_spoolss_PrinterInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
}
NDR_ALLOC_N(ndr, *info, count);
for (i=0;i<count;i++) {
NDR_CHECK(ndr_pull_spoolss_PrinterInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &level, &(*info)[i]));
NDR_CHECK(ndr_pull_spoolss_PrinterInfo(ndr, NDR_SCALARS|NDR_BUFFERS, level, &(*info)[i]));
}
return NT_STATUS_OK;
}

File diff suppressed because it is too large Load Diff

View File

@ -154,29 +154,25 @@ struct srvsvc_NetConnCtr1 {
struct srvsvc_NetConnCtrDefault {
};
union srvsvc_NetConnSubCtr {
union srvsvc_NetConnCtr {
/* [case(0)] */ struct srvsvc_NetConnCtr0 *ctr0;
/* [case(1)] */ struct srvsvc_NetConnCtr1 *ctr1;
/* [case(default)] */ struct srvsvc_NetConnCtrDefault ctrDefault;
};
struct srvsvc_NetConnCtr {
uint32 level;
uint32 level2;
union srvsvc_NetConnSubCtr subctr;
};
struct srvsvc_NetConnEnum {
struct {
const char *server_unc;
const char *path;
struct srvsvc_NetConnCtr ctr;
uint32 level;
union srvsvc_NetConnCtr ctr;
uint32 preferred_len;
uint32 *resume_handle;
} in;
struct {
struct srvsvc_NetConnCtr ctr;
uint32 level;
union srvsvc_NetConnCtr ctr;
uint32 total;
uint32 *resume_handle;
WERROR result;
@ -209,30 +205,26 @@ struct srvsvc_NetFileCtr3 {
struct srvsvc_NetFileCtrDefault {
};
union srvsvc_NetFileSubCtr {
union srvsvc_NetFileCtr {
/* [case(2)] */ struct srvsvc_NetFileCtr2 *ctr2;
/* [case(3)] */ struct srvsvc_NetFileCtr3 *ctr3;
/* [case(default)] */ struct srvsvc_NetFileCtrDefault ctrDefault;
};
struct srvsvc_NetFileCtr {
uint32 level;
uint32 level2;
union srvsvc_NetFileSubCtr subctr;
};
struct srvsvc_NetFileEnum {
struct {
const char *server_unc;
const char *path;
const char *user;
struct srvsvc_NetFileCtr ctr;
uint32 level;
union srvsvc_NetFileCtr ctr;
uint32 preferred_len;
uint32 *resume_handle;
} in;
struct {
struct srvsvc_NetFileCtr ctr;
uint32 level;
union srvsvc_NetFileCtr ctr;
uint32 total;
uint32 *resume_handle;
WERROR result;
@ -329,7 +321,7 @@ struct srvsvc_NetSessCtr502 {
struct srvsvc_NetSessCtrDefault {
};
union srvsvc_NetSessSubCtr {
union srvsvc_NetSessCtr {
/* [case(0)] */ struct srvsvc_NetSessCtr0 *ctr0;
/* [case(1)] */ struct srvsvc_NetSessCtr1 *ctr1;
/* [case(2)] */ struct srvsvc_NetSessCtr2 *ctr2;
@ -338,24 +330,20 @@ union srvsvc_NetSessSubCtr {
/* [case(default)] */ struct srvsvc_NetSessCtrDefault ctrDefault;
};
struct srvsvc_NetSessCtr {
uint32 level;
uint32 level2;
union srvsvc_NetSessSubCtr subctr;
};
struct srvsvc_NetSessEnum {
struct {
const char *server_unc;
const char *client;
const char *user;
struct srvsvc_NetSessCtr ctr;
uint32 level;
union srvsvc_NetSessCtr ctr;
uint32 preferred_len;
uint32 *resume_handle;
} in;
struct {
struct srvsvc_NetSessCtr ctr;
uint32 level;
union srvsvc_NetSessCtr ctr;
uint32 total;
uint32 *resume_handle;
WERROR result;
@ -452,7 +440,7 @@ struct srvsvc_NetShareCtr502 {
struct srvsvc_NetShareCtrDefault {
};
union srvsvc_NetShareSubCtr {
union srvsvc_NetShareCtr {
/* [case(0)] */ struct srvsvc_NetShareCtr0 *ctr0;
/* [case(1)] */ struct srvsvc_NetShareCtr1 *ctr1;
/* [case(2)] */ struct srvsvc_NetShareCtr2 *ctr2;
@ -461,23 +449,19 @@ union srvsvc_NetShareSubCtr {
/* [case(default)] */ struct srvsvc_NetShareCtrDefault ctrDefault;
};
struct srvsvc_NetShareCtr {
uint32 level;
uint32 level2;
union srvsvc_NetShareSubCtr subctr;
};
struct srvsvc_NetShareEnumAll {
struct {
const char *server_unc;
struct srvsvc_NetShareCtr ctr;
uint32 level;
union srvsvc_NetShareCtr ctr;
uint32 preferred_len;
uint32 *resume_handle;
} in;
struct {
struct srvsvc_NetShareCtr ctr;
uint32 total;
uint32 level;
union srvsvc_NetShareCtr ctr;
uint32 totalentries;
uint32 *resume_handle;
WERROR result;
} out;
@ -693,29 +677,25 @@ struct srvsvc_NetTransportCtr2 {
struct srvsvc_NetTransportCtrDefault {
};
union srvsvc_NetTransportSubCtr {
union srvsvc_NetTransportCtr {
/* [case(0)] */ struct srvsvc_NetTransportCtr0 *ctr0;
/* [case(1)] */ struct srvsvc_NetTransportCtr1 *ctr1;
/* [case(2)] */ struct srvsvc_NetTransportCtr2 *ctr2;
/* [case(default)] */ struct srvsvc_NetTransportCtrDefault ctrDefault;
};
struct srvsvc_NetTransportCtr {
uint32 level;
uint32 level2;
union srvsvc_NetTransportSubCtr subctr;
};
struct srvsvc_NetTransportEnum {
struct {
const char *server_unc;
struct srvsvc_NetTransportCtr ctr;
uint32 level;
union srvsvc_NetTransportCtr ctr;
uint32 preferred_len;
uint32 *resume_handle;
} in;
struct {
struct srvsvc_NetTransportCtr ctr;
uint32 level;
union srvsvc_NetTransportCtr ctr;
uint32 total;
uint32 *resume_handle;
WERROR result;
@ -816,14 +796,16 @@ struct srvsvc_23 {
struct srvsvc_NetShareEnum {
struct {
const char *server_unc;
struct srvsvc_NetShareCtr ctr;
uint32 level;
union srvsvc_NetShareCtr ctr;
uint32 preferred_len;
uint32 *resume_handle;
} in;
struct {
struct srvsvc_NetShareCtr ctr;
uint32 total;
uint32 level;
union srvsvc_NetShareCtr ctr;
uint32 totalentries;
uint32 *resume_handle;
WERROR result;
} out;

View File

@ -82,7 +82,6 @@ NTSTATUS ndr_push_wkssvc_TransportUnion(struct ndr_push *ndr, int ndr_flags, uin
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_push_struct_start(ndr));
NDR_CHECK(ndr_push_uint16(ndr, level));
switch (level) {
case 0:
NDR_CHECK(ndr_push_ptr(ndr, r->array));
@ -114,10 +113,12 @@ NTSTATUS ndr_push_wkssvc_TransportInfo(struct ndr_push *ndr, int ndr_flags, stru
NDR_CHECK(ndr_push_struct_start(ndr));
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, r->level));
NDR_CHECK(ndr_push_uint32(ndr, r->level));
NDR_CHECK(ndr_push_wkssvc_TransportUnion(ndr, NDR_SCALARS, r->level, &r->u));
ndr_push_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
NDR_CHECK(ndr_push_uint32(ndr, r->level));
NDR_CHECK(ndr_push_wkssvc_TransportUnion(ndr, NDR_BUFFERS, r->level, &r->u));
done:
return NT_STATUS_OK;
@ -129,6 +130,7 @@ NTSTATUS ndr_push_wkssvc_TransportEnum(struct ndr_push *ndr, struct wkssvc_Trans
if (r->in.server_name) {
NDR_CHECK(ndr_push_unistr(ndr, r->in.server_name));
}
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
NDR_CHECK(ndr_push_wkssvc_TransportInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
NDR_CHECK(ndr_push_uint32(ndr, r->in.max_buffer));
NDR_CHECK(ndr_push_ptr(ndr, r->in.resume_handle));
@ -462,12 +464,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_wkssvc_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union wkssvc_Info *r)
NTSTATUS ndr_pull_wkssvc_Info(struct ndr_pull *ndr, int ndr_flags, uint16 level, union wkssvc_Info *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 100: {
uint32 _ptr_info100;
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info100));
@ -509,12 +510,12 @@ NTSTATUS ndr_pull_wkssvc_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 100:
if (r->info100) {
NDR_CHECK(ndr_pull_wkssvc_Info100(ndr, NDR_SCALARS|NDR_BUFFERS, r->info100));
@ -540,7 +541,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -548,10 +549,12 @@ done:
NTSTATUS ndr_pull_wkssvc_QueryInfo(struct ndr_pull *ndr, struct wkssvc_QueryInfo *r)
{
{ uint16 _level = r->in.level;
NDR_CHECK(ndr_pull_wkssvc_Info(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, &r->out.info));
if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
if ((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) {
uint32 _level;
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 info");
}
NDR_CHECK(ndr_pull_wkssvc_Info(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.info));
NDR_CHECK(ndr_pull_WERROR(ndr, &r->out.result));
return NT_STATUS_OK;
@ -651,12 +654,11 @@ done:
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_wkssvc_TransportUnion(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union wkssvc_TransportUnion *r)
NTSTATUS ndr_pull_wkssvc_TransportUnion(struct ndr_pull *ndr, int ndr_flags, uint16 level, union wkssvc_TransportUnion *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
NDR_CHECK(ndr_pull_uint16(ndr, level));
switch (*level) {
switch (level) {
case 0: {
uint32 _ptr_array;
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_array));
@ -668,12 +670,12 @@ NTSTATUS ndr_pull_wkssvc_TransportUnion(struct ndr_pull *ndr, int ndr_flags, uin
break; }
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (*level) {
switch (level) {
case 0:
if (r->array) {
NDR_CHECK(ndr_pull_wkssvc_TransportInfoArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->array));
@ -681,7 +683,7 @@ buffers:
break;
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
done:
return NT_STATUS_OK;
@ -693,17 +695,21 @@ NTSTATUS ndr_pull_wkssvc_TransportInfo(struct ndr_pull *ndr, int ndr_flags, stru
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, &r->level));
{ uint16 _level = r->level;
NDR_CHECK(ndr_pull_wkssvc_TransportUnion(ndr, NDR_SCALARS, &_level, &r->u));
if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in u");
if ((NDR_SCALARS) & NDR_SCALARS) {
uint32 _level;
NDR_CHECK(ndr_pull_uint32(ndr, &_level));
if (_level != r->level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in u");
}
NDR_CHECK(ndr_pull_wkssvc_TransportUnion(ndr, NDR_SCALARS, r->level, &r->u));
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
{ uint16 _level = r->level;
NDR_CHECK(ndr_pull_wkssvc_TransportUnion(ndr, NDR_BUFFERS, &_level, &r->u));
if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in u");
if ((NDR_BUFFERS) & NDR_SCALARS) {
uint32 _level;
NDR_CHECK(ndr_pull_uint32(ndr, &_level));
if (_level != r->level) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in u");
}
NDR_CHECK(ndr_pull_wkssvc_TransportUnion(ndr, NDR_BUFFERS, r->level, &r->u));
done:
return NT_STATUS_OK;
}
@ -712,7 +718,7 @@ NTSTATUS ndr_pull_wkssvc_TransportEnum(struct ndr_pull *ndr, struct wkssvc_Trans
{
uint32 _ptr_resume_handle;
NDR_CHECK(ndr_pull_wkssvc_TransportInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
NDR_CHECK(ndr_pull_uint32(ndr, &r->out.unknown));
NDR_CHECK(ndr_pull_uint32(ndr, &r->out.totalentries));
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle));
if (_ptr_resume_handle) {
NDR_ALLOC(ndr, r->out.resume_handle);
@ -1242,6 +1248,7 @@ void ndr_print_wkssvc_TransportEnum(struct ndr_print *ndr, const char *name, int
ndr_print_unistr(ndr, "server_name", r->in.server_name);
}
ndr->depth--;
ndr_print_uint32(ndr, "level", r->in.level);
ndr_print_ptr(ndr, "info", r->in.info);
ndr->depth++;
ndr_print_wkssvc_TransportInfo(ndr, "info", r->in.info);
@ -1262,7 +1269,7 @@ void ndr_print_wkssvc_TransportEnum(struct ndr_print *ndr, const char *name, int
ndr->depth++;
ndr_print_wkssvc_TransportInfo(ndr, "info", r->out.info);
ndr->depth--;
ndr_print_uint32(ndr, "unknown", r->out.unknown);
ndr_print_uint32(ndr, "totalentries", r->out.totalentries);
ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
ndr->depth++;
if (r->out.resume_handle) {

View File

@ -187,6 +187,7 @@ struct wkssvc_TransportInfo {
struct wkssvc_TransportEnum {
struct {
const char *server_name;
uint32 level;
struct wkssvc_TransportInfo *info;
uint32 max_buffer;
uint32 *resume_handle;
@ -194,7 +195,7 @@ struct wkssvc_TransportEnum {
struct {
struct wkssvc_TransportInfo *info;
uint32 unknown;
uint32 totalentries;
uint32 *resume_handle;
WERROR result;
} out;

View File

@ -224,7 +224,7 @@ BOOL torture_rpc_echo(int dummy)
return False;
}
#if 1
#if 0
if (!test_addone(p, mem_ctx)) {
ret = False;
}

View File

@ -34,19 +34,18 @@ static BOOL test_NetConnEnum(struct dcerpc_pipe *p,
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
r.in.path = talloc_asprintf(mem_ctx,"%s","ADMIN$");
r.in.ctr.subctr.ctr0 = &c0;
r.in.ctr.subctr.ctr0->count = 0;
r.in.ctr.subctr.ctr0->array = NULL;
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;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.ctr.level = levels[i];
r.in.ctr.level2 = levels[i];
printf("testing NetConnEnum level %u\n", r.in.ctr.level);
r.in.level = levels[i];
printf("testing NetConnEnum level %u\n", r.in.level);
status = dcerpc_srvsvc_NetConnEnum(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("NetConnEnum level %u failed - %s\n", r.in.ctr.level, nt_errstr(status));
printf("NetConnEnum level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
}
}
@ -67,19 +66,18 @@ static BOOL test_NetFileEnum(struct dcerpc_pipe *p,
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
r.in.path = NULL;
r.in.user = NULL;
r.in.ctr.subctr.ctr3 = &c3;
r.in.ctr.subctr.ctr3->count = 0;
r.in.ctr.subctr.ctr3->array = NULL;
r.in.ctr.ctr3 = &c3;
r.in.ctr.ctr3->count = 0;
r.in.ctr.ctr3->array = NULL;
r.in.preferred_len = (uint32)4096;
r.in.resume_handle = NULL;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.ctr.level = levels[i];
r.in.ctr.level2 = levels[i];
printf("testing NetFileEnum level %u\n", r.in.ctr.level);
r.in.level = levels[i];
printf("testing NetFileEnum level %u\n", r.in.level);
status = dcerpc_srvsvc_NetFileEnum(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("NetFileEnum level %u failed - %s\n", r.in.ctr.level, nt_errstr(status));
printf("NetFileEnum level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
}
}
@ -100,19 +98,18 @@ static BOOL test_NetSessEnum(struct dcerpc_pipe *p,
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
r.in.client = NULL;
r.in.user = NULL;
r.in.ctr.subctr.ctr0 = &c0;
r.in.ctr.subctr.ctr0->count = 0;
r.in.ctr.subctr.ctr0->array = NULL;
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;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.ctr.level = levels[i];
r.in.ctr.level2 = levels[i];
printf("testing NetSessEnum level %u\n", r.in.ctr.level);
r.in.level = levels[i];
printf("testing NetSessEnum level %u\n", r.in.level);
status = dcerpc_srvsvc_NetSessEnum(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("NetSessEnum level %u failed - %s\n", r.in.ctr.level, nt_errstr(status));
printf("NetSessEnum level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
}
}
@ -131,19 +128,18 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p,
BOOL ret = True;
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
r.in.ctr.subctr.ctr0 = &c0;
r.in.ctr.subctr.ctr0->count = 0;
r.in.ctr.subctr.ctr0->array = NULL;
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;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.ctr.level = levels[i];
r.in.ctr.level2 = levels[i];
printf("testing NetShareEnumAll level %u\n", r.in.ctr.level);
r.in.level = levels[i];
printf("testing NetShareEnumAll level %u\n", r.in.level);
status = dcerpc_srvsvc_NetShareEnumAll(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("NetShareEnumAll level %u failed - %s\n", r.in.ctr.level, nt_errstr(status));
printf("NetShareEnumAll level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
}
}
@ -192,19 +188,18 @@ static BOOL test_NetTransportEnum(struct dcerpc_pipe *p,
BOOL ret = True;
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
r.in.ctr.subctr.ctr0 = &c0;
r.in.ctr.subctr.ctr0->count = 0;
r.in.ctr.subctr.ctr0->array = NULL;
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;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.ctr.level = levels[i];
r.in.ctr.level2 = levels[i];
printf("testing NetTransportEnum level %u\n", r.in.ctr.level);
r.in.level = levels[i];
printf("testing NetTransportEnum level %u\n", r.in.level);
status = dcerpc_srvsvc_NetTransportEnum(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("NetTransportEnum level %u failed - %s\n", r.in.ctr.level, nt_errstr(status));
printf("NetTransportEnum level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
}
}
@ -223,19 +218,18 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p,
BOOL ret = True;
r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p));
r.in.ctr.subctr.ctr0 = &c0;
r.in.ctr.subctr.ctr0->count = 0;
r.in.ctr.subctr.ctr0->array = NULL;
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;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.ctr.level = levels[i];
r.in.ctr.level2 = levels[i];
printf("testing NetShareEnum level %u\n", r.in.ctr.level);
r.in.level = levels[i];
printf("testing NetShareEnum level %u\n", r.in.level);
status = dcerpc_srvsvc_NetShareEnum(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("NetShareEnum level %u failed - %s\n", r.in.ctr.level, nt_errstr(status));
printf("NetShareEnum level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
}
}

View File

@ -60,7 +60,7 @@ static BOOL test_TransportEnum(struct dcerpc_pipe *p,
ZERO_STRUCT(info);
ZERO_STRUCT(info_array);
info.u.array = &info_array;
info.u.array = NULL;
r.in.server_name = dcerpc_server_name(p);
r.in.info = &info;