summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-12-12 02:52:41 +0100
committerGünther Deschner <gd@samba.org>2009-12-14 10:39:34 +0100
commite316624ddb8d4e178b03b315bfafd793e6c297c8 (patch)
tree9ca063db63742640ae309741494df3f1c616b9d8
parent5ae61cfbc281f346fd3712a975c5796f9cfbc6c2 (diff)
downloadsamba-e316624ddb8d4e178b03b315bfafd793e6c297c8.tar.gz
samba-e316624ddb8d4e178b03b315bfafd793e6c297c8.tar.bz2
samba-e316624ddb8d4e178b03b315bfafd793e6c297c8.zip
spoolss: fix spoolss_PrinterData size calculation.
Currently we were crashing in EnumPrinterDataEx when an e.g. an empty (NULL) string for a separator file was returned. Guenther
-rw-r--r--librpc/gen_ndr/ndr_spoolss.c5
-rw-r--r--librpc/gen_ndr/ndr_spoolss.h1
-rw-r--r--librpc/gen_ndr/spoolss.h2
-rw-r--r--librpc/idl/spoolss.idl2
-rw-r--r--librpc/ndr/ndr_spoolss_buf.c8
-rw-r--r--librpc/ndr/ndr_spoolss_buf.h1
6 files changed, 11 insertions, 8 deletions
diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c
index 388d707d3b..f4cf9687bd 100644
--- a/librpc/gen_ndr/ndr_spoolss.c
+++ b/librpc/gen_ndr/ndr_spoolss.c
@@ -15724,11 +15724,6 @@ _PUBLIC_ void ndr_print_spoolss_PrinterData(struct ndr_print *ndr, const char *n
}
}
-_PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
-{
- return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);
-}
-
static enum ndr_err_code ndr_push_spoolss_FormFlags(struct ndr_push *ndr, int ndr_flags, enum spoolss_FormFlags r)
{
NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h
index 2fb6e9ffea..b368006572 100644
--- a/librpc/gen_ndr/ndr_spoolss.h
+++ b/librpc/gen_ndr/ndr_spoolss.h
@@ -433,7 +433,6 @@ size_t ndr_size_spoolss_OSVersionEx(const struct spoolss_OSVersionEx *r, struct
enum ndr_err_code ndr_push_spoolss_PrinterData(struct ndr_push *ndr, int ndr_flags, const union spoolss_PrinterData *r);
enum ndr_err_code ndr_pull_spoolss_PrinterData(struct ndr_pull *ndr, int ndr_flags, union spoolss_PrinterData *r);
void ndr_print_spoolss_PrinterData(struct ndr_print *ndr, const char *name, const union spoolss_PrinterData *r);
-size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags);
void ndr_print_spoolss_FormFlags(struct ndr_print *ndr, const char *name, enum spoolss_FormFlags r);
void ndr_print_spoolss_FormSize(struct ndr_print *ndr, const char *name, const struct spoolss_FormSize *r);
void ndr_print_spoolss_FormArea(struct ndr_print *ndr, const char *name, const struct spoolss_FormArea *r);
diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h
index 146dde5e2d..5b88e08ac3 100644
--- a/librpc/gen_ndr/spoolss.h
+++ b/librpc/gen_ndr/spoolss.h
@@ -1569,7 +1569,7 @@ union spoolss_PrinterData {
uint32_t value;/* [case(REG_DWORD)] */
const char ** string_array;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(REG_MULTI_SZ)] */
DATA_BLOB data;/* [flag(LIBNDR_FLAG_REMAINING),default] */
-}/* [gensize,public,nodiscriminant] */;
+}/* [nodiscriminant,public] */;
enum spoolss_FormFlags
#ifndef USE_UINT_ENUMS
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index 14ddba8173..1695c5a8cc 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
@@ -1524,7 +1524,7 @@ import "misc.idl", "security.idl", "winreg.idl";
uint8 reserved;
} spoolss_OSVersionEx;
- typedef [nodiscriminant,public,gensize] union {
+ typedef [nodiscriminant,public] union {
[case(REG_NONE)];
[case(REG_SZ)] nstring string;
[case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index 853d9aaac6..b8d6f83ab6 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -1355,3 +1355,11 @@ void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const unio
}
}
+_PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
+{
+ if (!r) {
+ return 0;
+ }
+ return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);
+}
+
diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h
index c0c553b241..a53ab7bb8c 100644
--- a/librpc/ndr/ndr_spoolss_buf.h
+++ b/librpc/ndr/ndr_spoolss_buf.h
@@ -53,6 +53,7 @@ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct
_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r);
_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r);
void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r);
+size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags);
#undef _PRINTF_ATTRIBUTE
#define _PRINTF_ATTRIBUTE(a1, a2)