| 1 |
/* |
| 2 |
Unix SMB/CIFS implementation. |
| 3 |
|
| 4 |
iremotewinspool rpc test operations |
| 5 |
|
| 6 |
Copyright (C) 2018 Justin Stephenson |
| 7 |
|
| 8 |
This program is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3 of the License, or |
| 11 |
(at your option) any later version. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#include "torture/rpc/torture_rpc.h" |
| 23 |
|
| 24 |
#define REG_DRIVER_CONTROL_KEY "SYSTEM\\CurrentControlSet\\Control\\Print" |
| 25 |
|
| 26 |
struct test_driver_info { |
| 27 |
struct smbcli_state *cli; |
| 28 |
struct spoolss_AddDriverInfo8 *info; |
| 29 |
const char *local_driver_path; |
| 30 |
size_t driver_path_len; |
| 31 |
char *server_name; |
| 32 |
char *share_name; |
| 33 |
char *print_upload_guid_dir; |
| 34 |
const char *inf_file; |
| 35 |
const char *uploaded_inf_path; |
| 36 |
const char *driver_name; |
| 37 |
const char *driver_arch; |
| 38 |
const char *core_driver_inf; |
| 39 |
}; |
| 40 |
|
| 41 |
struct test_iremotewinspool_context { |
| 42 |
struct GUID object_uuid; |
| 43 |
struct dcerpc_pipe *iremotewinspool_pipe; |
| 44 |
struct policy_handle server_handle; |
| 45 |
struct test_driver_info *dinfo; |
| 46 |
const char *environment; |
| 47 |
}; |
| 48 |
|
| 49 |
enum client_os_version |
| 50 |
{ |
| 51 |
WIN_2000, |
| 52 |
WIN_VISTA, |
| 53 |
WIN_SERVER_2008, |
| 54 |
WIN_7, |
| 55 |
WIN_SERVER_2008R2, |
| 56 |
WIN_8, |
| 57 |
WIN_SERVER_2012, |
| 58 |
WIN_10, |
| 59 |
WIN_SERVER_2016 |
| 60 |
}; |
| 61 |
|
| 62 |
void init_winreg_String(struct winreg_String *name, const char *s); |
| 63 |
|
| 64 |
struct spoolss_UserLevel1 test_get_client_info(struct torture_context *tctx, |
| 65 |
enum client_os_version os, |
| 66 |
enum spoolss_MajorVersion major_number, |
| 67 |
enum spoolss_MinorVersion minor_number, |
| 68 |
const char *machine, |
| 69 |
const char *user); |
| 70 |
|
| 71 |
bool test_AsyncOpenPrinter_byprinter(struct torture_context *tctx, |
| 72 |
struct test_iremotewinspool_context *ctx, |
| 73 |
struct dcerpc_pipe *p, |
| 74 |
const char *printer_name, |
| 75 |
struct spoolss_UserLevel1 cinfo, |
| 76 |
struct policy_handle *handle); |
| 77 |
bool test_AsyncOpenPrinter_byprinter_expect(struct torture_context *tctx, |
| 78 |
struct test_iremotewinspool_context *ctx, |
| 79 |
struct dcerpc_pipe *p, |
| 80 |
const char *printer_name, |
| 81 |
uint32_t access_mask, |
| 82 |
struct spoolss_UserLevel1 cinfo, |
| 83 |
NTSTATUS exected_status, |
| 84 |
WERROR exected_result, |
| 85 |
struct policy_handle *handle); |
| 86 |
bool test_get_environment(struct torture_context *tctx, |
| 87 |
struct dcerpc_binding_handle *b, |
| 88 |
struct policy_handle *handle, |
| 89 |
const char **architecture); |
| 90 |
|
| 91 |
bool test_AsyncClosePrinter_byhandle(struct torture_context *tctx, |
| 92 |
struct test_iremotewinspool_context *ctx, |
| 93 |
struct dcerpc_pipe *p, |
| 94 |
struct policy_handle *handle); |
| 95 |
|
| 96 |
bool test_AsyncGetPrinterData_args(struct torture_context *tctx, |
| 97 |
struct dcerpc_binding_handle *b, |
| 98 |
struct policy_handle *handle, |
| 99 |
const char *value_name, |
| 100 |
enum winreg_Type *type_p, |
| 101 |
uint8_t **data_p, |
| 102 |
uint32_t *needed_p); |
| 103 |
|
| 104 |
bool parse_inf_driver(struct torture_context *tctx, |
| 105 |
const char *driver_name, |
| 106 |
const char *abs_inf_path, |
| 107 |
const char *driver_arch, |
| 108 |
const char *core_driver_inf, |
| 109 |
struct spoolss_AddDriverInfo8 **_parsed_dinfo); |