The branch, v3-6-test has been updated via 6bfbf5f s4-smbtorture: run the winreg tests also against an added driver. via 92ec3ab s4-smbtorture: allow to call test_GetDriverInfo_winreg without printer handle. via 469893d s4-smbtorture: check if returned driver paths match requested architecture. via 972ca1d s4-smbtorture: pass down driverosversion to test_DriverInfo_winreg. from c725e48 s3:cli_np_tstream: if SMBtrans is desired, the readv needs to wait for the last writev chunk.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 6bfbf5f5a4cc5e5b5150af32adaad9e0875d5c99 Author: Günther Deschner <g...@samba.org> Date: Fri Dec 17 16:34:47 2010 +0100 s4-smbtorture: run the winreg tests also against an added driver. Guenther Autobuild-User: Günther Deschner <g...@samba.org> Autobuild-Date: Mon Dec 20 14:31:43 CET 2010 on sn-devel-104 (cherry picked from commit 9dce43a809eae4b44bf1e2b301844a0753c037e9) commit 92ec3abd17df60a8f57983f3ab006f9ed9f7fc5c Author: Günther Deschner <g...@samba.org> Date: Thu Dec 16 16:06:02 2010 +0100 s4-smbtorture: allow to call test_GetDriverInfo_winreg without printer handle. Guenther Autobuild-User: Günther Deschner <g...@samba.org> Autobuild-Date: Fri Dec 17 17:35:21 CET 2010 on sn-devel-104 (cherry picked from commit 4e9d67b7c0a6fb3de56a0703ba1479360364071c) commit 469893d26d8a57905756c3dc63bd725f805bc27e Author: Günther Deschner <g...@samba.org> Date: Wed Dec 15 17:44:56 2010 +0100 s4-smbtorture: check if returned driver paths match requested architecture. Guenther (cherry picked from commit 92f1029e87e62fb20e9505f9315caefe1c3a8535) commit 972ca1d98d74385f8e707a512bb41116c6f7a204 Author: Günther Deschner <g...@samba.org> Date: Thu Dec 16 15:59:19 2010 +0100 s4-smbtorture: pass down driverosversion to test_DriverInfo_winreg. Guenther (cherry picked from commit 545d3a013cc9965e167ffc3d12951df0b27060bd) ----------------------------------------------------------------------- Summary of changes: source4/torture/rpc/spoolss.c | 194 ++++++++++++++++++++++++++++++++--------- 1 files changed, 154 insertions(+), 40 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index bc40aea..630694d 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -125,7 +125,8 @@ static bool test_AddPrinterDriver_args_level_3(struct torture_context *tctx, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex); + bool ex, + const char *remote_driver_dir); #define COMPARE_STRING(tctx, c,r,e) \ torture_assert_str_equal(tctx, c.e, r.e, "invalid value") @@ -564,7 +565,8 @@ static bool test_EnumPrinterDrivers_findone(struct torture_context *tctx, const char *server_name, const char *environment, uint32_t level, - const char *driver_name) + const char *driver_name, + union spoolss_DriverInfo *info_p) { uint32_t count; union spoolss_DriverInfo *info; @@ -615,6 +617,9 @@ static bool test_EnumPrinterDrivers_findone(struct torture_context *tctx, torture_assert_str_equal(tctx, environment, environment_ret, "architecture mismatch"); } if (strequal(driver_name, driver_name_ret)) { + if (info_p) { + *info_p = info[i]; + } return true; } } @@ -4592,8 +4597,10 @@ static bool test_GetDriverInfo_winreg(struct torture_context *tctx, const char *printer_name, const char *driver_name, const char *environment, + enum spoolss_DriverOSVersion version, struct dcerpc_binding_handle *winreg_handle, - struct policy_handle *hive_handle) + struct policy_handle *hive_handle, + const char *server_name_slash) { WERROR result; union spoolss_DriverInfo info; @@ -4617,7 +4624,7 @@ static bool test_GetDriverInfo_winreg(struct torture_context *tctx, driver_key = talloc_asprintf(tctx, "%s\\%s\\Drivers\\Version-%d\\%s", TOP_LEVEL_CONTROL_ENVIRONMENTS_KEY, environment, - 3, + version, driver_name); torture_assert(tctx, @@ -4632,9 +4639,15 @@ static bool test_GetDriverInfo_winreg(struct torture_context *tctx, goto try_level6; } - torture_assert(tctx, - test_GetPrinterDriver2_level(tctx, b, handle, driver_name, environment, 8, 3, 0, &info, &result), - "failed to get driver info level 8"); + if (handle) { + torture_assert(tctx, + test_GetPrinterDriver2_level(tctx, b, handle, driver_name, environment, 8, version, 0, &info, &result), + "failed to get driver info level 8"); + } else { + torture_assert(tctx, + test_EnumPrinterDrivers_findone(tctx, b, server_name_slash, environment, 8, driver_name, &info), + "failed to get driver info level 8"); + } if (W_ERROR_EQUAL(result, WERR_INVALID_LEVEL)) { goto try_level6; @@ -4680,9 +4693,15 @@ static bool test_GetDriverInfo_winreg(struct torture_context *tctx, try_level6: - torture_assert(tctx, - test_GetPrinterDriver2_level(tctx, b, handle, driver_name, environment, 6, 3, 0, &info, &result), - "failed to get driver info level 6"); + if (handle) { + torture_assert(tctx, + test_GetPrinterDriver2_level(tctx, b, handle, driver_name, environment, 6, version, 0, &info, &result), + "failed to get driver info level 6"); + } else { + torture_assert(tctx, + test_EnumPrinterDrivers_findone(tctx, b, server_name_slash, environment, 6, driver_name, &info), + "failed to get driver info level 6"); + } driver_path = strip_path(info.info6.driver_path); data_file = strip_path(info.info6.data_file); @@ -4714,9 +4733,15 @@ static bool test_GetDriverInfo_winreg(struct torture_context *tctx, try_level3: - torture_assert(tctx, - test_GetPrinterDriver2_level(tctx, b, handle, driver_name, environment, 3, 3, 0, &info, &result), - "failed to get driver info level 3"); + if (handle) { + torture_assert(tctx, + test_GetPrinterDriver2_level(tctx, b, handle, driver_name, environment, 3, version, 0, &info, &result), + "failed to get driver info level 3"); + } else { + torture_assert(tctx, + test_EnumPrinterDrivers_findone(tctx, b, server_name_slash, environment, 3, driver_name, &info), + "failed to get driver info level 3"); + } driver_path = strip_path(info.info3.driver_path); data_file = strip_path(info.info3.data_file); @@ -5270,7 +5295,8 @@ static bool test_DriverInfo_winreg(struct torture_context *tctx, struct policy_handle *handle, const char *printer_name, const char *driver_name, - const char *environment) + const char *environment, + enum spoolss_DriverOSVersion version) { struct dcerpc_binding_handle *b = p->binding_handle; struct dcerpc_pipe *p2; @@ -5285,7 +5311,7 @@ static bool test_DriverInfo_winreg(struct torture_context *tctx, torture_assert(tctx, test_winreg_OpenHKLM(tctx, b2, &hive_handle), ""); - ret = test_GetDriverInfo_winreg(tctx, b, handle, printer_name, driver_name, environment, b2, &hive_handle); + ret = test_GetDriverInfo_winreg(tctx, b, handle, printer_name, driver_name, environment, version, b2, &hive_handle, NULL); test_winreg_CloseKey(tctx, b2, &hive_handle); @@ -7416,7 +7442,7 @@ static bool torture_rpc_spoolss_printer_setup_common(struct torture_context *tct &t->driver.local.driver_directory), "failed to compose local driver directory"); - if (test_EnumPrinterDrivers_findone(tctx, b, server_name_slash, t->driver.remote.environment, 3, t->info2.drivername)) { + if (test_EnumPrinterDrivers_findone(tctx, b, server_name_slash, t->driver.remote.environment, 3, t->info2.drivername, NULL)) { torture_comment(tctx, "driver '%s' (architecture: %s, version: 3) is present on server\n", t->info2.drivername, t->driver.remote.environment); t->have_driver = true; @@ -7438,7 +7464,7 @@ static bool torture_rpc_spoolss_printer_setup_common(struct torture_context *tct "failed to upload printer driver"); torture_assert(tctx, - test_AddPrinterDriver_args_level_3(tctx, b, server_name_slash, &t->driver.info8, 0, false), + test_AddPrinterDriver_args_level_3(tctx, b, server_name_slash, &t->driver.info8, 0, false, NULL), "failed to add driver"); t->added_driver = true; @@ -7804,7 +7830,7 @@ static bool test_driver_info_winreg(struct torture_context *tctx, } torture_assert(tctx, - test_DriverInfo_winreg(tctx, p, &t->handle, t->info2.printername, driver_name, t->driver.remote.environment), + test_DriverInfo_winreg(tctx, p, &t->handle, t->info2.printername, driver_name, t->driver.remote.environment, 3), "failed to test driver info winreg"); return true; @@ -8053,12 +8079,18 @@ static bool test_AddPrinterDriverEx_exp(struct torture_context *tctx, return true; } +#define ASSERT_DRIVER_PATH(tctx, path, driver_dir, cmt) \ + if (path && strlen(path)) {\ + torture_assert_strn_equal(tctx, path, driver_dir, strlen(driver_dir), cmt); \ + } + static bool test_AddPrinterDriver_args_level_1(struct torture_context *tctx, struct dcerpc_binding_handle *b, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex) + bool ex, + const char *remote_driver_dir) { struct spoolss_AddDriverInfoCtr info_ctr; struct spoolss_AddDriverInfo1 info1; @@ -8098,10 +8130,12 @@ static bool test_AddPrinterDriver_args_level_2(struct torture_context *tctx, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex) + bool ex, + const char *remote_driver_dir) { struct spoolss_AddDriverInfoCtr info_ctr; struct spoolss_AddDriverInfo2 info2; + union spoolss_DriverInfo info; ZERO_STRUCT(info2); @@ -8197,9 +8231,15 @@ static bool test_AddPrinterDriver_args_level_2(struct torture_context *tctx, } torture_assert(tctx, - test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 2, r->driver_name), + test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 2, r->driver_name, &info), "failed to find added printer driver"); + if (remote_driver_dir) { + ASSERT_DRIVER_PATH(tctx, info.info2.driver_path, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info2.data_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info2.config_file, remote_driver_dir, "unexpected path"); + } + return true; } @@ -8208,10 +8248,12 @@ static bool test_AddPrinterDriver_args_level_3(struct torture_context *tctx, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex) + bool ex, + const char *remote_driver_dir) { struct spoolss_AddDriverInfoCtr info_ctr; struct spoolss_AddDriverInfo3 info3; + union spoolss_DriverInfo info; info3.driver_name = r->driver_name; info3.version = r->version; @@ -8239,9 +8281,20 @@ static bool test_AddPrinterDriver_args_level_3(struct torture_context *tctx, } torture_assert(tctx, - test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 3, r->driver_name), + test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 3, r->driver_name, &info), "failed to find added printer driver"); + if (remote_driver_dir) { + int i; + ASSERT_DRIVER_PATH(tctx, info.info3.driver_path, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info3.data_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info3.config_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info3.help_file, remote_driver_dir, "unexpected path"); + for (i=0; info.info3.dependent_files && info.info3.dependent_files[i] != NULL; i++) { + ASSERT_DRIVER_PATH(tctx, info.info3.dependent_files[i], remote_driver_dir, "unexpected path"); + } + } + return true; } @@ -8250,10 +8303,12 @@ static bool test_AddPrinterDriver_args_level_4(struct torture_context *tctx, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex) + bool ex, + const char *remote_driver_dir) { struct spoolss_AddDriverInfoCtr info_ctr; struct spoolss_AddDriverInfo4 info4; + union spoolss_DriverInfo info; info4.version = r->version; info4.driver_name = r->driver_name; @@ -8283,9 +8338,20 @@ static bool test_AddPrinterDriver_args_level_4(struct torture_context *tctx, } torture_assert(tctx, - test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 4, r->driver_name), + test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 4, r->driver_name, &info), "failed to find added printer driver"); + if (remote_driver_dir) { + int i; + ASSERT_DRIVER_PATH(tctx, info.info4.driver_path, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info4.data_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info4.config_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info4.help_file, remote_driver_dir, "unexpected path"); + for (i=0; info.info4.dependent_files && info.info4.dependent_files[i] != NULL; i++) { + ASSERT_DRIVER_PATH(tctx, info.info4.dependent_files[i], remote_driver_dir, "unexpected path"); + } + } + return true; } @@ -8294,10 +8360,12 @@ static bool test_AddPrinterDriver_args_level_6(struct torture_context *tctx, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex) + bool ex, + const char *remote_driver_dir) { struct spoolss_AddDriverInfoCtr info_ctr; struct spoolss_AddDriverInfo6 info6; + union spoolss_DriverInfo info; info6.version = r->version; info6.driver_name = r->driver_name; @@ -8339,9 +8407,20 @@ static bool test_AddPrinterDriver_args_level_6(struct torture_context *tctx, } torture_assert(tctx, - test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 6, r->driver_name), + test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 6, r->driver_name, &info), "failed to find added printer driver"); + if (remote_driver_dir) { + int i; + ASSERT_DRIVER_PATH(tctx, info.info6.driver_path, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info6.data_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info6.config_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info6.help_file, remote_driver_dir, "unexpected path"); + for (i=0; info.info6.dependent_files && info.info6.dependent_files[i] != NULL; i++) { + ASSERT_DRIVER_PATH(tctx, info.info6.dependent_files[i], remote_driver_dir, "unexpected path"); + } + } + return true; } @@ -8350,9 +8429,11 @@ static bool test_AddPrinterDriver_args_level_8(struct torture_context *tctx, const char *server_name, struct spoolss_AddDriverInfo8 *r, uint32_t flags, - bool ex) + bool ex, + const char *remote_driver_dir) { struct spoolss_AddDriverInfoCtr info_ctr; + union spoolss_DriverInfo info; info_ctr.level = 8; info_ctr.info.info8 = r; @@ -8374,12 +8455,25 @@ static bool test_AddPrinterDriver_args_level_8(struct torture_context *tctx, } torture_assert(tctx, - test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 8, r->driver_name), + test_EnumPrinterDrivers_findone(tctx, b, server_name, r->architecture, 8, r->driver_name, &info), "failed to find added printer driver"); + if (remote_driver_dir) { + int i; + ASSERT_DRIVER_PATH(tctx, info.info8.driver_path, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info8.data_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info8.config_file, remote_driver_dir, "unexpected path"); + ASSERT_DRIVER_PATH(tctx, info.info8.help_file, remote_driver_dir, "unexpected path"); + for (i=0; info.info8.dependent_files && info.info8.dependent_files[i] != NULL; i++) { + ASSERT_DRIVER_PATH(tctx, info.info8.dependent_files[i], remote_driver_dir, "unexpected path"); + } + } + return true; } +#undef ASSERT_DRIVER_PATH + static bool test_DeletePrinterDriver_exp(struct torture_context *tctx, struct dcerpc_binding_handle *b, const char *server, @@ -8446,7 +8540,7 @@ static bool test_DeletePrinterDriver(struct torture_context *tctx, test_DeletePrinterDriver_exp(tctx, b, server_name, driver, environment, WERR_OK), "failed to delete driver"); - if (test_EnumPrinterDrivers_findone(tctx, b, server_name, environment, 1, driver)) { + if (test_EnumPrinterDrivers_findone(tctx, b, server_name, environment, 1, driver, NULL)) { torture_fail(tctx, "deleted driver still enumerated"); } @@ -8473,7 +8567,7 @@ static bool test_DeletePrinterDriverEx(struct torture_context *tctx, test_DeletePrinterDriverEx_exp(tctx, b, server_name, driver, environment, delete_flags, version, WERR_OK), "failed to delete driver"); - if (test_EnumPrinterDrivers_findone(tctx, b, server_name, environment, 1, driver)) { + if (test_EnumPrinterDrivers_findone(tctx, b, server_name, environment, 1, driver, NULL)) { torture_fail(tctx, "deleted driver still enumerated"); } @@ -8492,28 +8586,29 @@ static bool test_PrinterDriver_args(struct torture_context *tctx, uint32_t add_flags, uint32_t delete_flags, uint32_t delete_version, - bool ex) + bool ex, + const char *remote_driver_dir) { bool ret = true; switch (level) { case 1: - ret = test_AddPrinterDriver_args_level_1(tctx, b, server_name, r, add_flags, ex); + ret = test_AddPrinterDriver_args_level_1(tctx, b, server_name, r, add_flags, ex, remote_driver_dir); break; case 2: - ret = test_AddPrinterDriver_args_level_2(tctx, b, server_name, r, add_flags, ex); + ret = test_AddPrinterDriver_args_level_2(tctx, b, server_name, r, add_flags, ex, remote_driver_dir); break; case 3: - ret = test_AddPrinterDriver_args_level_3(tctx, b, server_name, r, add_flags, ex); + ret = test_AddPrinterDriver_args_level_3(tctx, b, server_name, r, add_flags, ex, remote_driver_dir); break; case 4: - ret = test_AddPrinterDriver_args_level_4(tctx, b, server_name, r, add_flags, ex); + ret = test_AddPrinterDriver_args_level_4(tctx, b, server_name, r, add_flags, ex, remote_driver_dir); break; case 6: - ret = test_AddPrinterDriver_args_level_6(tctx, b, server_name, r, add_flags, ex); + ret = test_AddPrinterDriver_args_level_6(tctx, b, server_name, r, add_flags, ex, remote_driver_dir); break; case 8: - ret = test_AddPrinterDriver_args_level_8(tctx, b, server_name, r, add_flags, ex); + ret = test_AddPrinterDriver_args_level_8(tctx, b, server_name, r, add_flags, ex, remote_driver_dir); break; default: return false; @@ -8533,6 +8628,25 @@ static bool test_PrinterDriver_args(struct torture_context *tctx, return ret; } + { + struct dcerpc_pipe *p2; + struct policy_handle hive_handle; + struct dcerpc_binding_handle *b2; + + torture_assert_ntstatus_ok(tctx, + torture_rpc_connection(tctx, &p2, &ndr_table_winreg), + "could not open winreg pipe"); + b2 = p2->binding_handle; + + torture_assert(tctx, test_winreg_OpenHKLM(tctx, b2, &hive_handle), ""); + + ret = test_GetDriverInfo_winreg(tctx, b, NULL, NULL, r->driver_name, r->architecture, r->version, b2, &hive_handle, server_name); + + test_winreg_CloseKey(tctx, b2, &hive_handle); + + talloc_free(p2); + } + if (ex) { return test_DeletePrinterDriverEx(tctx, b, server_name, r->driver_name, r->architecture, delete_flags, r->version); } else { @@ -8876,7 +8990,7 @@ static bool test_add_driver_arg(struct torture_context *tctx, "Testing PrinterDriver%s '%s' add & delete level %d\n", d->ex ? "Ex" : "", info8.driver_name, levels[i]); - ret &= test_PrinterDriver_args(tctx, b, server_name_slash, levels[i], &info8, add_flags, delete_flags, d->info8.version, d->ex); + ret &= test_PrinterDriver_args(tctx, b, server_name_slash, levels[i], &info8, add_flags, delete_flags, d->info8.version, d->ex, d->remote.driver_directory); } info8.driver_path = talloc_asprintf(tctx, "%s\\%s", d->remote.driver_directory, d->info8.driver_path); @@ -8912,7 +9026,7 @@ static bool test_add_driver_arg(struct torture_context *tctx, "Testing PrinterDriver%s '%s' add & delete level %d (full unc paths)\n", d->ex ? "Ex" : "", info8.driver_name, levels[i]); - ret &= test_PrinterDriver_args(tctx, b, server_name_slash, levels[i], &info8, add_flags, delete_flags, d->info8.version, d->ex); + ret &= test_PrinterDriver_args(tctx, b, server_name_slash, levels[i], &info8, add_flags, delete_flags, d->info8.version, d->ex, d->remote.driver_directory); } torture_assert(tctx, -- Samba Shared Repository