The Samba-Bugzilla – Attachment 6263 Details for
Bug 7567
printing from Windows 7 fails with 0x000003e6 (in AD w2k8r2 controlled domain)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Draft patches for master (need a lot of review)
tmp.diff (text/plain), 10.83 KB, created by
Stefan Metzmacher
on 2011-02-22 12:42:59 UTC
(
hide
)
Description:
Draft patches for master (need a lot of review)
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2011-02-22 12:42:59 UTC
Size:
10.83 KB
patch
obsolete
>From be440e5c768bf2dfcbc1d9fc820d612aa52d0afd Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 11:00:07 +0100 >Subject: [PATCH 1/7] Revert "Fix alignment issues in SPOOLSS "BUFFER" marshalling." > >This reverts commit 187f695469071d0550613e037b36170facb85460. > >This is the wrong fix. > >metze >--- > pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 7 ------- > 1 files changed, 0 insertions(+), 7 deletions(-) > >diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm >index eda583e..075ad85 100644 >--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm >+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm >@@ -1281,19 +1281,12 @@ sub ParseStructPushPrimitives($$$$$) > sub ParseStructPushDeferred($$$$) > { > my ($self, $struct, $ndr, $varname, $env) = @_; >- > if (defined($struct->{PROPERTIES}{relative_base})) { >- $self->pidl("NDR_CHECK(ndr_push_align($ndr, $struct->{ALIGN}));"); >- > # retrieve the current offset as base for relative pointers > # based on the toplevel struct/union > $self->pidl("NDR_CHECK(ndr_push_setup_relative_base_offset2($ndr, $varname));"); > } > $self->ParseElementPush($_, $ndr, $env, 0, 1) foreach (@{$struct->{ELEMENTS}}); >- >- if (defined($struct->{PROPERTIES}{relative_base})) { >- $self->pidl("NDR_CHECK(ndr_push_trailer_align($ndr, $struct->{ALIGN}));"); >- } > } > > ##################################################################### >-- >1.7.0.4 > > >From 6a14d31371e677c6f2336a882e83265d4cd53d37 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 18:19:13 +0100 >Subject: [PATCH 2/7] TODO test/review librpc/ndr: let ndr_push/pull_DATA_BLOB() look at LIBNDR_FLAG_REMAINING before LIBNDR_ALIGN_FLAGS > >metze >--- > librpc/ndr/ndr_basic.c | 9 +++++---- > 1 files changed, 5 insertions(+), 4 deletions(-) > >diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c >index 1d67e11..d8e1cf0 100644 >--- a/librpc/ndr/ndr_basic.c >+++ b/librpc/ndr/ndr_basic.c >@@ -1157,7 +1157,8 @@ _PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_ > */ > _PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob) > { >- if (ndr->flags & LIBNDR_ALIGN_FLAGS) { >+ if (ndr->flags & LIBNDR_FLAG_REMAINING) { >+ } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) { > if (ndr->flags & LIBNDR_FLAG_ALIGN2) { > blob.length = NDR_ALIGN(ndr, 2); > } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { >@@ -1181,7 +1182,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flag > { > uint32_t length = 0; > >- if (ndr->flags & LIBNDR_ALIGN_FLAGS) { >+ if (ndr->flags & LIBNDR_FLAG_REMAINING) { >+ length = ndr->data_size - ndr->offset; >+ } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) { > if (ndr->flags & LIBNDR_FLAG_ALIGN2) { > length = NDR_ALIGN(ndr, 2); > } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { >@@ -1192,8 +1195,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flag > if (ndr->data_size - ndr->offset < length) { > length = ndr->data_size - ndr->offset; > } >- } else if (ndr->flags & LIBNDR_FLAG_REMAINING) { >- length = ndr->data_size - ndr->offset; > } else { > NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length)); > } >-- >1.7.0.4 > > >From 3c5769088ffbdfa75090e07d7e743f334cb757a0 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 15:45:44 +0100 >Subject: [PATCH 3/7] librpc/ndr: ndr align relative pointers based on the given flags > >We used to do this only for the reverse relative pointers >and now we always do it. > >metze >--- > librpc/ndr/ndr.c | 26 ++++++++++++++++++++++++++ > 1 files changed, 26 insertions(+), 0 deletions(-) > >diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c >index 068e07f..14f9e06 100644 >--- a/librpc/ndr/ndr.c >+++ b/librpc/ndr/ndr.c >@@ -1179,6 +1179,32 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, co > return NDR_ERR_SUCCESS; > } > if (!(ndr->flags & LIBNDR_FLAG_RELATIVE_REVERSE)) { >+ uint32_t relative_offset; >+ size_t pad; >+ /* TODO: remove this hack and let the idl use FLAG_ALIGN2 explicit */ >+ size_t align = 2; >+ >+ if (ndr->offset < ndr->relative_base_offset) { >+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE, >+ "ndr_push_relative_ptr2_start ndr->offset(%u) < ndr->relative_base_offset(%u)", >+ ndr->offset, ndr->relative_base_offset); >+ } >+ >+ relative_offset = ndr->offset - ndr->relative_base_offset; >+ >+ if (ndr->flags & LIBNDR_FLAG_ALIGN2) { >+ align = 2; >+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { >+ align = 4; >+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) { >+ align = 8; >+ } >+ >+ pad = ndr_align_size(relative_offset, align); >+ if (pad) { >+ NDR_CHECK(ndr_push_zero(ndr, pad)); >+ } >+ > return ndr_push_relative_ptr2(ndr, p); > } > if (ndr->relative_end_offset == -1) { >-- >1.7.0.4 > > >From 6c56ceac5b40b7085844a251d0339d58d73aa1c8 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 15:57:21 +0100 >Subject: [PATCH 4/7] TODO test/review librpc: align nstring and nstring_array to 2 byte > >metze >--- > librpc/idl/idl_types.h | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h >index 3c6c12c..88ece20 100644 >--- a/librpc/idl/idl_types.h >+++ b/librpc/idl/idl_types.h >@@ -12,7 +12,7 @@ > /* > a null terminated UCS2 string > */ >-#define nstring [flag(STR_NULLTERM)] string >+#define nstring [flag(STR_NULLTERM|NDR_ALIGN2)] string > > /* > an ascii string prefixed with [offset] [length], both 32 bits >@@ -50,7 +50,7 @@ > /* > a null terminated UCS2 string > */ >-#define nstring_array [flag(STR_NULLTERM)] string_array >+#define nstring_array [flag(STR_NULLTERM|NDR_ALIGN2)] string_array > > #define NDR_NOALIGN LIBNDR_FLAG_NOALIGN > #define NDR_REMAINING LIBNDR_FLAG_REMAINING >-- >1.7.0.4 > > >From baa87a99d82bac05e4ab1cffb1372d413383bd7a Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 15:58:45 +0100 >Subject: [PATCH 5/7] TODO test/review librpc/ndr: remove align2 hack for relative pointers > >metze >--- > librpc/ndr/ndr.c | 6 +----- > 1 files changed, 1 insertions(+), 5 deletions(-) > >diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c >index 14f9e06..e7850d3 100644 >--- a/librpc/ndr/ndr.c >+++ b/librpc/ndr/ndr.c >@@ -1181,8 +1181,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, co > if (!(ndr->flags & LIBNDR_FLAG_RELATIVE_REVERSE)) { > uint32_t relative_offset; > size_t pad; >- /* TODO: remove this hack and let the idl use FLAG_ALIGN2 explicit */ >- size_t align = 2; >+ size_t align = 1; > > if (ndr->offset < ndr->relative_base_offset) { > return ndr_push_error(ndr, NDR_ERR_BUFSIZE, >@@ -1271,9 +1270,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, cons > /* the reversed offset is at the end of the main buffer */ > correct_offset = ndr->relative_end_offset - len; > >- /* TODO: remove this hack and let the idl use FLAG_ALIGN2 explicit */ >- align = 2; >- > if (ndr->flags & LIBNDR_FLAG_ALIGN2) { > align = 2; > } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { >-- >1.7.0.4 > > >From fc6f6e4ca192d9b660989d9de049a0461391ac6b Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 19:23:33 +0100 >Subject: [PATCH 6/7] spoolss.idl: align spoolss_PrinterEnumValues 'data' based on the type > >metze >--- > librpc/idl/spoolss.idl | 2 +- > librpc/ndr/ndr_spoolss_buf.c | 32 ++++++++++++++++++++++++++++++++ > librpc/ndr/ndr_spoolss_buf.h | 1 + > 3 files changed, 34 insertions(+), 1 deletions(-) > >diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl >index c74bd69..430b538 100644 >--- a/librpc/idl/spoolss.idl >+++ b/librpc/idl/spoolss.idl >@@ -2906,7 +2906,7 @@ 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,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING)] DATA_BLOB *data; >+ [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING|ndr_spoolss_PrinterEnumValues_align(r->type))] DATA_BLOB *data; > [value(data ? data->length : 0)] uint32 data_length; > } spoolss_PrinterEnumValues; > >diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c >index 2fd9d95..d1e4b41 100644 >--- a/librpc/ndr/ndr_spoolss_buf.c >+++ b/librpc/ndr/ndr_spoolss_buf.c >@@ -1441,3 +1441,35 @@ _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, co > ndr->depth--; > talloc_free(str); > } >+ >+_PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type) >+{ >+ switch(type) { >+ case REG_NONE: >+ return 0; >+ case REG_SZ: >+ return LIBNDR_FLAG_ALIGN2; >+ case REG_EXPAND_SZ: >+ return LIBNDR_FLAG_ALIGN2; >+ case REG_BINARY: >+ return 0; >+ case REG_DWORD: >+ return LIBNDR_FLAG_ALIGN4; >+ case REG_DWORD_BIG_ENDIAN: >+ return LIBNDR_FLAG_ALIGN4; >+ case REG_LINK: >+ return 0; >+ case REG_MULTI_SZ: >+ return LIBNDR_FLAG_ALIGN2; >+ case REG_RESOURCE_LIST: >+ return LIBNDR_FLAG_ALIGN2; >+ case REG_FULL_RESOURCE_DESCRIPTOR: >+ return LIBNDR_FLAG_ALIGN4; >+ case REG_RESOURCE_REQUIREMENTS_LIST: >+ return LIBNDR_FLAG_ALIGN2; >+ case REG_QWORD: >+ return LIBNDR_FLAG_ALIGN8; >+ } >+ >+ return 0; >+} >diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h >index 9db187d..c5938c0 100644 >--- a/librpc/ndr/ndr_spoolss_buf.h >+++ b/librpc/ndr/ndr_spoolss_buf.h >@@ -52,6 +52,7 @@ void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *na > enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r); > enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r); > _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r); >+_PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type); > > #undef _PRINTF_ATTRIBUTE > #define _PRINTF_ATTRIBUTE(a1, a2) >-- >1.7.0.4 > > >From a2db6f37ce462e19e76ba281382d3420ebc64a8a Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 22 Feb 2011 15:56:30 +0100 >Subject: [PATCH 7/7] spoolss.idl: align spoolss_DriverFileInfo relative pointer to 4 byte > >metze >--- > librpc/idl/spoolss.idl | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl >index 430b538..4599e3a 100644 >--- a/librpc/idl/spoolss.idl >+++ b/librpc/idl/spoolss.idl >@@ -1560,7 +1560,7 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") > spoolss_DriverOSVersion version; > [relative] nstring *driver_name; > [relative] nstring *architecture; >- [relative] [size_is(file_count)] spoolss_DriverFileInfo *file_info; >+ [relative,size_is(file_count),flag(NDR_ALIGN4)] spoolss_DriverFileInfo *file_info; > uint32 file_count; > [relative] nstring *monitor_name; > [relative] nstring *default_datatype; >-- >1.7.0.4 >
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
Actions:
View
Attachments on
bug 7567
:
6229
|
6230
|
6231
|
6250
|
6251
|
6258
|
6259
|
6263
|
6267
|
6271
|
6274