[SCM] Samba Shared Repository - branch v3-5-test updated

Günther Deschner gd at samba.org
Tue Nov 24 03:43:42 MST 2009


The branch, v3-5-test has been updated
       via  698e8b4... docs: Fix Bug 6922: Add Registry patchfile for Win7 domain join.
       via  6405413... s3-spoolss: Fix GetPrinter level 101.
       via  0bf518c... s4-smbtorture: fix spoolss_EnumPrinterKey client in RPC-SPOOLSS-WIN.
       via  6b873f4... s3-printing: remove duplicate code while cleaning up driver structs.
      from  3de925c... Restore NtCreateX case handling with FILE_FLAG_POSIX_SEMANTICS to the way it worked in 3.3.x and 3.2.x. UCF_POSIX_PATHNAMES may no longer be needed, as lp_posix_pathnames() being set isn't the same as case handling from NtCreateX (lp_posix_pathnames() changes the STAT calls to LSTAT, not the case semantics). Jeremy. (cherry picked from commit a930e3e4e140a133cb2ab59d20bda9e04b93cd7a)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 698e8b4e26bd569607b6d1e73b8fb3da10281475
Author: Günther Deschner <gd at samba.org>
Date:   Tue Nov 24 11:36:14 2009 +0100

    docs: Fix Bug 6922: Add Registry patchfile for Win7 domain join.
    
    Patchfile from SATOH Fumiyasu <fumiyas at osstech.co.jp>.
    
    Thanks!
    
    Guenther
    (cherry picked from commit 95d0f0aab01fdd751841d57cebe6150cd6fdf80c)

commit 6405413e3aa88f6cecae5439bb59b1442fb2c5c7
Author: Günther Deschner <gd at samba.org>
Date:   Mon Nov 23 16:54:34 2009 +0100

    s3-spoolss: Fix GetPrinter level 101.
    
    Guenther
    (cherry picked from commit a6142987ac164318f5023eaa91e4e65efada4423)

commit 0bf518c3c20cc6d86e574733730a266dc7ef2496
Author: Günther Deschner <gd at samba.org>
Date:   Mon Nov 23 13:35:32 2009 +0100

    s4-smbtorture: fix spoolss_EnumPrinterKey client in RPC-SPOOLSS-WIN.
    
    Guenther

commit 6b873f4569ab54109fe2ad308483c9a81666c28c
Author: Günther Deschner <gd at samba.org>
Date:   Mon Nov 23 12:57:46 2009 +0100

    s3-printing: remove duplicate code while cleaning up driver structs.
    
    Guenther
    (cherry picked from commit 513d6da404fb37f87e5b658198ecfd9e35985353)

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/registry/Win7_Samba3DomainMember.reg |  Bin 0 -> 424 bytes
 source3/printing/nt_printing.c                |  107 +++++++++----------------
 source3/rpc_server/srv_spoolss_nt.c           |    2 +-
 source4/torture/rpc/spoolss_win.c             |   22 ++++-
 4 files changed, 58 insertions(+), 73 deletions(-)
 create mode 100644 docs-xml/registry/Win7_Samba3DomainMember.reg


Changeset truncated at 500 lines:

diff --git a/docs-xml/registry/Win7_Samba3DomainMember.reg b/docs-xml/registry/Win7_Samba3DomainMember.reg
new file mode 100644
index 0000000..b5de9e2
Binary files /dev/null and b/docs-xml/registry/Win7_Samba3DomainMember.reg differ
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 8fa29aa..7c449f9 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1608,10 +1608,17 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
 	} \
 } while (0);
 
-static WERROR clean_up_driver_struct_level_3(struct pipes_struct *rpc_pipe,
-					     struct spoolss_AddDriverInfo3 *driver)
+static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
+					   struct pipes_struct *rpc_pipe,
+					   const char *architecture,
+					   const char **driver_path,
+					   const char **data_file,
+					   const char **config_file,
+					   const char **help_file,
+					   struct spoolss_StringArray *dependent_files,
+					   uint32_t *version)
 {
-	const char *architecture;
+	const char *short_architecture;
 	int i;
 	WERROR err;
 	char *_p;
@@ -1622,19 +1629,19 @@ static WERROR clean_up_driver_struct_level_3(struct pipes_struct *rpc_pipe,
 	 */
 	/* using an intermediate string to not have overlaping memcpy()'s */
 
-	strip_driver_path(driver, driver->driver_path);
-	strip_driver_path(driver, driver->data_file);
-	strip_driver_path(driver, driver->config_file);
-	strip_driver_path(driver, driver->help_file);
+	strip_driver_path(mem_ctx, *driver_path);
+	strip_driver_path(mem_ctx, *data_file);
+	strip_driver_path(mem_ctx, *config_file);
+	strip_driver_path(mem_ctx, *help_file);
 
-	if (driver->dependent_files && driver->dependent_files->string) {
-		for (i=0; driver->dependent_files->string[i]; i++) {
-			strip_driver_path(driver, driver->dependent_files->string[i]);
+	if (dependent_files && dependent_files->string) {
+		for (i=0; dependent_files->string[i]; i++) {
+			strip_driver_path(mem_ctx, dependent_files->string[i]);
 		}
 	}
 
-	architecture = get_short_archi(driver->architecture);
-	if (!architecture) {
+	short_architecture = get_short_archi(architecture);
+	if (!short_architecture) {
 		return WERR_UNKNOWN_PRINTER_DRIVER;
 	}
 
@@ -1650,76 +1657,40 @@ static WERROR clean_up_driver_struct_level_3(struct pipes_struct *rpc_pipe,
 	 *	NT2K: cversion=3
 	 */
 
-	if ((driver->version = get_correct_cversion(rpc_pipe, architecture,
-						     driver->driver_path,
-						     &err)) == -1)
+	*version = get_correct_cversion(rpc_pipe, short_architecture,
+					*driver_path, &err);
+	if (*version == -1) {
 		return err;
-
-	return WERR_OK;
-}
-
-/****************************************************************************
-****************************************************************************/
-static WERROR clean_up_driver_struct_level_6(struct pipes_struct *rpc_pipe,
-					     struct spoolss_AddDriverInfo6 *driver)
-{
-	const char *architecture;
-	char *_p;
-	int i;
-	WERROR err;
-
-	/* clean up the driver name.
-	 * we can get .\driver.dll
-	 * or worse c:\windows\system\driver.dll !
-	 */
-	/* using an intermediate string to not have overlaping memcpy()'s */
-
-	strip_driver_path(driver, driver->driver_path);
-	strip_driver_path(driver, driver->data_file);
-	strip_driver_path(driver, driver->config_file);
-	strip_driver_path(driver, driver->help_file);
-
-	if (driver->dependent_files && driver->dependent_files->string) {
-		for (i=0; driver->dependent_files->string[i]; i++) {
-			strip_driver_path(driver, driver->dependent_files->string[i]);
-		}
-	}
-
-	architecture = get_short_archi(driver->architecture);
-	if (!architecture) {
-		return WERR_UNKNOWN_PRINTER_DRIVER;
 	}
 
-	/* jfm:7/16/2000 the client always sends the cversion=0.
-	 * The server should check which version the driver is by reading
-	 * the PE header of driver->driverpath.
-	 *
-	 * For Windows 95/98 the version is 0 (so the value sent is correct)
-	 * For Windows NT (the architecture doesn't matter)
-	 *	NT 3.1: cversion=0
-	 *	NT 3.5/3.51: cversion=1
-	 *	NT 4: cversion=2
-	 *	NT2K: cversion=3
-	 */
-
-	if ((driver->version = get_correct_cversion(rpc_pipe, architecture,
-						    driver->driver_path,
-						    &err)) == -1)
-			return err;
-
 	return WERR_OK;
 }
 
 /****************************************************************************
 ****************************************************************************/
+
 WERROR clean_up_driver_struct(struct pipes_struct *rpc_pipe,
 			      struct spoolss_AddDriverInfoCtr *r)
 {
 	switch (r->level) {
 	case 3:
-		return clean_up_driver_struct_level_3(rpc_pipe, r->info.info3);
+		return clean_up_driver_struct_level(r, rpc_pipe,
+						    r->info.info3->architecture,
+						    &r->info.info3->driver_path,
+						    &r->info.info3->data_file,
+						    &r->info.info3->config_file,
+						    &r->info.info3->help_file,
+						    r->info.info3->dependent_files,
+						    &r->info.info3->version);
 	case 6:
-		return clean_up_driver_struct_level_6(rpc_pipe, r->info.info6);
+		return clean_up_driver_struct_level(r, rpc_pipe,
+						    r->info.info6->architecture,
+						    &r->info.info6->driver_path,
+						    &r->info.info6->data_file,
+						    &r->info.info6->config_file,
+						    &r->info.info6->help_file,
+						    r->info.info6->dependent_files,
+						    &r->info.info6->version);
 	default:
 		return WERR_NOT_SUPPORTED;
 	}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 4f3bf73..072090b 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4946,7 +4946,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx,
 		count++;
 	}
 
-	for (i=0; driver->info3.dependent_files[i][0] != '\0'; i++) {
+	for (i=0; driver->info3.dependent_files[i] && driver->info3.dependent_files[i][0] != '\0'; i++) {
 		info = TALLOC_REALLOC_ARRAY(mem_ctx, info,
 					    struct spoolss_DriverFileInfo,
 					    count + 1);
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index 719d8e2..df1a47d 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -23,6 +23,7 @@
 #include "torture/rpc/rpc.h"
 #include "librpc/gen_ndr/ndr_spoolss_c.h"
 #include "rpc_server/dcerpc_server.h"
+#include "librpc/gen_ndr/ndr_misc.h"
 #include "ntvfs/ntvfs.h"
 #include "param/param.h"
 
@@ -177,7 +178,7 @@ static bool test_GetPrinterData(struct torture_context *tctx,
 	if (W_ERROR_IS_OK(expected_werr)) {
 		torture_assert_int_equal(tctx, data.value,
 			expected_value,
-			"GetPrinterData did not return expected value.");
+			talloc_asprintf(tctx, "GetPrinterData for %s did not return expected value.", value_name));
 	}
 	return true;
 }
@@ -385,15 +386,17 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
 	NTSTATUS status;
 	struct spoolss_EnumPrinterKey epk;
 	uint32_t needed = 0;
-	const char **key_buffer = NULL;
+	uint16_t *key_buffer;
 
 	torture_comment(tctx, "Testing EnumPrinterKey(%s)\n", key);
 
+	key_buffer = talloc_zero_array(tctx, uint16_t, 0);
+
 	epk.in.handle = handle;
 	epk.in.key_name = talloc_strdup(tctx, key);
 	epk.in.offered = 0;
 	epk.out.needed = &needed;
-	epk.out.key_buffer = &key_buffer;
+	epk.out.key_buffer = key_buffer;
 
 	status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
 	torture_assert_ntstatus_ok(tctx, status, "EnumPrinterKey failed");
@@ -401,6 +404,8 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
 
 	if (W_ERROR_EQUAL(epk.out.result, WERR_MORE_DATA)) {
 		epk.in.offered = needed;
+		key_buffer = talloc_zero_array(tctx, uint16_t, needed/2);
+		epk.out.key_buffer = key_buffer;
 		status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
 		torture_assert_ntstatus_ok(tctx, status,
 				"EnumPrinterKey failed");
@@ -408,7 +413,16 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
 
 	torture_assert_werr_ok(tctx, epk.out.result, "EnumPrinterKey failed");
 
-	ctx->printer_keys = key_buffer;
+	{
+		union winreg_Data data;
+		enum ndr_err_code ndr_err;
+		DATA_BLOB blob = data_blob_const(key_buffer, needed);
+		ndr_err = ndr_pull_union_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx),
+					&data, REG_MULTI_SZ,
+					(ndr_pull_flags_fn_t)ndr_pull_winreg_Data);
+		torture_assert_ndr_success(tctx, ndr_err, "failed to pull REG_MULTI_SZ");
+		ctx->printer_keys = data.string_array;
+	}
 
 	return true;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list