diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-02-22 19:23:33 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-02-28 15:54:13 -0800 |
commit | 341330600aebcec92fba64ea343888c15a0c3d44 (patch) | |
tree | 537c35a5589ca8427515d5b020678aa3c6e01a3e /librpc | |
parent | 23f6f449792d889538e0d0028bb8fbd5c807b0da (diff) | |
download | samba-341330600aebcec92fba64ea343888c15a0c3d44.tar.gz samba-341330600aebcec92fba64ea343888c15a0c3d44.tar.bz2 samba-341330600aebcec92fba64ea343888c15a0c3d44.zip |
spoolss.idl: align spoolss_PrinterEnumValues 'data' based on the type
metze
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/idl/spoolss.idl | 2 | ||||
-rw-r--r-- | librpc/ndr/ndr_spoolss_buf.c | 32 | ||||
-rw-r--r-- | 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 c74bd69a2f..430b538123 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 2fd9d95d2b..d1e4b41570 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 9db187dc7d..c5938c00c8 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) |