diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-16 11:36:59 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-16 11:36:59 +0000 |
commit | ea266c0625e04a2dc10d25c2fee7b685965fcd3e (patch) | |
tree | 3db57fa36d79ab2df9adf6d7faa37f7d644b83b7 | |
parent | 0c5759a4b2615b9c57ee7de04275ced1fc7d19cb (diff) | |
download | samba-ea266c0625e04a2dc10d25c2fee7b685965fcd3e.tar.gz samba-ea266c0625e04a2dc10d25c2fee7b685965fcd3e.tar.bz2 samba-ea266c0625e04a2dc10d25c2fee7b685965fcd3e.zip |
added support for level1 of EnumPrinters in spoolss. This uses a
number of "magic" add-ons to IDL to make it less painful, hopefully
this will make IDL generation useful for horrible systems like spoolss
(This used to be commit e18dba7d5a957ef82e8f91733a0bf95d579dcd7a)
-rw-r--r-- | source4/Makefile.in | 3 | ||||
-rw-r--r-- | source4/librpc/idl/spoolss.idl | 41 | ||||
-rw-r--r-- | source4/librpc/ndr/libndr.h | 9 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr.c | 14 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 71 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_dfs.c | 74 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_echo.c | 12 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.c | 84 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.c | 98 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss.c | 164 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss.h | 65 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss_buf.c | 51 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss_buf.h | 26 | ||||
-rw-r--r-- | source4/librpc/rpc/rpc_spoolss.c | 48 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss.c | 31 |
15 files changed, 552 insertions, 239 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in index 850cda2981..f8d36d656d 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -195,7 +195,8 @@ LIBCLIUTIL_OBJ = libcli/util/asn1.o \ LIBRAW_NDR_OBJ = librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \ librpc/ndr/ndr_echo.o librpc/ndr/ndr_misc.o librpc/ndr/ndr_lsa.o \ - librpc/ndr/ndr_dfs.o librpc/ndr/ndr_samr.o librpc/ndr/ndr_spoolss.o + librpc/ndr/ndr_dfs.o librpc/ndr/ndr_samr.o \ + librpc/ndr/ndr_spoolss.o librpc/ndr/ndr_spoolss_buf.o LIBRAW_RPC_OBJ = librpc/rpc/dcerpc.o librpc/rpc/rpc_echo.o librpc/rpc/rpc_lsa.o \ librpc/rpc/dcerpc_smb.o librpc/rpc/rpc_dfs.o librpc/rpc/rpc_spoolss.o \ diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl index 0bcb53de84..e2965c3586 100644 --- a/source4/librpc/idl/spoolss.idl +++ b/source4/librpc/idl/spoolss.idl @@ -7,32 +7,25 @@ pointer_default(unique) ] interface spoolss { - typedef struct { - uint32 flags; - unistr description; - unistr name; - unistr comment; - } spoolss_PrinterInfo1; - - typedef union { - case(1) spoolss_PrinterInfo1 info1; - } spoolssPrinterInfo; - - typedef struct { - uint32 len; - spoolssPrinterInfo *info; - } spoolss_PrinterInfoBuffer; - /******************/ /* Function: 0x00 */ + + typedef [public] struct { + uint32 flags; + relstr name; + relstr description; + relstr comment; + } spoolss_PrinterEnum1; + NTSTATUS spoolss_EnumPrinters( - [in] uint32 flags, - [in] unistr *server, - [in] uint32 level, - [in,out] uint8_buf *buffer, - [in] uint32 offered, - [out] uint32 needed, - [out] uint32 returned + [in] uint32 flags, + [in] unistr *server, + [in] uint32 level, + [in,size_is(offered)] uint8 *buf, + [in] uint32 offered, + [out,subcontext,switch_is(level)] spoolss_PrinterEnum *info, + [out,ref] uint32 *needed, + [out] uint32 returned ); /******************/ @@ -445,7 +438,7 @@ [in] uint32 value_offered, [in] uint32 data_offered, [out] uint32 value_len, - [out] unistr value_name, + [out] unistr *value_name, [out] uint32 value_needed, [out] uint32 printerdata_type, [out] uint8_buf printerdata, diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 8347aa8f28..5e53704255 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -52,10 +52,14 @@ struct ndr_push { uint32 alloc_size; uint32 offset; TALLOC_CTX *mem_ctx; + + /* this list is used by the relstr code to find the offsets */ + struct ndr_push_save *relstr_list; }; struct ndr_push_save { uint32 offset; + struct ndr_push_save *next; }; @@ -81,6 +85,8 @@ enum ndr_err_code { NDR_ERR_ARRAY_SIZE, NDR_ERR_BAD_SWITCH, NDR_ERR_OFFSET, + NDR_ERR_RELSTR, + NDR_ERR_CHARCNV, NDR_ERR_LENGTH }; @@ -145,6 +151,8 @@ 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_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 void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *); typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint16, void *); @@ -155,5 +163,6 @@ typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint16, v #include "librpc/ndr/ndr_lsa.h" #include "librpc/ndr/ndr_dfs.h" #include "librpc/ndr/ndr_spoolss.h" +#include "librpc/ndr/ndr_spoolss_buf.h" #include "librpc/ndr/ndr_samr.h" diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index cd744ab778..25bfd20006 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -405,3 +405,17 @@ NTSTATUS ndr_pull_subcontext_flags_fn(struct ndr_pull *ndr, return NT_STATUS_OK; } +NTSTATUS ndr_pull_subcontext_union_fn(struct ndr_pull *ndr, + uint16 *level, + void *base, + NTSTATUS (*fn)(struct ndr_pull *, int , uint16 *, void *)) +{ + uint32 size; + struct ndr_pull ndr2; + + NDR_CHECK(ndr_pull_uint32(ndr, &size)); + NDR_CHECK(ndr_pull_subcontext(ndr, &ndr2, size)); + NDR_CHECK(fn(&ndr2, NDR_SCALARS|NDR_BUFFERS, level, base)); + NDR_CHECK(ndr_pull_advance(ndr, size)); + return NT_STATUS_OK; +} diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 31e16b6812..ece496ebde 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -512,3 +512,74 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, struct GUID *guid) } +/* + pull a spoolss style "relative string" +*/ +NTSTATUS ndr_pull_relstr(struct ndr_pull *ndr, int ndr_flags, const char **s) +{ + uint32 ofs; + int ret; + struct ndr_pull_save save; + + if (!(ndr_flags & NDR_SCALARS)) { + return NT_STATUS_OK; + } + + NDR_CHECK(ndr_pull_uint32(ndr, &ofs)); + ndr_pull_save(ndr, &save); + NDR_CHECK(ndr_pull_set_offset(ndr, ofs)); + ret = convert_string_talloc(ndr->mem_ctx, CH_UCS2, CH_UNIX, + ndr->data+ndr->offset, + ndr->data_size - ndr->offset, + (const void **)s); + if (ret == -1) { + return ndr_pull_error(ndr, NDR_ERR_RELSTR, "Bad relative string"); + } + ndr_pull_restore(ndr, &save); + return NT_STATUS_OK; +} + +/* + push a spoolss style "relative string" +*/ +NTSTATUS ndr_push_relstr(struct ndr_push *ndr, int ndr_flags, const char **s) +{ + struct ndr_push_save *save; + if (ndr_flags & NDR_SCALARS) { + save = talloc(ndr->mem_ctx, sizeof(*save)); + if (!save) return NT_STATUS_NO_MEMORY; + NDR_CHECK(ndr_push_align(ndr, 4)); + ndr_push_save(ndr, save); + NDR_CHECK(ndr_push_uint32(ndr, 0xFFFFFFFF)); + save->next = ndr->relstr_list; + ndr->relstr_list = save; + } + if (ndr_flags & NDR_BUFFERS) { + struct ndr_push_save save2; + uint32 len; + int ret; + save = ndr->relstr_list; + if (!save) { + return ndr_push_error(ndr, NDR_ERR_RELSTR, "Empty relstr stack"); + } + ndr->relstr_list = save->next; + NDR_CHECK(ndr_push_align(ndr, 2)); + ndr_push_save(ndr, &save2); + ndr_push_restore(ndr, save); + NDR_CHECK(ndr_push_uint32(ndr, save2.offset)); + ndr_push_restore(ndr, &save2); + len = 2*(strlen_m(*s)+1); + NDR_PUSH_NEED_BYTES(ndr, len); + ret = push_ucs2(NULL, ndr->data + ndr->offset, *s, len, STR_TERMINATE); + if (ret == -1) { + return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad string conversion"); + } + ndr->offset += len; + } + return NT_STATUS_OK; +} + +void ndr_print_relstr(struct ndr_print *ndr, const char *name, const char **s) +{ + ndr_print_unistr(ndr, name, *s); +} diff --git a/source4/librpc/ndr/ndr_dfs.c b/source4/librpc/ndr/ndr_dfs.c index 6b85e0c61b..90f56f911b 100644 --- a/source4/librpc/ndr/ndr_dfs.c +++ b/source4/librpc/ndr/ndr_dfs.c @@ -46,7 +46,7 @@ NTSTATUS ndr_push_dfs_SetInfo(struct ndr_push *ndr, struct dfs_SetInfo *r) return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_Info1(struct ndr_push *ndr, int ndr_flags, struct dfs_Info1 *r) +NTSTATUS ndr_push_dfs_Info1(struct ndr_push *ndr, int ndr_flags, struct dfs_Info1 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -60,7 +60,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_Info2(struct ndr_push *ndr, int ndr_flags, struct dfs_Info2 *r) +NTSTATUS ndr_push_dfs_Info2(struct ndr_push *ndr, int ndr_flags, struct dfs_Info2 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -80,7 +80,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_StorageInfo(struct ndr_push *ndr, int ndr_flags, struct dfs_StorageInfo *r) +NTSTATUS ndr_push_dfs_StorageInfo(struct ndr_push *ndr, int ndr_flags, struct dfs_StorageInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -99,7 +99,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_Info3(struct ndr_push *ndr, int ndr_flags, struct dfs_Info3 *r) +NTSTATUS ndr_push_dfs_Info3(struct ndr_push *ndr, int ndr_flags, struct dfs_Info3 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -124,7 +124,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_Info4(struct ndr_push *ndr, int ndr_flags, struct dfs_Info4 *r) +NTSTATUS ndr_push_dfs_Info4(struct ndr_push *ndr, int ndr_flags, struct dfs_Info4 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -152,7 +152,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_Info200(struct ndr_push *ndr, int ndr_flags, struct dfs_Info200 *r) +NTSTATUS ndr_push_dfs_Info200(struct ndr_push *ndr, int ndr_flags, struct dfs_Info200 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -166,7 +166,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_Info300(struct ndr_push *ndr, int ndr_flags, struct dfs_Info300 *r) +NTSTATUS ndr_push_dfs_Info300(struct ndr_push *ndr, int ndr_flags, struct dfs_Info300 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -197,7 +197,7 @@ NTSTATUS ndr_push_dfs_GetInfo(struct ndr_push *ndr, struct dfs_GetInfo *r) return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumArray1(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray1 *r) +NTSTATUS ndr_push_dfs_EnumArray1(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray1 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -213,7 +213,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumArray2(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray2 *r) +NTSTATUS ndr_push_dfs_EnumArray2(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray2 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -229,7 +229,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumArray3(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray3 *r) +NTSTATUS ndr_push_dfs_EnumArray3(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray3 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -245,7 +245,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumArray4(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray4 *r) +NTSTATUS ndr_push_dfs_EnumArray4(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray4 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -261,7 +261,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumArray200(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray200 *r) +NTSTATUS ndr_push_dfs_EnumArray200(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray200 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -277,7 +277,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumArray300(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray300 *r) +NTSTATUS ndr_push_dfs_EnumArray300(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray300 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -293,7 +293,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_flags, uint16 level, union dfs_EnumInfo *r) +NTSTATUS ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_flags, uint16 level, union dfs_EnumInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_uint16(ndr, level)); @@ -371,7 +371,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_dfs_EnumStruct(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumStruct *r) +NTSTATUS ndr_push_dfs_EnumStruct(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumStruct *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -432,7 +432,7 @@ NTSTATUS ndr_pull_dfs_SetInfo(struct ndr_pull *ndr, struct dfs_SetInfo *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info1(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info1 *r) +NTSTATUS ndr_pull_dfs_Info1(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info1 *r) { uint32 _ptr_path; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -452,7 +452,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info2(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info2 *r) +NTSTATUS ndr_pull_dfs_Info2(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info2 *r) { uint32 _ptr_path; uint32 _ptr_comment; @@ -484,7 +484,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_StorageInfo(struct ndr_pull *ndr, int ndr_flags, struct dfs_StorageInfo *r) +NTSTATUS ndr_pull_dfs_StorageInfo(struct ndr_pull *ndr, int ndr_flags, struct dfs_StorageInfo *r) { uint32 _ptr_server; uint32 _ptr_share; @@ -515,7 +515,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info3(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info3 *r) +NTSTATUS ndr_pull_dfs_Info3(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info3 *r) { uint32 _ptr_path; uint32 _ptr_comment; @@ -565,7 +565,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info4(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info4 *r) +NTSTATUS ndr_pull_dfs_Info4(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info4 *r) { uint32 _ptr_path; uint32 _ptr_comment; @@ -618,7 +618,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info100(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info100 *r) +NTSTATUS ndr_pull_dfs_Info100(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info100 *r) { uint32 _ptr_comment; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -638,7 +638,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info101(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info101 *r) +NTSTATUS ndr_pull_dfs_Info101(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info101 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -649,7 +649,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info102(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info102 *r) +NTSTATUS ndr_pull_dfs_Info102(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info102 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -660,7 +660,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info200(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info200 *r) +NTSTATUS ndr_pull_dfs_Info200(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info200 *r) { uint32 _ptr_dom_root; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -680,7 +680,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_Info300(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info300 *r) +NTSTATUS ndr_pull_dfs_Info300(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info300 *r) { uint32 _ptr_dom_root; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -701,7 +701,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -865,7 +865,7 @@ done: NTSTATUS ndr_pull_dfs_GetInfo(struct ndr_pull *ndr, struct dfs_GetInfo *r) { - { uint16 _level; + { 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"); } @@ -874,7 +874,7 @@ NTSTATUS ndr_pull_dfs_GetInfo(struct ndr_pull *ndr, struct dfs_GetInfo *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumArray1(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray1 *r) +NTSTATUS ndr_pull_dfs_EnumArray1(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray1 *r) { uint32 _ptr_s; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -903,7 +903,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumArray2(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray2 *r) +NTSTATUS ndr_pull_dfs_EnumArray2(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray2 *r) { uint32 _ptr_s; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -932,7 +932,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumArray3(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray3 *r) +NTSTATUS ndr_pull_dfs_EnumArray3(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray3 *r) { uint32 _ptr_s; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -961,7 +961,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumArray4(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray4 *r) +NTSTATUS ndr_pull_dfs_EnumArray4(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray4 *r) { uint32 _ptr_s; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -990,7 +990,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumArray200(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray200 *r) +NTSTATUS ndr_pull_dfs_EnumArray200(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray200 *r) { uint32 _ptr_s; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1019,7 +1019,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumArray300(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray300 *r) +NTSTATUS ndr_pull_dfs_EnumArray300(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray300 *r) { uint32 _ptr_s; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1048,7 +1048,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -1162,18 +1162,18 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_dfs_EnumStruct(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumStruct *r) +NTSTATUS ndr_pull_dfs_EnumStruct(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumStruct *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_uint32(ndr, &r->level)); - { uint16 _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"); } buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level; + { 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"); } diff --git a/source4/librpc/ndr/ndr_echo.c b/source4/librpc/ndr/ndr_echo.c index 568255f993..d7f131f784 100644 --- a/source4/librpc/ndr/ndr_echo.c +++ b/source4/librpc/ndr/ndr_echo.c @@ -90,7 +90,7 @@ NTSTATUS ndr_pull_echo_SourceData(struct ndr_pull *ndr, struct echo_SourceData * return NT_STATUS_OK; } -static NTSTATUS ndr_pull_echo_Enum1(struct ndr_pull *ndr, int ndr_flags, struct echo_Enum1 *r) +NTSTATUS ndr_pull_echo_Enum1(struct ndr_pull *ndr, int ndr_flags, struct echo_Enum1 *r) { uint32 _ptr_count; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -110,7 +110,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_echo_Enum3(struct ndr_pull *ndr, int ndr_flags, struct echo_Enum3 *r) +NTSTATUS ndr_pull_echo_Enum3(struct ndr_pull *ndr, int ndr_flags, struct echo_Enum3 *r) { uint32 _ptr_count; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -130,7 +130,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_echo_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union echo_EnumInfo *r) +NTSTATUS ndr_pull_echo_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union echo_EnumInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_uint16(ndr, level)); @@ -164,18 +164,18 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_Struct1(struct ndr_pull *ndr, int ndr_flags, struct Struct1 *r) +NTSTATUS ndr_pull_Struct1(struct ndr_pull *ndr, int ndr_flags, struct Struct1 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_uint32(ndr, &r->level)); - { uint16 _level; + { uint16 _level = r->level; NDR_CHECK(ndr_pull_echo_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"); } buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; - { uint16 _level; + { uint16 _level = r->level; NDR_CHECK(ndr_pull_echo_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"); } diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c index a6bf580557..bf27ec3ec5 100644 --- a/source4/librpc/ndr/ndr_lsa.c +++ b/source4/librpc/ndr/ndr_lsa.c @@ -16,7 +16,7 @@ NTSTATUS ndr_push_lsa_Delete(struct ndr_push *ndr, struct lsa_Delete *r) return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_Name(struct ndr_push *ndr, int ndr_flags, struct lsa_Name *r) +NTSTATUS ndr_push_lsa_Name(struct ndr_push *ndr, int ndr_flags, struct lsa_Name *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -61,7 +61,7 @@ NTSTATUS ndr_push_lsa_ChangePassword(struct ndr_push *ndr, struct lsa_ChangePass return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_QosInfo(struct ndr_push *ndr, int ndr_flags, struct lsa_QosInfo *r) +NTSTATUS ndr_push_lsa_QosInfo(struct ndr_push *ndr, int ndr_flags, struct lsa_QosInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -75,7 +75,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, int ndr_flags, struct lsa_ObjectAttribute *r) +NTSTATUS ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, int ndr_flags, struct lsa_ObjectAttribute *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -141,7 +141,7 @@ NTSTATUS ndr_push_lsa_CreateAccount(struct ndr_push *ndr, struct lsa_CreateAccou return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_SidPtr(struct ndr_push *ndr, int ndr_flags, struct lsa_SidPtr *r) +NTSTATUS ndr_push_lsa_SidPtr(struct ndr_push *ndr, int ndr_flags, struct lsa_SidPtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -155,7 +155,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, struct lsa_SidArray *r) +NTSTATUS ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, struct lsa_SidArray *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -195,7 +195,7 @@ NTSTATUS ndr_push_lsa_EnumTrustDom(struct ndr_push *ndr, struct lsa_EnumTrustDom return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_TranslatedSid(struct ndr_push *ndr, int ndr_flags, struct lsa_TranslatedSid *r) +NTSTATUS ndr_push_lsa_TranslatedSid(struct ndr_push *ndr, int ndr_flags, struct lsa_TranslatedSid *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -208,7 +208,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_TransSidArray(struct ndr_push *ndr, int ndr_flags, struct lsa_TransSidArray *r) +NTSTATUS ndr_push_lsa_TransSidArray(struct ndr_push *ndr, int ndr_flags, struct lsa_TransSidArray *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -240,7 +240,7 @@ NTSTATUS ndr_push_lsa_LookupNames(struct ndr_push *ndr, struct lsa_LookupNames * return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_TranslatedName(struct ndr_push *ndr, int ndr_flags, struct lsa_TranslatedName *r) +NTSTATUS ndr_push_lsa_TranslatedName(struct ndr_push *ndr, int ndr_flags, struct lsa_TranslatedName *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -254,7 +254,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_TransNameArray(struct ndr_push *ndr, int ndr_flags, struct lsa_TransNameArray *r) +NTSTATUS ndr_push_lsa_TransNameArray(struct ndr_push *ndr, int ndr_flags, struct lsa_TransNameArray *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -296,7 +296,7 @@ NTSTATUS ndr_push_lsa_OpenAccount(struct ndr_push *ndr, struct lsa_OpenAccount * return NT_STATUS_OK; } -static NTSTATUS ndr_push_lsa_LUID(struct ndr_push *ndr, int ndr_flags, struct lsa_LUID *r) +NTSTATUS ndr_push_lsa_LUID(struct ndr_push *ndr, int ndr_flags, struct lsa_LUID *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -508,7 +508,7 @@ NTSTATUS ndr_pull_lsa_Delete(struct ndr_pull *ndr, struct lsa_Delete *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_Name(struct ndr_pull *ndr, int ndr_flags, struct lsa_Name *r) +NTSTATUS ndr_pull_lsa_Name(struct ndr_pull *ndr, int ndr_flags, struct lsa_Name *r) { uint32 _ptr_name; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -530,7 +530,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_PrivEntry(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivEntry *r) +NTSTATUS ndr_pull_lsa_PrivEntry(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivEntry *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -544,7 +544,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_PrivArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivArray *r) +NTSTATUS ndr_pull_lsa_PrivArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivArray *r) { uint32 _ptr_privs; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -582,7 +582,7 @@ NTSTATUS ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, struct lsa_EnumPrivs *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r) +NTSTATUS ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r) { uint32 _ptr_sd; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -642,7 +642,7 @@ NTSTATUS ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, struct lsa_OpenPolicy *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_AuditLogInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditLogInfo *r) +NTSTATUS ndr_pull_lsa_AuditLogInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditLogInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -659,7 +659,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_AuditSettings(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditSettings *r) +NTSTATUS ndr_pull_lsa_AuditSettings(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditSettings *r) { uint32 _conformant_size; NDR_CHECK(ndr_pull_uint32(ndr, &_conformant_size)); @@ -677,7 +677,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditEventsInfo *r) +NTSTATUS ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditEventsInfo *r) { uint32 _ptr_settings; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -698,7 +698,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_DomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainInfo *r) +NTSTATUS ndr_pull_lsa_DomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainInfo *r) { uint32 _ptr_sid; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -720,7 +720,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_PDAccountInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_PDAccountInfo *r) +NTSTATUS ndr_pull_lsa_PDAccountInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_PDAccountInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -732,7 +732,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_ServerRole(struct ndr_pull *ndr, int ndr_flags, struct lsa_ServerRole *r) +NTSTATUS ndr_pull_lsa_ServerRole(struct ndr_pull *ndr, int ndr_flags, struct lsa_ServerRole *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -743,7 +743,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_ReplicaSourceInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ReplicaSourceInfo *r) +NTSTATUS ndr_pull_lsa_ReplicaSourceInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ReplicaSourceInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -757,7 +757,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_DefaultQuotaInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DefaultQuotaInfo *r) +NTSTATUS ndr_pull_lsa_DefaultQuotaInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DefaultQuotaInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -773,7 +773,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_ModificationInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ModificationInfo *r) +NTSTATUS ndr_pull_lsa_ModificationInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ModificationInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -785,7 +785,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_AuditFullSetInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullSetInfo *r) +NTSTATUS ndr_pull_lsa_AuditFullSetInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullSetInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -796,7 +796,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_AuditFullQueryInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullQueryInfo *r) +NTSTATUS ndr_pull_lsa_AuditFullQueryInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullQueryInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -808,7 +808,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_DnsDomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DnsDomainInfo *r) +NTSTATUS ndr_pull_lsa_DnsDomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DnsDomainInfo *r) { uint32 _ptr_sid; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -836,7 +836,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -960,7 +960,7 @@ NTSTATUS ndr_pull_lsa_QueryInfoPolicy(struct ndr_pull *ndr, struct lsa_QueryInfo r->out.info = NULL; } if (r->out.info) { - { uint16 _level; + { 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"); } @@ -991,7 +991,7 @@ NTSTATUS ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, struct lsa_CreateAccou return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_SidPtr(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidPtr *r) +NTSTATUS ndr_pull_lsa_SidPtr(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidPtr *r) { uint32 _ptr_sid; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1011,7 +1011,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_SidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidArray *r) +NTSTATUS ndr_pull_lsa_SidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidArray *r) { uint32 _ptr_sids; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1056,7 +1056,7 @@ NTSTATUS ndr_pull_lsa_CreateTrustDom(struct ndr_pull *ndr, struct lsa_CreateTrus return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_DomainInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainInformation *r) +NTSTATUS ndr_pull_lsa_DomainInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainInformation *r) { uint32 _ptr_sid; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1078,7 +1078,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_DomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainList *r) +NTSTATUS ndr_pull_lsa_DomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainList *r) { uint32 _ptr_domains; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1116,7 +1116,7 @@ NTSTATUS ndr_pull_lsa_EnumTrustDom(struct ndr_pull *ndr, struct lsa_EnumTrustDom return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_TranslatedSid(struct ndr_pull *ndr, int ndr_flags, struct lsa_TranslatedSid *r) +NTSTATUS ndr_pull_lsa_TranslatedSid(struct ndr_pull *ndr, int ndr_flags, struct lsa_TranslatedSid *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1129,7 +1129,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_TransSidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_TransSidArray *r) +NTSTATUS ndr_pull_lsa_TransSidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_TransSidArray *r) { uint32 _ptr_sids; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1158,7 +1158,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_TrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustInformation *r) +NTSTATUS ndr_pull_lsa_TrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustInformation *r) { uint32 _ptr_sid; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1180,7 +1180,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_RefDomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_RefDomainList *r) +NTSTATUS ndr_pull_lsa_RefDomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_RefDomainList *r) { uint32 _ptr_domains; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1229,7 +1229,7 @@ NTSTATUS ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, struct lsa_LookupNames * return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_TranslatedName(struct ndr_pull *ndr, int ndr_flags, struct lsa_TranslatedName *r) +NTSTATUS ndr_pull_lsa_TranslatedName(struct ndr_pull *ndr, int ndr_flags, struct lsa_TranslatedName *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1243,7 +1243,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_TransNameArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_TransNameArray *r) +NTSTATUS ndr_pull_lsa_TransNameArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_TransNameArray *r) { uint32 _ptr_names; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1306,7 +1306,7 @@ NTSTATUS ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, struct lsa_OpenAccount * return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_LUID(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUID *r) +NTSTATUS ndr_pull_lsa_LUID(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUID *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1318,7 +1318,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_LUIDAttribute(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUIDAttribute *r) +NTSTATUS ndr_pull_lsa_LUIDAttribute(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUIDAttribute *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1331,7 +1331,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_PrivilegeSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivilegeSet *r) +NTSTATUS ndr_pull_lsa_PrivilegeSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivilegeSet *r) { uint32 _conformant_size; NDR_CHECK(ndr_pull_uint32(ndr, &_conformant_size)); @@ -1496,7 +1496,7 @@ NTSTATUS ndr_pull_ENUMACCTWITHRIGHT(struct ndr_pull *ndr, struct ENUMACCTWITHRIG return NT_STATUS_OK; } -static NTSTATUS ndr_pull_lsa_RightSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_RightSet *r) +NTSTATUS ndr_pull_lsa_RightSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_RightSet *r) { uint32 _ptr_names; if (!(ndr_flags & NDR_SCALARS)) goto buffers; diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index 268d763383..ef5206bc08 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -38,7 +38,7 @@ NTSTATUS ndr_push_samr_Shutdown(struct ndr_push *ndr, struct samr_Shutdown *r) return NT_STATUS_OK; } -static NTSTATUS ndr_push_samr_Name(struct ndr_push *ndr, int ndr_flags, struct samr_Name *r) +NTSTATUS ndr_push_samr_Name(struct ndr_push *ndr, int ndr_flags, struct samr_Name *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -510,7 +510,7 @@ NTSTATUS ndr_pull_samr_Shutdown(struct ndr_pull *ndr, struct samr_Shutdown *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_Name(struct ndr_pull *ndr, int ndr_flags, struct samr_Name *r) +NTSTATUS ndr_pull_samr_Name(struct ndr_pull *ndr, int ndr_flags, struct samr_Name *r) { uint32 _ptr_name; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -549,7 +549,7 @@ NTSTATUS ndr_pull_samr_LookupDomain(struct ndr_pull *ndr, struct samr_LookupDoma return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_SamEntry(struct ndr_pull *ndr, int ndr_flags, struct samr_SamEntry *r) +NTSTATUS ndr_pull_samr_SamEntry(struct ndr_pull *ndr, int ndr_flags, struct samr_SamEntry *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -562,7 +562,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_SamArray(struct ndr_pull *ndr, int ndr_flags, struct samr_SamArray *r) +NTSTATUS ndr_pull_samr_SamArray(struct ndr_pull *ndr, int ndr_flags, struct samr_SamArray *r) { uint32 _ptr_entries; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -618,7 +618,7 @@ NTSTATUS ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, struct samr_OpenDomain * return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo1 *r) +NTSTATUS ndr_pull_samr_DomInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo1 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -633,7 +633,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo2 *r) +NTSTATUS ndr_pull_samr_DomInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo2 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -657,7 +657,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo3 *r) +NTSTATUS ndr_pull_samr_DomInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo3 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -668,7 +668,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo4 *r) +NTSTATUS ndr_pull_samr_DomInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo4 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -680,7 +680,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo5 *r) +NTSTATUS ndr_pull_samr_DomInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo5 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -692,7 +692,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo6 *r) +NTSTATUS ndr_pull_samr_DomInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo6 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -704,7 +704,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo7 *r) +NTSTATUS ndr_pull_samr_DomInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo7 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -715,7 +715,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo8 *r) +NTSTATUS ndr_pull_samr_DomInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo8 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -727,7 +727,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo9 *r) +NTSTATUS ndr_pull_samr_DomInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo9 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -738,7 +738,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo11 *r) +NTSTATUS ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo11 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -765,7 +765,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo12 *r) +NTSTATUS ndr_pull_samr_DomInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo12 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -778,7 +778,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_DomInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo13 *r) +NTSTATUS ndr_pull_samr_DomInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo13 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -792,7 +792,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -916,7 +916,7 @@ NTSTATUS ndr_pull_samr_QueryDomainInfo(struct ndr_pull *ndr, struct samr_QueryDo r->out.info = NULL; } if (r->out.info) { - { uint16 _level; + { 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"); } @@ -1040,7 +1040,7 @@ NTSTATUS ndr_pull_samr_OpenGroup(struct ndr_pull *ndr, struct samr_OpenGroup *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_GroupInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAll *r) +NTSTATUS ndr_pull_samr_GroupInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAll *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1056,7 +1056,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_GroupInfoName(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoName *r) +NTSTATUS ndr_pull_samr_GroupInfoName(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoName *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1068,7 +1068,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_GroupInfoX(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoX *r) +NTSTATUS ndr_pull_samr_GroupInfoX(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoX *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1079,7 +1079,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_GroupInfoDesciption(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoDesciption *r) +NTSTATUS ndr_pull_samr_GroupInfoDesciption(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoDesciption *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1091,7 +1091,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -1151,7 +1151,7 @@ NTSTATUS ndr_pull_samr_QueryGroupInfo(struct ndr_pull *ndr, struct samr_QueryGro r->out.info = NULL; } if (r->out.info) { - { uint16 _level; + { 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"); } @@ -1211,7 +1211,7 @@ NTSTATUS ndr_pull_samr_OpenAlias(struct ndr_pull *ndr, struct samr_OpenAlias *r) return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_AliasInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoAll *r) +NTSTATUS ndr_pull_samr_AliasInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoAll *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1226,7 +1226,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_AliasInfoName(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoName *r) +NTSTATUS ndr_pull_samr_AliasInfoName(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoName *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1238,7 +1238,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_AliasInfoDescription(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoDescription *r) +NTSTATUS ndr_pull_samr_AliasInfoDescription(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoDescription *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1250,7 +1250,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -1302,7 +1302,7 @@ NTSTATUS ndr_pull_samr_QueryAliasInfo(struct ndr_pull *ndr, struct samr_QueryAli r->out.info = NULL; } if (r->out.info) { - { uint16 _level; + { 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"); } @@ -1362,7 +1362,7 @@ NTSTATUS ndr_pull_samr_DELETE_DOM_USER(struct ndr_pull *ndr, struct samr_DELETE_ return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo1 *r) +NTSTATUS ndr_pull_samr_UserInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo1 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1381,7 +1381,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo2 *r) +NTSTATUS ndr_pull_samr_UserInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo2 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1397,7 +1397,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo3 *r) +NTSTATUS ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo3 *r) { uint32 _ptr_logon_hours; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1455,7 +1455,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo4 *r) +NTSTATUS ndr_pull_samr_UserInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo4 *r) { uint32 _ptr_logon_hours; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1489,7 +1489,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo5 *r) +NTSTATUS ndr_pull_samr_UserInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo5 *r) { uint32 _ptr_logon_hours; if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1547,7 +1547,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo6 *r) +NTSTATUS ndr_pull_samr_UserInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo6 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1561,7 +1561,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo7 *r) +NTSTATUS ndr_pull_samr_UserInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo7 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1573,7 +1573,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo8 *r) +NTSTATUS ndr_pull_samr_UserInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo8 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1585,7 +1585,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo9 *r) +NTSTATUS ndr_pull_samr_UserInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo9 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1596,7 +1596,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo10(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo10 *r) +NTSTATUS ndr_pull_samr_UserInfo10(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo10 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1610,7 +1610,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo11 *r) +NTSTATUS ndr_pull_samr_UserInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo11 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1622,7 +1622,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo12 *r) +NTSTATUS ndr_pull_samr_UserInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo12 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1634,7 +1634,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo13 *r) +NTSTATUS ndr_pull_samr_UserInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo13 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1646,7 +1646,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo14(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo14 *r) +NTSTATUS ndr_pull_samr_UserInfo14(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo14 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1658,7 +1658,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo16(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo16 *r) +NTSTATUS ndr_pull_samr_UserInfo16(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo16 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1669,7 +1669,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo17(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo17 *r) +NTSTATUS ndr_pull_samr_UserInfo17(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo17 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1680,7 +1680,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo20(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo20 *r) +NTSTATUS ndr_pull_samr_UserInfo20(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo20 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -1692,7 +1692,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_pull_samr_UserInfo21(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo21 *r) +NTSTATUS ndr_pull_samr_UserInfo21(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo21 *r) { uint32 _ptr_buffer; uint32 _ptr_logon_hours; @@ -1789,7 +1789,7 @@ done: return NT_STATUS_OK; } -static 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_uint16(ndr, level)); @@ -1961,7 +1961,7 @@ NTSTATUS ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, struct samr_QueryUser r->out.info = NULL; } if (r->out.info) { - { uint16 _level; + { 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"); } diff --git a/source4/librpc/ndr/ndr_spoolss.c b/source4/librpc/ndr/ndr_spoolss.c index 319e2dade0..f5e8f2b2cf 100644 --- a/source4/librpc/ndr/ndr_spoolss.c +++ b/source4/librpc/ndr/ndr_spoolss.c @@ -2,6 +2,23 @@ #include "includes.h" +NTSTATUS ndr_push_spoolss_PrinterEnum1(struct ndr_push *ndr, int ndr_flags, struct spoolss_PrinterEnum1 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, r->flags)); + NDR_CHECK(ndr_push_relstr(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_push_relstr(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_push_relstr(ndr, NDR_SCALARS, &r->comment)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_push_relstr(ndr, NDR_BUFFERS, &r->name)); + NDR_CHECK(ndr_push_relstr(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_push_relstr(ndr, NDR_BUFFERS, &r->comment)); +done: + return NT_STATUS_OK; +} + NTSTATUS ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, struct spoolss_EnumPrinters *r) { NDR_CHECK(ndr_push_uint32(ndr, r->in.flags)); @@ -10,9 +27,10 @@ NTSTATUS ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, struct spoolss_Enum NDR_CHECK(ndr_push_unistr(ndr, r->in.server)); } NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); - NDR_CHECK(ndr_push_ptr(ndr, r->in.buffer)); - if (r->in.buffer) { - NDR_CHECK(ndr_push_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buffer)); + NDR_CHECK(ndr_push_ptr(ndr, r->in.buf)); + if (r->in.buf) { + NDR_CHECK(ndr_push_uint32(ndr, r->in.offered)); + NDR_CHECK(ndr_push_array_uint8(ndr, r->in.buf, r->in.offered)); } NDR_CHECK(ndr_push_uint32(ndr, r->in.offered)); @@ -37,8 +55,17 @@ NTSTATUS ndr_push_spoolss_03(struct ndr_push *ndr, struct spoolss_03 *r) return NT_STATUS_OK; } -NTSTATUS ndr_push_spoolss_04(struct ndr_push *ndr, struct spoolss_04 *r) +NTSTATUS ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, struct spoolss_EnumJobs *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.firstjob)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.numjobs)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_ptr(ndr, r->in.buffer)); + if (r->in.buffer) { + NDR_CHECK(ndr_push_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buffer)); + } + NDR_CHECK(ndr_push_uint32(ndr, r->in.offered)); return NT_STATUS_OK; } @@ -61,8 +88,15 @@ NTSTATUS ndr_push_spoolss_07(struct ndr_push *ndr, struct spoolss_07 *r) return NT_STATUS_OK; } -NTSTATUS ndr_push_spoolss_08(struct ndr_push *ndr, struct spoolss_08 *r) +NTSTATUS ndr_push_spoolss_GetPrinter(struct ndr_push *ndr, struct spoolss_GetPrinter *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + NDR_CHECK(ndr_push_ptr(ndr, r->in.buffer)); + if (r->in.buffer) { + NDR_CHECK(ndr_push_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buffer)); + } + NDR_CHECK(ndr_push_uint32(ndr, r->in.offered)); return NT_STATUS_OK; } @@ -121,8 +155,9 @@ NTSTATUS ndr_push_spoolss_11(struct ndr_push *ndr, struct spoolss_11 *r) return NT_STATUS_OK; } -NTSTATUS ndr_push_spoolss_12(struct ndr_push *ndr, struct spoolss_12 *r) +NTSTATUS ndr_push_spoolss_StartPagePrinter(struct ndr_push *ndr, struct spoolss_StartPagePrinter *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); return NT_STATUS_OK; } @@ -133,8 +168,9 @@ NTSTATUS ndr_push_spoolss_13(struct ndr_push *ndr, struct spoolss_13 *r) return NT_STATUS_OK; } -NTSTATUS ndr_push_spoolss_14(struct ndr_push *ndr, struct spoolss_14 *r) +NTSTATUS ndr_push_spoolss_EndPagePrinter(struct ndr_push *ndr, struct spoolss_EndPagePrinter *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); return NT_STATUS_OK; } @@ -151,7 +187,7 @@ NTSTATUS ndr_push_spoolss_16(struct ndr_push *ndr, struct spoolss_16 *r) return NT_STATUS_OK; } -NTSTATUS ndr_push_spoolss_17(struct ndr_push *ndr, struct spoolss_17 *r) +NTSTATUS ndr_push_spoolss_EndDocPrinter(struct ndr_push *ndr, struct spoolss_EndDocPrinter *r) { return NT_STATUS_OK; @@ -428,7 +464,7 @@ NTSTATUS ndr_push_spoolss_44(struct ndr_push *ndr, struct spoolss_44 *r) return NT_STATUS_OK; } -static NTSTATUS ndr_push_spoolss_Devmode(struct ndr_push *ndr, int ndr_flags, struct spoolss_Devmode *r) +NTSTATUS ndr_push_spoolss_Devmode(struct ndr_push *ndr, int ndr_flags, struct spoolss_Devmode *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -439,7 +475,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_spoolss_DevmodeContainer(struct ndr_push *ndr, int ndr_flags, struct spoolss_DevmodeContainer *r) +NTSTATUS ndr_push_spoolss_DevmodeContainer(struct ndr_push *ndr, int ndr_flags, struct spoolss_DevmodeContainer *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -454,7 +490,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_spoolss_UserLevel1(struct ndr_push *ndr, int ndr_flags, struct spoolss_UserLevel1 *r) +NTSTATUS ndr_push_spoolss_UserLevel1(struct ndr_push *ndr, int ndr_flags, struct spoolss_UserLevel1 *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_align(ndr, 4)); @@ -477,7 +513,7 @@ done: return NT_STATUS_OK; } -static NTSTATUS ndr_push_spoolss_UserLevel(struct ndr_push *ndr, int ndr_flags, uint16 level, union spoolss_UserLevel *r) +NTSTATUS ndr_push_spoolss_UserLevel(struct ndr_push *ndr, int ndr_flags, uint16 level, union spoolss_UserLevel *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_uint16(ndr, level)); @@ -535,8 +571,12 @@ NTSTATUS ndr_push_spoolss_47(struct ndr_push *ndr, struct spoolss_47 *r) return NT_STATUS_OK; } -NTSTATUS ndr_push_spoolss_48(struct ndr_push *ndr, struct spoolss_48 *r) +NTSTATUS ndr_push_spoolss_EnumPrinterData(struct ndr_push *ndr, struct spoolss_EnumPrinterData *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.enum_index)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.value_offered)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.data_offered)); return NT_STATUS_OK; } @@ -679,19 +719,39 @@ NTSTATUS ndr_push_spoolss_5f(struct ndr_push *ndr, struct spoolss_5f *r) return NT_STATUS_OK; } +NTSTATUS ndr_pull_spoolss_PrinterEnum1(struct ndr_pull *ndr, int ndr_flags, struct spoolss_PrinterEnum1 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->flags)); + NDR_CHECK(ndr_pull_relstr(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_pull_relstr(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_pull_relstr(ndr, NDR_SCALARS, &r->comment)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_relstr(ndr, NDR_BUFFERS, &r->name)); + NDR_CHECK(ndr_pull_relstr(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_pull_relstr(ndr, NDR_BUFFERS, &r->comment)); +done: + return NT_STATUS_OK; +} + NTSTATUS ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, struct spoolss_EnumPrinters *r) { - uint32 _ptr_buffer; - NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_buffer)); - if (_ptr_buffer) { - NDR_ALLOC(ndr, r->out.buffer); + uint32 _ptr_info; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_ALLOC(ndr, r->out.info); } else { - r->out.buffer = NULL; + r->out.info = NULL; } - if (r->out.buffer) { - NDR_CHECK(ndr_pull_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.buffer)); + 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_PrinterEnum)); + 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_uint32(ndr, &r->out.needed)); + } + NDR_CHECK(ndr_pull_uint32(ndr, r->out.needed)); NDR_CHECK(ndr_pull_uint32(ndr, &r->out.returned)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); @@ -719,8 +779,20 @@ NTSTATUS ndr_pull_spoolss_03(struct ndr_pull *ndr, struct spoolss_03 *r) return NT_STATUS_OK; } -NTSTATUS ndr_pull_spoolss_04(struct ndr_pull *ndr, struct spoolss_04 *r) +NTSTATUS ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, struct spoolss_EnumJobs *r) { + uint32 _ptr_buffer; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_ALLOC(ndr, r->out.buffer); + } else { + r->out.buffer = NULL; + } + if (r->out.buffer) { + NDR_CHECK(ndr_pull_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.buffer)); + } + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.needed)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.numjobs)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; @@ -747,8 +819,20 @@ NTSTATUS ndr_pull_spoolss_07(struct ndr_pull *ndr, struct spoolss_07 *r) return NT_STATUS_OK; } -NTSTATUS ndr_pull_spoolss_08(struct ndr_pull *ndr, struct spoolss_08 *r) +NTSTATUS ndr_pull_spoolss_GetPrinter(struct ndr_pull *ndr, struct spoolss_GetPrinter *r) { + uint32 _ptr_buffer; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_ALLOC(ndr, r->out.buffer); + } else { + r->out.buffer = NULL; + } + if (r->out.buffer) { + NDR_CHECK(ndr_pull_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.buffer)); + } + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.needed)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.returned)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; @@ -817,7 +901,7 @@ NTSTATUS ndr_pull_spoolss_11(struct ndr_pull *ndr, struct spoolss_11 *r) return NT_STATUS_OK; } -NTSTATUS ndr_pull_spoolss_12(struct ndr_pull *ndr, struct spoolss_12 *r) +NTSTATUS ndr_pull_spoolss_StartPagePrinter(struct ndr_pull *ndr, struct spoolss_StartPagePrinter *r) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); @@ -831,7 +915,7 @@ NTSTATUS ndr_pull_spoolss_13(struct ndr_pull *ndr, struct spoolss_13 *r) return NT_STATUS_OK; } -NTSTATUS ndr_pull_spoolss_14(struct ndr_pull *ndr, struct spoolss_14 *r) +NTSTATUS ndr_pull_spoolss_EndPagePrinter(struct ndr_pull *ndr, struct spoolss_EndPagePrinter *r) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); @@ -852,7 +936,7 @@ NTSTATUS ndr_pull_spoolss_16(struct ndr_pull *ndr, struct spoolss_16 *r) return NT_STATUS_OK; } -NTSTATUS ndr_pull_spoolss_17(struct ndr_pull *ndr, struct spoolss_17 *r) +NTSTATUS ndr_pull_spoolss_EndDocPrinter(struct ndr_pull *ndr, struct spoolss_EndDocPrinter *r) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); @@ -1197,8 +1281,23 @@ NTSTATUS ndr_pull_spoolss_47(struct ndr_pull *ndr, struct spoolss_47 *r) return NT_STATUS_OK; } -NTSTATUS ndr_pull_spoolss_48(struct ndr_pull *ndr, struct spoolss_48 *r) +NTSTATUS ndr_pull_spoolss_EnumPrinterData(struct ndr_pull *ndr, struct spoolss_EnumPrinterData *r) { + uint32 _ptr_value_name; + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.value_len)); + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_value_name)); + if (_ptr_value_name) { + NDR_ALLOC(ndr, r->out.value_name); + } else { + r->out.value_name = NULL; + } + if (r->out.value_name) { + NDR_CHECK(ndr_pull_unistr(ndr, &r->out.value_name)); + } + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.value_needed)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.printerdata_type)); + NDR_CHECK(ndr_pull_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, &r->out.printerdata)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.data_needed)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; @@ -1365,6 +1464,17 @@ NTSTATUS ndr_pull_spoolss_5f(struct ndr_pull *ndr, struct spoolss_5f *r) return NT_STATUS_OK; } +void ndr_print_spoolss_PrinterEnum1(struct ndr_print *ndr, const char *name, struct spoolss_PrinterEnum1 *r) +{ + ndr_print_struct(ndr, name, "spoolss_PrinterEnum1"); + ndr->depth++; + ndr_print_uint32(ndr, "flags", r->flags); + ndr_print_relstr(ndr, "name", &r->name); + ndr_print_relstr(ndr, "description", &r->description); + ndr_print_relstr(ndr, "comment", &r->comment); + ndr->depth--; +} + void ndr_print_spoolss_Devmode(struct ndr_print *ndr, const char *name, struct spoolss_Devmode *r) { ndr_print_struct(ndr, name, "spoolss_Devmode"); diff --git a/source4/librpc/ndr/ndr_spoolss.h b/source4/librpc/ndr/ndr_spoolss.h index dcacef337a..c05f3d7494 100644 --- a/source4/librpc/ndr/ndr_spoolss.h +++ b/source4/librpc/ndr/ndr_spoolss.h @@ -1,17 +1,24 @@ /* header auto-generated by pidl */ +struct spoolss_PrinterEnum1 { + uint32 flags; + const char * name; + const char * description; + const char * comment; +}; + struct spoolss_EnumPrinters { struct { uint32 flags; const char *server; uint32 level; - struct uint8_buf *buffer; + uint8 *buf; uint32 offered; } in; struct { - struct uint8_buf *buffer; - uint32 needed; + union spoolss_PrinterEnum *info; + uint32 *needed; uint32 returned; NTSTATUS result; } out; @@ -48,11 +55,20 @@ struct spoolss_03 { }; -struct spoolss_04 { +struct spoolss_EnumJobs { struct { + struct policy_handle *handle; + uint32 firstjob; + uint32 numjobs; + uint32 level; + struct uint8_buf *buffer; + uint32 offered; } in; struct { + struct uint8_buf *buffer; + uint32 needed; + uint32 numjobs; NTSTATUS result; } out; @@ -88,11 +104,18 @@ struct spoolss_07 { }; -struct spoolss_08 { +struct spoolss_GetPrinter { struct { + struct policy_handle *handle; + uint32 level; + struct uint8_buf *buffer; + uint32 offered; } in; struct { + struct uint8_buf *buffer; + uint32 needed; + uint32 returned; NTSTATUS result; } out; @@ -188,8 +211,9 @@ struct spoolss_11 { }; -struct spoolss_12 { +struct spoolss_StartPagePrinter { struct { + struct policy_handle *handle; } in; struct { @@ -208,8 +232,9 @@ struct spoolss_13 { }; -struct spoolss_14 { +struct spoolss_EndPagePrinter { struct { + struct policy_handle *handle; } in; struct { @@ -238,7 +263,7 @@ struct spoolss_16 { }; -struct spoolss_17 { +struct spoolss_EndDocPrinter { struct { } in; @@ -760,11 +785,21 @@ struct spoolss_47 { }; -struct spoolss_48 { +struct spoolss_EnumPrinterData { struct { + struct policy_handle *handle; + uint32 enum_index; + uint32 value_offered; + uint32 data_offered; } in; struct { + uint32 value_len; + const char *value_name; + uint32 value_needed; + uint32 printerdata_type; + struct uint8_buf printerdata; + uint32 data_needed; NTSTATUS result; } out; @@ -1004,11 +1039,11 @@ struct spoolss_5f { #define DCERPC_SPOOLSS_01 1 #define DCERPC_SPOOLSS_02 2 #define DCERPC_SPOOLSS_03 3 -#define DCERPC_SPOOLSS_04 4 +#define DCERPC_SPOOLSS_ENUMJOBS 4 #define DCERPC_SPOOLSS_05 5 #define DCERPC_SPOOLSS_06 6 #define DCERPC_SPOOLSS_07 7 -#define DCERPC_SPOOLSS_08 8 +#define DCERPC_SPOOLSS_GETPRINTER 8 #define DCERPC_SPOOLSS_09 9 #define DCERPC_SPOOLSS_0A 10 #define DCERPC_SPOOLSS_0B 11 @@ -1018,12 +1053,12 @@ struct spoolss_5f { #define DCERPC_SPOOLSS_0F 15 #define DCERPC_SPOOLSS_10 16 #define DCERPC_SPOOLSS_11 17 -#define DCERPC_SPOOLSS_12 18 +#define DCERPC_SPOOLSS_STARTPAGEPRINTER 18 #define DCERPC_SPOOLSS_13 19 -#define DCERPC_SPOOLSS_14 20 +#define DCERPC_SPOOLSS_ENDPAGEPRINTER 20 #define DCERPC_SPOOLSS_15 21 #define DCERPC_SPOOLSS_16 22 -#define DCERPC_SPOOLSS_17 23 +#define DCERPC_SPOOLSS_ENDDOCPRINTER 23 #define DCERPC_SPOOLSS_18 24 #define DCERPC_SPOOLSS_19 25 #define DCERPC_SPOOLSS_1A 26 @@ -1072,7 +1107,7 @@ struct spoolss_5f { #define DCERPC_SPOOLSS_OPENPRINTEREX 69 #define DCERPC_SPOOLSS_46 70 #define DCERPC_SPOOLSS_47 71 -#define DCERPC_SPOOLSS_48 72 +#define DCERPC_SPOOLSS_ENUMPRINTERDATA 72 #define DCERPC_SPOOLSS_49 73 #define DCERPC_SPOOLSS_4A 74 #define DCERPC_SPOOLSS_4B 75 diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c new file mode 100644 index 0000000000..292de862cf --- /dev/null +++ b/source4/librpc/ndr/ndr_spoolss_buf.c @@ -0,0 +1,51 @@ +/* + Unix SMB/CIFS implementation. + + routines for marshalling/unmarshalling spoolss subcontext buffer structures + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) Tim Potter 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#include "includes.h" + +NTSTATUS ndr_pull_spoolss_PrinterEnum(struct ndr_pull *ndr, int ndr_flags, + uint16 *level, union spoolss_PrinterEnum *info) +{ + switch (*level) { + case 1: + NDR_CHECK(ndr_pull_spoolss_PrinterEnum1(ndr, NDR_SCALARS|NDR_BUFFERS, &info->info1)); + break; + default: + return NT_STATUS_INVALID_LEVEL; + } + return NT_STATUS_OK; +} + + +void ndr_print_spoolss_PrinterEnum(struct ndr_print *ndr, const char *name, uint16 level, + union spoolss_PrinterEnum *info) +{ + ndr_print_struct(ndr, name, "spoolss_PrinterEnum"); + + switch (level) { + case 1: + ndr_print_spoolss_PrinterEnum1(ndr, "info1", &info->info1); + break; + } +} diff --git a/source4/librpc/ndr/ndr_spoolss_buf.h b/source4/librpc/ndr/ndr_spoolss_buf.h new file mode 100644 index 0000000000..7c57fb81e6 --- /dev/null +++ b/source4/librpc/ndr/ndr_spoolss_buf.h @@ -0,0 +1,26 @@ +/* + Unix SMB/CIFS implementation. + + definitions for marshalling/unmarshalling spoolss buffer structures + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) Tim Potter 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +union spoolss_PrinterEnum { + /* [case(1)] */ struct spoolss_PrinterEnum1 info1; +}; diff --git a/source4/librpc/rpc/rpc_spoolss.c b/source4/librpc/rpc/rpc_spoolss.c index 45ee3726fd..f7613b82d1 100644 --- a/source4/librpc/rpc/rpc_spoolss.c +++ b/source4/librpc/rpc/rpc_spoolss.c @@ -59,12 +59,12 @@ NTSTATUS dcerpc_spoolss_03(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct sp return r->out.result; } -NTSTATUS dcerpc_spoolss_04(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_04 *r) +NTSTATUS dcerpc_spoolss_EnumJobs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_EnumJobs *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_04, mem_ctx, - (ndr_push_fn_t) ndr_push_spoolss_04, - (ndr_pull_fn_t) ndr_pull_spoolss_04, + status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_ENUMJOBS, mem_ctx, + (ndr_push_fn_t) ndr_push_spoolss_EnumJobs, + (ndr_pull_fn_t) ndr_pull_spoolss_EnumJobs, r); if (!NT_STATUS_IS_OK(status)) { return status; @@ -115,12 +115,12 @@ NTSTATUS dcerpc_spoolss_07(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct sp return r->out.result; } -NTSTATUS dcerpc_spoolss_08(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_08 *r) +NTSTATUS dcerpc_spoolss_GetPrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinter *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_08, mem_ctx, - (ndr_push_fn_t) ndr_push_spoolss_08, - (ndr_pull_fn_t) ndr_pull_spoolss_08, + status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_GETPRINTER, mem_ctx, + (ndr_push_fn_t) ndr_push_spoolss_GetPrinter, + (ndr_pull_fn_t) ndr_pull_spoolss_GetPrinter, r); if (!NT_STATUS_IS_OK(status)) { return status; @@ -255,12 +255,12 @@ NTSTATUS dcerpc_spoolss_11(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct sp return r->out.result; } -NTSTATUS dcerpc_spoolss_12(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_12 *r) +NTSTATUS dcerpc_spoolss_StartPagePrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_StartPagePrinter *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_12, mem_ctx, - (ndr_push_fn_t) ndr_push_spoolss_12, - (ndr_pull_fn_t) ndr_pull_spoolss_12, + status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_STARTPAGEPRINTER, mem_ctx, + (ndr_push_fn_t) ndr_push_spoolss_StartPagePrinter, + (ndr_pull_fn_t) ndr_pull_spoolss_StartPagePrinter, r); if (!NT_STATUS_IS_OK(status)) { return status; @@ -283,12 +283,12 @@ NTSTATUS dcerpc_spoolss_13(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct sp return r->out.result; } -NTSTATUS dcerpc_spoolss_14(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_14 *r) +NTSTATUS dcerpc_spoolss_EndPagePrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_EndPagePrinter *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_14, mem_ctx, - (ndr_push_fn_t) ndr_push_spoolss_14, - (ndr_pull_fn_t) ndr_pull_spoolss_14, + status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_ENDPAGEPRINTER, mem_ctx, + (ndr_push_fn_t) ndr_push_spoolss_EndPagePrinter, + (ndr_pull_fn_t) ndr_pull_spoolss_EndPagePrinter, r); if (!NT_STATUS_IS_OK(status)) { return status; @@ -325,12 +325,12 @@ NTSTATUS dcerpc_spoolss_16(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct sp return r->out.result; } -NTSTATUS dcerpc_spoolss_17(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_17 *r) +NTSTATUS dcerpc_spoolss_EndDocPrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_EndDocPrinter *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_17, mem_ctx, - (ndr_push_fn_t) ndr_push_spoolss_17, - (ndr_pull_fn_t) ndr_pull_spoolss_17, + status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_ENDDOCPRINTER, mem_ctx, + (ndr_push_fn_t) ndr_push_spoolss_EndDocPrinter, + (ndr_pull_fn_t) ndr_pull_spoolss_EndDocPrinter, r); if (!NT_STATUS_IS_OK(status)) { return status; @@ -1011,12 +1011,12 @@ NTSTATUS dcerpc_spoolss_47(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct sp return r->out.result; } -NTSTATUS dcerpc_spoolss_48(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_48 *r) +NTSTATUS dcerpc_spoolss_EnumPrinterData(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinterData *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_48, mem_ctx, - (ndr_push_fn_t) ndr_push_spoolss_48, - (ndr_pull_fn_t) ndr_pull_spoolss_48, + status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_ENUMPRINTERDATA, mem_ctx, + (ndr_push_fn_t) ndr_push_spoolss_EnumPrinterData, + (ndr_pull_fn_t) ndr_pull_spoolss_EnumPrinterData, r); if (!NT_STATUS_IS_OK(status)) { return status; diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index e83e63eea4..e0aa429ae7 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -25,34 +25,37 @@ static BOOL test_EnumPrinters(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct spoolss_EnumPrinters r; NTSTATUS status; + uint32 needed = 0; r.in.flags = 0x02; - r.in.server = "\\\\movingforward"; + r.in.server = ""; r.in.level = 1; - r.in.buffer = NULL; - r.in.offered = 0; + r.in.buf = NULL; + r.in.offered = needed; + r.out.needed = &needed; status = dcerpc_spoolss_EnumPrinters(p, mem_ctx, &r); - if (NT_STATUS_IS_ERR(status)) { - printf("OpenPrinter failed - %s\n", nt_errstr(status)); + printf("EnumPrinters failed - %s\n", nt_errstr(status)); return False; } if (NT_STATUS_V(status) == 0x0000007a) { - struct uint8_buf buffer; - - r.in.offered = r.out.needed; - buffer.size = r.out.needed; - buffer.data = talloc(mem_ctx, buffer.size); - memset(buffer.data, 0xfe, buffer.size); - r.in.buffer = &buffer; + r.in.buf = talloc(mem_ctx, needed); + if (!r.in.buf) { + return False; + } + memset(r.in.buf, 0xfe, needed); + r.in.offered = needed; status = dcerpc_spoolss_EnumPrinters(p, mem_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { - printf("OpenPrinter failed - %s\n", nt_errstr(status)); - return False; + printf("EnumPrinters failed - %s\n", nt_errstr(status)); + } + + if (r.out.info) { + NDR_PRINT_UNION_DEBUG(spoolss_PrinterEnum, r.in.level, r.out.info); } return True; |