diff options
author | Günther Deschner <gd@samba.org> | 2013-01-18 22:22:13 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2013-01-24 17:42:25 +0100 |
commit | 11fba102082239c5d70b6314b19dab72b49478ed (patch) | |
tree | 7c3511c0ed56d0b76347867db071223957eb491d | |
parent | 6bcd3dda2825a8791e7284b3229aa518416e8544 (diff) | |
download | samba-11fba102082239c5d70b6314b19dab72b49478ed.tar.gz samba-11fba102082239c5d70b6314b19dab72b49478ed.tar.bz2 samba-11fba102082239c5d70b6314b19dab72b49478ed.zip |
spoolss: make spoolss deal with ndr64 StartDocPrinter by using proper container object.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | librpc/idl/spoolss.idl | 8 | ||||
-rw-r--r-- | source3/printing/printspoolss.c | 23 | ||||
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss.c | 8 |
4 files changed, 29 insertions, 14 deletions
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl index ba67188148..69d9f8e792 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -1753,10 +1753,14 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") [default]; } spoolss_DocumentInfo; + typedef struct { + uint32 level; + [switch_is(level)] spoolss_DocumentInfo info; + } spoolss_DocumentInfoCtr; + WERROR spoolss_StartDocPrinter( [in,ref] policy_handle *handle, - [in] uint32 level, - [in,switch_is(level)] spoolss_DocumentInfo info, + [in,ref] spoolss_DocumentInfoCtr *info_ctr, [out,ref] uint32 *job_id ); diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c index 7a730a55bb..acf4c0d19a 100644 --- a/source3/printing/printspoolss.c +++ b/source3/printing/printspoolss.c @@ -64,7 +64,8 @@ NTSTATUS print_spool_open(files_struct *fsp, struct print_file_data *pf; struct dcerpc_binding_handle *b = NULL; struct spoolss_DevmodeContainer devmode_ctr; - union spoolss_DocumentInfo info; + struct spoolss_DocumentInfoCtr info_ctr; + struct spoolss_DocumentInfo1 *info1; int fd = -1; WERROR werr; @@ -173,17 +174,23 @@ NTSTATUS print_spool_open(files_struct *fsp, goto done; } - info.info1 = talloc(tmp_ctx, struct spoolss_DocumentInfo1); - if (!info.info1) { + info1 = talloc(tmp_ctx, struct spoolss_DocumentInfo1); + if (info1 == NULL) { status = NT_STATUS_NO_MEMORY; goto done; } - info.info1->document_name = pf->docname; - info.info1->output_file = pf->filename; - info.info1->datatype = "RAW"; + info1->document_name = pf->docname; + info1->output_file = pf->filename; + info1->datatype = "RAW"; - status = dcerpc_spoolss_StartDocPrinter(b, tmp_ctx, &pf->handle, - 1, info, &pf->jobid, &werr); + info_ctr.level = 1; + info_ctr.info.info1 = info1; + + status = dcerpc_spoolss_StartDocPrinter(b, tmp_ctx, + &pf->handle, + &info_ctr, + &pf->jobid, + &werr); if (!NT_STATUS_IS_OK(status)) { goto done; } diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 9601ce6a62..3107cda36f 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -5730,11 +5730,11 @@ WERROR _spoolss_StartDocPrinter(struct pipes_struct *p, return WERR_INVALID_HANDLE; } - if (r->in.level != 1) { + if (r->in.info_ctr->level != 1) { return WERR_UNKNOWN_LEVEL; } - info_1 = r->in.info.info1; + info_1 = r->in.info_ctr->info.info1; /* * a nice thing with NT is it doesn't listen to what you tell it. diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index d13a11dc87..509c61fd7e 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -3273,6 +3273,7 @@ static bool test_DoPrintTest_add_one_job(struct torture_context *tctx, { NTSTATUS status; struct spoolss_StartDocPrinter s; + struct spoolss_DocumentInfoCtr info_ctr; struct spoolss_DocumentInfo1 info1; struct spoolss_StartPagePrinter sp; struct spoolss_WritePrinter w; @@ -3284,13 +3285,16 @@ static bool test_DoPrintTest_add_one_job(struct torture_context *tctx, torture_comment(tctx, "Testing StartDocPrinter\n"); s.in.handle = handle; - s.in.level = 1; - s.in.info.info1 = &info1; + s.in.info_ctr = &info_ctr; s.out.job_id = job_id; + info1.document_name = document_name; info1.output_file = NULL; info1.datatype = "RAW"; + info_ctr.level = 1; + info_ctr.info.info1 = &info1; + status = dcerpc_spoolss_StartDocPrinter_r(b, tctx, &s); torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_StartDocPrinter failed"); torture_assert_werr_ok(tctx, s.out.result, "StartDocPrinter failed"); |