summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-04-02 06:51:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:23 -0500
commit3abce73193dcc393fee5ca6e326678009e87cbd7 (patch)
treeb8d95131444612aa46964eb56335bc508b241889 /source4/librpc
parent0ba6108bcdd07d32443c3c6608f5e0f74d67cfc1 (diff)
downloadsamba-3abce73193dcc393fee5ca6e326678009e87cbd7.tar.gz
samba-3abce73193dcc393fee5ca6e326678009e87cbd7.tar.bz2
samba-3abce73193dcc393fee5ca6e326678009e87cbd7.zip
r6179: - add new spoolss tests for all spoolss_Enum*() calls which didn't need
a handle as parameter, EnumPorts EnumPrinterDrivers EnumMonitors EnumPrintProcessors EnumPrinters we now do cross checks between the different info levels and sore the results in a global context, so that we later can add cross checks between the different object types - add idl for EnumMonitors and EnumPrintProcessors metze (This used to be commit 92a3721bc7a28d521090b10eb3b1eed089036432)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/idl/spoolss.idl51
-rw-r--r--source4/librpc/ndr/ndr_spoolss_buf.c274
2 files changed, 323 insertions, 2 deletions
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 79b8d5b7cc..d5bfd687ac 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -243,6 +243,7 @@
[case(7)] spoolss_PrinterInfo7 info7;
[case(8)] spoolss_DeviceModeInfo info8;
[case(9)] spoolss_DeviceModeInfo info9;
+ [default];
} spoolss_PrinterInfo;
/******************/
@@ -315,6 +316,7 @@
typedef [nodiscriminant,public] union {
[case(1)] spoolss_JobInfo1 info1;
+ [default];
} spoolss_JobInfo;
/******************/
@@ -463,6 +465,7 @@
[case(4)] spoolss_DriverInfo4 info4;
[case(5)] spoolss_DriverInfo5 info5;
[case(6)] spoolss_DriverInfo6 info6;
+ [default];
} spoolss_DriverInfo;
/******************/
@@ -504,7 +507,25 @@
/******************/
/* Function: 0x0f */
- WERROR spoolss_EnumPrintProcessors(
+ typedef struct {
+ [relative] nstring *print_processor_name;
+ } spoolss_PrintProcessorInfo1;
+
+ typedef [nodiscriminant,public] union {
+ [case(1)] spoolss_PrintProcessorInfo1 info1;
+ [default];
+ } spoolss_PrintProcessorInfo;
+
+ [noprint,nopull,nopush] WERROR spoolss_EnumPrintProcessors(
+ [in] unistr *servername,
+ [in] unistr *environment,
+ [in] uint32 level,
+ [in] DATA_BLOB *buffer,
+ /* [out,subcontext(4),switch_is(level)] spoolss_PrintProcessorInfo *info[count],*/
+ [out,subcontext(4),switch_is(level)] spoolss_PrintProcessorInfo **info,
+ /* [out,subcontext(4),flag(NDR_REMAINING)] DATA_BLOB *info,*/
+ [in,out,ref] uint32 *buf_size,
+ [out] uint32 count
);
/******************/
@@ -668,6 +689,7 @@
typedef [nodiscriminant,public] union {
[case(1)] spoolss_FormInfo1 info1;
+ [default];
} spoolss_FormInfo;
/******************/
@@ -704,6 +726,7 @@
typedef [nodiscriminant,public] union {
[case(1)] spoolss_PortInfo1 info1;
[case(2)] spoolss_PortInfo2 info2;
+ [default];
} spoolss_PortInfo;
/******************/
@@ -720,7 +743,31 @@
/******************/
/* Function: 0x24 */
- WERROR spoolss_EnumMonitors(
+ typedef struct {
+ [relative] nstring *monitor_name;
+ } spoolss_MonitorInfo1;
+
+ typedef struct {
+ [relative] nstring *monitor_name;
+ [relative] nstring *environment;
+ [relative] nstring *dll_name;
+ } spoolss_MonitorInfo2;
+
+ typedef [nodiscriminant,public] union {
+ [case(1)] spoolss_MonitorInfo1 info1;
+ [case(2)] spoolss_MonitorInfo2 info2;
+ [default];
+ } spoolss_MonitorInfo;
+
+ [noprint,nopull,nopush] WERROR spoolss_EnumMonitors(
+ [in] unistr *servername,
+ [in] uint32 level,
+ [in] DATA_BLOB *buffer,
+ /* [out,subcontext(4),switch_is(level)] spoolss_MonitorInfo *info[count], */
+ [out,subcontext(4),switch_is(level)] spoolss_MonitorInfo **info,
+ /* [out,subcontext(4),flag(NDR_REMAINING)] DATA_BLOB *info,*/
+ [in,out,ref] uint32 *buf_size,
+ [out] uint32 count
);
/******************/
diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c
index ecb8f374c6..4da604b187 100644
--- a/source4/librpc/ndr/ndr_spoolss_buf.c
+++ b/source4/librpc/ndr/ndr_spoolss_buf.c
@@ -711,3 +711,277 @@ void ndr_print_spoolss_EnumPorts(struct ndr_print *ndr, const char *name, int fl
}
ndr->depth--;
}
+
+/*
+ spoolss_EnumMonitors
+*/
+NTSTATUS ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, struct spoolss_EnumMonitors *r)
+{
+ if (!(flags & NDR_IN)) goto ndr_out;
+
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.servername));
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ if (r->in.servername) {
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.servername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.buffer));
+ if (r->in.buffer) {
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.buffer));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.buf_size));
+ ndr_out:
+ if (!(flags & NDR_OUT)) goto done;
+
+ NDR_SPOOLSS_PUSH_ENUM_OUT(spoolss_EnumMonitors,spoolss_MonitorInfo);
+
+ done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
+{
+ uint32_t _ptr_servername;
+ uint32_t _ptr_buffer;
+ uint32_t _ptr_info;
+ if (!(flags & NDR_IN)) goto ndr_out;
+
+ ZERO_STRUCT(r->out);
+
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_servername));
+ if (_ptr_servername) {
+ NDR_ALLOC(ndr, r->in.servername);
+ } else {
+ r->in.servername = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ if (r->in.servername) {
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.servername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.level));
+ NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_buffer));
+ if (_ptr_buffer) {
+ NDR_ALLOC(ndr, r->in.buffer);
+ } else {
+ r->in.buffer = NULL;
+ }
+ if (r->in.buffer) {
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buffer));
+ }
+ NDR_ALLOC(ndr, r->in.buf_size);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buf_size));
+ NDR_ALLOC(ndr, r->out.buf_size);
+ *r->out.buf_size = *r->in.buf_size;
+ ndr_out:
+ if (!(flags & NDR_OUT)) goto done;
+
+ NDR_SPOOLSS_PULL_ENUM_OUT(spoolss_EnumMonitors,spoolss_MonitorInfo);
+
+ done:
+
+ return NT_STATUS_OK;
+}
+
+void ndr_print_spoolss_EnumMonitors(struct ndr_print *ndr, const char *name, int flags, struct spoolss_EnumMonitors *r)
+{
+ ndr_print_struct(ndr, name, "spoolss_EnumMonitors");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "spoolss_EnumMonitors");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "servername", r->in.servername);
+ ndr->depth++;
+ if (r->in.servername) {
+ ndr_print_string(ndr, "servername", r->in.servername);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "level", r->in.level);
+ ndr_print_ptr(ndr, "buffer", r->in.buffer);
+ ndr->depth++;
+ if (r->in.buffer) {
+ ndr_print_DATA_BLOB(ndr, "buffer", *r->in.buffer);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "buf_size", r->in.buf_size);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "buf_size", *r->in.buf_size);
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ NDR_SPOOLSS_PRINT_ENUM_OUT(spoolss_EnumMonitors,spoolss_MonitorInfo);
+ }
+ ndr->depth--;
+}
+
+/*
+ spoolss_EnumPrintProcessors
+*/
+NTSTATUS ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
+{
+ if (!(flags & NDR_IN)) goto ndr_out;
+
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.servername));
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ if (r->in.servername) {
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.servername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.environment));
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ if (r->in.environment) {
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.environment));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.buffer));
+ if (r->in.buffer) {
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.buffer));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.buf_size));
+ ndr_out:
+ if (!(flags & NDR_OUT)) goto done;
+
+ NDR_SPOOLSS_PUSH_ENUM_OUT(spoolss_EnumPrintProcessors,spoolss_PrintProcessorInfo);
+
+ done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
+{
+ uint32_t _ptr_servername;
+ uint32_t _ptr_environment;
+ uint32_t _ptr_buffer;
+ uint32_t _ptr_info;
+ if (!(flags & NDR_IN)) goto ndr_out;
+
+ ZERO_STRUCT(r->out);
+
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_servername));
+ if (_ptr_servername) {
+ NDR_ALLOC(ndr, r->in.servername);
+ } else {
+ r->in.servername = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ if (r->in.servername) {
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.servername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_environment));
+ if (_ptr_environment) {
+ NDR_ALLOC(ndr, r->in.environment);
+ } else {
+ r->in.environment = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ { uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_LEN4);
+ if (r->in.environment) {
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.environment));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.level));
+ NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_buffer));
+ if (_ptr_buffer) {
+ NDR_ALLOC(ndr, r->in.buffer);
+ } else {
+ r->in.buffer = NULL;
+ }
+ if (r->in.buffer) {
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buffer));
+ }
+ NDR_ALLOC(ndr, r->in.buf_size);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buf_size));
+ NDR_ALLOC(ndr, r->out.buf_size);
+ *r->out.buf_size = *r->in.buf_size;
+ ndr_out:
+ if (!(flags & NDR_OUT)) goto done;
+
+ NDR_SPOOLSS_PULL_ENUM_OUT(spoolss_EnumPrintProcessors,spoolss_PrintProcessorInfo);
+
+ done:
+
+ return NT_STATUS_OK;
+}
+
+void ndr_print_spoolss_EnumPrintProcessors(struct ndr_print *ndr, const char *name, int flags, struct spoolss_EnumPrintProcessors *r)
+{
+ ndr_print_struct(ndr, name, "spoolss_EnumPrintProcessors");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "spoolss_EnumPrintProcessors");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "servername", r->in.servername);
+ ndr->depth++;
+ if (r->in.servername) {
+ ndr_print_string(ndr, "servername", r->in.servername);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "environment", r->in.environment);
+ ndr->depth++;
+ if (r->in.environment) {
+ ndr_print_string(ndr, "environment", r->in.environment);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "level", r->in.level);
+ ndr_print_ptr(ndr, "buffer", r->in.buffer);
+ ndr->depth++;
+ if (r->in.buffer) {
+ ndr_print_DATA_BLOB(ndr, "buffer", *r->in.buffer);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "buf_size", r->in.buf_size);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "buf_size", *r->in.buf_size);
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ NDR_SPOOLSS_PRINT_ENUM_OUT(spoolss_EnumPrintProcessors,spoolss_PrintProcessorInfo);
+ }
+ ndr->depth--;
+}