diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-19 22:10:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-19 22:10:20 +0000 |
commit | 10ee36bede1337d73feec575cc840957090b30b2 (patch) | |
tree | 8d292361ad5e6bb1291fc3dbca191d1c44bd453b /source4/librpc/ndr/ndr_spoolss.c | |
parent | 5a51af068533357fbf0ae4ddfd169fb752ddd2b5 (diff) | |
download | samba-10ee36bede1337d73feec575cc840957090b30b2.tar.gz samba-10ee36bede1337d73feec575cc840957090b30b2.tar.bz2 samba-10ee36bede1337d73feec575cc840957090b30b2.zip |
switched to a new way of handling unions, so that we can handle
alignment correctly for unions that have non-uint16 discriminants
fixed the union handling in srvsvc.idl. (metze, please take a look at
the changes, your IDL did match what was one the wire in most cases,
but isn't the way IDL is usually coded)
(This used to be commit 7b5d0287298e8505e0ec7b22d75d9f9a8a610031)
Diffstat (limited to 'source4/librpc/ndr/ndr_spoolss.c')
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/source4/librpc/ndr/ndr_spoolss.c b/source4/librpc/ndr/ndr_spoolss.c index f88e12dd2c..cddbf64570 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)); |