|
|
bec1a9 |
From 7afb2ec722fa628a3b214252535a8e31aac16f12 Mon Sep 17 00:00:00 2001
|
|
|
bec1a9 |
From: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Date: Thu, 4 May 2017 17:48:42 +0200
|
|
|
bec1a9 |
Subject: [PATCH 1/3] s3:printing: Change to GUID dir if we deal with
|
|
|
bec1a9 |
COPY_FROM_DIRECTORY
|
|
|
bec1a9 |
|
|
|
bec1a9 |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12761
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Reviewed-by: Guenther Deschner <gd@samba.org>
|
|
|
bec1a9 |
(cherry picked from commit 5b15c7e8908697b157d2593b7caa9be760594a05)
|
|
|
bec1a9 |
---
|
|
|
bec1a9 |
source3/printing/nt_printing.c | 51 +++++++++++++++++++++++++++++-------------
|
|
|
bec1a9 |
1 file changed, 35 insertions(+), 16 deletions(-)
|
|
|
bec1a9 |
|
|
|
bec1a9 |
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
|
|
|
bec1a9 |
index 394a3e5..49be5d9 100644
|
|
|
bec1a9 |
--- a/source3/printing/nt_printing.c
|
|
|
bec1a9 |
+++ b/source3/printing/nt_printing.c
|
|
|
bec1a9 |
@@ -666,16 +666,18 @@ Determine the correct cVersion associated with an architecture and driver
|
|
|
bec1a9 |
static uint32_t get_correct_cversion(struct auth_session_info *session_info,
|
|
|
bec1a9 |
const char *architecture,
|
|
|
bec1a9 |
const char *driverpath_in,
|
|
|
bec1a9 |
+ const char *driver_directory,
|
|
|
bec1a9 |
WERROR *perr)
|
|
|
bec1a9 |
{
|
|
|
bec1a9 |
int cversion = -1;
|
|
|
bec1a9 |
NTSTATUS nt_status;
|
|
|
bec1a9 |
struct smb_filename *smb_fname = NULL;
|
|
|
bec1a9 |
- char *driverpath = NULL;
|
|
|
bec1a9 |
files_struct *fsp = NULL;
|
|
|
bec1a9 |
connection_struct *conn = NULL;
|
|
|
bec1a9 |
char *oldcwd;
|
|
|
bec1a9 |
char *printdollar = NULL;
|
|
|
bec1a9 |
+ char *printdollar_path = NULL;
|
|
|
bec1a9 |
+ char *working_dir = NULL;
|
|
|
bec1a9 |
int printdollar_snum;
|
|
|
bec1a9 |
|
|
|
bec1a9 |
*perr = WERR_INVALID_PARAMETER;
|
|
|
bec1a9 |
@@ -704,12 +706,33 @@ static uint32_t get_correct_cversion(struct auth_session_info *session_info,
|
|
|
bec1a9 |
return -1;
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
+ printdollar_path = lp_path(talloc_tos(), printdollar_snum);
|
|
|
bec1a9 |
+ if (printdollar_path == NULL) {
|
|
|
bec1a9 |
+ *perr = WERR_NOT_ENOUGH_MEMORY;
|
|
|
bec1a9 |
+ return -1;
|
|
|
bec1a9 |
+ }
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+ working_dir = talloc_asprintf(talloc_tos(),
|
|
|
bec1a9 |
+ "%s/%s",
|
|
|
bec1a9 |
+ printdollar_path,
|
|
|
bec1a9 |
+ architecture);
|
|
|
bec1a9 |
+ /*
|
|
|
bec1a9 |
+ * If the driver has been uploaded into a temorpary driver
|
|
|
bec1a9 |
+ * directory, switch to the driver directory.
|
|
|
bec1a9 |
+ */
|
|
|
bec1a9 |
+ if (driver_directory != NULL) {
|
|
|
bec1a9 |
+ working_dir = talloc_asprintf(talloc_tos(), "%s/%s/%s",
|
|
|
bec1a9 |
+ printdollar_path,
|
|
|
bec1a9 |
+ architecture,
|
|
|
bec1a9 |
+ driver_directory);
|
|
|
bec1a9 |
+ }
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
nt_status = create_conn_struct_cwd(talloc_tos(),
|
|
|
bec1a9 |
server_event_context(),
|
|
|
bec1a9 |
server_messaging_context(),
|
|
|
bec1a9 |
&conn,
|
|
|
bec1a9 |
printdollar_snum,
|
|
|
bec1a9 |
- lp_path(talloc_tos(), printdollar_snum),
|
|
|
bec1a9 |
+ working_dir,
|
|
|
bec1a9 |
session_info, &oldcwd);
|
|
|
bec1a9 |
if (!NT_STATUS_IS_OK(nt_status)) {
|
|
|
bec1a9 |
DEBUG(0,("get_correct_cversion: create_conn_struct "
|
|
|
bec1a9 |
@@ -731,18 +754,11 @@ static uint32_t get_correct_cversion(struct auth_session_info *session_info,
|
|
|
bec1a9 |
goto error_free_conn;
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
- /* Open the driver file (Portable Executable format) and determine the
|
|
|
bec1a9 |
- * deriver the cversion. */
|
|
|
bec1a9 |
- driverpath = talloc_asprintf(talloc_tos(),
|
|
|
bec1a9 |
- "%s/%s",
|
|
|
bec1a9 |
- architecture,
|
|
|
bec1a9 |
- driverpath_in);
|
|
|
bec1a9 |
- if (!driverpath) {
|
|
|
bec1a9 |
- *perr = WERR_NOT_ENOUGH_MEMORY;
|
|
|
bec1a9 |
- goto error_exit;
|
|
|
bec1a9 |
- }
|
|
|
bec1a9 |
-
|
|
|
bec1a9 |
- nt_status = driver_unix_convert(conn, driverpath, &smb_fname);
|
|
|
bec1a9 |
+ /*
|
|
|
bec1a9 |
+ * We switch to the directory where the driver files are located,
|
|
|
bec1a9 |
+ * so only work on the file names
|
|
|
bec1a9 |
+ */
|
|
|
bec1a9 |
+ nt_status = driver_unix_convert(conn, driverpath_in, &smb_fname);
|
|
|
bec1a9 |
if (!NT_STATUS_IS_OK(nt_status)) {
|
|
|
bec1a9 |
*perr = ntstatus_to_werror(nt_status);
|
|
|
bec1a9 |
goto error_exit;
|
|
|
bec1a9 |
@@ -956,8 +972,11 @@ static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
|
|
|
bec1a9 |
* NT2K: cversion=3
|
|
|
bec1a9 |
*/
|
|
|
bec1a9 |
|
|
|
bec1a9 |
- *version = get_correct_cversion(session_info, short_architecture,
|
|
|
bec1a9 |
- *driver_path, &err;;
|
|
|
bec1a9 |
+ *version = get_correct_cversion(session_info,
|
|
|
bec1a9 |
+ short_architecture,
|
|
|
bec1a9 |
+ *driver_path,
|
|
|
bec1a9 |
+ *driver_directory,
|
|
|
bec1a9 |
+ &err;;
|
|
|
bec1a9 |
if (*version == -1) {
|
|
|
bec1a9 |
return err;
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
--
|
|
|
bec1a9 |
2.9.3
|
|
|
bec1a9 |
|
|
|
bec1a9 |
|
|
|
bec1a9 |
From f0c2a79e1312d2f8231940c12e08b09d65d03648 Mon Sep 17 00:00:00 2001
|
|
|
bec1a9 |
From: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Date: Fri, 5 May 2017 11:11:25 +0200
|
|
|
bec1a9 |
Subject: [PATCH 2/3] smbtorture:spoolss: Rename the copy_from_directory test
|
|
|
bec1a9 |
for 64bit
|
|
|
bec1a9 |
|
|
|
bec1a9 |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12761
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Reviewed-by: Guenther Deschner <gd@samba.org>
|
|
|
bec1a9 |
(cherry picked from commit 86798a0fa16b4cc89c35d698bffe0b436fc4eb2e)
|
|
|
bec1a9 |
---
|
|
|
bec1a9 |
source4/torture/rpc/spoolss.c | 16 +++++++++++-----
|
|
|
bec1a9 |
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
|
bec1a9 |
|
|
|
bec1a9 |
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
|
|
|
bec1a9 |
index 409ba57..c4b7bf1 100644
|
|
|
bec1a9 |
--- a/source4/torture/rpc/spoolss.c
|
|
|
bec1a9 |
+++ b/source4/torture/rpc/spoolss.c
|
|
|
bec1a9 |
@@ -11109,7 +11109,8 @@ static bool test_multiple_drivers(struct torture_context *tctx,
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
static bool test_driver_copy_from_directory(struct torture_context *tctx,
|
|
|
bec1a9 |
- struct dcerpc_pipe *p)
|
|
|
bec1a9 |
+ struct dcerpc_pipe *p,
|
|
|
bec1a9 |
+ const char *architecture)
|
|
|
bec1a9 |
{
|
|
|
bec1a9 |
struct torture_driver_context *d;
|
|
|
bec1a9 |
struct spoolss_StringArray *a;
|
|
|
bec1a9 |
@@ -11125,8 +11126,7 @@ static bool test_driver_copy_from_directory(struct torture_context *tctx,
|
|
|
bec1a9 |
d = talloc_zero(tctx, struct torture_driver_context);
|
|
|
bec1a9 |
torture_assert_not_null(tctx, d, "ENOMEM");
|
|
|
bec1a9 |
|
|
|
bec1a9 |
- d->local.environment =
|
|
|
bec1a9 |
- talloc_asprintf(d, SPOOLSS_ARCHITECTURE_x64);
|
|
|
bec1a9 |
+ d->local.environment = talloc_strdup(d, architecture);
|
|
|
bec1a9 |
torture_assert_not_null_goto(tctx, d->local.environment, ok, done, "ENOMEM");
|
|
|
bec1a9 |
|
|
|
bec1a9 |
d->local.driver_directory =
|
|
|
bec1a9 |
@@ -11208,6 +11208,12 @@ done:
|
|
|
bec1a9 |
return ok;
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
+static bool test_driver_copy_from_directory_64(struct torture_context *tctx,
|
|
|
bec1a9 |
+ struct dcerpc_pipe *p)
|
|
|
bec1a9 |
+{
|
|
|
bec1a9 |
+ return test_driver_copy_from_directory(tctx, p, SPOOLSS_ARCHITECTURE_x64);
|
|
|
bec1a9 |
+}
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
static bool test_del_driver_all_files(struct torture_context *tctx,
|
|
|
bec1a9 |
struct dcerpc_pipe *p)
|
|
|
bec1a9 |
{
|
|
|
bec1a9 |
@@ -11401,8 +11407,8 @@ struct torture_suite *torture_rpc_spoolss_driver(TALLOC_CTX *mem_ctx)
|
|
|
bec1a9 |
torture_rpc_tcase_add_test(tcase, "multiple_drivers", test_multiple_drivers);
|
|
|
bec1a9 |
|
|
|
bec1a9 |
torture_rpc_tcase_add_test(tcase,
|
|
|
bec1a9 |
- "test_driver_copy_from_directory",
|
|
|
bec1a9 |
- test_driver_copy_from_directory);
|
|
|
bec1a9 |
+ "test_driver_copy_from_directory_64",
|
|
|
bec1a9 |
+ test_driver_copy_from_directory_64);
|
|
|
bec1a9 |
|
|
|
bec1a9 |
torture_rpc_tcase_add_test(tcase, "del_driver_all_files", test_del_driver_all_files);
|
|
|
bec1a9 |
|
|
|
bec1a9 |
--
|
|
|
bec1a9 |
2.9.3
|
|
|
bec1a9 |
|
|
|
bec1a9 |
|
|
|
bec1a9 |
From daca3311db095c96a471f49dcfe291e5e048ed19 Mon Sep 17 00:00:00 2001
|
|
|
bec1a9 |
From: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Date: Fri, 5 May 2017 11:12:02 +0200
|
|
|
bec1a9 |
Subject: [PATCH 3/3] smbtorture:spoolss: Add a 32bit test for
|
|
|
bec1a9 |
copy_from_directory
|
|
|
bec1a9 |
|
|
|
bec1a9 |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12761
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Reviewed-by: Guenther Deschner <gd@samba.org>
|
|
|
bec1a9 |
(cherry picked from commit 23009b97bf2f831811c4690141db7355537659d0)
|
|
|
bec1a9 |
---
|
|
|
bec1a9 |
source4/torture/rpc/spoolss.c | 19 +++++++++++++++++--
|
|
|
bec1a9 |
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
bec1a9 |
|
|
|
bec1a9 |
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
|
|
|
bec1a9 |
index c4b7bf1..e17ac6f 100644
|
|
|
bec1a9 |
--- a/source4/torture/rpc/spoolss.c
|
|
|
bec1a9 |
+++ b/source4/torture/rpc/spoolss.c
|
|
|
bec1a9 |
@@ -11129,8 +11129,13 @@ static bool test_driver_copy_from_directory(struct torture_context *tctx,
|
|
|
bec1a9 |
d->local.environment = talloc_strdup(d, architecture);
|
|
|
bec1a9 |
torture_assert_not_null_goto(tctx, d->local.environment, ok, done, "ENOMEM");
|
|
|
bec1a9 |
|
|
|
bec1a9 |
- d->local.driver_directory =
|
|
|
bec1a9 |
- talloc_asprintf(d, "/usr/share/cups/drivers/x64");
|
|
|
bec1a9 |
+ if (strequal(architecture, SPOOLSS_ARCHITECTURE_x64)) {
|
|
|
bec1a9 |
+ d->local.driver_directory =
|
|
|
bec1a9 |
+ talloc_strdup(d, "/usr/share/cups/drivers/x64");
|
|
|
bec1a9 |
+ } else {
|
|
|
bec1a9 |
+ d->local.driver_directory =
|
|
|
bec1a9 |
+ talloc_strdup(d, "/usr/share/cups/drivers/i386");
|
|
|
bec1a9 |
+ }
|
|
|
bec1a9 |
torture_assert_not_null_goto(tctx, d->local.driver_directory, ok, done, "ENOMEM");
|
|
|
bec1a9 |
|
|
|
bec1a9 |
d->remote.driver_upload_directory = GUID_string2(d, &guid);
|
|
|
bec1a9 |
@@ -11214,6 +11219,12 @@ static bool test_driver_copy_from_directory_64(struct torture_context *tctx,
|
|
|
bec1a9 |
return test_driver_copy_from_directory(tctx, p, SPOOLSS_ARCHITECTURE_x64);
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
+static bool test_driver_copy_from_directory_32(struct torture_context *tctx,
|
|
|
bec1a9 |
+ struct dcerpc_pipe *p)
|
|
|
bec1a9 |
+{
|
|
|
bec1a9 |
+ return test_driver_copy_from_directory(tctx, p, SPOOLSS_ARCHITECTURE_NT_X86);
|
|
|
bec1a9 |
+}
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
static bool test_del_driver_all_files(struct torture_context *tctx,
|
|
|
bec1a9 |
struct dcerpc_pipe *p)
|
|
|
bec1a9 |
{
|
|
|
bec1a9 |
@@ -11410,6 +11421,10 @@ struct torture_suite *torture_rpc_spoolss_driver(TALLOC_CTX *mem_ctx)
|
|
|
bec1a9 |
"test_driver_copy_from_directory_64",
|
|
|
bec1a9 |
test_driver_copy_from_directory_64);
|
|
|
bec1a9 |
|
|
|
bec1a9 |
+ torture_rpc_tcase_add_test(tcase,
|
|
|
bec1a9 |
+ "test_driver_copy_from_directory_32",
|
|
|
bec1a9 |
+ test_driver_copy_from_directory_32);
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
torture_rpc_tcase_add_test(tcase, "del_driver_all_files", test_del_driver_all_files);
|
|
|
bec1a9 |
|
|
|
bec1a9 |
torture_rpc_tcase_add_test(tcase, "del_driver_unused_files", test_del_driver_unused_files);
|
|
|
bec1a9 |
--
|
|
|
bec1a9 |
2.9.3
|
|
|
bec1a9 |
|