The Samba-Bugzilla – Attachment 5473 Details for
Bug 6727
Printer issues on 3.4.x and 3.5.x
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 3.5
printerdata-v3-5-test.patch (text/plain), 114.54 KB, created by
Guenther Deschner
on 2010-03-09 05:53:03 UTC
(
hide
)
Description:
patch for 3.5
Filename:
MIME Type:
Creator:
Guenther Deschner
Created:
2010-03-09 05:53:03 UTC
Size:
114.54 KB
patch
obsolete
>From 7814a9175be9952f6e1226a6df11126614b7b11c Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Wed, 3 Mar 2010 18:22:57 +0100 >Subject: [PATCH 01/18] spoolss: rollback SetPrinterData{Ex} IDL. > >Guenther >(cherry picked from commit 0528515be44c40603827bb153ff0e2bac7b0f041) >--- > librpc/idl/spoolss.idl | 35 +++--------------- > librpc/ndr/ndr_spoolss_buf.c | 82 ------------------------------------------ > librpc/ndr/ndr_spoolss_buf.h | 2 - > 3 files changed, 6 insertions(+), 113 deletions(-) > >diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl >index 377ef5e..623a534 100644 >--- a/librpc/idl/spoolss.idl >+++ b/librpc/idl/spoolss.idl >@@ -1644,23 +1644,12 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") > > /******************/ > /* Function: 0x1b */ >- [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData( >+ WERROR spoolss_SetPrinterData( > [in,ref] policy_handle *handle, > [in] [string,charset(UTF16)] uint16 value_name[], > [in] winreg_Type type, >- [in] DATA_BLOB data, >- [in] uint32 _offered >- ); >- [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData( >- [in] winreg_Type type, >- [out,ref,switch_is(type)] spoolss_PrinterData *data >- ); >- [nopush] WERROR spoolss_SetPrinterData( >- [in,ref] policy_handle *handle, >- [in] [string,charset(UTF16)] uint16 value_name[], >- [in] winreg_Type type, >- [in,subcontext(4),switch_is(type)] spoolss_PrinterData data, >- [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered >+ [in,ref] [size_is(offered)] uint8 *data, >+ [in] uint32 offered > ); > > /******************/ >@@ -2545,25 +2534,13 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") > > /******************/ > /* Function: 0x4d */ >- [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterDataEx( >- [in,ref] policy_handle *handle, >- [in] [string,charset(UTF16)] uint16 key_name[], >- [in] [string,charset(UTF16)] uint16 value_name[], >- [in] winreg_Type type, >- [in] DATA_BLOB data, >- [in] uint32 _offered >- ); >- [noopnum,nopull,noprint,public] void __spoolss_SetPrinterDataEx( >- [in] winreg_Type type, >- [out,ref,switch_is(type)] spoolss_PrinterData *data >- ); >- [nopush] WERROR spoolss_SetPrinterDataEx( >+ WERROR spoolss_SetPrinterDataEx( > [in,ref] policy_handle *handle, > [in] [string,charset(UTF16)] uint16 key_name[], > [in] [string,charset(UTF16)] uint16 value_name[], > [in] winreg_Type type, >- [in,subcontext(4),switch_is(type)] spoolss_PrinterData data, >- [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered >+ [in,ref] [size_is(offered)] uint8 *data, >+ [in] uint32 offered > ); > > /******************/ >diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c >index 8d977c8..9f9580e 100644 >--- a/librpc/ndr/ndr_spoolss_buf.c >+++ b/librpc/ndr/ndr_spoolss_buf.c >@@ -658,46 +658,6 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag > } > > /* >- spoolss_SetPrinterData >-*/ >-enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r) >-{ >- struct _spoolss_SetPrinterData _r; >- if (flags & NDR_IN) { >- struct ndr_push *_ndr_data; >- struct __spoolss_SetPrinterData __r; >- DATA_BLOB _data_blob_data; >- >- _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience); >- NDR_ERR_HAVE_NO_MEMORY(_ndr_data); >- _ndr_data->flags= ndr->flags; >- >- __r.in.type = r->in.type; >- __r.out.data = discard_const_p(union spoolss_PrinterData, &r->in.data); >- NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r)); >- _data_blob_data = ndr_push_blob(_ndr_data); >- >- _r.in.handle = r->in.handle; >- _r.in.value_name= r->in.value_name; >- _r.in.type = r->in.type; >- _r.in.data = _data_blob_data; >- _r.in._offered = _data_blob_data.length; >- _r.out.result = r->out.result; >- NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r)); >- } >- if (flags & NDR_OUT) { >- _r.in.handle = r->in.handle; >- _r.in.value_name= r->in.value_name; >- _r.in.type = r->in.type; >- _r.in.data = data_blob(NULL,0), >- _r.in._offered = r->in._offered; >- _r.out.result = r->out.result; >- NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-/* > spoolss_GetPrinterDataEx > */ > enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r) >@@ -802,48 +762,6 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int fl > return NDR_ERR_SUCCESS; > } > >-/* >- spoolss_SetPrinterDataEx >-*/ >-enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r) >-{ >- struct _spoolss_SetPrinterDataEx _r; >- if (flags & NDR_IN) { >- struct ndr_push *_ndr_data; >- struct __spoolss_SetPrinterDataEx __r; >- DATA_BLOB _data_blob_data; >- >- _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience); >- NDR_ERR_HAVE_NO_MEMORY(_ndr_data); >- _ndr_data->flags= ndr->flags; >- >- __r.in.type = r->in.type; >- __r.out.data = discard_const_p(union spoolss_PrinterData, &r->in.data); >- NDR_CHECK(ndr_push___spoolss_SetPrinterDataEx(_ndr_data, NDR_OUT, &__r)); >- _data_blob_data = ndr_push_blob(_ndr_data); >- >- _r.in.handle = r->in.handle; >- _r.in.key_name = r->in.key_name; >- _r.in.value_name= r->in.value_name; >- _r.in.type = r->in.type; >- _r.in.data = _data_blob_data; >- _r.in._offered = _data_blob_data.length; >- _r.out.result = r->out.result; >- NDR_CHECK(ndr_push__spoolss_SetPrinterDataEx(ndr, flags, &_r)); >- } >- if (flags & NDR_OUT) { >- _r.in.handle = r->in.handle; >- _r.in.key_name = r->in.key_name; >- _r.in.value_name= r->in.value_name; >- _r.in.type = r->in.type; >- _r.in.data = data_blob(NULL,0), >- _r.in._offered = r->in._offered; >- _r.out.result = r->out.result; >- NDR_CHECK(ndr_push__spoolss_SetPrinterDataEx(ndr, flags, &_r)); >- } >- return NDR_ERR_SUCCESS; >-} >- > uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags) > { > if (!devmode) return 0; >diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h >index 948e910..fa22cdf 100644 >--- a/librpc/ndr/ndr_spoolss_buf.h >+++ b/librpc/ndr/ndr_spoolss_buf.h >@@ -44,10 +44,8 @@ uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb > uint32_t count, struct spoolss_PrinterEnumValues *info); > enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r); > enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r); > enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r); > enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r); > uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags); > size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags); > _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r); >-- >1.6.6.1 > > >From 51e57f8ad0480b7965062e2970d34e5044ce1db6 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 17:00:34 +0100 >Subject: [PATCH 02/18] s3-spoolss: fix _spoolss_SetPrinterData{Ex} after IDL change. > >Guenther >(cherry picked from commit 9a934832797c3e72859770719e05d19a5eefa14d) >--- > source3/rpc_server/srv_spoolss_nt.c | 13 +++---------- > 1 files changed, 3 insertions(+), 10 deletions(-) > >diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c >index 98de40b..e546a31 100644 >--- a/source3/rpc_server/srv_spoolss_nt.c >+++ b/source3/rpc_server/srv_spoolss_nt.c >@@ -7741,7 +7741,7 @@ WERROR _spoolss_SetPrinterData(pipes_struct *p, > r2.in.value_name = r->in.value_name; > r2.in.type = r->in.type; > r2.in.data = r->in.data; >- r2.in._offered = r->in._offered; >+ r2.in.offered = r->in.offered; > > return _spoolss_SetPrinterDataEx(p, &r2); > } >@@ -8674,7 +8674,6 @@ WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, > WERROR result = WERR_OK; > Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle); > char *oid_string; >- DATA_BLOB blob; > > DEBUG(4,("_spoolss_SetPrinterDataEx\n")); > >@@ -8724,12 +8723,6 @@ WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, > oid_string++; > } > >- result = push_spoolss_PrinterData(p->mem_ctx, &blob, >- r->in.type, &r->in.data); >- if (!W_ERROR_IS_OK(result)) { >- goto done; >- } >- > /* > * When client side code sets a magic printer data key, detect it and save > * the current printer data and the magic key's data (its the DEVMODE) for >@@ -8737,7 +8730,7 @@ WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, > */ > if ((r->in.type == REG_BINARY) && strequal(r->in.value_name, PHANTOM_DEVMODE_KEY)) { > /* Set devmode and printer initialization info */ >- result = save_driver_init(printer, 2, blob.data, blob.length); >+ result = save_driver_init(printer, 2, r->in.data, r->in.offered); > > srv_spoolss_reset_printerdata(printer->info_2->drivername); > >@@ -8747,7 +8740,7 @@ WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, > /* save the registry data */ > > result = set_printer_dataex(printer, r->in.key_name, r->in.value_name, >- r->in.type, blob.data, blob.length); >+ r->in.type, r->in.data, r->in.offered); > > if (W_ERROR_IS_OK(result)) { > /* save the OID if one was specified */ >-- >1.6.6.1 > > >From 012bc7f84a9ba8f9574fe5ab576c9d10f2953c46 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 15:34:22 +0100 >Subject: [PATCH 03/18] s3-net: fix net after spoolss_SetPrinterData{Ex} IDL change. > >Guenther >(cherry picked from commit 37ca9288d2631b48a8eb50c01d6c0cc462d8ee31) >--- > source3/utils/net_rpc_printer.c | 30 ++++++------------------------ > 1 files changed, 6 insertions(+), 24 deletions(-) > >diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c >index d1d38e8..2077083 100644 >--- a/source3/utils/net_rpc_printer.c >+++ b/source3/utils/net_rpc_printer.c >@@ -832,7 +832,8 @@ static bool net_spoolss_setprinterdata(struct rpc_pipe_client *pipe_hnd, > struct policy_handle *hnd, > const char *value_name, > enum winreg_Type type, >- union spoolss_PrinterData data) >+ uint8_t *data, >+ uint32_t offered) > { > WERROR result; > NTSTATUS status; >@@ -843,7 +844,7 @@ static bool net_spoolss_setprinterdata(struct rpc_pipe_client *pipe_hnd, > value_name, > type, > data, >- 0, /* autocalculated */ >+ offered, > &result); > > if (!W_ERROR_IS_OK(result)) { >@@ -910,15 +911,6 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd, > { > WERROR result; > NTSTATUS status; >- union spoolss_PrinterData data; >- DATA_BLOB blob; >- >- blob = data_blob_const(value->data_p, value->size); >- >- result = pull_spoolss_PrinterData(mem_ctx, &blob, &data, value->type); >- if (!W_ERROR_IS_OK(result)) { >- return false; >- } > > /* setprinterdataex call */ > status = rpccli_spoolss_SetPrinterDataEx(pipe_hnd, mem_ctx, >@@ -926,8 +918,8 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd, > keyname, > value->valuename, > value->type, >- data, >- 0, >+ value->data_p, >+ value->size, > &result); > > if (!W_ERROR_IS_OK(result)) { >@@ -2359,8 +2351,6 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c, > if (NT_STATUS_IS_OK(nt_status) && W_ERROR_IS_OK(result)) { > > struct regval_blob v; >- DATA_BLOB blob; >- union spoolss_PrinterData printer_data; > > /* display_value */ > if (c->opt_verbose) { >@@ -2371,18 +2361,10 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c, > display_reg_value(SPOOL_PRINTERDATA_KEY, v); > } > >- result = pull_spoolss_PrinterData(mem_ctx, >- &blob, >- &printer_data, >- type); >- if (!W_ERROR_IS_OK(result)) { >- goto done; >- } >- > /* set_value */ > if (!net_spoolss_setprinterdata(pipe_hnd_dst, mem_ctx, > &hnd_dst, value_name, >- type, printer_data)) >+ type, buffer, data_offered)) > goto done; > > DEBUGADD(1,("\tSetPrinterData of [%s] succeeded\n", >-- >1.6.6.1 > > >From d2d3892b57379668fc2366891e864454e3282396 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 15:34:49 +0100 >Subject: [PATCH 04/18] s3-rpcclient: fix rpcclient after spoolss_SetPrinterData{Ex} IDL change. > >Guenther >(cherry picked from commit 4956650369156dfff96ccc827e55697ec642240d) >--- > source3/rpcclient/cmd_spoolss.c | 10 ++++++++-- > 1 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c >index deecbc5..8b71521 100644 >--- a/source3/rpcclient/cmd_spoolss.c >+++ b/source3/rpcclient/cmd_spoolss.c >@@ -2368,6 +2368,7 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli, > union spoolss_PrinterInfo info; > enum winreg_Type type; > union spoolss_PrinterData data; >+ DATA_BLOB blob; > > /* parse the command arguments */ > if (argc < 5) { >@@ -2470,12 +2471,17 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli, > goto done; > } > >+ result = push_spoolss_PrinterData(mem_ctx, &blob, type, &data); >+ if (!W_ERROR_IS_OK(result)) { >+ goto done; >+ } >+ > status = rpccli_spoolss_SetPrinterData(cli, mem_ctx, > &pol, > argv[3], /* value_name */ > type, >- data, >- 0, /* autocalculated size */ >+ blob.data, >+ blob.length, > &result); > if (!W_ERROR_IS_OK(result)) { > printf ("Unable to set [%s=%s]!\n", argv[3], argv[4]); >-- >1.6.6.1 > > >From aa46dcbfb06a0d101419290019f3a384baef9efa Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 15:38:18 +0100 >Subject: [PATCH 05/18] spoolss: rollback GetPrinterData[Ex] IDL. > >Guenther >(cherry picked from commit 0e779b573bf5c27bf08ceefa09a7e2b07691f948) >--- > librpc/idl/spoolss.idl | 33 +------ > librpc/ndr/ndr_spoolss_buf.c | 205 ------------------------------------------ > librpc/ndr/ndr_spoolss_buf.h | 4 - > 3 files changed, 4 insertions(+), 238 deletions(-) > >diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl >index 623a534..73afc76 100644 >--- a/librpc/idl/spoolss.idl >+++ b/librpc/idl/spoolss.idl >@@ -1621,24 +1621,12 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") > const string SPOOL_REG_URL = "url"; > const string SPOOL_REG_VERSIONNUMBER = "versionNumber"; > >- [noopnum,noprint,public] WERROR _spoolss_GetPrinterData( >+ WERROR spoolss_GetPrinterData( > [in,ref] policy_handle *handle, > [in] [string,charset(UTF16)] uint16 value_name[], >- [in] uint32 offered, > [out,ref] winreg_Type *type, >- [out,ref] DATA_BLOB *data, >- [out,ref] uint32 *needed >- ); >- [noopnum,noprint,public] void __spoolss_GetPrinterData( >- [in] winreg_Type type, >- [out,ref,switch_is(type)] spoolss_PrinterData *data >- ); >- [nopull,nopush,public] WERROR spoolss_GetPrinterData( >- [in,ref] policy_handle *handle, >- [in] [string,charset(UTF16)] uint16 value_name[], >+ [out,ref,size_is(offered)] uint8 *data, > [in] uint32 offered, >- [out,ref] winreg_Type *type, >- [out,ref,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData *data, > [out,ref] uint32 *needed > ); > >@@ -2545,26 +2533,13 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") > > /******************/ > /* Function: 0x4e */ >- [noopnum,noprint,public] WERROR _spoolss_GetPrinterDataEx( >+ WERROR spoolss_GetPrinterDataEx( > [in,ref] policy_handle *handle, > [in] [string,charset(UTF16)] uint16 key_name[], > [in] [string,charset(UTF16)] uint16 value_name[], >- [in] uint32 offered, > [out,ref] winreg_Type *type, >- [out,ref] DATA_BLOB *data, >- [out,ref] uint32 *needed >- ); >- [noopnum,noprint,public] void __spoolss_GetPrinterDataEx( >- [in] winreg_Type type, >- [out,ref,switch_is(type)] spoolss_PrinterData *data >- ); >- [nopull,nopush,public] WERROR spoolss_GetPrinterDataEx( >- [in,ref] policy_handle *handle, >- [in] [string,charset(UTF16)] uint16 key_name[], >- [in] [string,charset(UTF16)] uint16 value_name[], >+ [out,ref,size_is(offered)] uint8 *data, > [in] uint32 offered, >- [out,ref] winreg_Type *type, >- [out,ref,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData *data, > [out,ref] uint32 *needed > ); > >diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c >index 9f9580e..5aa89e4 100644 >--- a/librpc/ndr/ndr_spoolss_buf.c >+++ b/librpc/ndr/ndr_spoolss_buf.c >@@ -557,211 +557,6 @@ uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb > NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx); > } > >-/* >- spoolss_GetPrinterData >-*/ >-enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r) >-{ >- struct _spoolss_GetPrinterData _r; >- if (flags & NDR_IN) { >- _r.in.handle = r->in.handle; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r)); >- } >- if (flags & NDR_OUT) { >- struct ndr_push *_ndr_info; >- DATA_BLOB blob = data_blob(NULL, 0); >- _r.in.handle = r->in.handle; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- _r.out.type = r->out.type; >- _r.out.data = &blob; >- _r.out.needed = r->out.needed; >- _r.out.result = r->out.result; >- { >- struct __spoolss_GetPrinterData __r; >- DATA_BLOB _blob; >- _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience); >- NDR_ERR_HAVE_NO_MEMORY(_ndr_info); >- _ndr_info->flags= ndr->flags; >- __r.in.type = *r->out.type; >- __r.out.data = r->out.data; >- NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, flags, &__r)); >- if (r->in.offered > _ndr_info->offset) { >- uint32_t _padding_len = r->in.offered - _ndr_info->offset; >- NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len)); >- } >- _blob = ndr_push_blob(_ndr_info); >- _r.out.data = &_blob; >- } >- NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r) >-{ >- struct _spoolss_GetPrinterData _r; >- if (flags & NDR_IN) { >- DATA_BLOB blob = data_blob(NULL,0); >- ZERO_STRUCT(r->out); >- >- _r.in.handle = r->in.handle; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- _r.out.type = r->out.type; >- _r.out.data = &blob; >- _r.out.needed = r->out.needed; >- NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r)); >- r->in.handle = _r.in.handle; >- r->in.value_name= _r.in.value_name; >- r->in.offered = _r.in.offered; >- r->out.needed = _r.out.needed; >- } >- if (flags & NDR_OUT) { >- DATA_BLOB blob = data_blob_talloc(ndr,NULL,0); >- _r.in.handle = r->in.handle; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- _r.out.type = r->out.type; >- _r.out.data = &blob; >- _r.out.needed = r->out.needed; >- _r.out.result = r->out.result; >- NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r)); >- r->out.type = _r.out.type; >- if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >- NDR_PULL_ALLOC(ndr, r->out.data); >- } >- ZERO_STRUCTP(r->out.data); >- r->out.needed = _r.out.needed; >- r->out.result = _r.out.result; >- if (_r.out.data && _r.out.data->length != r->in.offered) { >- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, >- "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]", >- (unsigned)r->in.offered, (unsigned)_r.out.data->length); >- } >- if (_r.out.data && _r.out.data->length > 0 && *r->out.needed <= _r.out.data->length) { >- struct __spoolss_GetPrinterData __r; >- struct ndr_pull *_ndr_data = ndr_pull_init_blob(_r.out.data, ndr, ndr->iconv_convenience); >- NDR_ERR_HAVE_NO_MEMORY(_ndr_data); >- _ndr_data->flags= ndr->flags; >- __r.in.type = *r->out.type; >- __r.out.data = r->out.data; >- NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r)); >- r->out.data = __r.out.data; >- } else { >- *r->out.type = REG_NONE; >- } >- } >- return NDR_ERR_SUCCESS; >-} >- >-/* >- spoolss_GetPrinterDataEx >-*/ >-enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r) >-{ >- struct _spoolss_GetPrinterDataEx _r; >- if (flags & NDR_IN) { >- _r.in.handle = r->in.handle; >- _r.in.key_name = r->in.key_name; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- NDR_CHECK(ndr_push__spoolss_GetPrinterDataEx(ndr, flags, &_r)); >- } >- if (flags & NDR_OUT) { >- struct ndr_push *_ndr_info; >- DATA_BLOB blob = data_blob(NULL, 0); >- _r.in.handle = r->in.handle; >- _r.in.key_name = r->in.key_name; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- _r.out.type = r->out.type; >- _r.out.data = &blob; >- _r.out.needed = r->out.needed; >- _r.out.result = r->out.result; >- { >- struct __spoolss_GetPrinterDataEx __r; >- DATA_BLOB _blob; >- _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience); >- NDR_ERR_HAVE_NO_MEMORY(_ndr_info); >- _ndr_info->flags= ndr->flags; >- __r.in.type = *r->out.type; >- __r.out.data = r->out.data; >- NDR_CHECK(ndr_push___spoolss_GetPrinterDataEx(_ndr_info, flags, &__r)); >- if (r->in.offered > _ndr_info->offset) { >- uint32_t _padding_len = r->in.offered - _ndr_info->offset; >- NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len)); >- } >- _blob = ndr_push_blob(_ndr_info); >- _r.out.data = &_blob; >- } >- NDR_CHECK(ndr_push__spoolss_GetPrinterDataEx(ndr, flags, &_r)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r) >-{ >- struct _spoolss_GetPrinterDataEx _r; >- if (flags & NDR_IN) { >- DATA_BLOB blob = data_blob(NULL,0); >- ZERO_STRUCT(r->out); >- >- _r.in.handle = r->in.handle; >- _r.in.key_name = r->in.key_name; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- _r.out.type = r->out.type; >- _r.out.data = &blob; >- _r.out.needed = r->out.needed; >- NDR_CHECK(ndr_pull__spoolss_GetPrinterDataEx(ndr, flags, &_r)); >- r->in.handle = _r.in.handle; >- r->in.key_name = _r.in.key_name; >- r->in.value_name= _r.in.value_name; >- r->in.offered = _r.in.offered; >- r->out.needed = _r.out.needed; >- } >- if (flags & NDR_OUT) { >- DATA_BLOB blob = data_blob_talloc(ndr,NULL,0); >- _r.in.handle = r->in.handle; >- _r.in.key_name = r->in.key_name; >- _r.in.value_name= r->in.value_name; >- _r.in.offered = r->in.offered; >- _r.out.type = r->out.type; >- _r.out.data = &blob; >- _r.out.needed = r->out.needed; >- _r.out.result = r->out.result; >- NDR_CHECK(ndr_pull__spoolss_GetPrinterDataEx(ndr, flags, &_r)); >- r->out.type = _r.out.type; >- if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >- NDR_PULL_ALLOC(ndr, r->out.data); >- } >- ZERO_STRUCTP(r->out.data); >- r->out.needed = _r.out.needed; >- r->out.result = _r.out.result; >- if (_r.out.data && _r.out.data->length != r->in.offered) { >- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, >- "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]", >- (unsigned)r->in.offered, (unsigned)_r.out.data->length); >- } >- if (_r.out.data && _r.out.data->length > 0 && *r->out.needed <= _r.out.data->length) { >- struct __spoolss_GetPrinterDataEx __r; >- struct ndr_pull *_ndr_data = ndr_pull_init_blob(_r.out.data, ndr, ndr->iconv_convenience); >- NDR_ERR_HAVE_NO_MEMORY(_ndr_data); >- _ndr_data->flags= ndr->flags; >- __r.in.type = *r->out.type; >- __r.out.data = r->out.data; >- NDR_CHECK(ndr_pull___spoolss_GetPrinterDataEx(_ndr_data, flags, &__r)); >- r->out.data = __r.out.data; >- } else { >- *r->out.type = REG_NONE; >- } >- } >- return NDR_ERR_SUCCESS; >-} >- > uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags) > { > if (!devmode) return 0; >diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h >index fa22cdf..2766abb 100644 >--- a/librpc/ndr/ndr_spoolss_buf.h >+++ b/librpc/ndr/ndr_spoolss_buf.h >@@ -42,10 +42,6 @@ enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int f > enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r); > uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, > uint32_t count, struct spoolss_PrinterEnumValues *info); >-enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r); > uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags); > size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags); > _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r); >-- >1.6.6.1 > > >From dfd0fb2a23691ccaa7a15ebbc7c6637cb950c760 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 15:39:59 +0100 >Subject: [PATCH 06/18] s3-spoolss: fix _spoolss_GetPrinterDataEx after IDL change. > >Guenther >(cherry picked from commit fbb6d00eed6bca960aa53a5967a2dea426cacfe2) >--- > source3/rpc_server/srv_spoolss_nt.c | 38 ++++++++++++++++++++++++---------- > 1 files changed, 27 insertions(+), 11 deletions(-) > >diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c >index e546a31..03b7504 100644 >--- a/source3/rpc_server/srv_spoolss_nt.c >+++ b/source3/rpc_server/srv_spoolss_nt.c >@@ -8589,11 +8589,29 @@ WERROR _spoolss_GetPrinterDataEx(pipes_struct *p, > > if (Printer->printer_type == SPLHND_SERVER) { > >+ union spoolss_PrinterData data; >+ > result = getprinterdata_printer_server(p->mem_ctx, > r->in.value_name, > r->out.type, >- r->out.data); >- goto done; >+ &data); >+ if (!W_ERROR_IS_OK(result)) { >+ goto done; >+ } >+ >+ result = push_spoolss_PrinterData(p->mem_ctx, &blob, >+ *r->out.type, &data); >+ if (!W_ERROR_IS_OK(result)) { >+ goto done; >+ } >+ >+ *r->out.needed = blob.length; >+ >+ if (r->in.offered >= *r->out.needed) { >+ memcpy(r->out.data, blob.data, blob.length); >+ } >+ >+ return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA); > } > > if (!get_printer_snum(p, r->in.handle, &snum, NULL)) { >@@ -8618,8 +8636,10 @@ WERROR _spoolss_GetPrinterDataEx(pipes_struct *p, > strequal(r->in.value_name, "ChangeId")) { > *r->out.type = REG_DWORD; > *r->out.needed = 4; >- r->out.data->value = printer->info_2->changeid; >- result = WERR_OK; >+ if (r->in.offered >= *r->out.needed) { >+ SIVAL(r->out.data, 0, printer->info_2->changeid); >+ result = WERR_OK; >+ } > goto done; > } > >@@ -8640,12 +8660,9 @@ WERROR _spoolss_GetPrinterDataEx(pipes_struct *p, > *r->out.needed = regval_size(val); > *r->out.type = regval_type(val); > >- blob = data_blob_const(regval_data_p(val), regval_size(val)); >- >- result = pull_spoolss_PrinterData(p->mem_ctx, &blob, >- r->out.data, >- *r->out.type); >- >+ if (r->in.offered >= *r->out.needed) { >+ memcpy(r->out.data, regval_data_p(val), regval_size(val)); >+ } > done: > if (printer) { > free_a_printer(&printer, 2); >@@ -8655,7 +8672,6 @@ WERROR _spoolss_GetPrinterDataEx(pipes_struct *p, > return result; > } > >- *r->out.needed = ndr_size_spoolss_PrinterData(r->out.data, *r->out.type, NULL, 0); > *r->out.type = SPOOLSS_BUFFER_OK(*r->out.type, REG_NONE); > r->out.data = SPOOLSS_BUFFER_OK(r->out.data, r->out.data); > >-- >1.6.6.1 > > >From 99a23f42153938c6a2d52fb61d65cbaf184c485b Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 15:46:28 +0100 >Subject: [PATCH 07/18] s3-rpcclient: fix rpcclient after spoolss_GetPrinterData{Ex} IDL change. > >Guenther >(cherry picked from commit 7643afa70e879efc059c75b8309bf89dbb3c459b) >--- > source3/include/proto.h | 3 +- > source3/rpc_client/cli_spoolss.c | 16 +++++++++-- > source3/rpcclient/cmd_spoolss.c | 54 ++++++++++++++++++++++++++----------- > 3 files changed, 53 insertions(+), 20 deletions(-) > >diff --git a/source3/include/proto.h b/source3/include/proto.h >index 26fbb44..65fd9a8 100644 >--- a/source3/include/proto.h >+++ b/source3/include/proto.h >@@ -5567,7 +5567,8 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, > const char *value_name, > uint32_t offered, > enum winreg_Type *type, >- union spoolss_PrinterData *data); >+ uint32_t *needed_p, >+ uint8_t **data_p); > WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, > TALLOC_CTX *mem_ctx, > struct policy_handle *handle, >diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c >index d0781a0..2ca313d 100644 >--- a/source3/rpc_client/cli_spoolss.c >+++ b/source3/rpc_client/cli_spoolss.c >@@ -765,34 +765,44 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, > const char *value_name, > uint32_t offered, > enum winreg_Type *type, >- union spoolss_PrinterData *data) >+ uint32_t *needed_p, >+ uint8_t **data_p) > { > NTSTATUS status; > WERROR werror; > uint32_t needed; >+ uint8_t *data; >+ >+ data = talloc_zero_array(mem_ctx, uint8_t, offered); >+ W_ERROR_HAVE_NO_MEMORY(data); > > status = rpccli_spoolss_GetPrinterData(cli, mem_ctx, > handle, > value_name, >- offered, > type, > data, >+ offered, > &needed, > &werror); > > if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) { > offered = needed; >+ data = talloc_zero_array(mem_ctx, uint8_t, offered); >+ W_ERROR_HAVE_NO_MEMORY(data); > > status = rpccli_spoolss_GetPrinterData(cli, mem_ctx, > handle, > value_name, >- offered, > type, > data, >+ offered, > &needed, > &werror); > } > >+ *data_p = data; >+ *needed_p = needed; >+ > return werror; > } > >diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c >index 8b71521..06bbbdf 100644 >--- a/source3/rpcclient/cmd_spoolss.c >+++ b/source3/rpcclient/cmd_spoolss.c >@@ -749,20 +749,29 @@ static void display_reg_value(struct regval_blob value) > > static void display_printer_data(const char *v, > enum winreg_Type type, >- union spoolss_PrinterData *r) >+ uint8_t *data, >+ uint32_t length) > { > int i; >+ union spoolss_PrinterData r; >+ DATA_BLOB blob = data_blob_const(data, length); >+ WERROR result; >+ >+ result = pull_spoolss_PrinterData(talloc_tos(), &blob, &r, type); >+ if (!W_ERROR_IS_OK(result)) { >+ return; >+ } > > switch (type) { > case REG_DWORD: >- printf("%s: REG_DWORD: 0x%08x\n", v, r->value); >+ printf("%s: REG_DWORD: 0x%08x\n", v, r.value); > break; > case REG_SZ: >- printf("%s: REG_SZ: %s\n", v, r->string); >+ printf("%s: REG_SZ: %s\n", v, r.string); > break; > case REG_BINARY: { > char *hex = hex_encode_talloc(NULL, >- r->binary.data, r->binary.length); >+ r.binary.data, r.binary.length); > size_t len; > printf("%s: REG_BINARY:", v); > len = strlen(hex); >@@ -781,8 +790,8 @@ static void display_printer_data(const char *v, > } > case REG_MULTI_SZ: > printf("%s: REG_MULTI_SZ: ", v); >- for (i=0; r->string_array[i] != NULL; i++) { >- printf("%s ", r->string_array[i]); >+ for (i=0; r.string_array[i] != NULL; i++) { >+ printf("%s ", r.string_array[i]); > } > printf("\n"); > break; >@@ -804,7 +813,8 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli, > fstring printername; > const char *valuename; > enum winreg_Type type; >- union spoolss_PrinterData data; >+ uint8_t *data; >+ uint32_t needed; > > if (argc != 3) { > printf("Usage: %s <printername> <valuename>\n", argv[0]); >@@ -837,13 +847,14 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli, > valuename, > 0, > &type, >+ &needed, > &data); > if (!W_ERROR_IS_OK(result)) > goto done; > > /* Display printer data */ > >- display_printer_data(valuename, type, &data); >+ display_printer_data(valuename, type, data, needed); > > done: > if (is_valid_policy_hnd(&pol)) >@@ -866,7 +877,7 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, > const char *valuename, *keyname; > > enum winreg_Type type; >- union spoolss_PrinterData data; >+ uint8_t *data = NULL; > uint32_t offered = 0; > uint32_t needed; > >@@ -898,24 +909,33 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, > > /* Get printer info */ > >+ data = talloc_zero_array(mem_ctx, uint8_t, offered); >+ if (!data) { >+ goto done; >+ } >+ > status = rpccli_spoolss_GetPrinterDataEx(cli, mem_ctx, > &pol, > keyname, > valuename, >- offered, > &type, >- &data, >+ data, >+ offered, > &needed, > &result); > if (W_ERROR_EQUAL(result, WERR_MORE_DATA)) { > offered = needed; >+ data = talloc_zero_array(mem_ctx, uint8_t, offered); >+ if (!data) { >+ goto done; >+ } > status = rpccli_spoolss_GetPrinterDataEx(cli, mem_ctx, > &pol, > keyname, > valuename, >- offered, > &type, >- &data, >+ data, >+ offered, > &needed, > &result); > } >@@ -929,7 +949,7 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, > > /* Display printer data */ > >- display_printer_data(valuename, type, &data); >+ display_printer_data(valuename, type, data, needed); > > > done: >@@ -2850,7 +2870,9 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli, > const char **argv) > { > WERROR result; >+#if 0 > uint32_t i; >+#endif > const char *printername; > struct policy_handle hnd; > uint32_t count; >@@ -2884,13 +2906,13 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli, > if (!W_ERROR_IS_OK(result)) { > goto done; > } >- >+#if 0 > for (i=0; i < count; i++) { > display_printer_data(info[i].value_name, > info[i].type, > info[i].data); > } >- >+#endif > done: > if (is_valid_policy_hnd(&hnd)) { > rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL); >-- >1.6.6.1 > > >From f40598d23a5e668cc44bd73315e1d3be4fa096bb Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 16:40:31 +0100 >Subject: [PATCH 08/18] spoolss: fix spoolss_EnumPrinterDataEx IDL. > >Guenther >(cherry picked from commit 4df1047e8398a9af4df94c7e245d993d1f60ef5f) >--- > librpc/idl/spoolss.idl | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl >index 73afc76..bfaca4a 100644 >--- a/librpc/idl/spoolss.idl >+++ b/librpc/idl/spoolss.idl >@@ -2550,8 +2550,8 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") > [relative] nstring *value_name; > [value(2*strlen_m_term(value_name))] uint32 value_name_len; > winreg_Type type; >- [relative,switch_is(type),subcontext(0),subcontext_size(r->data_length)] spoolss_PrinterData *data; >- [value(ndr_size_spoolss_PrinterData(data, type, ndr->iconv_convenience, ndr->flags))] uint32 data_length; >+ [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING)] DATA_BLOB *data; >+ [value(data->length)] uint32 data_length; > } spoolss_PrinterEnumValues; > > [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDataEx( >-- >1.6.6.1 > > >From e67578858f7c91f310c5067ce9c29a7e1d470b12 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 16:46:53 +0100 >Subject: [PATCH 09/18] s3-net: fix net after spoolss_EnumPrinterDataEx IDL change. > >Guenther >(cherry picked from commit a99ac4f236d9a93d4ca8bd874cbab89b155c644a) >--- > source3/utils/net_rpc_printer.c | 11 ++--------- > 1 files changed, 2 insertions(+), 9 deletions(-) > >diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c >index 2077083..6c11a2f 100644 >--- a/source3/utils/net_rpc_printer.c >+++ b/source3/utils/net_rpc_printer.c >@@ -2483,17 +2483,10 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c, > > struct regval_blob v; > >- result = push_spoolss_PrinterData(mem_ctx, &blob, >- info[j].type, >- info[j].data); >- if (!W_ERROR_IS_OK(result)) { >- goto done; >- } >- > fstrcpy(v.valuename, info[j].value_name); > v.type = info[j].type; >- v.data_p = blob.data; >- v.size = blob.length; >+ v.data_p = info[j].data->data; >+ v.size = info[j].data->length; > > if (c->opt_verbose) { > display_reg_value(subkey, v); >-- >1.6.6.1 > > >From 3ee6b7ae6f61a31ad1632ec129a7f4cf18a2a609 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 16:47:10 +0100 >Subject: [PATCH 10/18] s3-rpcclient: fix rpcclient after spoolss_EnumPrinterDataEx IDL change. > >Guenther >(cherry picked from commit becbb624eb90b84ff20b128de1aee5f5acfc3dbc) >--- > source3/rpcclient/cmd_spoolss.c | 9 ++++----- > 1 files changed, 4 insertions(+), 5 deletions(-) > >diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c >index 06bbbdf..b88ff10 100644 >--- a/source3/rpcclient/cmd_spoolss.c >+++ b/source3/rpcclient/cmd_spoolss.c >@@ -2870,9 +2870,7 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli, > const char **argv) > { > WERROR result; >-#if 0 > uint32_t i; >-#endif > const char *printername; > struct policy_handle hnd; > uint32_t count; >@@ -2906,13 +2904,14 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli, > if (!W_ERROR_IS_OK(result)) { > goto done; > } >-#if 0 >+ > for (i=0; i < count; i++) { > display_printer_data(info[i].value_name, > info[i].type, >- info[i].data); >+ info[i].data->data, >+ info[i].data->length); > } >-#endif >+ > done: > if (is_valid_policy_hnd(&hnd)) { > rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL); >-- >1.6.6.1 > > >From 1230b9878c2255ea36ec8984e0bd1513bbbf2dfe Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 16:47:33 +0100 >Subject: [PATCH 11/18] s3-spoolss: fix _spoolss_EnumPrinterDataEx after idl > >Guenther >(cherry picked from commit 55326549852a3ab1114a8cb1536578ae02183eb8) >--- > source3/rpc_server/srv_spoolss_nt.c | 13 ++----------- > 1 files changed, 2 insertions(+), 11 deletions(-) > >diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c >index 03b7504..b6a0616 100644 >--- a/source3/rpc_server/srv_spoolss_nt.c >+++ b/source3/rpc_server/srv_spoolss_nt.c >@@ -8994,9 +8994,7 @@ static WERROR registry_value_to_printer_enum_value(TALLOC_CTX *mem_ctx, > struct regval_blob *v, > struct spoolss_PrinterEnumValues *r) > { >- WERROR result; >- >- r->data = TALLOC_ZERO_P(mem_ctx, union spoolss_PrinterData); >+ r->data = TALLOC_ZERO_P(mem_ctx, DATA_BLOB); > W_ERROR_HAVE_NO_MEMORY(r->data); > > r->value_name = talloc_strdup(mem_ctx, regval_name(v)); >@@ -9006,14 +9004,7 @@ static WERROR registry_value_to_printer_enum_value(TALLOC_CTX *mem_ctx, > r->data_length = regval_size(v); > > if (r->data_length) { >- DATA_BLOB blob = data_blob_const(regval_data_p(v), >- regval_size(v)); >- result = pull_spoolss_PrinterData(mem_ctx, &blob, >- r->data, >- r->type); >- if (!W_ERROR_IS_OK(result)) { >- return result; >- } >+ *r->data = data_blob_talloc(r->data, regval_data_p(v), regval_size(v)); > } > > return WERR_OK; >-- >1.6.6.1 > > >From 08f2754ca31d100dd6b71db461bebb0a96310f4f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 17:58:49 +0100 >Subject: [PATCH 12/18] s3-libads: fix get_remote_printer_publishing_data after spoolss_EnumPrinterDataEx IDL change. > >Guenther >(cherry picked from commit 8e6dd25391d77b69859a3b622a1b116fa8000a40) >--- > source3/libads/ldap_printer.c | 40 ++++++++++++++-------------------------- > 1 files changed, 14 insertions(+), 26 deletions(-) > >diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c >index b5a3e6b..d5290b2 100644 >--- a/source3/libads/ldap_printer.c >+++ b/source3/libads/ldap_printer.c >@@ -346,19 +346,13 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli, > /* Have the data we need now, so start building */ > for (i=0; i < count; i++) { > struct regval_blob v; >- DATA_BLOB blob; >- >- result = push_spoolss_PrinterData(mem_ctx, &blob, >- info[i].type, >- info[i].data); >- if (W_ERROR_IS_OK(result)) { >- fstrcpy(v.valuename, info[i].value_name); >- v.type = info[i].type; >- v.data_p = blob.data; >- v.size = blob.length; >- >- map_regval_to_ads(mem_ctx, mods, &v); >- } >+ >+ fstrcpy(v.valuename, info[i].value_name); >+ v.type = info[i].type; >+ v.data_p = info[i].data->data; >+ v.size = info[i].data->length; >+ >+ map_regval_to_ads(mem_ctx, mods, &v); > } > } > >@@ -373,19 +367,13 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli, > } else { > for (i=0; i < count; i++) { > struct regval_blob v; >- DATA_BLOB blob = data_blob_null; >- >- result = push_spoolss_PrinterData(mem_ctx, &blob, >- info[i].type, >- info[i].data); >- if (W_ERROR_IS_OK(result)) { >- fstrcpy(v.valuename, info[i].value_name); >- v.type = info[i].type; >- v.data_p = blob.data; >- v.size = blob.length; >- >- map_regval_to_ads(mem_ctx, mods, &v); >- } >+ >+ fstrcpy(v.valuename, info[i].value_name); >+ v.type = info[i].type; >+ v.data_p = info[i].data->data; >+ v.size = info[i].data->length; >+ >+ map_regval_to_ads(mem_ctx, mods, &v); > } > } > >-- >1.6.6.1 > > >From 1f0bd729cd21bc1763417aab2749c4035388132f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 5 Mar 2010 17:17:49 +0100 >Subject: [PATCH 13/18] s3: re-run make samba3-idl. > >Guenther >--- > librpc/gen_ndr/cli_spoolss.c | 48 ++++---- > librpc/gen_ndr/cli_spoolss.h | 32 +++--- > librpc/gen_ndr/ndr_spoolss.c | 305 ++++++++++++++++-------------------------- > librpc/gen_ndr/ndr_spoolss.h | 30 ---- > librpc/gen_ndr/spoolss.h | 130 +----------------- > librpc/gen_ndr/srv_spoolss.c | 8 +- > 6 files changed, 166 insertions(+), 387 deletions(-) > >diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c >index c6bb8ed..c674f94 100644 >--- a/librpc/gen_ndr/cli_spoolss.c >+++ b/librpc/gen_ndr/cli_spoolss.c >@@ -4152,9 +4152,9 @@ struct tevent_req *rpccli_spoolss_GetPrinterData_send(TALLOC_CTX *mem_ctx, > struct rpc_pipe_client *cli, > struct policy_handle *_handle /* [in] [ref] */, > const char *_value_name /* [in] [charset(UTF16)] */, >- uint32_t _offered /* [in] */, > enum winreg_Type *_type /* [out] [ref] */, >- union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *_data /* [out] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */, > uint32_t *_needed /* [out] [ref] */) > { > struct tevent_req *req; >@@ -4226,7 +4226,7 @@ static void rpccli_spoolss_GetPrinterData_done(struct tevent_req *subreq) > > /* Copy out parameters */ > *state->orig.out.type = *state->tmp.out.type; >- *state->orig.out.data = *state->tmp.out.data; >+ memcpy(state->orig.out.data, state->tmp.out.data, (state->tmp.in.offered) * sizeof(*state->orig.out.data)); > *state->orig.out.needed = *state->tmp.out.needed; > > /* Copy result */ >@@ -4265,9 +4265,9 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, > TALLOC_CTX *mem_ctx, > struct policy_handle *handle /* [in] [ref] */, > const char *value_name /* [in] [charset(UTF16)] */, >- uint32_t offered /* [in] */, > enum winreg_Type *type /* [out] [ref] */, >- union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *data /* [out] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > uint32_t *needed /* [out] [ref] */, > WERROR *werror) > { >@@ -4295,7 +4295,7 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, > > /* Return variables */ > *type = *r.out.type; >- *data = *r.out.data; >+ memcpy(data, r.out.data, (r.in.offered) * sizeof(*data)); > *needed = *r.out.needed; > > /* Return result */ >@@ -4321,8 +4321,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx, > struct policy_handle *_handle /* [in] [ref] */, > const char *_value_name /* [in] [charset(UTF16)] */, > enum winreg_Type _type /* [in] */, >- union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */) >+ uint8_t *_data /* [in] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */) > { > struct tevent_req *req; > struct rpccli_spoolss_SetPrinterData_state *state; >@@ -4341,7 +4341,7 @@ struct tevent_req *rpccli_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx, > state->orig.in.value_name = _value_name; > state->orig.in.type = _type; > state->orig.in.data = _data; >- state->orig.in._offered = __offered; >+ state->orig.in.offered = _offered; > > /* Out parameters */ > >@@ -4423,8 +4423,8 @@ NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli, > struct policy_handle *handle /* [in] [ref] */, > const char *value_name /* [in] [charset(UTF16)] */, > enum winreg_Type type /* [in] */, >- union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */, >+ uint8_t *data /* [in] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > WERROR *werror) > { > struct spoolss_SetPrinterData r; >@@ -4435,7 +4435,7 @@ NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli, > r.in.value_name = value_name; > r.in.type = type; > r.in.data = data; >- r.in._offered = _offered; >+ r.in.offered = offered; > > status = cli->dispatch(cli, > mem_ctx, >@@ -11710,8 +11710,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx, > const char *_key_name /* [in] [charset(UTF16)] */, > const char *_value_name /* [in] [charset(UTF16)] */, > enum winreg_Type _type /* [in] */, >- union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */) >+ uint8_t *_data /* [in] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */) > { > struct tevent_req *req; > struct rpccli_spoolss_SetPrinterDataEx_state *state; >@@ -11731,7 +11731,7 @@ struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx, > state->orig.in.value_name = _value_name; > state->orig.in.type = _type; > state->orig.in.data = _data; >- state->orig.in._offered = __offered; >+ state->orig.in.offered = _offered; > > /* Out parameters */ > >@@ -11814,8 +11814,8 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli, > const char *key_name /* [in] [charset(UTF16)] */, > const char *value_name /* [in] [charset(UTF16)] */, > enum winreg_Type type /* [in] */, >- union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */, >+ uint8_t *data /* [in] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > WERROR *werror) > { > struct spoolss_SetPrinterDataEx r; >@@ -11827,7 +11827,7 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli, > r.in.value_name = value_name; > r.in.type = type; > r.in.data = data; >- r.in._offered = _offered; >+ r.in.offered = offered; > > status = cli->dispatch(cli, > mem_ctx, >@@ -11868,9 +11868,9 @@ struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, > struct policy_handle *_handle /* [in] [ref] */, > const char *_key_name /* [in] [charset(UTF16)] */, > const char *_value_name /* [in] [charset(UTF16)] */, >- uint32_t _offered /* [in] */, > enum winreg_Type *_type /* [out] [ref] */, >- union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *_data /* [out] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */, > uint32_t *_needed /* [out] [ref] */) > { > struct tevent_req *req; >@@ -11943,7 +11943,7 @@ static void rpccli_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq) > > /* Copy out parameters */ > *state->orig.out.type = *state->tmp.out.type; >- *state->orig.out.data = *state->tmp.out.data; >+ memcpy(state->orig.out.data, state->tmp.out.data, (state->tmp.in.offered) * sizeof(*state->orig.out.data)); > *state->orig.out.needed = *state->tmp.out.needed; > > /* Copy result */ >@@ -11983,9 +11983,9 @@ NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli, > struct policy_handle *handle /* [in] [ref] */, > const char *key_name /* [in] [charset(UTF16)] */, > const char *value_name /* [in] [charset(UTF16)] */, >- uint32_t offered /* [in] */, > enum winreg_Type *type /* [out] [ref] */, >- union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *data /* [out] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > uint32_t *needed /* [out] [ref] */, > WERROR *werror) > { >@@ -12014,7 +12014,7 @@ NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli, > > /* Return variables */ > *type = *r.out.type; >- *data = *r.out.data; >+ memcpy(data, r.out.data, (r.in.offered) * sizeof(*data)); > *needed = *r.out.needed; > > /* Return result */ >diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h >index cae24be..f5e554d 100644 >--- a/librpc/gen_ndr/cli_spoolss.h >+++ b/librpc/gen_ndr/cli_spoolss.h >@@ -478,9 +478,9 @@ struct tevent_req *rpccli_spoolss_GetPrinterData_send(TALLOC_CTX *mem_ctx, > struct rpc_pipe_client *cli, > struct policy_handle *_handle /* [in] [ref] */, > const char *_value_name /* [in] [charset(UTF16)] */, >- uint32_t _offered /* [in] */, > enum winreg_Type *_type /* [out] [ref] */, >- union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *_data /* [out] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */, > uint32_t *_needed /* [out] [ref] */); > NTSTATUS rpccli_spoolss_GetPrinterData_recv(struct tevent_req *req, > TALLOC_CTX *mem_ctx, >@@ -489,9 +489,9 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, > TALLOC_CTX *mem_ctx, > struct policy_handle *handle /* [in] [ref] */, > const char *value_name /* [in] [charset(UTF16)] */, >- uint32_t offered /* [in] */, > enum winreg_Type *type /* [out] [ref] */, >- union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *data /* [out] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > uint32_t *needed /* [out] [ref] */, > WERROR *werror); > struct tevent_req *rpccli_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx, >@@ -500,8 +500,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx, > struct policy_handle *_handle /* [in] [ref] */, > const char *_value_name /* [in] [charset(UTF16)] */, > enum winreg_Type _type /* [in] */, >- union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */); >+ uint8_t *_data /* [in] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */); > NTSTATUS rpccli_spoolss_SetPrinterData_recv(struct tevent_req *req, > TALLOC_CTX *mem_ctx, > WERROR *result); >@@ -510,8 +510,8 @@ NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli, > struct policy_handle *handle /* [in] [ref] */, > const char *value_name /* [in] [charset(UTF16)] */, > enum winreg_Type type /* [in] */, >- union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */, >+ uint8_t *data /* [in] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > WERROR *werror); > struct tevent_req *rpccli_spoolss_WaitForPrinterChange_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, >@@ -1199,8 +1199,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx, > const char *_key_name /* [in] [charset(UTF16)] */, > const char *_value_name /* [in] [charset(UTF16)] */, > enum winreg_Type _type /* [in] */, >- union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */); >+ uint8_t *_data /* [in] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */); > NTSTATUS rpccli_spoolss_SetPrinterDataEx_recv(struct tevent_req *req, > TALLOC_CTX *mem_ctx, > WERROR *result); >@@ -1210,8 +1210,8 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli, > const char *key_name /* [in] [charset(UTF16)] */, > const char *value_name /* [in] [charset(UTF16)] */, > enum winreg_Type type /* [in] */, >- union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */, >- uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */, >+ uint8_t *data /* [in] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > WERROR *werror); > struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, >@@ -1219,9 +1219,9 @@ struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, > struct policy_handle *_handle /* [in] [ref] */, > const char *_key_name /* [in] [charset(UTF16)] */, > const char *_value_name /* [in] [charset(UTF16)] */, >- uint32_t _offered /* [in] */, > enum winreg_Type *_type /* [out] [ref] */, >- union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *_data /* [out] [ref,size_is(offered)] */, >+ uint32_t _offered /* [in] */, > uint32_t *_needed /* [out] [ref] */); > NTSTATUS rpccli_spoolss_GetPrinterDataEx_recv(struct tevent_req *req, > TALLOC_CTX *mem_ctx, >@@ -1231,9 +1231,9 @@ NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli, > struct policy_handle *handle /* [in] [ref] */, > const char *key_name /* [in] [charset(UTF16)] */, > const char *value_name /* [in] [charset(UTF16)] */, >- uint32_t offered /* [in] */, > enum winreg_Type *type /* [out] [ref] */, >- union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, >+ uint8_t *data /* [out] [ref,size_is(offered)] */, >+ uint32_t offered /* [in] */, > uint32_t *needed /* [out] [ref] */, > WERROR *werror); > struct tevent_req *rpccli_spoolss_EnumPrinterDataEx_send(TALLOC_CTX *mem_ctx, >diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c >index fe74901..af555d7 100644 >--- a/librpc/gen_ndr/ndr_spoolss.c >+++ b/librpc/gen_ndr/ndr_spoolss.c >@@ -19532,8 +19532,13 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterEnumValues(struct ndr_push *n > } > NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2 * strlen_m_term(r->value_name))); > NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->type)); >- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->data)); >- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_spoolss_PrinterData(r->data, r->type, ndr->iconv_convenience, ndr->flags))); >+ { >+ uint32_t _flags_save_DATA_BLOB = ndr->flags; >+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); >+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->data)); >+ ndr->flags = _flags_save_DATA_BLOB; >+ } >+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data->length)); > NDR_CHECK(ndr_push_trailer_align(ndr, 5)); > } > if (ndr_flags & NDR_BUFFERS) { >@@ -19548,16 +19553,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterEnumValues(struct ndr_push *n > } > ndr->flags = _flags_save_string; > } >- if (r->data) { >- NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->data)); >- { >- struct ndr_push *_ndr_data; >- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_data, 0, r->data_length)); >- NDR_CHECK(ndr_push_set_switch_value(_ndr_data, r->data, r->type)); >- NDR_CHECK(ndr_push_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, r->data)); >- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_data, 0, r->data_length)); >+ { >+ uint32_t _flags_save_DATA_BLOB = ndr->flags; >+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); >+ if (r->data) { >+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->data)); >+ { >+ struct ndr_push *_ndr_data; >+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_data, 0, r->data->length)); >+ NDR_CHECK(ndr_push_DATA_BLOB(_ndr_data, NDR_SCALARS, *r->data)); >+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_data, 0, r->data->length)); >+ } >+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->data)); > } >- NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->data)); >+ ndr->flags = _flags_save_DATA_BLOB; > } > } > ndr_push_restore_relative_base_offset(ndr, _save_relative_base_offset); >@@ -19588,12 +19597,17 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterEnumValues(struct ndr_pull *n > } > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->value_name_len)); > NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->type)); >- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); >- if (_ptr_data) { >- NDR_PULL_ALLOC(ndr, r->data); >- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->data, _ptr_data)); >- } else { >- r->data = NULL; >+ { >+ uint32_t _flags_save_DATA_BLOB = ndr->flags; >+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); >+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); >+ if (_ptr_data) { >+ NDR_PULL_ALLOC(ndr, r->data); >+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->data, _ptr_data)); >+ } else { >+ r->data = NULL; >+ } >+ ndr->flags = _flags_save_DATA_BLOB; > } > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_length)); > NDR_CHECK(ndr_pull_trailer_align(ndr, 5)); >@@ -19615,21 +19629,25 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterEnumValues(struct ndr_pull *n > } > ndr->flags = _flags_save_string; > } >- if (r->data) { >- uint32_t _relative_save_offset; >- _relative_save_offset = ndr->offset; >- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->data)); >- _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); >- NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); >- { >- struct ndr_pull *_ndr_data; >- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 0, r->data_length)); >- NDR_CHECK(ndr_pull_set_switch_value(_ndr_data, r->data, r->type)); >- NDR_CHECK(ndr_pull_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, r->data)); >- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_data, 0, r->data_length)); >+ { >+ uint32_t _flags_save_DATA_BLOB = ndr->flags; >+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); >+ if (r->data) { >+ uint32_t _relative_save_offset; >+ _relative_save_offset = ndr->offset; >+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->data)); >+ _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); >+ NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); >+ { >+ struct ndr_pull *_ndr_data; >+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 0, r->data_length)); >+ NDR_CHECK(ndr_pull_DATA_BLOB(_ndr_data, NDR_SCALARS, r->data)); >+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_data, 0, r->data_length)); >+ } >+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); >+ ndr->offset = _relative_save_offset; > } >- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); >- ndr->offset = _relative_save_offset; >+ ndr->flags = _flags_save_DATA_BLOB; > } > } > ndr_pull_restore_relative_base_offset(ndr, _save_relative_base_offset); >@@ -19651,11 +19669,10 @@ _PUBLIC_ void ndr_print_spoolss_PrinterEnumValues(struct ndr_print *ndr, const c > ndr_print_ptr(ndr, "data", r->data); > ndr->depth++; > if (r->data) { >- ndr_print_set_switch_value(ndr, r->data, r->type); >- ndr_print_spoolss_PrinterData(ndr, "data", r->data); >+ ndr_print_DATA_BLOB(ndr, "data", *r->data); > } > ndr->depth--; >- ndr_print_uint32(ndr, "data_length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_spoolss_PrinterData(r->data, r->type, ndr->iconv_convenience, ndr->flags):r->data_length); >+ ndr_print_uint32(ndr, "data_length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->data->length:r->data_length); > ndr->depth--; > } > >@@ -23405,7 +23422,7 @@ _PUBLIC_ void ndr_print_spoolss_ScheduleJob(struct ndr_print *ndr, const char *n > ndr->depth--; > } > >-_PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct _spoolss_GetPrinterData *r) >+static enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r) > { > if (flags & NDR_IN) { > if (r->in.handle == NULL) { >@@ -23426,7 +23443,8 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr > if (r->out.data == NULL) { > return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); > } >- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, *r->out.data)); >+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->in.offered)); >+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, r->in.offered)); > if (r->out.needed == NULL) { > return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); > } >@@ -23436,11 +23454,10 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr > return NDR_ERR_SUCCESS; > } > >-_PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct _spoolss_GetPrinterData *r) >+static enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r) > { > TALLOC_CTX *_mem_save_handle_0; > TALLOC_CTX *_mem_save_type_0; >- TALLOC_CTX *_mem_save_data_0; > TALLOC_CTX *_mem_save_needed_0; > if (flags & NDR_IN) { > ZERO_STRUCT(r->out); >@@ -23462,8 +23479,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); > NDR_PULL_ALLOC(ndr, r->out.type); > ZERO_STRUCTP(r->out.type); >- NDR_PULL_ALLOC(ndr, r->out.data); >- ZERO_STRUCTP(r->out.data); >+ NDR_PULL_ALLOC_N(ndr, r->out.data, r->in.offered); >+ memset(r->out.data, 0, (r->in.offered) * sizeof(*r->out.data)); > NDR_PULL_ALLOC(ndr, r->out.needed); > ZERO_STRUCTP(r->out.needed); > } >@@ -23475,13 +23492,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr > NDR_PULL_SET_MEM_CTX(ndr, r->out.type, LIBNDR_FLAG_REF_ALLOC); > NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); > NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, LIBNDR_FLAG_REF_ALLOC); >+ NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); > if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >- NDR_PULL_ALLOC(ndr, r->out.data); >+ NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data)); > } >- _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); >- NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); >- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, r->out.data)); >- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); >+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_size(ndr, &r->out.data))); > if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { > NDR_PULL_ALLOC(ndr, r->out.needed); > } >@@ -23490,44 +23505,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.needed)); > NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC); > NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-_PUBLIC_ enum ndr_err_code ndr_push___spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterData *r) >-{ >- if (flags & NDR_IN) { >- NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); >- } >- if (flags & NDR_OUT) { >- if (r->out.data == NULL) { >- return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); >- } >- NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.data, r->in.type)); >- NDR_CHECK(ndr_push_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-_PUBLIC_ enum ndr_err_code ndr_pull___spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterData *r) >-{ >- TALLOC_CTX *_mem_save_data_0; >- if (flags & NDR_IN) { >- ZERO_STRUCT(r->out); >- >- NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); >- NDR_PULL_ALLOC(ndr, r->out.data); >- ZERO_STRUCTP(r->out.data); >- } >- if (flags & NDR_OUT) { >- if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >- NDR_PULL_ALLOC(ndr, r->out.data); >+ if (r->out.data) { >+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, r->in.offered)); > } >- _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); >- NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); >- NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.data, r->in.type)); >- NDR_CHECK(ndr_pull_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); >- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); > } > return NDR_ERR_SUCCESS; > } >@@ -23559,8 +23539,7 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterData(struct ndr_print *ndr, const char > ndr->depth--; > ndr_print_ptr(ndr, "data", r->out.data); > ndr->depth++; >- ndr_print_set_switch_value(ndr, r->out.data, *r->out.type); >- ndr_print_spoolss_PrinterData(ndr, "data", r->out.data); >+ ndr_print_array_uint8(ndr, "data", r->out.data, r->in.offered); > ndr->depth--; > ndr_print_ptr(ndr, "needed", r->out.needed); > ndr->depth++; >@@ -23572,7 +23551,7 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterData(struct ndr_print *ndr, const char > ndr->depth--; > } > >-_PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct _spoolss_SetPrinterData *r) >+static enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r) > { > if (flags & NDR_IN) { > if (r->in.handle == NULL) { >@@ -23584,8 +23563,12 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterData(struct ndr_push *ndr > NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->in.value_name, CH_UTF16))); > NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.value_name, ndr_charset_length(r->in.value_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); > NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); >- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->in.data)); >- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in._offered)); >+ if (r->in.data == NULL) { >+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); >+ } >+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->in.offered)); >+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, r->in.offered)); >+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); > } > if (flags & NDR_OUT) { > NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); >@@ -23593,21 +23576,6 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterData(struct ndr_push *ndr > return NDR_ERR_SUCCESS; > } > >-_PUBLIC_ enum ndr_err_code ndr_push___spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterData *r) >-{ >- if (flags & NDR_IN) { >- NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); >- } >- if (flags & NDR_OUT) { >- if (r->out.data == NULL) { >- return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); >- } >- NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.data, r->in.type)); >- NDR_CHECK(ndr_push_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); >- } >- return NDR_ERR_SUCCESS; >-} >- > static enum ndr_err_code ndr_pull_spoolss_SetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_SetPrinterData *r) > { > TALLOC_CTX *_mem_save_handle_0; >@@ -23627,14 +23595,15 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterData(struct ndr_pull *ndr, i > NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t))); > NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.value_name, ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t), CH_UTF16)); > NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); >- { >- struct ndr_pull *_ndr_data; >- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 4, -1)); >- NDR_CHECK(ndr_pull_set_switch_value(_ndr_data, &r->in.data, r->in.type)); >- NDR_CHECK(ndr_pull_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, &r->in.data)); >- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_data, 4, -1)); >+ NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); >+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >+ NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); >+ } >+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_size(ndr, &r->in.data))); >+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); >+ if (r->in.data) { >+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, r->in.offered)); > } >- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in._offered)); > } > if (flags & NDR_OUT) { > NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); >@@ -23658,9 +23627,11 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterData(struct ndr_print *ndr, const char > ndr->depth--; > ndr_print_string(ndr, "value_name", r->in.value_name); > ndr_print_winreg_Type(ndr, "type", r->in.type); >- ndr_print_set_switch_value(ndr, &r->in.data, r->in.type); >- ndr_print_spoolss_PrinterData(ndr, "data", &r->in.data); >- ndr_print_uint32(ndr, "_offered", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_spoolss_PrinterData(&r->in.data, r->in.type, ndr->iconv_convenience, flags):r->in._offered); >+ ndr_print_ptr(ndr, "data", r->in.data); >+ ndr->depth++; >+ ndr_print_array_uint8(ndr, "data", r->in.data, r->in.offered); >+ ndr->depth--; >+ ndr_print_uint32(ndr, "offered", r->in.offered); > ndr->depth--; > } > if (flags & NDR_OUT) { >@@ -27812,7 +27783,7 @@ _PUBLIC_ void ndr_print_spoolss_4c(struct ndr_print *ndr, const char *name, int > ndr->depth--; > } > >-_PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_SetPrinterDataEx *r) >+static enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r) > { > if (flags & NDR_IN) { > if (r->in.handle == NULL) { >@@ -27828,8 +27799,12 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterDataEx(struct ndr_push *n > NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->in.value_name, CH_UTF16))); > NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.value_name, ndr_charset_length(r->in.value_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); > NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); >- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->in.data)); >- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in._offered)); >+ if (r->in.data == NULL) { >+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); >+ } >+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->in.offered)); >+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, r->in.offered)); >+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); > } > if (flags & NDR_OUT) { > NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); >@@ -27837,21 +27812,6 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterDataEx(struct ndr_push *n > return NDR_ERR_SUCCESS; > } > >-_PUBLIC_ enum ndr_err_code ndr_push___spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterDataEx *r) >-{ >- if (flags & NDR_IN) { >- NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); >- } >- if (flags & NDR_OUT) { >- if (r->out.data == NULL) { >- return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); >- } >- NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.data, r->in.type)); >- NDR_CHECK(ndr_push_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); >- } >- return NDR_ERR_SUCCESS; >-} >- > static enum ndr_err_code ndr_pull_spoolss_SetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_SetPrinterDataEx *r) > { > TALLOC_CTX *_mem_save_handle_0; >@@ -27878,14 +27838,15 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterDataEx(struct ndr_pull *ndr, > NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t))); > NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.value_name, ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t), CH_UTF16)); > NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); >- { >- struct ndr_pull *_ndr_data; >- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 4, -1)); >- NDR_CHECK(ndr_pull_set_switch_value(_ndr_data, &r->in.data, r->in.type)); >- NDR_CHECK(ndr_pull_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, &r->in.data)); >- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_data, 4, -1)); >+ NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); >+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >+ NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); >+ } >+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_size(ndr, &r->in.data))); >+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); >+ if (r->in.data) { >+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, r->in.offered)); > } >- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in._offered)); > } > if (flags & NDR_OUT) { > NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); >@@ -27910,9 +27871,11 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const ch > ndr_print_string(ndr, "key_name", r->in.key_name); > ndr_print_string(ndr, "value_name", r->in.value_name); > ndr_print_winreg_Type(ndr, "type", r->in.type); >- ndr_print_set_switch_value(ndr, &r->in.data, r->in.type); >- ndr_print_spoolss_PrinterData(ndr, "data", &r->in.data); >- ndr_print_uint32(ndr, "_offered", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_spoolss_PrinterData(&r->in.data, r->in.type, ndr->iconv_convenience, flags):r->in._offered); >+ ndr_print_ptr(ndr, "data", r->in.data); >+ ndr->depth++; >+ ndr_print_array_uint8(ndr, "data", r->in.data, r->in.offered); >+ ndr->depth--; >+ ndr_print_uint32(ndr, "offered", r->in.offered); > ndr->depth--; > } > if (flags & NDR_OUT) { >@@ -27924,7 +27887,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const ch > ndr->depth--; > } > >-_PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_GetPrinterDataEx *r) >+static enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r) > { > if (flags & NDR_IN) { > if (r->in.handle == NULL) { >@@ -27949,7 +27912,8 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterDataEx(struct ndr_push *n > if (r->out.data == NULL) { > return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); > } >- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, *r->out.data)); >+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->in.offered)); >+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, r->in.offered)); > if (r->out.needed == NULL) { > return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); > } >@@ -27959,11 +27923,10 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterDataEx(struct ndr_push *n > return NDR_ERR_SUCCESS; > } > >-_PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_GetPrinterDataEx *r) >+static enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r) > { > TALLOC_CTX *_mem_save_handle_0; > TALLOC_CTX *_mem_save_type_0; >- TALLOC_CTX *_mem_save_data_0; > TALLOC_CTX *_mem_save_needed_0; > if (flags & NDR_IN) { > ZERO_STRUCT(r->out); >@@ -27992,8 +27955,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *n > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); > NDR_PULL_ALLOC(ndr, r->out.type); > ZERO_STRUCTP(r->out.type); >- NDR_PULL_ALLOC(ndr, r->out.data); >- ZERO_STRUCTP(r->out.data); >+ NDR_PULL_ALLOC_N(ndr, r->out.data, r->in.offered); >+ memset(r->out.data, 0, (r->in.offered) * sizeof(*r->out.data)); > NDR_PULL_ALLOC(ndr, r->out.needed); > ZERO_STRUCTP(r->out.needed); > } >@@ -28005,13 +27968,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *n > NDR_PULL_SET_MEM_CTX(ndr, r->out.type, LIBNDR_FLAG_REF_ALLOC); > NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); > NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, LIBNDR_FLAG_REF_ALLOC); >+ NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); > if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >- NDR_PULL_ALLOC(ndr, r->out.data); >+ NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data)); > } >- _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); >- NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); >- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, r->out.data)); >- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); >+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_size(ndr, &r->out.data))); > if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { > NDR_PULL_ALLOC(ndr, r->out.needed); > } >@@ -28020,44 +27981,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *n > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.needed)); > NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC); > NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-_PUBLIC_ enum ndr_err_code ndr_push___spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterDataEx *r) >-{ >- if (flags & NDR_IN) { >- NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); >- } >- if (flags & NDR_OUT) { >- if (r->out.data == NULL) { >- return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); >- } >- NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.data, r->in.type)); >- NDR_CHECK(ndr_push_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); >- } >- return NDR_ERR_SUCCESS; >-} >- >-_PUBLIC_ enum ndr_err_code ndr_pull___spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterDataEx *r) >-{ >- TALLOC_CTX *_mem_save_data_0; >- if (flags & NDR_IN) { >- ZERO_STRUCT(r->out); >- >- NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); >- NDR_PULL_ALLOC(ndr, r->out.data); >- ZERO_STRUCTP(r->out.data); >- } >- if (flags & NDR_OUT) { >- if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { >- NDR_PULL_ALLOC(ndr, r->out.data); >+ if (r->out.data) { >+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, r->in.offered)); > } >- _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); >- NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); >- NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.data, r->in.type)); >- NDR_CHECK(ndr_pull_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); >- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); > } > return NDR_ERR_SUCCESS; > } >@@ -28090,8 +28016,7 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterDataEx(struct ndr_print *ndr, const ch > ndr->depth--; > ndr_print_ptr(ndr, "data", r->out.data); > ndr->depth++; >- ndr_print_set_switch_value(ndr, r->out.data, *r->out.type); >- ndr_print_spoolss_PrinterData(ndr, "data", r->out.data); >+ ndr_print_array_uint8(ndr, "data", r->out.data, r->in.offered); > ndr->depth--; > ndr_print_ptr(ndr, "needed", r->out.needed); > ndr->depth++; >diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h >index 0591980..71390b5 100644 >--- a/librpc/gen_ndr/ndr_spoolss.h >+++ b/librpc/gen_ndr/ndr_spoolss.h >@@ -611,22 +611,7 @@ void ndr_print_spoolss_ReadPrinter(struct ndr_print *ndr, const char *name, int > void ndr_print_spoolss_EndDocPrinter(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_EndDocPrinter *r); > void ndr_print_spoolss_AddJob(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_AddJob *r); > void ndr_print_spoolss_ScheduleJob(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_ScheduleJob *r); >-enum ndr_err_code ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct _spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct _spoolss_GetPrinterData *r); >-void ndr_print__spoolss_GetPrinterData(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_push___spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_pull___spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterData *r); >-void ndr_print___spoolss_GetPrinterData(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r); > void ndr_print_spoolss_GetPrinterData(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_GetPrinterData *r); >-enum ndr_err_code ndr_push__spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct _spoolss_SetPrinterData *r); >-enum ndr_err_code ndr_pull__spoolss_SetPrinterData(struct ndr_pull *ndr, int flags, struct _spoolss_SetPrinterData *r); >-void ndr_print__spoolss_SetPrinterData(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_SetPrinterData *r); >-enum ndr_err_code ndr_push___spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterData *r); >-enum ndr_err_code ndr_pull___spoolss_SetPrinterData(struct ndr_pull *ndr, int flags, struct __spoolss_SetPrinterData *r); >-void ndr_print___spoolss_SetPrinterData(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_SetPrinterData *r); >-enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r); > void ndr_print_spoolss_SetPrinterData(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_SetPrinterData *r); > void ndr_print_spoolss_WaitForPrinterChange(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_WaitForPrinterChange *r); > enum ndr_err_code ndr_push_spoolss_ClosePrinter(struct ndr_push *ndr, int flags, const struct spoolss_ClosePrinter *r); >@@ -723,22 +708,7 @@ void ndr_print_spoolss_DeletePrinterData(struct ndr_print *ndr, const char *name > void ndr_print_spoolss_4a(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4a *r); > void ndr_print_spoolss_4b(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4b *r); > void ndr_print_spoolss_4c(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4c *r); >-enum ndr_err_code ndr_push__spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_SetPrinterDataEx *r); >-enum ndr_err_code ndr_pull__spoolss_SetPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_SetPrinterDataEx *r); >-void ndr_print__spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_SetPrinterDataEx *r); >-enum ndr_err_code ndr_push___spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterDataEx *r); >-enum ndr_err_code ndr_pull___spoolss_SetPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_SetPrinterDataEx *r); >-void ndr_print___spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_SetPrinterDataEx *r); >-enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r); > void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_SetPrinterDataEx *r); >-enum ndr_err_code ndr_push__spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_GetPrinterDataEx *r); >-void ndr_print__spoolss_GetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_push___spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_pull___spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterDataEx *r); >-void ndr_print___spoolss_GetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r); >-enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r); > void ndr_print_spoolss_GetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_GetPrinterDataEx *r); > enum ndr_err_code ndr_push__spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_EnumPrinterDataEx *r); > enum ndr_err_code ndr_pull__spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_EnumPrinterDataEx *r); >diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h >index 945453c..fc7114a 100644 >--- a/librpc/gen_ndr/spoolss.h >+++ b/librpc/gen_ndr/spoolss.h >@@ -2068,8 +2068,8 @@ struct spoolss_PrinterEnumValues { > const char * value_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ > uint32_t value_name_len;/* [value(2*strlen_m_term(value_name))] */ > enum winreg_Type type; >- union spoolss_PrinterData *data;/* [relative,subcontext_size(r->data_length),subcontext(0),switch_is(type)] */ >- uint32_t data_length;/* [value(ndr_size_spoolss_PrinterData(data,type,ndr->iconv_convenience,ndr->flags))] */ >+ DATA_BLOB *data;/* [relative,subcontext_size(data_length),subcontext(0),flag(LIBNDR_FLAG_REMAINING)] */ >+ uint32_t data_length;/* [value(data->length)] */ > }/* [relative_base,gensize,public] */; > > union spoolss_KeyNames { >@@ -2686,35 +2686,6 @@ struct spoolss_ScheduleJob { > }; > > >-struct _spoolss_GetPrinterData { >- struct { >- struct policy_handle *handle;/* [ref] */ >- const char *value_name;/* [charset(UTF16)] */ >- uint32_t offered; >- } in; >- >- struct { >- enum winreg_Type *type;/* [ref] */ >- DATA_BLOB *data;/* [ref] */ >- uint32_t *needed;/* [ref] */ >- WERROR result; >- } out; >- >-}; >- >- >-struct __spoolss_GetPrinterData { >- struct { >- enum winreg_Type type; >- } in; >- >- struct { >- union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ >- } out; >- >-}; >- >- > struct spoolss_GetPrinterData { > struct { > struct policy_handle *handle;/* [ref] */ >@@ -2724,7 +2695,7 @@ struct spoolss_GetPrinterData { > > struct { > enum winreg_Type *type;/* [ref] */ >- union spoolss_PrinterData *data;/* [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */ >+ uint8_t *data;/* [ref,size_is(offered)] */ > uint32_t *needed;/* [ref] */ > WERROR result; > } out; >@@ -2732,41 +2703,13 @@ struct spoolss_GetPrinterData { > }; > > >-struct _spoolss_SetPrinterData { >- struct { >- struct policy_handle *handle;/* [ref] */ >- const char *value_name;/* [charset(UTF16)] */ >- enum winreg_Type type; >- DATA_BLOB data; >- uint32_t _offered; >- } in; >- >- struct { >- WERROR result; >- } out; >- >-}; >- >- >-struct __spoolss_SetPrinterData { >- struct { >- enum winreg_Type type; >- } in; >- >- struct { >- union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ >- } out; >- >-}; >- >- > struct spoolss_SetPrinterData { > struct { > struct policy_handle *handle;/* [ref] */ > const char *value_name;/* [charset(UTF16)] */ > enum winreg_Type type; >- union spoolss_PrinterData data;/* [subcontext(4),switch_is(type)] */ >- uint32_t _offered;/* [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */ >+ uint8_t *data;/* [ref,size_is(offered)] */ >+ uint32_t offered; > } in; > > struct { >@@ -3490,82 +3433,23 @@ struct spoolss_4c { > }; > > >-struct _spoolss_SetPrinterDataEx { >- struct { >- struct policy_handle *handle;/* [ref] */ >- const char *key_name;/* [charset(UTF16)] */ >- const char *value_name;/* [charset(UTF16)] */ >- enum winreg_Type type; >- DATA_BLOB data; >- uint32_t _offered; >- } in; >- >- struct { >- WERROR result; >- } out; >- >-}; >- >- >-struct __spoolss_SetPrinterDataEx { >- struct { >- enum winreg_Type type; >- } in; >- >- struct { >- union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ >- } out; >- >-}; >- >- > struct spoolss_SetPrinterDataEx { > struct { > struct policy_handle *handle;/* [ref] */ > const char *key_name;/* [charset(UTF16)] */ > const char *value_name;/* [charset(UTF16)] */ > enum winreg_Type type; >- union spoolss_PrinterData data;/* [subcontext(4),switch_is(type)] */ >- uint32_t _offered;/* [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */ >- } in; >- >- struct { >- WERROR result; >- } out; >- >-}; >- >- >-struct _spoolss_GetPrinterDataEx { >- struct { >- struct policy_handle *handle;/* [ref] */ >- const char *key_name;/* [charset(UTF16)] */ >- const char *value_name;/* [charset(UTF16)] */ >+ uint8_t *data;/* [ref,size_is(offered)] */ > uint32_t offered; > } in; > > struct { >- enum winreg_Type *type;/* [ref] */ >- DATA_BLOB *data;/* [ref] */ >- uint32_t *needed;/* [ref] */ > WERROR result; > } out; > > }; > > >-struct __spoolss_GetPrinterDataEx { >- struct { >- enum winreg_Type type; >- } in; >- >- struct { >- union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ >- } out; >- >-}; >- >- > struct spoolss_GetPrinterDataEx { > struct { > struct policy_handle *handle;/* [ref] */ >@@ -3576,7 +3460,7 @@ struct spoolss_GetPrinterDataEx { > > struct { > enum winreg_Type *type;/* [ref] */ >- union spoolss_PrinterData *data;/* [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */ >+ uint8_t *data;/* [ref,size_is(offered)] */ > uint32_t *needed;/* [ref] */ > WERROR result; > } out; >diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c >index cc11d12..236467a 100644 >--- a/librpc/gen_ndr/srv_spoolss.c >+++ b/librpc/gen_ndr/srv_spoolss.c >@@ -2139,7 +2139,7 @@ static bool api_spoolss_GetPrinterData(pipes_struct *p) > return false; > } > >- r->out.data = talloc_zero(r, union spoolss_PrinterData); >+ r->out.data = talloc_zero_array(r, uint8_t, r->in.offered); > if (r->out.data == NULL) { > talloc_free(r); > return false; >@@ -6147,7 +6147,7 @@ static bool api_spoolss_GetPrinterDataEx(pipes_struct *p) > return false; > } > >- r->out.data = talloc_zero(r, union spoolss_PrinterData); >+ r->out.data = talloc_zero_array(r, uint8_t, r->in.offered); > if (r->out.data == NULL) { > talloc_free(r); > return false; >@@ -8979,7 +8979,7 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, > return NT_STATUS_NO_MEMORY; > } > >- r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData); >+ r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.offered); > if (r->out.data == NULL) { > return NT_STATUS_NO_MEMORY; > } >@@ -9471,7 +9471,7 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, > return NT_STATUS_NO_MEMORY; > } > >- r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData); >+ r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.offered); > if (r->out.data == NULL) { > return NT_STATUS_NO_MEMORY; > } >-- >1.6.6.1 > > >From 49bf3fc459bd7adec969876b8776146376291602 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 18:21:50 +0100 >Subject: [PATCH 14/18] s4-spoolss: fix spoolss_GetPrinterData implementation after IDL change. > >Guenther >--- > source4/ntptr/simple_ldb/ntptr_simple_ldb.c | 122 +++++++++++++++++---------- > source4/rpc_server/spoolss/dcesrv_spoolss.c | 3 +- > 2 files changed, 79 insertions(+), 46 deletions(-) > >diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c >index 601f790..fbdae6d 100644 >--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c >+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c >@@ -122,51 +122,57 @@ static WERROR sptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ > /* > * PrintServer PrinterData functions > */ >-static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, >- struct spoolss_GetPrinterData *r) >+ >+static WERROR sptr_PrintServerData(struct ntptr_GenericHandle *server, >+ TALLOC_CTX *mem_ctx, >+ const char *value_name, >+ union spoolss_PrinterData *r, >+ enum winreg_Type *type) > { > struct dcerpc_server_info *server_info = lp_dcerpc_server_info(mem_ctx, server->ntptr->lp_ctx); >- if (strcmp("W3SvcInstalled", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 0; >+ if (strcmp("W3SvcInstalled", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 0; > return WERR_OK; >- } else if (strcmp("BeepEnabled", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 0; >+ } else if (strcmp("BeepEnabled", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 0; > return WERR_OK; >- } else if (strcmp("EventLog", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 0; >+ } else if (strcmp("EventLog", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 0; > return WERR_OK; >- } else if (strcmp("NetPopup", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 0; >+ } else if (strcmp("NetPopup", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 0; > return WERR_OK; >- } else if (strcmp("NetPopupToComputer", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 0; >+ } else if (strcmp("NetPopupToComputer", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 0; > return WERR_OK; >- } else if (strcmp("MajorVersion", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 3; >+ } else if (strcmp("MajorVersion", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 3; > return WERR_OK; >- } else if (strcmp("MinorVersion", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 0; >+ } else if (strcmp("MinorVersion", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 0; > return WERR_OK; >- } else if (strcmp("DefaultSpoolDirectory", r->in.value_name) == 0) { >- *r->out.type = REG_SZ; >- r->out.data->string = "C:\\PRINTERS"; >+ } else if (strcmp("DefaultSpoolDirectory", value_name) == 0) { >+ *type = REG_SZ; >+ r->string = talloc_strdup(mem_ctx, "C:\\PRINTERS"); >+ W_ERROR_HAVE_NO_MEMORY(r->string); > return WERR_OK; >- } else if (strcmp("Architecture", r->in.value_name) == 0) { >- *r->out.type = REG_SZ; >- r->out.data->string = SPOOLSS_ARCHITECTURE_NT_X86; >+ } else if (strcmp("Architecture", value_name) == 0) { >+ *type = REG_SZ; >+ r->string = talloc_strdup(mem_ctx, SPOOLSS_ARCHITECTURE_NT_X86); >+ W_ERROR_HAVE_NO_MEMORY(r->string); > return WERR_OK; >- } else if (strcmp("DsPresent", r->in.value_name) == 0) { >- *r->out.type = REG_DWORD; >- r->out.data->value = 1; >+ } else if (strcmp("DsPresent", value_name) == 0) { >+ *type = REG_DWORD; >+ r->value = 1; > return WERR_OK; >- } else if (strcmp("OSVersion", r->in.value_name) == 0) { >+ } else if (strcmp("OSVersion", value_name) == 0) { > DATA_BLOB blob; > enum ndr_err_code ndr_err; > struct spoolss_OSVersion os; >@@ -181,10 +187,10 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC > return WERR_GENERAL_FAILURE; > } > >- *r->out.type = REG_BINARY; >- r->out.data->binary = blob; >+ *type = REG_BINARY; >+ r->binary = blob; > return WERR_OK; >- } else if (strcmp("OSVersionEx", r->in.value_name) == 0) { >+ } else if (strcmp("OSVersionEx", value_name) == 0) { > DATA_BLOB blob; > enum ndr_err_code ndr_err; > struct spoolss_OSVersionEx os_ex; >@@ -204,23 +210,51 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC > return WERR_GENERAL_FAILURE; > } > >- *r->out.type = REG_BINARY; >- r->out.data->binary = blob; >+ *type = REG_BINARY; >+ r->binary = blob; > return WERR_OK; >- } else if (strcmp("DNSMachineName", r->in.value_name) == 0) { >+ } else if (strcmp("DNSMachineName", value_name) == 0) { > if (!lp_realm(server->ntptr->lp_ctx)) return WERR_INVALID_PARAM; > >- *r->out.type = REG_SZ; >- r->out.data->string = talloc_asprintf(mem_ctx, "%s.%s", >- lp_netbios_name(server->ntptr->lp_ctx), >- lp_realm(server->ntptr->lp_ctx)); >- W_ERROR_HAVE_NO_MEMORY(r->out.data->string); >+ *type = REG_SZ; >+ r->string = talloc_asprintf(mem_ctx, "%s.%s", >+ lp_netbios_name(server->ntptr->lp_ctx), >+ lp_realm(server->ntptr->lp_ctx)); >+ W_ERROR_HAVE_NO_MEMORY(r->string); > return WERR_OK; > } > > return WERR_INVALID_PARAM; > } > >+static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, >+ struct spoolss_GetPrinterData *r) >+{ >+ WERROR result; >+ union spoolss_PrinterData data; >+ DATA_BLOB blob; >+ enum ndr_err_code ndr_err; >+ >+ result = sptr_PrintServerData(server, mem_ctx, r->in.value_name, &data, r->out.type); >+ if (!W_ERROR_IS_OK(result)) { >+ return result; >+ } >+ >+ ndr_err = ndr_push_union_blob(&blob, mem_ctx, lp_iconv_convenience(server->ntptr->lp_ctx), >+ &data, *r->out.type, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData); >+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { >+ return WERR_GENERAL_FAILURE; >+ } >+ >+ *r->out.needed = blob.length; >+ >+ if (r->in.offered >= *r->out.needed) { >+ memcpy(r->out.data, blob.data, blob.length); >+ } >+ >+ return WERR_OK; >+} >+ > /* PrintServer Form functions */ > static WERROR sptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, > struct spoolss_EnumForms *r) >diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c >index d380b10..6e50898 100644 >--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c >+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c >@@ -579,7 +579,7 @@ static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call, > r->out.needed = talloc_zero(mem_ctx, uint32_t); > W_ERROR_HAVE_NO_MEMORY(r->out.needed); > >- r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData); >+ r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.needed); > W_ERROR_HAVE_NO_MEMORY(r->out.data); > > DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY); >@@ -598,7 +598,6 @@ static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call, > > W_ERROR_NOT_OK_RETURN(status); > >- *r->out.needed = ndr_size_spoolss_PrinterData(r->out.data, *r->out.type, ic, 0); > *r->out.type = SPOOLSS_BUFFER_OK(*r->out.type, REG_NONE); > r->out.data = SPOOLSS_BUFFER_OK(r->out.data, r->out.data); > return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA); >-- >1.6.6.1 > > >From 7542879805f25c7a945454379acf4c0a35f4bc73 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 5 Mar 2010 16:34:17 +0100 >Subject: [PATCH 15/18] s4-spoolss: fix dcesrv_spoolss_GetPrinterData build. > >really not my day today... > >Guenther >(cherry picked from commit 91ff11d50458a951ab0adc9b37bcb0ef4ee09e15) >--- > source4/rpc_server/spoolss/dcesrv_spoolss.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c >index 6e50898..f4ec5d6 100644 >--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c >+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c >@@ -579,7 +579,7 @@ static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call, > r->out.needed = talloc_zero(mem_ctx, uint32_t); > W_ERROR_HAVE_NO_MEMORY(r->out.needed); > >- r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.needed); >+ r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.offered); > W_ERROR_HAVE_NO_MEMORY(r->out.data); > > DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY); >-- >1.6.6.1 > > >From 37759cba21c8bca10a2c97466c42a09d5b5e558e Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 5 Mar 2010 20:32:16 +0100 >Subject: [PATCH 16/18] s4-smbtorture: fix RPC-SPOOLSS-WIN after PrinterData IDL changes. > >Guenther >(cherry picked from commit 58c9070746a3e0725f5d3a3ce6deda8fad0c5974) >--- > source4/torture/rpc/spoolss_win.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > >diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c >index 5834480..8179e86 100644 >--- a/source4/torture/rpc/spoolss_win.c >+++ b/source4/torture/rpc/spoolss_win.c >@@ -160,7 +160,7 @@ static bool test_GetPrinterData(struct torture_context *tctx, > struct spoolss_GetPrinterData gpd; > uint32_t needed; > enum winreg_Type type; >- union spoolss_PrinterData data; >+ uint8_t *data = talloc_zero_array(tctx, uint8_t, 4); > > torture_comment(tctx, "Testing GetPrinterData(%s).\n", value_name); > gpd.in.handle = handle; >@@ -168,7 +168,7 @@ static bool test_GetPrinterData(struct torture_context *tctx, > gpd.in.offered = 4; > gpd.out.needed = &needed; > gpd.out.type = &type; >- gpd.out.data = &data; >+ gpd.out.data = data; > > status = dcerpc_spoolss_GetPrinterData(p, tctx, &gpd); > torture_assert_ntstatus_ok(tctx, status, "GetPrinterData failed."); >@@ -176,7 +176,8 @@ static bool test_GetPrinterData(struct torture_context *tctx, > "GetPrinterData did not return expected error value."); > > if (W_ERROR_IS_OK(expected_werr)) { >- torture_assert_int_equal(tctx, data.value, >+ uint32_t value = IVAL(data, 0); >+ torture_assert_int_equal(tctx, value, > expected_value, > talloc_asprintf(tctx, "GetPrinterData for %s did not return expected value.", value_name)); > } >-- >1.6.6.1 > > >From 4a5d95e90d69b366a6b6c5d02d2294029e257c8c Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Thu, 4 Mar 2010 22:40:31 +0100 >Subject: [PATCH 17/18] s4-smbtorture: fix smbtorture after GetPrinterData{Ex} after IDL changes. > >Guenther >--- > source4/torture/rpc/spoolss.c | 101 ++++++++++++++++++++++++----------------- > 1 files changed, 59 insertions(+), 42 deletions(-) > >diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c >index 489174b..c443f9b 100644 >--- a/source4/torture/rpc/spoolss.c >+++ b/source4/torture/rpc/spoolss.c >@@ -28,6 +28,7 @@ > #include "librpc/gen_ndr/ndr_spoolss.h" > #include "librpc/gen_ndr/ndr_spoolss_c.h" > #include "param/param.h" >+#include "lib/registry/registry.h" > > #define TORTURE_WELLKNOWN_PRINTER "torture_wkn_printer" > #define TORTURE_PRINTER "torture_printer" >@@ -2185,7 +2186,8 @@ static bool test_GetPrinterData(struct torture_context *tctx, > struct policy_handle *handle, > const char *value_name, > enum winreg_Type *type_p, >- union spoolss_PrinterData *data_p) >+ uint8_t **data_p, >+ uint32_t *needed_p) > { > NTSTATUS status; > struct spoolss_GetPrinterData r; >@@ -2198,7 +2200,7 @@ static bool test_GetPrinterData(struct torture_context *tctx, > r.in.offered = 0; > r.out.needed = &needed; > r.out.type = &type; >- r.out.data = &data; >+ r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered); > > torture_comment(tctx, "Testing GetPrinterData(%s)\n", r.in.value_name); > >@@ -2207,7 +2209,7 @@ static bool test_GetPrinterData(struct torture_context *tctx, > > if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { > r.in.offered = needed; >- >+ r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered); > status = dcerpc_spoolss_GetPrinterData(p, tctx, &r); > torture_assert_ntstatus_ok(tctx, status, "GetPrinterData failed"); > } >@@ -2222,7 +2224,11 @@ static bool test_GetPrinterData(struct torture_context *tctx, > } > > if (data_p) { >- *data_p = data; >+ *data_p = r.out.data; >+ } >+ >+ if (needed_p) { >+ *needed_p = needed; > } > > return true; >@@ -2234,7 +2240,8 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx, > const char *key_name, > const char *value_name, > enum winreg_Type *type_p, >- union spoolss_PrinterData *data_p) >+ uint8_t **data_p, >+ uint32_t *needed_p) > { > NTSTATUS status; > struct spoolss_GetPrinterDataEx r; >@@ -2248,7 +2255,7 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx, > r.in.offered = 0; > r.out.type = &type; > r.out.needed = &needed; >- r.out.data = &data; >+ r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered); > > torture_comment(tctx, "Testing GetPrinterDataEx(%s - %s)\n", > r.in.key_name, r.in.value_name); >@@ -2264,6 +2271,7 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx, > > if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { > r.in.offered = needed; >+ r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered); > status = dcerpc_spoolss_GetPrinterDataEx(p, tctx, &r); > torture_assert_ntstatus_ok(tctx, status, "GetPrinterDataEx failed"); > } >@@ -2278,7 +2286,11 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx, > } > > if (data_p) { >- *data_p = data; >+ *data_p = r.out.data; >+ } >+ >+ if (needed_p) { >+ *needed_p = needed; > } > > return true; >@@ -2307,26 +2319,16 @@ static bool test_GetPrinterData_list(struct torture_context *tctx, > > for (i=0; i < ARRAY_SIZE(list); i++) { > enum winreg_Type type, type_ex; >- union spoolss_PrinterData data, data_ex; >+ uint8_t *data, *data_ex; >+ uint32_t needed, needed_ex; > >- torture_assert(tctx, test_GetPrinterData(tctx, p, handle, list[i], &type, &data), >+ torture_assert(tctx, test_GetPrinterData(tctx, p, handle, list[i], &type, &data, &needed), > talloc_asprintf(tctx, "GetPrinterData failed on %s\n", list[i])); >- torture_assert(tctx, test_GetPrinterDataEx(tctx, p, handle, "random_string", list[i], &type_ex, &data_ex), >+ torture_assert(tctx, test_GetPrinterDataEx(tctx, p, handle, "random_string", list[i], &type_ex, &data_ex, &needed_ex), > talloc_asprintf(tctx, "GetPrinterDataEx failed on %s\n", list[i])); > torture_assert_int_equal(tctx, type, type_ex, "type mismatch"); >- switch (type) { >- case REG_SZ: >- torture_assert_str_equal(tctx, data.string, data_ex.string, "REG_SZ mismatch"); >- break; >- case REG_DWORD: >- torture_assert_int_equal(tctx, data.value, data_ex.value, "REG_DWORD mismatch"); >- break; >- case REG_BINARY: >- torture_assert_data_blob_equal(tctx, data.binary, data_ex.binary, "REG_BINARY mismatch"); >- break; >- default: >- break; >- } >+ torture_assert_int_equal(tctx, needed, needed_ex, "needed mismatch"); >+ torture_assert_mem_equal(tctx, data, data_ex, needed, "data mismatch"); > } > > return true; >@@ -2379,10 +2381,10 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip > > torture_assert_werr_ok(tctx, r.out.result, "EnumPrinterData failed"); > >- torture_assert(tctx, test_GetPrinterData(tctx, p, handle, r.out.value_name, NULL, NULL), >+ torture_assert(tctx, test_GetPrinterData(tctx, p, handle, r.out.value_name, NULL, NULL, NULL), > talloc_asprintf(tctx, "failed to call GetPrinterData for %s\n", r.out.value_name)); > >- torture_assert(tctx, test_GetPrinterDataEx(tctx, p, handle, "PrinterDriverData", r.out.value_name, NULL, NULL), >+ torture_assert(tctx, test_GetPrinterDataEx(tctx, p, handle, "PrinterDriverData", r.out.value_name, NULL, NULL, NULL), > talloc_asprintf(tctx, "failed to call GetPrinterDataEx on PrinterDriverData for %s\n", r.out.value_name)); > > r.in.enum_index++; >@@ -2525,12 +2527,19 @@ static bool test_SetPrinterData(struct torture_context *tctx, > for (i=0; i < ARRAY_SIZE(values); i++) { > > enum winreg_Type type; >- union spoolss_PrinterData data; >+ uint8_t *data; >+ DATA_BLOB blob; >+ uint32_t needed; >+ >+ torture_assert(tctx, >+ reg_string_to_val(tctx, lp_iconv_convenience(tctx->lp_ctx), >+ "REG_SZ", "dog", &r.in.type, &blob), ""); > > r.in.handle = handle; > r.in.value_name = values[i]; > r.in.type = REG_SZ; >- r.in.data.string = "dog"; >+ r.in.data = blob.data; >+ r.in.offered = blob.length; > > torture_comment(tctx, "Testing SetPrinterData(%s)\n", > r.in.value_name); >@@ -2540,12 +2549,13 @@ static bool test_SetPrinterData(struct torture_context *tctx, > torture_assert_ntstatus_ok(tctx, status, "SetPrinterData failed"); > torture_assert_werr_ok(tctx, r.out.result, "SetPrinterData failed"); > >- if (!test_GetPrinterData(tctx, p, handle, r.in.value_name, &type, &data)) { >+ if (!test_GetPrinterData(tctx, p, handle, r.in.value_name, &type, &data, &needed)) { > return false; > } > > torture_assert_int_equal(tctx, r.in.type, type, "type mismatch"); >- torture_assert_str_equal(tctx, r.in.data.string, data.string, "data mismatch"); >+ torture_assert_int_equal(tctx, r.in.offered, needed, "size mismatch"); >+ torture_assert_mem_equal(tctx, blob.data, data, needed, "buffer mismatch"); > > if (!test_DeletePrinterData(tctx, p, handle, r.in.value_name)) { > return false; >@@ -2599,13 +2609,15 @@ static bool test_SetPrinterDataEx(struct torture_context *tctx, > const char *key; > enum winreg_Type type; > const char **subkeys; >- union spoolss_PrinterData data; >+ uint8_t *data_out; >+ uint32_t needed; > > r.in.handle = handle; > r.in.key_name = keys[i]; > r.in.value_name = value_name; > r.in.type = REG_BINARY; >- r.in.data.binary = blob; >+ r.in.data = blob.data; >+ r.in.offered = blob.length; > > torture_comment(tctx, "Testing SetPrinterDataEx(%s - %s)\n", r.in.key_name, value_name); > >@@ -2614,14 +2626,15 @@ static bool test_SetPrinterDataEx(struct torture_context *tctx, > torture_assert_ntstatus_ok(tctx, status, "SetPrinterDataEx failed"); > torture_assert_werr_ok(tctx, r.out.result, "SetPrinterDataEx failed"); > >- key = talloc_strdup(tctx, r.in.key_name); >- >- if (!test_GetPrinterDataEx(tctx, p, handle, r.in.key_name, value_name, &type, &data)) { >+ if (!test_GetPrinterDataEx(tctx, p, handle, keys[i], value_name, &type, &data_out, &needed)) { > return false; > } > >- torture_assert_int_equal(tctx, r.in.type, type, "type mismatch"); >- torture_assert_data_blob_equal(tctx, blob, data.binary, "data mismatch"); >+ torture_assert_int_equal(tctx, type, REG_BINARY, "type mismatch"); >+ torture_assert_int_equal(tctx, needed, blob.length, "size mismatch"); >+ torture_assert_mem_equal(tctx, data_out, blob.data, blob.length, "buffer mismatch"); >+ >+ key = talloc_strdup(tctx, keys[i]); > > if (!test_EnumPrinterDataEx(tctx, p, handle, r.in.key_name)) { > return false; >@@ -2672,15 +2685,17 @@ static bool test_GetChangeID_PrinterData(struct torture_context *tctx, > uint32_t *change_id) > { > enum winreg_Type type; >- union spoolss_PrinterData data; >+ uint8_t *data; >+ uint32_t needed; > > torture_assert(tctx, >- test_GetPrinterData(tctx, p, handle, "ChangeID", &type, &data), >+ test_GetPrinterData(tctx, p, handle, "ChangeID", &type, &data, &needed), > "failed to call GetPrinterData"); > > torture_assert(tctx, type == REG_DWORD, "unexpected type"); >+ torture_assert_int_equal(tctx, needed, 4, "unexpected size"); > >- *change_id = data.value; >+ *change_id = IVAL(data, 0); > > return true; > } >@@ -2691,15 +2706,17 @@ static bool test_GetChangeID_PrinterDataEx(struct torture_context *tctx, > uint32_t *change_id) > { > enum winreg_Type type; >- union spoolss_PrinterData data; >+ uint8_t *data; >+ uint32_t needed; > > torture_assert(tctx, >- test_GetPrinterDataEx(tctx, p, handle, "PrinterDriverData", "ChangeID", &type, &data), >+ test_GetPrinterDataEx(tctx, p, handle, "PrinterDriverData", "ChangeID", &type, &data, &needed), > "failed to call GetPrinterData"); > > torture_assert(tctx, type == REG_DWORD, "unexpected type"); >+ torture_assert_int_equal(tctx, needed, 4, "unexpected size"); > >- *change_id = data.value; >+ *change_id = IVAL(data, 0); > > return true; > } >-- >1.6.6.1 > > >From 0a1e120f5d9783674a1a96fd1296925295a81965 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 19 Feb 2010 14:25:19 +0100 >Subject: [PATCH 18/18] s4-smbtorture: add --option=torture:spoolss_check_size=yes. > >This disables the size calculation comparison by default. > >Guenther >(cherry picked from commit f2ecec3dcdafd63cd72d13019a998bf99539a9ba) >--- > source4/torture/rpc/spoolss.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > >diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c >index c443f9b..044b6aa 100644 >--- a/source4/torture/rpc/spoolss.c >+++ b/source4/torture/rpc/spoolss.c >@@ -119,30 +119,36 @@ struct test_spoolss_context { > #define DO_ROUND(size, n) (((size)+((n)-1)) & ~((n)-1)) > > #define CHECK_NEEDED_SIZE_ENUM_LEVEL(fn, info, level, count, ic, needed, align) do { \ >+ if (torture_setting_bool(tctx, "spoolss_check_size", false)) {\ > uint32_t size = ndr_size_##fn##_info(tctx, ic, level, count, info);\ > uint32_t round_size = DO_ROUND(size, align);\ > if (round_size != needed) {\ > torture_warning(tctx, __location__": "#fn" level %d (count: %d) got unexpected needed size: %d, we calculated: %d", level, count, needed, round_size);\ > CHECK_ALIGN(size, align);\ > }\ >+ }\ > } while(0) > > #define CHECK_NEEDED_SIZE_ENUM(fn, info, count, ic, needed, align) do { \ >+ if (torture_setting_bool(tctx, "spoolss_check_size", false)) {\ > uint32_t size = ndr_size_##fn##_info(tctx, ic, count, info);\ > uint32_t round_size = DO_ROUND(size, align);\ > if (round_size != needed) {\ > torture_warning(tctx, __location__": "#fn" (count: %d) got unexpected needed size: %d, we calculated: %d", count, needed, round_size);\ > CHECK_ALIGN(size, align);\ > }\ >+ }\ > } while(0) > > #define CHECK_NEEDED_SIZE_LEVEL(fn, info, level, ic, needed, align) do { \ >+ if (torture_setting_bool(tctx, "spoolss_check_size", false)) {\ > uint32_t size = ndr_size_##fn(info, level, ic, 0);\ > uint32_t round_size = DO_ROUND(size, align);\ > if (round_size != needed) {\ > torture_warning(tctx, __location__": "#fn" level %d got unexpected needed size: %d, we calculated: %d", level, needed, round_size);\ > CHECK_ALIGN(size, align);\ > }\ >+ }\ > } while(0) > > static bool test_OpenPrinter_server(struct torture_context *tctx, >-- >1.6.6.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 6727
:
4694
|
5433
| 5473 |
5475