summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-17 03:38:13 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-17 03:38:13 +0000
commitbf48b6e69a638dc78ab119424e27adc0ccc6c610 (patch)
tree60b76902359884ad7c708cec467bee0baf6e2898 /source4/librpc
parent90916de4a5303601a59938237a551d976cde0589 (diff)
downloadsamba-bf48b6e69a638dc78ab119424e27adc0ccc6c610.tar.gz
samba-bf48b6e69a638dc78ab119424e27adc0ccc6c610.tar.bz2
samba-bf48b6e69a638dc78ab119424e27adc0ccc6c610.zip
added OpenPrinter and a test function. Note that the Samba3 structure
for OpenPrinter was wrong. (This used to be commit 186ddbbf8774d0960852ea9186c8e4e6f7be7a0f)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/idl/spoolss.idl7
-rw-r--r--source4/librpc/ndr/ndr_spoolss.c20
-rw-r--r--source4/librpc/ndr/ndr_spoolss.h11
-rw-r--r--source4/librpc/rpc/dcerpc.c7
-rw-r--r--source4/librpc/rpc/rpc_spoolss.c16
5 files changed, 43 insertions, 18 deletions
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 515ac0fd51..be6f9a8f51 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -128,7 +128,12 @@
/******************/
/* Function: 0x01 */
- NTSTATUS spoolss_01(
+ WERROR spoolss_OpenPrinter(
+ [in] unistr *server,
+ [in] unistr *printer,
+ [in] DATA_BLOB *buffer,
+ [in] uint32 access_mask,
+ [out,ref] policy_handle *handle
);
/******************/
diff --git a/source4/librpc/ndr/ndr_spoolss.c b/source4/librpc/ndr/ndr_spoolss.c
index f88e46890a..5b64f9067a 100644
--- a/source4/librpc/ndr/ndr_spoolss.c
+++ b/source4/librpc/ndr/ndr_spoolss.c
@@ -292,8 +292,21 @@ NTSTATUS ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, struct spoolss_Enum
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_spoolss_01(struct ndr_push *ndr, struct spoolss_01 *r)
+NTSTATUS ndr_push_spoolss_OpenPrinter(struct ndr_push *ndr, struct spoolss_OpenPrinter *r)
{
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.server));
+ if (r->in.server) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.server));
+ }
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.printer));
+ if (r->in.printer) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.printer));
+ }
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.buffer));
+ if (r->in.buffer) {
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, *r->in.buffer));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.access_mask));
return NT_STATUS_OK;
}
@@ -1249,9 +1262,10 @@ NTSTATUS ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, struct spoolss_Enum
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_spoolss_01(struct ndr_pull *ndr, struct spoolss_01 *r)
+NTSTATUS ndr_pull_spoolss_OpenPrinter(struct ndr_pull *ndr, struct spoolss_OpenPrinter *r)
{
- NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle));
+ NDR_CHECK(ndr_pull_WERROR(ndr, &r->out.result));
return NT_STATUS_OK;
}
diff --git a/source4/librpc/ndr/ndr_spoolss.h b/source4/librpc/ndr/ndr_spoolss.h
index 61aeed9b54..60738b494a 100644
--- a/source4/librpc/ndr/ndr_spoolss.h
+++ b/source4/librpc/ndr/ndr_spoolss.h
@@ -124,12 +124,17 @@ struct spoolss_EnumPrinters {
};
-struct spoolss_01 {
+struct spoolss_OpenPrinter {
struct {
+ const char *server;
+ const char *printer;
+ DATA_BLOB *buffer;
+ uint32 access_mask;
} in;
struct {
- NTSTATUS result;
+ struct policy_handle *handle;
+ WERROR result;
} out;
};
@@ -1135,7 +1140,7 @@ struct spoolss_5f {
};
#define DCERPC_SPOOLSS_ENUMPRINTERS 0
-#define DCERPC_SPOOLSS_01 1
+#define DCERPC_SPOOLSS_OPENPRINTER 1
#define DCERPC_SPOOLSS_02 2
#define DCERPC_SPOOLSS_03 3
#define DCERPC_SPOOLSS_ENUMJOBS 4
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 6e6436887b..aa8b8520f3 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -814,3 +814,10 @@ failed:
}
+/*
+ a useful function for retrieving the server name we connected to
+*/
+const char *dcerpc_server_name(struct dcerpc_pipe *p)
+{
+ return p->tree->session->transport->called.name;
+}
diff --git a/source4/librpc/rpc/rpc_spoolss.c b/source4/librpc/rpc/rpc_spoolss.c
index 366072c42c..e2d3a1ae35 100644
--- a/source4/librpc/rpc/rpc_spoolss.c
+++ b/source4/librpc/rpc/rpc_spoolss.c
@@ -11,18 +11,12 @@ NTSTATUS dcerpc_spoolss_EnumPrinters(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r);
}
-NTSTATUS dcerpc_spoolss_01(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_01 *r)
+NTSTATUS dcerpc_spoolss_OpenPrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_OpenPrinter *r)
{
- NTSTATUS status;
- status = dcerpc_ndr_request(p, DCERPC_SPOOLSS_01, mem_ctx,
- (ndr_push_fn_t) ndr_push_spoolss_01,
- (ndr_pull_fn_t) ndr_pull_spoolss_01,
- r);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- return r->out.result;
+ return dcerpc_ndr_request(p, DCERPC_SPOOLSS_OPENPRINTER, mem_ctx,
+ (ndr_push_fn_t) ndr_push_spoolss_OpenPrinter,
+ (ndr_pull_fn_t) ndr_pull_spoolss_OpenPrinter,
+ r);
}
NTSTATUS dcerpc_spoolss_02(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct spoolss_02 *r)