summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-06-06 09:59:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:42 -0500
commit9a831a3963d9784a470b7d3971b54bd9bde3d7c3 (patch)
tree0312550c7dae4e894645e7fc2a4c2b9acf5c29e1 /source4/librpc
parentaa5ff56d89814bc92decc7e9db6e2ed8cf8630b7 (diff)
downloadsamba-9a831a3963d9784a470b7d3971b54bd9bde3d7c3.tar.gz
samba-9a831a3963d9784a470b7d3971b54bd9bde3d7c3.tar.bz2
samba-9a831a3963d9784a470b7d3971b54bd9bde3d7c3.zip
r7328: fix GetPrinterData and SetPrinterData, with zero length subcontexts
metze (This used to be commit 73d597bacf83492ed3da2307dd6785548b903b39)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/idl/spoolss.idl32
-rw-r--r--source4/librpc/ndr/ndr_spoolss_buf.c91
2 files changed, 118 insertions, 5 deletions
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 9808837422..201226d548 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -652,7 +652,18 @@
[default,flag(NDR_REMAINING)] DATA_BLOB data;
} spoolss_PrinterData;
- WERROR spoolss_GetPrinterData(
+ [noopnum,nopush,noprint,public] WERROR _spoolss_GetPrinterData(
+ [in,ref] policy_handle *handle,
+ [in] unistr value_name,
+ [out] spoolss_PrinterDataType type,
+ [out] DATA_BLOB data,
+ [in,out,ref] uint32 *buf_size
+ );
+ [noopnum,nopush,noprint,public] void __spoolss_GetPrinterData(
+ [in] spoolss_PrinterDataType type,
+ [out,switch_is(type)] spoolss_PrinterData data
+ );
+ [nopull] WERROR spoolss_GetPrinterData(
[in,ref] policy_handle *handle,
[in] unistr value_name,
[out] spoolss_PrinterDataType type,
@@ -662,12 +673,23 @@
/******************/
/* Function: 0x1b */
- WERROR spoolss_SetPrinterData(
+ [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData(
[in,ref] policy_handle *handle,
[in] unistr value_name,
- [in] uint32 type,
- [in] DATA_BLOB buffer,
- [in] uint32 real_len
+ [in] spoolss_PrinterDataType type,
+ [in] DATA_BLOB data,
+ [in] uint32 _buf_size
+ );
+ [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData(
+ [in] spoolss_PrinterDataType type,
+ [out,switch_is(type)] spoolss_PrinterData data
+ );
+ [nopush] WERROR spoolss_SetPrinterData(
+ [in,ref] policy_handle *handle,
+ [in] unistr value_name,
+ [in] spoolss_PrinterDataType type,
+ [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
+ [in,value(ndr_size_spoolss_PrinterData(&r->in.data,r->in.type,flags))] uint32 _buf_size
);
/******************/
diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c
index 26113cca38..97eaaedee4 100644
--- a/source4/librpc/ndr/ndr_spoolss_buf.c
+++ b/source4/librpc/ndr/ndr_spoolss_buf.c
@@ -350,3 +350,94 @@ uint32_t ndr_size_spoolss_EnumPrinterProcessors_info(TALLOC_CTX *mem_ctx, uint32
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcessors);
}
+
+/*
+ spoolss_GetPrinterData
+*/
+NTSTATUS ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
+{
+ struct _spoolss_GetPrinterData _r;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ _r.in.handle = r->in.handle;
+ _r.in.value_name= r->in.value_name;
+ _r.in.buf_size = r->in.buf_size;
+ _r.out.type = r->out.type;
+ _r.out.data = data_blob(NULL,0),
+ _r.out.buf_size = r->out.buf_size;
+ NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
+ r->in.handle = _r.in.handle;
+ r->in.value_name= _r.in.value_name;
+ r->in.buf_size = _r.in.buf_size;
+ }
+ if (flags & NDR_OUT) {
+ _r.in.handle = r->in.handle;
+ _r.in.value_name= r->in.value_name;
+ _r.in.buf_size = r->in.buf_size;
+ _r.out.type = r->out.type;
+ _r.out.data = data_blob(NULL,0),
+ _r.out.buf_size = r->out.buf_size;
+ _r.out.result = r->out.result;
+ NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
+ r->out.type = _r.out.type;
+ ZERO_STRUCT(r->out.data);
+ r->out.buf_size = _r.out.buf_size;
+ r->out.result = _r.out.result;
+ if (_r.out.data.length > 0) {
+ struct __spoolss_GetPrinterData __r;
+ struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr);\
+ if (!_ndr_data) return NT_STATUS_NO_MEMORY;\
+ _ndr_data->flags= ndr->flags;\
+ __r.in.type = r->out.type;
+ __r.out.data = r->out.data;
+ NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r));
+ r->out.data = __r.out.data;
+ } else {
+ r->out.type = SPOOLSS_PRINTER_DATA_TYPE_NULL;
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+/*
+ spoolss_SetPrinterData
+*/
+NTSTATUS ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, struct spoolss_SetPrinterData *r)
+{
+ struct _spoolss_SetPrinterData _r;
+ if (flags & NDR_IN) {
+ struct ndr_push *_ndr_data;
+ struct __spoolss_SetPrinterData __r;
+ DATA_BLOB _data_blob_data;
+
+ _ndr_data = ndr_push_init_ctx(ndr);\
+ if (!_ndr_data) return NT_STATUS_NO_MEMORY;\
+ _ndr_data->flags= ndr->flags;\
+
+ __r.in.type = r->in.type;
+ __r.out.data = r->in.data;
+ NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r));
+ _data_blob_data = ndr_push_blob(_ndr_data);
+
+ r->in._buf_size = _data_blob_data.length;
+
+ _r.in.handle = r->in.handle;
+ _r.in.value_name= r->in.value_name;
+ _r.in.type = r->in.type;
+ _r.in.data = _data_blob_data;
+ _r.in._buf_size = r->in._buf_size;
+ _r.out.result = r->out.result;
+ NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
+ }
+ if (flags & NDR_OUT) {
+ _r.in.handle = r->in.handle;
+ _r.in.value_name= r->in.value_name;
+ _r.in.type = r->in.type;
+ _r.in.data = data_blob(NULL,0),
+ _r.in._buf_size = r->in._buf_size;
+ _r.out.result = r->out.result;
+ NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
+ }
+ return NT_STATUS_OK;
+}