summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-17 04:56:59 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-17 04:56:59 +0000
commitd1feb4c6d56b37d045a329fab98857fb36bd42c1 (patch)
treec2f7b2022f3cda522104769de7b88c9bbe18ec38 /source4/librpc/ndr
parentbf48b6e69a638dc78ab119424e27adc0ccc6c610 (diff)
downloadsamba-d1feb4c6d56b37d045a329fab98857fb36bd42c1.tar.gz
samba-d1feb4c6d56b37d045a329fab98857fb36bd42c1.tar.bz2
samba-d1feb4c6d56b37d045a329fab98857fb36bd42c1.zip
call OpenPrinterEx on each printer on the server, and then call
GetPrinter with all info levels on each printer (This used to be commit 136b3cfc0460315e924c3d9c8328c1850fc21fba)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr.c29
-rw-r--r--source4/librpc/ndr/ndr_spoolss.c23
-rw-r--r--source4/librpc/ndr/ndr_spoolss.h17
-rw-r--r--source4/librpc/ndr/ndr_spoolss_buf.c6
4 files changed, 51 insertions, 24 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 97eee70dfe..5f941c703d 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -533,3 +533,32 @@ NTSTATUS ndr_push_relative(struct ndr_push *ndr, int ndr_flags, const void *p,
}
return NT_STATUS_OK;
}
+
+
+/*
+ pull a union from a blob using NDR
+*/
+NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint16 level, void *p,
+ NTSTATUS (*fn)(struct ndr_pull *, int ndr_flags, uint16 *, void *))
+{
+ struct ndr_pull *ndr;
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ return fn(ndr, NDR_SCALARS|NDR_BUFFERS, &level, p);
+}
+
+/*
+ pull a struct from a blob using NDR
+*/
+NTSTATUS ndr_pull_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+ NTSTATUS (*fn)(struct ndr_pull *, int ndr_flags, void *))
+{
+ struct ndr_pull *ndr;
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ return fn(ndr, NDR_SCALARS|NDR_BUFFERS, p);
+}
diff --git a/source4/librpc/ndr/ndr_spoolss.c b/source4/librpc/ndr/ndr_spoolss.c
index 5b64f9067a..2e2e911311 100644
--- a/source4/librpc/ndr/ndr_spoolss.c
+++ b/source4/librpc/ndr/ndr_spoolss.c
@@ -200,7 +200,7 @@ done:
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_spoolss_PrinterEnum(struct ndr_push *ndr, int ndr_flags, uint16 level, union spoolss_PrinterEnum *r)
+NTSTATUS ndr_push_spoolss_PrinterInfo(struct ndr_push *ndr, int ndr_flags, uint16 level, union spoolss_PrinterInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_push_struct_start(ndr));
@@ -362,9 +362,9 @@ NTSTATUS ndr_push_spoolss_GetPrinter(struct ndr_push *ndr, struct spoolss_GetPri
NDR_CHECK(ndr_push_uint32(ndr, r->in.level));
NDR_CHECK(ndr_push_ptr(ndr, r->in.buffer));
if (r->in.buffer) {
- NDR_CHECK(ndr_push_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.buffer));
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, *r->in.buffer));
}
- NDR_CHECK(ndr_push_uint32(ndr, r->in.offered));
+ NDR_CHECK(ndr_push_uint32(ndr, *r->in.buf_size));
return NT_STATUS_OK;
}
@@ -1168,7 +1168,7 @@ done:
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_spoolss_PrinterEnum(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union spoolss_PrinterEnum *r)
+NTSTATUS ndr_pull_spoolss_PrinterInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union spoolss_PrinterInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_struct_start(ndr));
@@ -1334,11 +1334,10 @@ NTSTATUS ndr_pull_spoolss_GetPrinter(struct ndr_pull *ndr, struct spoolss_GetPri
r->out.buffer = NULL;
}
if (r->out.buffer) {
- NDR_CHECK(ndr_pull_uint8_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.buffer));
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, r->out.buffer));
}
- NDR_CHECK(ndr_pull_uint32(ndr, &r->out.needed));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->out.returned));
- NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+ NDR_CHECK(ndr_pull_uint32(ndr, r->out.buf_size));
+ NDR_CHECK(ndr_pull_WERROR(ndr, &r->out.result));
return NT_STATUS_OK;
}
@@ -1486,7 +1485,7 @@ NTSTATUS ndr_pull_spoolss_1c(struct ndr_pull *ndr, struct spoolss_1c *r)
NTSTATUS ndr_pull_spoolss_ClosePrinter(struct ndr_pull *ndr, struct spoolss_ClosePrinter *r)
{
NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle));
- NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+ NDR_CHECK(ndr_pull_WERROR(ndr, &r->out.result));
return NT_STATUS_OK;
}
@@ -1767,7 +1766,7 @@ NTSTATUS ndr_pull_spoolss_44(struct ndr_pull *ndr, struct spoolss_44 *r)
NTSTATUS ndr_pull_spoolss_OpenPrinterEx(struct ndr_pull *ndr, struct spoolss_OpenPrinterEx *r)
{
NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle));
- NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+ NDR_CHECK(ndr_pull_WERROR(ndr, &r->out.result));
return NT_STATUS_OK;
}
@@ -2112,9 +2111,9 @@ void ndr_print_spoolss_PrinterInfo7(struct ndr_print *ndr, const char *name, str
ndr->depth--;
}
-void ndr_print_spoolss_PrinterEnum(struct ndr_print *ndr, const char *name, uint16 level, union spoolss_PrinterEnum *r)
+void ndr_print_spoolss_PrinterInfo(struct ndr_print *ndr, const char *name, uint16 level, union spoolss_PrinterInfo *r)
{
- ndr_print_union(ndr, name, level, "spoolss_PrinterEnum");
+ ndr_print_union(ndr, name, level, "spoolss_PrinterInfo");
switch (level) {
case 1:
ndr_print_spoolss_PrinterInfo1(ndr, "info1", &r->info1);
diff --git a/source4/librpc/ndr/ndr_spoolss.h b/source4/librpc/ndr/ndr_spoolss.h
index 60738b494a..61aac510d9 100644
--- a/source4/librpc/ndr/ndr_spoolss.h
+++ b/source4/librpc/ndr/ndr_spoolss.h
@@ -96,7 +96,7 @@ struct spoolss_PrinterInfo7 {
uint32 action;
};
-union spoolss_PrinterEnum {
+union spoolss_PrinterInfo {
/* [case(1)] */ struct spoolss_PrinterInfo1 info1;
/* [case(2)] */ struct spoolss_PrinterInfo2 info2;
/* [case(3)] */ struct spoolss_PrinterInfo3 info3;
@@ -212,15 +212,14 @@ struct spoolss_GetPrinter {
struct {
struct policy_handle *handle;
uint32 level;
- struct uint8_buf *buffer;
- uint32 offered;
+ DATA_BLOB *buffer;
+ uint32 *buf_size;
} in;
struct {
- struct uint8_buf *buffer;
- uint32 needed;
- uint32 returned;
- NTSTATUS result;
+ DATA_BLOB *buffer;
+ uint32 *buf_size;
+ WERROR result;
} out;
};
@@ -434,7 +433,7 @@ struct spoolss_ClosePrinter {
struct {
struct policy_handle *handle;
- NTSTATUS result;
+ WERROR result;
} out;
};
@@ -864,7 +863,7 @@ struct spoolss_OpenPrinterEx {
struct {
struct policy_handle *handle;
- NTSTATUS result;
+ WERROR result;
} out;
};
diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c
index c53a691417..c06d6704b2 100644
--- a/source4/librpc/ndr/ndr_spoolss_buf.c
+++ b/source4/librpc/ndr/ndr_spoolss_buf.c
@@ -24,9 +24,9 @@
#include "includes.h"
-NTSTATUS pull_spoolss_PrinterEnumArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+NTSTATUS pull_spoolss_PrinterInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
uint16 level, uint32 count,
- union spoolss_PrinterEnum **info)
+ union spoolss_PrinterInfo **info)
{
int i;
struct ndr_pull *ndr;
@@ -36,7 +36,7 @@ NTSTATUS pull_spoolss_PrinterEnumArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
}
NDR_ALLOC_N(ndr, *info, count);
for (i=0;i<count;i++) {
- NDR_CHECK(ndr_pull_spoolss_PrinterEnum(ndr, NDR_SCALARS|NDR_BUFFERS, &level, &(*info)[i]));
+ NDR_CHECK(ndr_pull_spoolss_PrinterInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &level, &(*info)[i]));
}
return NT_STATUS_OK;
}