summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-06 13:52:39 +0100
committerGünther Deschner <gd@samba.org>2009-03-06 14:27:57 +0100
commitc6aea64e9223f89691e401c08ef82173c55883db (patch)
treeaf0cdc27bbbbfb693aa6dc7a17b32f7126f0d0e1
parent4941e80d0ec0ca61a0edaff15edeb2d58b5be769 (diff)
downloadsamba-c6aea64e9223f89691e401c08ef82173c55883db.tar.gz
samba-c6aea64e9223f89691e401c08ef82173c55883db.tar.bz2
samba-c6aea64e9223f89691e401c08ef82173c55883db.zip
spoolss: fix spoolss enum calls helper macro code after pointer changes.
Guenther
-rw-r--r--librpc/ndr/ndr_spoolss_buf.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index afc06be4e0..bcc2afaa6e 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -52,9 +52,9 @@
_r.out.needed = r->out.needed;\
_r.out.count = r->out.count;\
_r.out.result = r->out.result;\
- if (r->out.info && !r->in.buffer) {\
+ if (r->out.info && *r->out.info && !r->in.buffer) {\
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
- "SPOOLSS Buffer: r->out.info but there's no r->in.buffer");\
+ "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
}\
if (r->in.buffer) {\
DATA_BLOB _data_blob_info;\
@@ -65,7 +65,7 @@
struct __##fn __r;\
__r.in.level = r->in.level;\
__r.in.count = *r->out.count;\
- __r.out.info = r->out.info;\
+ __r.out.info = *r->out.info;\
NDR_CHECK(ndr_push___##fn(_ndr_info, flags, &__r)); \
}\
if (r->in.offered > _ndr_info->offset) {\
@@ -111,6 +111,8 @@
"SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
(unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
}\
+ NDR_PULL_ALLOC(ndr, r->out.info);\
+ ZERO_STRUCTP(r->out.info);\
} while(0)
#define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
@@ -120,12 +122,17 @@
_r.out.needed = r->out.needed;\
_r.out.count = r->out.count;\
NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
- r->out.info = NULL;\
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
+ NDR_PULL_ALLOC(ndr, r->out.info);\
+ }\
+ *r->out.info = NULL;\
r->out.needed = _r.out.needed;\
r->out.count = _r.out.count;\
r->out.result = _r.out.result;\
if (_r.out.info) {\
- struct ndr_pull *_ndr_info = ndr_pull_init_blob(_r.out.info, ndr, ndr->iconv_convenience);\
+ struct ndr_pull *_ndr_info;\
+ NDR_PULL_ALLOC(ndr, *r->out.info);\
+ _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
_ndr_info->flags= ndr->flags;\
if (r->in.offered != _ndr_info->data_size) {\
@@ -139,7 +146,7 @@
__r.in.count = *r->out.count;\
__r.out.info = NULL;\
NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
- r->out.info = __r.out.info;\
+ *r->out.info = __r.out.info;\
}\
}\
} while(0)