diff options
author | Günther Deschner <gd@samba.org> | 2013-01-16 01:15:49 +0100 |
---|---|---|
committer | David Disseldorp <ddiss@samba.org> | 2013-01-17 17:11:37 +0100 |
commit | 8304fe73f69ea7de57bd2d331038c4664553a9bd (patch) | |
tree | cad9cb9aa73651190673f499d9342a7f5212759a /source3 | |
parent | be8c81bfa3c6a2727eab589a71c6215ca76e3d3a (diff) | |
download | samba-8304fe73f69ea7de57bd2d331038c4664553a9bd.tar.gz samba-8304fe73f69ea7de57bd2d331038c4664553a9bd.tar.bz2 samba-8304fe73f69ea7de57bd2d331038c4664553a9bd.zip |
spoolss: make spoolss deal with ndr64 AddForm by using proper container object.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 11 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 12 | ||||
-rw-r--r-- | source3/utils/net_rpc_printer.c | 9 |
3 files changed, 20 insertions, 12 deletions
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 48a2981986..b4f1bec15e 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -8648,7 +8648,7 @@ WERROR _spoolss_DeletePrinterData(struct pipes_struct *p, WERROR _spoolss_AddForm(struct pipes_struct *p, struct spoolss_AddForm *r) { - struct spoolss_AddFormInfo1 *form = r->in.info.info1; + struct spoolss_AddFormInfo1 *form; int snum = -1; WERROR status = WERR_OK; struct printer_handle *Printer = find_printer_index_by_hnd(p, r->in.handle); @@ -8673,6 +8673,15 @@ WERROR _spoolss_AddForm(struct pipes_struct *p, return WERR_ACCESS_DENIED; } + if (r->in.info_ctr->level != 1) { + return WERR_INVALID_LEVEL; + } + + form = r->in.info_ctr->info.info1; + if (!form) { + return WERR_INVALID_PARAM; + } + switch (form->flags) { case SPOOLSS_FORM_USER: case SPOOLSS_FORM_BUILTIN: diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 969b747f4c..4e5da2a3ae 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -2104,7 +2104,7 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c WERROR werror; NTSTATUS status; const char *printername; - union spoolss_AddFormInfo info; + struct spoolss_AddFormInfoCtr info_ctr; struct spoolss_AddFormInfo1 info1; struct spoolss_AddFormInfo2 info2; uint32_t level = 1; @@ -2145,7 +2145,8 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c info1.area.right = 20; info1.area.bottom = 30; - info.info1 = &info1; + info_ctr.level = 1; + info_ctr.info.info1 = &info1; break; case 2: @@ -2164,7 +2165,8 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c info2.display_name = argv[2]; info2.lang_id = 0; - info.info2 = &info2; + info_ctr.level = 2; + info_ctr.info.info2 = &info2; break; default: @@ -2174,11 +2176,9 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* Add the form */ - status = dcerpc_spoolss_AddForm(b, mem_ctx, &handle, - level, - info, + &info_ctr, &werror); if (!NT_STATUS_IS_OK(status)) { werror = ntstatus_to_werror(status); diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c index 4fbe14f294..9743d08e0c 100644 --- a/source3/utils/net_rpc_printer.c +++ b/source3/utils/net_rpc_printer.c @@ -1789,7 +1789,7 @@ NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c, for (f = 0; f < num_forms; f++) { - union spoolss_AddFormInfo info; + struct spoolss_AddFormInfoCtr info_ctr; NTSTATUS status; /* only migrate FORM_PRINTER types, according to jerry @@ -1802,16 +1802,15 @@ NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c, "[%d]\n"), f, forms[f].info1.form_name, forms[f].info1.flags); - - info.info1 = (struct spoolss_AddFormInfo1 *) + info_ctr.level = 1; + info_ctr.info.info1 = (struct spoolss_AddFormInfo1 *) (void *)&forms[f].info1; /* FIXME: there might be something wrong with samba's builtin-forms */ status = dcerpc_spoolss_AddForm(b_dst, mem_ctx, &hnd_dst, - 1, - info, + &info_ctr, &result); if (!NT_STATUS_IS_OK(status)) { d_printf(_("\tdcerpc_spoolss_AddForm form %d: [%s] - %s\n"), |