[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Mon Feb 28 18:13:02 MST 2011
The branch, master has been updated
via db11e65 spoolss.idl: align spoolss_DriverFileInfo relative pointer to 4 byte
via 3413306 spoolss.idl: align spoolss_PrinterEnumValues 'data' based on the type
via 23f6f44 TODO test/review librpc/ndr: remove align2 hack for relative pointers
via 712ef25 TODO test/review librpc: align nstring and nstring_array to 2 byte
via 84b884e librpc/ndr: ndr align relative pointers based on the given flags
via 6c3a49c TODO test/review librpc/ndr: let ndr_push/pull_DATA_BLOB() look at LIBNDR_FLAG_REMAINING before LIBNDR_ALIGN_FLAGS
via bd2b007 Revert "Fix alignment issues in SPOOLSS "BUFFER" marshalling."
via 87c4cea Fix compiler warning on casting -1 to uint32.
from 59a077d Fix some types
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit db11e6505e3205700fe323c550a72df825830f4b
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 15:56:30 2011 +0100
spoolss.idl: align spoolss_DriverFileInfo relative pointer to 4 byte
metze
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Tue Mar 1 02:12:37 CET 2011 on sn-devel-104
commit 341330600aebcec92fba64ea343888c15a0c3d44
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 19:23:33 2011 +0100
spoolss.idl: align spoolss_PrinterEnumValues 'data' based on the type
metze
commit 23f6f449792d889538e0d0028bb8fbd5c807b0da
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 15:58:45 2011 +0100
TODO test/review librpc/ndr: remove align2 hack for relative pointers
metze
commit 712ef2590d0ee59a4a659926cdf8aac6e968dfa8
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 15:57:21 2011 +0100
TODO test/review librpc: align nstring and nstring_array to 2 byte
metze
commit 84b884eb4bec38b721d6c38704f12d1d2c601bcb
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 15:45:44 2011 +0100
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
commit 6c3a49ced333988b21d86e47b2b1dd1a5957e15c
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 18:19:13 2011 +0100
TODO test/review librpc/ndr: let ndr_push/pull_DATA_BLOB() look at LIBNDR_FLAG_REMAINING before LIBNDR_ALIGN_FLAGS
metze
commit bd2b0076b4ea0be6e2f6730566736be7e338aafc
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 22 11:00:07 2011 +0100
Revert "Fix alignment issues in SPOOLSS "BUFFER" marshalling."
This reverts commit 187f695469071d0550613e037b36170facb85460.
This is the wrong fix.
metze
commit 87c4ceaf7c9ac98a35b5ed3de31191887d609d79
Author: Jeremy Allison <jra at samba.org>
Date: Mon Feb 28 14:56:03 2011 -0800
Fix compiler warning on casting -1 to uint32.
-----------------------------------------------------------------------
Summary of changes:
librpc/idl/idl_types.h | 4 +-
librpc/idl/spoolss.idl | 4 +-
librpc/ndr/ndr.c | 28 +++++++++++++++++++++++--
librpc/ndr/ndr_basic.c | 9 ++++---
librpc/ndr/ndr_spoolss_buf.c | 32 ++++++++++++++++++++++++++++++
librpc/ndr/ndr_spoolss_buf.h | 1 +
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 7 ------
source3/printing/printing.c | 6 ++--
8 files changed, 70 insertions(+), 21 deletions(-)
Changeset truncated at 500 lines:
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
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index c74bd69..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;
@@ -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.c b/librpc/ndr/ndr.c
index 068e07f..e7850d3 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1179,6 +1179,31 @@ _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;
+ size_t align = 1;
+
+ 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) {
@@ -1245,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) {
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));
}
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)
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}));");
- }
}
#####################################################################
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index ce112bb..a890814 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -527,8 +527,8 @@ uint32 sysjob_to_jobid(int unix_jobid)
****************************************************************************/
static const struct {
- uint32 lpq_status;
- uint32 spoolss_status;
+ uint32_t lpq_status;
+ uint32_t spoolss_status;
} lpq_to_spoolss_status_map[] = {
{ LPQ_QUEUED, JOB_STATUS_QUEUED },
{ LPQ_PAUSED, JOB_STATUS_PAUSED },
@@ -541,7 +541,7 @@ static const struct {
{ LPQ_DELETED, JOB_STATUS_DELETED },
{ LPQ_BLOCKED, JOB_STATUS_BLOCKED_DEVQ },
{ LPQ_USER_INTERVENTION, JOB_STATUS_USER_INTERVENTION },
- { -1, 0 }
+ { (uint32_t)-1, 0 }
};
/* Convert a lpq status value stored in printing.tdb into the
--
Samba Shared Repository
More information about the samba-cvs
mailing list