diff --git a/source4/librpc/idl/echo.idl b/source4/librpc/idl/echo.idl index 2ef70268267..304ba4c66a8 100644 --- a/source4/librpc/idl/echo.idl +++ b/source4/librpc/idl/echo.idl @@ -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 ); } diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index 02055dccb66..40cb905e73c 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -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 diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 6893fb4a867..96322ed6541 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -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" diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 0d40b328352..a78f135d924 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -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); } /* diff --git a/source4/librpc/ndr/ndr_dfs.c b/source4/librpc/ndr/ndr_dfs.c index c6f508536c5..626cfc5789b 100644 --- a/source4/librpc/ndr/ndr_dfs.c +++ b/source4/librpc/ndr/ndr_dfs.c @@ -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; } diff --git a/source4/librpc/ndr/ndr_echo.c b/source4/librpc/ndr/ndr_echo.c index 8e4690de52b..3c548d9be88 100644 --- a/source4/librpc/ndr/ndr_echo.c +++ b/source4/librpc/ndr/ndr_echo.c @@ -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) { diff --git a/source4/librpc/ndr/ndr_echo.h b/source4/librpc/ndr/ndr_echo.h index 5b5d118e19d..c7c371ebca0 100644 --- a/source4/librpc/ndr/ndr_echo.h +++ b/source4/librpc/ndr/ndr_echo.h @@ -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 { diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c index 3b540b36143..2ed6b89e7b8 100644 --- a/source4/librpc/ndr/ndr_lsa.c +++ b/source4/librpc/ndr/ndr_lsa.c @@ -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)); diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index 7b4a637726e..c319e4cac73 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -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)); diff --git a/source4/librpc/ndr/ndr_spoolss.c b/source4/librpc/ndr/ndr_spoolss.c index f88e12dd2c5..cddbf645708 100644 --- a/source4/librpc/ndr/ndr_spoolss.c +++ b/source4/librpc/ndr/ndr_spoolss.c @@ -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)); diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c index c06d6704b2c..381093a58f0 100644 --- a/source4/librpc/ndr/ndr_spoolss_buf.c +++ b/source4/librpc/ndr/ndr_spoolss_buf.c @@ -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;ilevel)); - NDR_CHECK(ndr_push_uint32(ndr, r->level2)); - NDR_CHECK(ndr_push_srvsvc_NetConnSubCtr(ndr, NDR_SCALARS, r->level, &r->subctr)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - NDR_CHECK(ndr_push_srvsvc_NetConnSubCtr(ndr, NDR_BUFFERS, r->level, &r->subctr)); -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_push_srvsvc_NetConnEnum(struct ndr_push *ndr, struct srvsvc_NetConnEnum *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.server_unc)); @@ -205,7 +189,9 @@ NTSTATUS ndr_push_srvsvc_NetConnEnum(struct ndr_push *ndr, struct srvsvc_NetConn if (r->in.path) { NDR_CHECK(ndr_push_unistr(ndr, r->in.path)); } - NDR_CHECK(ndr_push_srvsvc_NetConnCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.ctr)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_srvsvc_NetConnCtr(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) { @@ -299,7 +285,7 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetFileSubCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetFileSubCtr *r) +NTSTATUS ndr_push_srvsvc_NetFileCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetFileCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_struct_start(ndr)); @@ -342,22 +328,6 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetFileCtr(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetFileCtr *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->level)); - NDR_CHECK(ndr_push_uint32(ndr, r->level2)); - NDR_CHECK(ndr_push_srvsvc_NetFileSubCtr(ndr, NDR_SCALARS, r->level, &r->subctr)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - NDR_CHECK(ndr_push_srvsvc_NetFileSubCtr(ndr, NDR_BUFFERS, r->level, &r->subctr)); -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_push_srvsvc_NetFileEnum(struct ndr_push *ndr, struct srvsvc_NetFileEnum *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.server_unc)); @@ -372,7 +342,9 @@ NTSTATUS ndr_push_srvsvc_NetFileEnum(struct ndr_push *ndr, struct srvsvc_NetFile if (r->in.user) { NDR_CHECK(ndr_push_unistr(ndr, r->in.user)); } - NDR_CHECK(ndr_push_srvsvc_NetFileCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.ctr)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_srvsvc_NetFileCtr(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) { @@ -618,7 +590,7 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetSessSubCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetSessSubCtr *r) +NTSTATUS ndr_push_srvsvc_NetSessCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetSessCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_struct_start(ndr)); @@ -691,22 +663,6 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetSessCtr(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetSessCtr *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->level)); - NDR_CHECK(ndr_push_uint32(ndr, r->level2)); - NDR_CHECK(ndr_push_srvsvc_NetSessSubCtr(ndr, NDR_SCALARS, r->level, &r->subctr)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - NDR_CHECK(ndr_push_srvsvc_NetSessSubCtr(ndr, NDR_BUFFERS, r->level, &r->subctr)); -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_push_srvsvc_NetSessEnum(struct ndr_push *ndr, struct srvsvc_NetSessEnum *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.server_unc)); @@ -721,7 +677,9 @@ NTSTATUS ndr_push_srvsvc_NetSessEnum(struct ndr_push *ndr, struct srvsvc_NetSess if (r->in.user) { NDR_CHECK(ndr_push_unistr(ndr, r->in.user)); } - NDR_CHECK(ndr_push_srvsvc_NetSessCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.ctr)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_srvsvc_NetSessCtr(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) { @@ -973,7 +931,7 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetShareSubCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareSubCtr *r) +NTSTATUS ndr_push_srvsvc_NetShareCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_struct_start(ndr)); @@ -1046,29 +1004,15 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetShareCtr(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetShareCtr *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->level)); - NDR_CHECK(ndr_push_uint32(ndr, r->level2)); - NDR_CHECK(ndr_push_srvsvc_NetShareSubCtr(ndr, NDR_SCALARS, r->level, &r->subctr)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - NDR_CHECK(ndr_push_srvsvc_NetShareSubCtr(ndr, NDR_BUFFERS, r->level, &r->subctr)); -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_push_srvsvc_NetShareEnumAll(struct ndr_push *ndr, struct srvsvc_NetShareEnumAll *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.server_unc)); if (r->in.server_unc) { NDR_CHECK(ndr_push_unistr(ndr, r->in.server_unc)); } - NDR_CHECK(ndr_push_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.ctr)); + 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_ptr(ndr, r->in.resume_handle)); if (r->in.resume_handle) { @@ -1120,205 +1064,6 @@ NTSTATUS ndr_push_srvsvc_NET_SRV_SET_INFO(struct ndr_push *ndr, struct srvsvc_NE return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetDisk0(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDisk0 *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->unknown)); - NDR_CHECK(ndr_push_uint32(ndr, r->size)); - NDR_CHECK(ndr_push_ptr(ndr, r->disk)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - if (r->disk) { - NDR_CHECK(ndr_push_uint32(ndr, r->size)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS|NDR_BUFFERS, r->disk, r->size)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDiskCtr0(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDiskCtr0 *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_uint32(ndr, r->unknown1)); - NDR_CHECK(ndr_push_uint32(ndr, r->unknown2)); - 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_NetDisk0)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDisk1(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDisk1 *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->dummy)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDiskCtr1(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDiskCtr1 *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_NetDisk1)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDisk2(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDisk2 *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->dummy)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDiskCtr2(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDiskCtr2 *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_NetDisk2)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDisk3(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDisk3 *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->dummy)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDiskCtr3(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDiskCtr3 *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_NetDisk3)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDiskCtrDefault(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetDiskCtrDefault *r) -{ - if (!(ndr_flags & NDR_SCALARS)) goto buffers; - NDR_CHECK(ndr_push_struct_start(ndr)); - NDR_CHECK(ndr_push_align(ndr, 1)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_push_srvsvc_NetDiskSubCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetDiskSubCtr *r) -{ - if (!(ndr_flags & NDR_SCALARS)) goto buffers; - NDR_CHECK(ndr_push_struct_start(ndr)); - switch (level) { - case 0: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr0(ndr, NDR_SCALARS, &r->ctr0)); - break; - - case 1: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr1(ndr, NDR_SCALARS, &r->ctr1)); - break; - - case 2: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr2(ndr, NDR_SCALARS, &r->ctr2)); - break; - - case 3: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr3(ndr, NDR_SCALARS, &r->ctr3)); - break; - - default: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtrDefault(ndr, NDR_SCALARS, &r->ctrDefault)); - break; - - } - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (level) { - case 0: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr0(ndr, ndr_flags, &r->ctr0)); - break; - - case 1: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr1(ndr, ndr_flags, &r->ctr1)); - break; - - case 2: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr2(ndr, ndr_flags, &r->ctr2)); - break; - - case 3: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtr3(ndr, ndr_flags, &r->ctr3)); - break; - - default: - NDR_CHECK(ndr_push_srvsvc_NetDiskCtrDefault(ndr, ndr_flags, &r->ctrDefault)); - break; - - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_push_srvsvc_NetDiskEnum(struct ndr_push *ndr, struct srvsvc_NetDiskEnum *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.server_unc)); @@ -1502,7 +1247,7 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetTransportSubCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetTransportSubCtr *r) +NTSTATUS ndr_push_srvsvc_NetTransportCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetTransportCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_struct_start(ndr)); @@ -1555,29 +1300,15 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_push_srvsvc_NetTransportCtr(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetTransportCtr *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->level)); - NDR_CHECK(ndr_push_uint32(ndr, r->level2)); - NDR_CHECK(ndr_push_srvsvc_NetTransportSubCtr(ndr, NDR_SCALARS, r->level, &r->subctr)); - ndr_push_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - NDR_CHECK(ndr_push_srvsvc_NetTransportSubCtr(ndr, NDR_BUFFERS, r->level, &r->subctr)); -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_push_srvsvc_NetTransportEnum(struct ndr_push *ndr, struct srvsvc_NetTransportEnum *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.server_unc)); if (r->in.server_unc) { NDR_CHECK(ndr_push_unistr(ndr, r->in.server_unc)); } - NDR_CHECK(ndr_push_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.ctr)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_srvsvc_NetTransportCtr(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) { @@ -1647,7 +1378,9 @@ NTSTATUS ndr_push_srvsvc_NetShareEnum(struct ndr_push *ndr, struct srvsvc_NetSha if (r->in.server_unc) { NDR_CHECK(ndr_push_unistr(ndr, r->in.server_unc)); } - NDR_CHECK(ndr_push_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.ctr)); + 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_ptr(ndr, r->in.resume_handle)); if (r->in.resume_handle) { @@ -1861,11 +1594,11 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetConnSubCtr(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union srvsvc_NetConnSubCtr *r) +NTSTATUS ndr_pull_srvsvc_NetConnCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetConnCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_struct_start(ndr)); - switch (*level) { + switch (level) { case 0: { uint32 _ptr_ctr0; NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr0)); @@ -1894,7 +1627,7 @@ NTSTATUS ndr_pull_srvsvc_NetConnSubCtr(struct ndr_pull *ndr, int ndr_flags, uint ndr_pull_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (*level) { + switch (level) { case 0: if (r->ctr0) { NDR_CHECK(ndr_pull_srvsvc_NetConnCtr0(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr0)); @@ -1916,32 +1649,16 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetConnCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetConnCtr *r) -{ - 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->level)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->level2)); - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetConnSubCtr(ndr, NDR_SCALARS, &_level, &r->subctr)); - if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetConnSubCtr(ndr, NDR_BUFFERS, &_level, &r->subctr)); - if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_pull_srvsvc_NetConnEnum(struct ndr_pull *ndr, struct srvsvc_NetConnEnum *r) { uint32 _ptr_resume_handle; - NDR_CHECK(ndr_pull_srvsvc_NetConnCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.ctr)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.level)); + 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 ctr"); + } + NDR_CHECK(ndr_pull_srvsvc_NetConnCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr)); NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total)); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle)); if (_ptr_resume_handle) { @@ -2079,11 +1796,11 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetFileSubCtr(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union srvsvc_NetFileSubCtr *r) +NTSTATUS ndr_pull_srvsvc_NetFileCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetFileCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_struct_start(ndr)); - switch (*level) { + switch (level) { case 2: { uint32 _ptr_ctr2; NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr2)); @@ -2112,7 +1829,7 @@ NTSTATUS ndr_pull_srvsvc_NetFileSubCtr(struct ndr_pull *ndr, int ndr_flags, uint ndr_pull_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (*level) { + switch (level) { case 2: if (r->ctr2) { NDR_CHECK(ndr_pull_srvsvc_NetFileCtr2(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr2)); @@ -2134,32 +1851,16 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetFileCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetFileCtr *r) -{ - 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->level)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->level2)); - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetFileSubCtr(ndr, NDR_SCALARS, &_level, &r->subctr)); - if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetFileSubCtr(ndr, NDR_BUFFERS, &_level, &r->subctr)); - if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_pull_srvsvc_NetFileEnum(struct ndr_pull *ndr, struct srvsvc_NetFileEnum *r) { uint32 _ptr_resume_handle; - NDR_CHECK(ndr_pull_srvsvc_NetFileCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.ctr)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.level)); + 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 ctr"); + } + NDR_CHECK(ndr_pull_srvsvc_NetFileCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr)); NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total)); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle)); if (_ptr_resume_handle) { @@ -2550,11 +2251,11 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetSessSubCtr(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union srvsvc_NetSessSubCtr *r) +NTSTATUS ndr_pull_srvsvc_NetSessCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetSessCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_struct_start(ndr)); - switch (*level) { + switch (level) { case 0: { uint32 _ptr_ctr0; NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr0)); @@ -2613,7 +2314,7 @@ NTSTATUS ndr_pull_srvsvc_NetSessSubCtr(struct ndr_pull *ndr, int ndr_flags, uint ndr_pull_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (*level) { + switch (level) { case 0: if (r->ctr0) { NDR_CHECK(ndr_pull_srvsvc_NetSessCtr0(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr0)); @@ -2653,32 +2354,16 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetSessCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetSessCtr *r) -{ - 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->level)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->level2)); - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetSessSubCtr(ndr, NDR_SCALARS, &_level, &r->subctr)); - if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetSessSubCtr(ndr, NDR_BUFFERS, &_level, &r->subctr)); - if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_pull_srvsvc_NetSessEnum(struct ndr_pull *ndr, struct srvsvc_NetSessEnum *r) { uint32 _ptr_resume_handle; - NDR_CHECK(ndr_pull_srvsvc_NetSessCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.ctr)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.level)); + 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 ctr"); + } + NDR_CHECK(ndr_pull_srvsvc_NetSessCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr)); NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total)); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle)); if (_ptr_resume_handle) { @@ -3087,11 +2772,11 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetShareSubCtr(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union srvsvc_NetShareSubCtr *r) +NTSTATUS ndr_pull_srvsvc_NetShareCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_struct_start(ndr)); - switch (*level) { + switch (level) { case 0: { uint32 _ptr_ctr0; NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr0)); @@ -3150,7 +2835,7 @@ NTSTATUS ndr_pull_srvsvc_NetShareSubCtr(struct ndr_pull *ndr, int ndr_flags, uin ndr_pull_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (*level) { + switch (level) { case 0: if (r->ctr0) { NDR_CHECK(ndr_pull_srvsvc_NetShareCtr0(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr0)); @@ -3190,33 +2875,17 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetShareCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetShareCtr *r) -{ - 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->level)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->level2)); - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetShareSubCtr(ndr, NDR_SCALARS, &_level, &r->subctr)); - if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetShareSubCtr(ndr, NDR_BUFFERS, &_level, &r->subctr)); - if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_pull_srvsvc_NetShareEnumAll(struct ndr_pull *ndr, struct srvsvc_NetShareEnumAll *r) { uint32 _ptr_resume_handle; - NDR_CHECK(ndr_pull_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.ctr)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.level)); + 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 ctr"); + } + NDR_CHECK(ndr_pull_srvsvc_NetShareCtr(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) { NDR_ALLOC(ndr, r->out.resume_handle); @@ -3345,205 +3014,6 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetDisk1(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDisk1 *r) -{ - 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->dummy)); - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDiskCtr1(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDiskCtr1 *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_NetDisk1)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDisk2(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDisk2 *r) -{ - 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->dummy)); - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDiskCtr2(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDiskCtr2 *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_NetDisk2)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDisk3(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDisk3 *r) -{ - 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->dummy)); - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDiskCtr3(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDiskCtr3 *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_NetDisk3)); - } -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDiskCtrDefault(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDiskCtrDefault *r) -{ - NDR_CHECK(ndr_pull_struct_start(ndr)); - if (!(ndr_flags & NDR_SCALARS)) goto buffers; - NDR_CHECK(ndr_pull_align(ndr, 1)); - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; -done: - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_srvsvc_NetDiskSubCtr(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union srvsvc_NetDiskSubCtr *r) -{ - if (!(ndr_flags & NDR_SCALARS)) goto buffers; - NDR_CHECK(ndr_pull_struct_start(ndr)); - switch (*level) { - case 0: { - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr0(ndr, NDR_SCALARS, &r->ctr0)); - break; } - - case 1: { - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr1(ndr, NDR_SCALARS, &r->ctr1)); - break; } - - case 2: { - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr2(ndr, NDR_SCALARS, &r->ctr2)); - break; } - - case 3: { - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr3(ndr, NDR_SCALARS, &r->ctr3)); - break; } - - default: { - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtrDefault(ndr, NDR_SCALARS, &r->ctrDefault)); - break; } - - } - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (*level) { - case 0: - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr0(ndr, NDR_BUFFERS, &r->ctr0)); - break; - - case 1: - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr1(ndr, NDR_BUFFERS, &r->ctr1)); - break; - - case 2: - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr2(ndr, NDR_BUFFERS, &r->ctr2)); - break; - - case 3: - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtr3(ndr, NDR_BUFFERS, &r->ctr3)); - break; - - default: - NDR_CHECK(ndr_pull_srvsvc_NetDiskCtrDefault(ndr, NDR_BUFFERS, &r->ctrDefault)); - break; - - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_pull_srvsvc_NetDiskCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetDiskCtr *r) { uint32 _ptr_ctr0; @@ -3847,11 +3317,11 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetTransportSubCtr(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union srvsvc_NetTransportSubCtr *r) +NTSTATUS ndr_pull_srvsvc_NetTransportCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetTransportCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_struct_start(ndr)); - switch (*level) { + switch (level) { case 0: { uint32 _ptr_ctr0; NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr0)); @@ -3890,7 +3360,7 @@ NTSTATUS ndr_pull_srvsvc_NetTransportSubCtr(struct ndr_pull *ndr, int ndr_flags, ndr_pull_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - switch (*level) { + switch (level) { case 0: if (r->ctr0) { NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr0(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr0)); @@ -3918,32 +3388,16 @@ done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_srvsvc_NetTransportCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetTransportCtr *r) -{ - 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->level)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->level2)); - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetTransportSubCtr(ndr, NDR_SCALARS, &_level, &r->subctr)); - if (((NDR_SCALARS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } - ndr_pull_struct_end(ndr); -buffers: - if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level = r->level; - NDR_CHECK(ndr_pull_srvsvc_NetTransportSubCtr(ndr, NDR_BUFFERS, &_level, &r->subctr)); - if (((NDR_BUFFERS) & NDR_SCALARS) && (_level != r->level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in subctr"); - } -done: - return NT_STATUS_OK; -} - NTSTATUS ndr_pull_srvsvc_NetTransportEnum(struct ndr_pull *ndr, struct srvsvc_NetTransportEnum *r) { uint32 _ptr_resume_handle; - NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.ctr)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.level)); + 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 ctr"); + } + NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, &r->out.ctr)); NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total)); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle)); if (_ptr_resume_handle) { @@ -4025,8 +3479,14 @@ NTSTATUS ndr_pull_srvsvc_23(struct ndr_pull *ndr, struct srvsvc_23 *r) NTSTATUS ndr_pull_srvsvc_NetShareEnum(struct ndr_pull *ndr, struct srvsvc_NetShareEnum *r) { uint32 _ptr_resume_handle; - NDR_CHECK(ndr_pull_srvsvc_NetShareCtr(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.ctr)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.level)); + 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 ctr"); + } + NDR_CHECK(ndr_pull_srvsvc_NetShareCtr(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) { NDR_ALLOC(ndr, r->out.resume_handle); @@ -4280,9 +3740,9 @@ void ndr_print_srvsvc_NetConnCtrDefault(struct ndr_print *ndr, const char *name, ndr->depth--; } -void ndr_print_srvsvc_NetConnSubCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetConnSubCtr *r) +void ndr_print_srvsvc_NetConnCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetConnCtr *r) { - ndr_print_union(ndr, name, level, "srvsvc_NetConnSubCtr"); + ndr_print_union(ndr, name, level, "srvsvc_NetConnCtr"); switch (level) { case 0: ndr_print_ptr(ndr, "ctr0", r->ctr0); @@ -4309,16 +3769,6 @@ void ndr_print_srvsvc_NetConnSubCtr(struct ndr_print *ndr, const char *name, uin } } -void ndr_print_srvsvc_NetConnCtr(struct ndr_print *ndr, const char *name, struct srvsvc_NetConnCtr *r) -{ - ndr_print_struct(ndr, name, "srvsvc_NetConnCtr"); - ndr->depth++; - ndr_print_uint32(ndr, "level", r->level); - ndr_print_uint32(ndr, "level2", r->level2); - ndr_print_srvsvc_NetConnSubCtr(ndr, "subctr", r->level, &r->subctr); - ndr->depth--; -} - void ndr_print_srvsvc_NetConnEnum(struct ndr_print *ndr, const char *name, int flags, struct srvsvc_NetConnEnum *r) { ndr_print_struct(ndr, name, "srvsvc_NetConnEnum"); @@ -4338,7 +3788,8 @@ void ndr_print_srvsvc_NetConnEnum(struct ndr_print *ndr, const char *name, int f ndr_print_unistr(ndr, "path", r->in.path); } ndr->depth--; - ndr_print_srvsvc_NetConnCtr(ndr, "ctr", &r->in.ctr); + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_srvsvc_NetConnCtr(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++; @@ -4351,7 +3802,8 @@ void ndr_print_srvsvc_NetConnEnum(struct ndr_print *ndr, const char *name, int f if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetConnEnum"); ndr->depth++; - ndr_print_srvsvc_NetConnCtr(ndr, "ctr", &r->out.ctr); + ndr_print_uint32(ndr, "level", r->out.level); + ndr_print_srvsvc_NetConnCtr(ndr, "ctr", r->in.level, &r->out.ctr); ndr_print_uint32(ndr, "total", r->out.total); ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); ndr->depth++; @@ -4430,9 +3882,9 @@ void ndr_print_srvsvc_NetFileCtrDefault(struct ndr_print *ndr, const char *name, ndr->depth--; } -void ndr_print_srvsvc_NetFileSubCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetFileSubCtr *r) +void ndr_print_srvsvc_NetFileCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetFileCtr *r) { - ndr_print_union(ndr, name, level, "srvsvc_NetFileSubCtr"); + ndr_print_union(ndr, name, level, "srvsvc_NetFileCtr"); switch (level) { case 2: ndr_print_ptr(ndr, "ctr2", r->ctr2); @@ -4459,16 +3911,6 @@ void ndr_print_srvsvc_NetFileSubCtr(struct ndr_print *ndr, const char *name, uin } } -void ndr_print_srvsvc_NetFileCtr(struct ndr_print *ndr, const char *name, struct srvsvc_NetFileCtr *r) -{ - ndr_print_struct(ndr, name, "srvsvc_NetFileCtr"); - ndr->depth++; - ndr_print_uint32(ndr, "level", r->level); - ndr_print_uint32(ndr, "level2", r->level2); - ndr_print_srvsvc_NetFileSubCtr(ndr, "subctr", r->level, &r->subctr); - ndr->depth--; -} - void ndr_print_srvsvc_NetFileEnum(struct ndr_print *ndr, const char *name, int flags, struct srvsvc_NetFileEnum *r) { ndr_print_struct(ndr, name, "srvsvc_NetFileEnum"); @@ -4494,7 +3936,8 @@ void ndr_print_srvsvc_NetFileEnum(struct ndr_print *ndr, const char *name, int f ndr_print_unistr(ndr, "user", r->in.user); } ndr->depth--; - ndr_print_srvsvc_NetFileCtr(ndr, "ctr", &r->in.ctr); + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_srvsvc_NetFileCtr(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++; @@ -4507,7 +3950,8 @@ void ndr_print_srvsvc_NetFileEnum(struct ndr_print *ndr, const char *name, int f if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetFileEnum"); ndr->depth++; - ndr_print_srvsvc_NetFileCtr(ndr, "ctr", &r->out.ctr); + ndr_print_uint32(ndr, "level", r->out.level); + ndr_print_srvsvc_NetFileCtr(ndr, "ctr", r->in.level, &r->out.ctr); ndr_print_uint32(ndr, "total", r->out.total); ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); ndr->depth++; @@ -4755,9 +4199,9 @@ void ndr_print_srvsvc_NetSessCtrDefault(struct ndr_print *ndr, const char *name, ndr->depth--; } -void ndr_print_srvsvc_NetSessSubCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetSessSubCtr *r) +void ndr_print_srvsvc_NetSessCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetSessCtr *r) { - ndr_print_union(ndr, name, level, "srvsvc_NetSessSubCtr"); + ndr_print_union(ndr, name, level, "srvsvc_NetSessCtr"); switch (level) { case 0: ndr_print_ptr(ndr, "ctr0", r->ctr0); @@ -4811,16 +4255,6 @@ void ndr_print_srvsvc_NetSessSubCtr(struct ndr_print *ndr, const char *name, uin } } -void ndr_print_srvsvc_NetSessCtr(struct ndr_print *ndr, const char *name, struct srvsvc_NetSessCtr *r) -{ - ndr_print_struct(ndr, name, "srvsvc_NetSessCtr"); - ndr->depth++; - ndr_print_uint32(ndr, "level", r->level); - ndr_print_uint32(ndr, "level2", r->level2); - ndr_print_srvsvc_NetSessSubCtr(ndr, "subctr", r->level, &r->subctr); - ndr->depth--; -} - void ndr_print_srvsvc_NetSessEnum(struct ndr_print *ndr, const char *name, int flags, struct srvsvc_NetSessEnum *r) { ndr_print_struct(ndr, name, "srvsvc_NetSessEnum"); @@ -4846,7 +4280,8 @@ void ndr_print_srvsvc_NetSessEnum(struct ndr_print *ndr, const char *name, int f ndr_print_unistr(ndr, "user", r->in.user); } ndr->depth--; - ndr_print_srvsvc_NetSessCtr(ndr, "ctr", &r->in.ctr); + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_srvsvc_NetSessCtr(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++; @@ -4859,7 +4294,8 @@ void ndr_print_srvsvc_NetSessEnum(struct ndr_print *ndr, const char *name, int f if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetSessEnum"); ndr->depth++; - ndr_print_srvsvc_NetSessCtr(ndr, "ctr", &r->out.ctr); + ndr_print_uint32(ndr, "level", r->out.level); + ndr_print_srvsvc_NetSessCtr(ndr, "ctr", r->in.level, &r->out.ctr); ndr_print_uint32(ndr, "total", r->out.total); ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); ndr->depth++; @@ -5117,9 +4553,9 @@ void ndr_print_srvsvc_NetShareCtrDefault(struct ndr_print *ndr, const char *name ndr->depth--; } -void ndr_print_srvsvc_NetShareSubCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetShareSubCtr *r) +void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetShareCtr *r) { - ndr_print_union(ndr, name, level, "srvsvc_NetShareSubCtr"); + ndr_print_union(ndr, name, level, "srvsvc_NetShareCtr"); switch (level) { case 0: ndr_print_ptr(ndr, "ctr0", r->ctr0); @@ -5173,16 +4609,6 @@ void ndr_print_srvsvc_NetShareSubCtr(struct ndr_print *ndr, const char *name, ui } } -void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, struct srvsvc_NetShareCtr *r) -{ - ndr_print_struct(ndr, name, "srvsvc_NetShareCtr"); - ndr->depth++; - ndr_print_uint32(ndr, "level", r->level); - ndr_print_uint32(ndr, "level2", r->level2); - ndr_print_srvsvc_NetShareSubCtr(ndr, "subctr", r->level, &r->subctr); - ndr->depth--; -} - void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, int flags, struct srvsvc_NetShareEnumAll *r) { ndr_print_struct(ndr, name, "srvsvc_NetShareEnumAll"); @@ -5196,7 +4622,8 @@ void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, i ndr_print_unistr(ndr, "server_unc", r->in.server_unc); } ndr->depth--; - ndr_print_srvsvc_NetShareCtr(ndr, "ctr", &r->in.ctr); + 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_ptr(ndr, "resume_handle", r->in.resume_handle); ndr->depth++; @@ -5209,8 +4636,9 @@ void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, i if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetShareEnumAll"); ndr->depth++; - ndr_print_srvsvc_NetShareCtr(ndr, "ctr", &r->out.ctr); - ndr_print_uint32(ndr, "total", r->out.total); + ndr_print_uint32(ndr, "level", r->out.level); + ndr_print_srvsvc_NetShareCtr(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++; if (r->out.resume_handle) { @@ -5703,9 +5131,9 @@ void ndr_print_srvsvc_NetTransportCtrDefault(struct ndr_print *ndr, const char * ndr->depth--; } -void ndr_print_srvsvc_NetTransportSubCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetTransportSubCtr *r) +void ndr_print_srvsvc_NetTransportCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetTransportCtr *r) { - ndr_print_union(ndr, name, level, "srvsvc_NetTransportSubCtr"); + ndr_print_union(ndr, name, level, "srvsvc_NetTransportCtr"); switch (level) { case 0: ndr_print_ptr(ndr, "ctr0", r->ctr0); @@ -5741,16 +5169,6 @@ void ndr_print_srvsvc_NetTransportSubCtr(struct ndr_print *ndr, const char *name } } -void ndr_print_srvsvc_NetTransportCtr(struct ndr_print *ndr, const char *name, struct srvsvc_NetTransportCtr *r) -{ - ndr_print_struct(ndr, name, "srvsvc_NetTransportCtr"); - ndr->depth++; - ndr_print_uint32(ndr, "level", r->level); - ndr_print_uint32(ndr, "level2", r->level2); - ndr_print_srvsvc_NetTransportSubCtr(ndr, "subctr", r->level, &r->subctr); - ndr->depth--; -} - void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const char *name, int flags, struct srvsvc_NetTransportEnum *r) { ndr_print_struct(ndr, name, "srvsvc_NetTransportEnum"); @@ -5764,7 +5182,8 @@ void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const char *name, ndr_print_unistr(ndr, "server_unc", r->in.server_unc); } ndr->depth--; - ndr_print_srvsvc_NetTransportCtr(ndr, "ctr", &r->in.ctr); + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_srvsvc_NetTransportCtr(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++; @@ -5777,7 +5196,8 @@ void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const char *name, if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetTransportEnum"); ndr->depth++; - ndr_print_srvsvc_NetTransportCtr(ndr, "ctr", &r->out.ctr); + ndr_print_uint32(ndr, "level", r->out.level); + ndr_print_srvsvc_NetTransportCtr(ndr, "ctr", r->in.level, &r->out.ctr); ndr_print_uint32(ndr, "total", r->out.total); ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); ndr->depth++; @@ -5966,7 +5386,8 @@ void ndr_print_srvsvc_NetShareEnum(struct ndr_print *ndr, const char *name, int ndr_print_unistr(ndr, "server_unc", r->in.server_unc); } ndr->depth--; - ndr_print_srvsvc_NetShareCtr(ndr, "ctr", &r->in.ctr); + 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_ptr(ndr, "resume_handle", r->in.resume_handle); ndr->depth++; @@ -5979,8 +5400,9 @@ void ndr_print_srvsvc_NetShareEnum(struct ndr_print *ndr, const char *name, int if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetShareEnum"); ndr->depth++; - ndr_print_srvsvc_NetShareCtr(ndr, "ctr", &r->out.ctr); - ndr_print_uint32(ndr, "total", r->out.total); + ndr_print_uint32(ndr, "level", r->out.level); + ndr_print_srvsvc_NetShareCtr(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++; if (r->out.resume_handle) { diff --git a/source4/librpc/ndr/ndr_srvsvc.h b/source4/librpc/ndr/ndr_srvsvc.h index c017c88a93f..7ebcb552b7d 100644 --- a/source4/librpc/ndr/ndr_srvsvc.h +++ b/source4/librpc/ndr/ndr_srvsvc.h @@ -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; diff --git a/source4/librpc/ndr/ndr_wkssvc.c b/source4/librpc/ndr/ndr_wkssvc.c index 47ddbcb9bf8..07852795a2f 100644 --- a/source4/librpc/ndr/ndr_wkssvc.c +++ b/source4/librpc/ndr/ndr_wkssvc.c @@ -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) { diff --git a/source4/librpc/ndr/ndr_wkssvc.h b/source4/librpc/ndr/ndr_wkssvc.h index d4930e3baeb..7c8b1dd3177 100644 --- a/source4/librpc/ndr/ndr_wkssvc.h +++ b/source4/librpc/ndr/ndr_wkssvc.h @@ -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; diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index 8d8a3d7c0c6..2ea7362e9ad 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -224,7 +224,7 @@ BOOL torture_rpc_echo(int dummy) return False; } -#if 1 +#if 0 if (!test_addone(p, mem_ctx)) { ret = False; } diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 384959f26aa..45103b8188a 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -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;icount = 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;icount = 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;icount = 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;icount = 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;icount = 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