diff options
author | Günther Deschner <gd@samba.org> | 2013-01-14 17:26:31 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2013-01-16 11:42:13 +0100 |
commit | a4dcf7b94d8f2d8180bb5b390f49e89e2c956a88 (patch) | |
tree | 28136af45498a9d5f94527baf6fa52854af4770a | |
parent | 6bb7bf9ebb0671be19419ba54955dd929494c8e8 (diff) | |
download | samba-a4dcf7b94d8f2d8180bb5b390f49e89e2c956a88.tar.gz samba-a4dcf7b94d8f2d8180bb5b390f49e89e2c956a88.tar.bz2 samba-a4dcf7b94d8f2d8180bb5b390f49e89e2c956a88.zip |
spoolss: Make OpenPrinterEx work with NDR64 by using UserInfo Container.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | librpc/idl/spoolss.idl | 3 | ||||
-rw-r--r-- | source3/rpc_client/cli_spoolss.c | 8 | ||||
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 14 | ||||
-rw-r--r-- | source4/rpc_server/spoolss/dcesrv_spoolss.c | 5 | ||||
-rw-r--r-- | source4/torture/rpc/samba3rpc.c | 8 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss.c | 35 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss_access.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss_win.c | 8 |
8 files changed, 42 insertions, 43 deletions
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl index 06a0935f81..7d8e8de3ad 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -2821,8 +2821,7 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") [in,unique] [string,charset(UTF16)] uint16 *datatype, [in] spoolss_DevmodeContainer devmode_ctr, [in] spoolss_AccessRights access_mask, - [in] uint32 level, - [in,switch_is(level)] spoolss_UserLevel userlevel, + [in] spoolss_UserLevelCtr userlevel_ctr, [out,ref] policy_handle *handle ); diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c index 5c8448b29b..1a8903d82a 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -40,7 +40,7 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli, NTSTATUS status; WERROR werror; struct spoolss_DevmodeContainer devmode_ctr; - union spoolss_UserLevel userlevel; + struct spoolss_UserLevelCtr userlevel_ctr; struct spoolss_UserLevel1 level1; struct dcerpc_binding_handle *b = cli->binding_handle; @@ -55,15 +55,15 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli, level1.minor = 0; level1.processor = 0; - userlevel.level1 = &level1; + userlevel_ctr.level = 1; + userlevel_ctr.user_info.level1 = &level1; status = dcerpc_spoolss_OpenPrinterEx(b, mem_ctx, printername, NULL, devmode_ctr, access_desired, - 1, /* level */ - userlevel, + userlevel_ctr, handle, &werror); diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 28ef836b41..48a2981986 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1632,15 +1632,17 @@ WERROR _spoolss_OpenPrinter(struct pipes_struct *p, struct spoolss_OpenPrinter *r) { struct spoolss_OpenPrinterEx e; + struct spoolss_UserLevel1 level1; WERROR werr; - ZERO_STRUCT(e.in.userlevel); + ZERO_STRUCT(level1); e.in.printername = r->in.printername; e.in.datatype = r->in.datatype; e.in.devmode_ctr = r->in.devmode_ctr; e.in.access_mask = r->in.access_mask; - e.in.level = 0; + e.in.userlevel_ctr.level = 1; + e.in.userlevel_ctr.user_info.level1 = &level1; e.out.handle = r->out.handle; @@ -1714,12 +1716,12 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p, return WERR_INVALID_PARAM; } - if (r->in.level > 3) { + if (r->in.userlevel_ctr.level > 3) { return WERR_INVALID_PARAM; } - if ((r->in.level == 1 && !r->in.userlevel.level1) || - (r->in.level == 2 && !r->in.userlevel.level2) || - (r->in.level == 3 && !r->in.userlevel.level3)) { + if ((r->in.userlevel_ctr.level == 1 && !r->in.userlevel_ctr.user_info.level1) || + (r->in.userlevel_ctr.level == 2 && !r->in.userlevel_ctr.user_info.level2) || + (r->in.userlevel_ctr.level == 3 && !r->in.userlevel_ctr.user_info.level3)) { return WERR_INVALID_PARAM; } diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index 76035f3ce9..e3df4e0ff5 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -269,9 +269,8 @@ static WERROR dcesrv_spoolss_OpenPrinter(struct dcesrv_call_state *dce_call, TAL r2->in.datatype = r->in.datatype; r2->in.devmode_ctr = r->in.devmode_ctr; r2->in.access_mask = r->in.access_mask; - r2->in.level = 1; - r2->in.userlevel.level1 = NULL; - + r2->in.userlevel_ctr.level = 1; + r2->in.userlevel_ctr.user_info.level1 = NULL; r2->out.handle = r->out.handle; /* TODO: we should take care about async replies here, diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index c19476d9bf..f7c76743aa 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -2804,8 +2804,8 @@ static bool torture_samba3_rpc_spoolss(struct torture_context *torture) servername); r.in.datatype = NULL; r.in.access_mask = 0; - r.in.level = 1; - r.in.userlevel.level1 = &userlevel1; + r.in.userlevel_ctr.level = 1; + r.in.userlevel_ctr.user_info.level1 = &userlevel1; r.out.handle = &server_handle; torture_assert_ntstatus_ok(torture, @@ -2836,8 +2836,8 @@ static bool torture_samba3_rpc_spoolss(struct torture_context *torture) torture, "\\\\%s\\%s", servername, printers[0]); r.in.datatype = NULL; r.in.access_mask = 0; - r.in.level = 1; - r.in.userlevel.level1 = &userlevel1; + r.in.userlevel_ctr.level = 1; + r.in.userlevel_ctr.user_info.level1 = &userlevel1; r.out.handle = &printer_handle; torture_assert_ntstatus_ok(torture, diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index b1229ac3aa..064d3b434d 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -5777,8 +5777,8 @@ static bool test_OpenPrinter_badname(struct torture_context *tctx, opEx.in.datatype = NULL; opEx.in.devmode_ctr.devmode = NULL; opEx.in.access_mask = 0; - opEx.in.level = 1; - opEx.in.userlevel.level1 = NULL; + opEx.in.userlevel_ctr.level = 1; + opEx.in.userlevel_ctr.user_info.level1 = NULL; opEx.out.handle = &handle; torture_comment(tctx, "Testing OpenPrinterEx(%s) with bad name\n", opEx.in.printername); @@ -5887,8 +5887,7 @@ static bool test_OpenPrinterEx(struct torture_context *tctx, const char *datatype, struct spoolss_DeviceMode *devmode, uint32_t access_mask, - uint32_t level, - union spoolss_UserLevel *userlevel, + struct spoolss_UserLevelCtr *userlevel_ctr, struct policy_handle *handle, WERROR expected_result) { @@ -5898,8 +5897,7 @@ static bool test_OpenPrinterEx(struct torture_context *tctx, r.in.datatype = datatype; r.in.devmode_ctr.devmode= devmode; r.in.access_mask = access_mask; - r.in.level = level; - r.in.userlevel = *userlevel; + r.in.userlevel_ctr = *userlevel_ctr; r.out.handle = handle; torture_comment(tctx, "Testing OpenPrinterEx(%s)\n", r.in.printername); @@ -5920,7 +5918,7 @@ static bool call_OpenPrinterEx(struct torture_context *tctx, struct spoolss_DeviceMode *devmode, struct policy_handle *handle) { - union spoolss_UserLevel userlevel; + struct spoolss_UserLevelCtr userlevel_ctr; struct spoolss_UserLevel1 userlevel1; struct dcerpc_binding_handle *b = p->binding_handle; @@ -5932,12 +5930,12 @@ static bool call_OpenPrinterEx(struct torture_context *tctx, userlevel1.minor = 3; userlevel1.processor = 4; - userlevel.level1 = &userlevel1; + userlevel_ctr.level = 1; + userlevel_ctr.user_info.level1 = &userlevel1; return test_OpenPrinterEx(tctx, b, name, NULL, devmode, SEC_FLAG_MAXIMUM_ALLOWED, - 1, - &userlevel, + &userlevel_ctr, handle, WERR_OK); } @@ -6041,7 +6039,7 @@ static bool test_openprinter(struct torture_context *tctx, struct dcerpc_binding_handle *b, const char *real_printername) { - union spoolss_UserLevel userlevel; + struct spoolss_UserLevelCtr userlevel_ctr; struct policy_handle handle; struct spoolss_UserLevel1 userlevel1; const char *printername = NULL; @@ -6119,13 +6117,14 @@ static bool test_openprinter(struct torture_context *tctx, userlevel1.minor = 3; userlevel1.processor = 4; - userlevel.level1 = &userlevel1; + userlevel_ctr.level = 1; + userlevel_ctr.user_info.level1 = &userlevel1; torture_comment(tctx, "Testing openprinterex printername pattern\n"); torture_assert(tctx, - test_OpenPrinterEx(tctx, b, real_printername, NULL, NULL, 0, 1, - &userlevel, &handle, + test_OpenPrinterEx(tctx, b, real_printername, NULL, NULL, 0, + &userlevel_ctr, &handle, WERR_OK), "OpenPrinterEx failed"); test_ClosePrinter(tctx, b, &handle); @@ -6137,8 +6136,8 @@ static bool test_openprinter(struct torture_context *tctx, tests[i].suffix); torture_assert(tctx, - test_OpenPrinterEx(tctx, b, printername, NULL, NULL, 0, 1, - &userlevel, &handle, + test_OpenPrinterEx(tctx, b, printername, NULL, NULL, 0, + &userlevel_ctr, &handle, tests[i].expected_result), "OpenPrinterEx failed"); if (W_ERROR_IS_OK(tests[i].expected_result)) { @@ -7335,8 +7334,8 @@ static bool test_architecture_buffer(struct torture_context *tctx, r.in.datatype = NULL; r.in.devmode_ctr.devmode= NULL; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - r.in.level = 1; - r.in.userlevel.level1 = &u1; + r.in.userlevel_ctr.level = 1; + r.in.userlevel_ctr.user_info.level1 = &u1; r.out.handle = &handle; torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_OpenPrinterEx_r(b, tctx, &r), ""); diff --git a/source4/torture/rpc/spoolss_access.c b/source4/torture/rpc/spoolss_access.c index a935cbd3c3..411dac1fdc 100644 --- a/source4/torture/rpc/spoolss_access.c +++ b/source4/torture/rpc/spoolss_access.c @@ -83,8 +83,8 @@ static bool test_openprinter_handle(struct torture_context *tctx, r.in.datatype = NULL; r.in.devmode_ctr.devmode= NULL; r.in.access_mask = access_mask; - r.in.level = 1; - r.in.userlevel.level1 = &level1; + r.in.userlevel_ctr.level = 1; + r.in.userlevel_ctr.user_info.level1 = &level1; r.out.handle = handle; torture_comment(tctx, "Testing OpenPrinterEx(%s) with access_mask 0x%08x (%s)\n", diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c index 96c3a2455d..bda0f3a832 100644 --- a/source4/torture/rpc/spoolss_win.c +++ b/source4/torture/rpc/spoolss_win.c @@ -54,8 +54,8 @@ static bool test_OpenPrinterEx(struct torture_context *tctx, op.in.datatype = NULL; op.in.devmode_ctr.devmode = NULL; op.in.access_mask = access_mask; - op.in.level = 1; - op.in.userlevel.level1 = &ul_1; + op.in.userlevel_ctr.level = 1; + op.in.userlevel_ctr.user_info.level1 = &ul_1; op.out.handle = handle; ul_1.size = 1234; @@ -95,8 +95,8 @@ static bool test_OpenPrinterAsAdmin(struct torture_context *tctx, op.in.datatype = NULL; op.in.devmode_ctr.devmode = NULL; op.in.access_mask = SERVER_ALL_ACCESS; - op.in.level = 1; - op.in.userlevel.level1 = &ul_1; + op.in.userlevel_ctr.level = 1; + op.in.userlevel_ctr.user_info.level1 = &ul_1; op.out.handle = &handle; cp.in.handle = &handle; |