[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Jun 21 10:59:02 MDT 2011


The branch, master has been updated
       via  c173e6e s3-spoolss: Fix some valgrind warnings.
       via  a45120a s3-rpc_client: Fix some valgrind warnings.
       via  0b5e5db s4-smbtorture: rework the spoolss notify test a bit.
       via  834dcdb s4-smbtorture: use ipv4 addresses for backchannel spoolss change notify connections for now.
      from  7e1d485 s3: Remove unused code

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c173e6e80db7505ccc71d95ed602804133d602d7
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jun 20 19:27:01 2011 +0200

    s3-spoolss: Fix some valgrind warnings.
    
    These are in/out values and need to be initialized.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Tue Jun 21 18:58:30 CEST 2011 on sn-devel-104

commit a45120aea75044fb58dd6ce267d852be9d2978af
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jun 20 15:39:36 2011 +0200

    s3-rpc_client: Fix some valgrind warnings.
    
    These are in/out values and need to be initialized.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 0b5e5db218451effe667e50ca0d0783e7878c748
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jun 21 15:06:27 2011 +0200

    s4-smbtorture: rework the spoolss notify test a bit.
    
    Guenther

commit 834dcdb35df6c56391cef240accf39b4a3b0c48a
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jun 20 18:01:38 2011 +0200

    s4-smbtorture: use ipv4 addresses for backchannel spoolss change notify
    connections for now.
    
    Guenther

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

Summary of changes:
 source3/rpc_client/cli_winreg.c               |   22 +++++++++-------
 source3/rpc_server/spoolss/srv_spoolss_nt.c   |    6 ++--
 source3/rpc_server/spoolss/srv_spoolss_util.c |   10 ++++----
 source4/torture/rpc/spoolss_notify.c          |   33 ++++++++++++-------------
 4 files changed, 36 insertions(+), 35 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_client/cli_winreg.c b/source3/rpc_client/cli_winreg.c
index 3731fc7..e5ebc25 100644
--- a/source3/rpc_client/cli_winreg.c
+++ b/source3/rpc_client/cli_winreg.c
@@ -33,7 +33,7 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
 				   WERROR *pwerr)
 {
 	struct winreg_String wvalue;
-	enum winreg_Type type;
+	enum winreg_Type type = REG_NONE;
 	uint32_t value_len = 0;
 	uint32_t data_size = 0;
 	WERROR result = WERR_OK;
@@ -69,7 +69,7 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
 		return status;
 	}
 
-	blob = data_blob_talloc(mem_ctx, NULL, data_size);
+	blob = data_blob_talloc_zero(mem_ctx, data_size);
 	if (blob.data == NULL) {
 		*pwerr = WERR_NOMEM;
 		return status;
@@ -108,13 +108,14 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
 				    WERROR *pwerr)
 {
 	struct winreg_String wvalue;
-	enum winreg_Type type;
+	enum winreg_Type type = REG_NONE;
 	WERROR result = WERR_OK;
 	uint32_t value_len = 0;
 	uint32_t data_size = 0;
 	NTSTATUS status;
 	DATA_BLOB blob;
 
+	ZERO_STRUCT(wvalue);
 	wvalue.name = value;
 
 	status = dcerpc_winreg_QueryValue(h,
@@ -139,7 +140,7 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
 		return status;
 	}
 
-	blob = data_blob_talloc(mem_ctx, NULL, data_size);
+	blob = data_blob_talloc_zero(mem_ctx, data_size);
 	if (blob.data == NULL) {
 		*pwerr = WERR_NOMEM;
 		return status;
@@ -179,7 +180,7 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
 				      WERROR *pwerr)
 {
 	struct winreg_String wvalue;
-	enum winreg_Type type;
+	enum winreg_Type type = REG_NONE;
 	WERROR result = WERR_OK;
 	uint32_t value_len = 0;
 	uint32_t data_size = 0;
@@ -210,7 +211,7 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
 		return status;
 	}
 
-	blob = data_blob_talloc(mem_ctx, NULL, data_size);
+	blob = data_blob_talloc_zero(mem_ctx, data_size);
 	if (blob.data == NULL) {
 		*pwerr = WERR_NOMEM;
 		return status;
@@ -254,7 +255,7 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
 				      WERROR *pwerr)
 {
 	struct winreg_String wvalue;
-	enum winreg_Type type;
+	enum winreg_Type type = REG_NONE;
 	WERROR result = WERR_OK;
 	uint32_t value_len = 0;
 	uint32_t data_size = 0;
@@ -285,7 +286,7 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
 		return status;
 	}
 
-	blob = data_blob_talloc(mem_ctx, NULL, data_size);
+	blob = data_blob_talloc_zero(mem_ctx, data_size);
 	if (blob.data == NULL) {
 		*pwerr = WERR_NOMEM;
 		return status;
@@ -380,13 +381,14 @@ NTSTATUS dcerpc_winreg_set_dword(TALLOC_CTX *mem_ctx,
 				 uint32_t data,
 				 WERROR *pwerr)
 {
-	struct winreg_String wvalue = { 0, };
+	struct winreg_String wvalue;
 	DATA_BLOB blob;
 	WERROR result = WERR_OK;
 	NTSTATUS status;
 
+	ZERO_STRUCT(wvalue);
 	wvalue.name = value;
-	blob = data_blob_talloc(mem_ctx, NULL, 4);
+	blob = data_blob_talloc_zero(mem_ctx, 4);
 	SIVAL(blob.data, 0, data);
 
 	status = dcerpc_winreg_SetValue(h,
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index cb311ef..8216388 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -9191,9 +9191,9 @@ WERROR _spoolss_GetPrinterDataEx(struct pipes_struct *p,
 	int 			snum = 0;
 	WERROR result = WERR_OK;
 	DATA_BLOB blob;
-	enum winreg_Type val_type;
-	uint8_t *val_data;
-	uint32_t val_size;
+	enum winreg_Type val_type = REG_NONE;
+	uint8_t *val_data = NULL;
+	uint32_t val_size = 0;
 
 
 	DEBUG(4,("_spoolss_GetPrinterDataEx\n"));
diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c
index ecb3567..5201571 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_util.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_util.c
@@ -471,7 +471,7 @@ static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx,
 		data_size = max_valbufsize;
 		data = NULL;
 		if (data_size) {
-			data = (uint8_t *) TALLOC(tmp_ctx, data_size);
+			data = (uint8_t *) talloc_zero_size(tmp_ctx, data_size);
 		}
 		length = 0;
 
@@ -2315,9 +2315,9 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
 	struct dcerpc_binding_handle *winreg_handle = NULL;
 	struct policy_handle hive_hnd, key_hnd;
 	struct winreg_String wvalue;
-	enum winreg_Type type_in;
+	enum winreg_Type type_in = REG_NONE;
 	char *path;
-	uint8_t *data_in;
+	uint8_t *data_in = NULL;
 	uint32_t data_in_size = 0;
 	uint32_t value_len = 0;
 	WERROR result = WERR_OK;
@@ -3337,8 +3337,8 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx,
 	struct dcerpc_binding_handle *winreg_handle = NULL;
 	struct policy_handle hive_hnd, key_hnd;
 	struct winreg_String wvalue;
-	enum winreg_Type type_in;
-	uint8_t *data_in;
+	enum winreg_Type type_in = REG_NONE;
+	uint8_t *data_in = NULL;
 	uint32_t data_in_size = 0;
 	uint32_t value_len = 0;
 	uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index cfb6771..ea05d9b 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -247,20 +247,13 @@ static NTSTATUS spoolss__op_init_server(struct dcesrv_context *dce_ctx, const st
 static bool test_OpenPrinter(struct torture_context *tctx,
 			     struct dcerpc_pipe *p,
 			     struct policy_handle *handle,
-			     const char *name)
+			     const char *printername)
 {
 	struct spoolss_OpenPrinter r;
-	const char *printername;
 	struct dcerpc_binding_handle *b = p->binding_handle;
 
 	ZERO_STRUCT(r);
 
-	if (name) {
-		printername	= talloc_asprintf(tctx, "\\\\%s\\%s", dcerpc_server_name(p), name);
-	} else {
-		printername	= talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
-	}
-
 	r.in.printername	= printername;
 	r.in.datatype		= NULL;
 	r.in.devmode_ctr.devmode= NULL;
@@ -352,17 +345,17 @@ static bool test_RemoteFindFirstPrinterChangeNotifyEx(struct torture_context *tc
 static bool test_RouterRefreshPrinterChangeNotify(struct torture_context *tctx,
 						  struct dcerpc_binding_handle *b,
 						  struct policy_handle *handle,
-						  struct spoolss_NotifyOption *options)
+						  struct spoolss_NotifyOption *options,
+						  struct spoolss_NotifyInfo **info)
 {
 	struct spoolss_RouterRefreshPrinterChangeNotify r;
-	struct spoolss_NotifyInfo *info;
 
 	torture_comment(tctx, "Testing RouterRefreshPrinterChangeNotify\n");
 
 	r.in.handle = handle;
 	r.in.change_low = 0;
 	r.in.options = options;
-	r.out.info = &info;
+	r.out.info = info;
 
 	torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r(b, tctx, &r),
 		"RouterRefreshPrinterChangeNotify failed");
@@ -456,7 +449,7 @@ static bool test_start_dcerpc_server(struct torture_context *tctx,
 	lpcfg_set_cmdline(tctx->lp_ctx, "dcerpc endpoint servers", "spoolss");
 
 	load_interface_list(tctx, tctx->lp_ctx, &ifaces);
-	address = iface_list_n_ip(ifaces, 0);
+	address = iface_list_first_v4(ifaces);
 
 	torture_comment(tctx, "Listening for callbacks on %s\n", address);
 
@@ -503,31 +496,37 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	struct spoolss_NotifyOption *printer_option = setup_printer_NotifyOption(tctx);
 #endif
 	struct dcerpc_binding_handle *b = p->binding_handle;
+	const char *printername = NULL;
+	struct spoolss_NotifyInfo *info = NULL;
 
 	received_packets = NULL;
 
 	/* Start DCE/RPC server */
 	torture_assert(tctx, test_start_dcerpc_server(tctx, p->conn->event_ctx, &dce_ctx, &address), "");
 
-	torture_assert(tctx, test_OpenPrinter(tctx, p, &handle, NULL), "");
+	printername	= talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+
+	torture_assert(tctx, test_OpenPrinter(tctx, p, &handle, printername), "");
 	torture_assert(tctx, test_RemoteFindFirstPrinterChangeNotifyEx(tctx, b, &handle, address, server_option), "");
 	torture_assert(tctx, received_packets, "no packets received");
 	torture_assert_int_equal(tctx, received_packets->opnum, NDR_SPOOLSS_REPLYOPENPRINTER,
 		"no ReplyOpenPrinter packet after RemoteFindFirstPrinterChangeNotifyEx");
-	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, NULL), "");
-	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, server_option), "");
+	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, NULL, &info), "");
+	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, b, &handle, server_option, &info), "");
 	torture_assert(tctx, test_ClosePrinter(tctx, b, &handle), "");
 	tmp = last_packet(received_packets);
 	torture_assert_int_equal(tctx, tmp->opnum, NDR_SPOOLSS_REPLYCLOSEPRINTER,
 		"no ReplyClosePrinter packet after ClosePrinter");
 #if 0
+	printername	= talloc_asprintf(tctx, "\\\\%s\\%s", dcerpc_server_name(p), name);
+
 	torture_assert(tctx, test_OpenPrinter(tctx, p, &handle, "Epson AL-2600"), "");
 	torture_assert(tctx, test_RemoteFindFirstPrinterChangeNotifyEx(tctx, p, &handle, address, printer_option), "");
 	tmp = last_packet(received_packets);
 	torture_assert_int_equal(tctx, tmp->opnum, NDR_SPOOLSS_REPLYOPENPRINTER,
 		"no ReplyOpenPrinter packet after RemoteFindFirstPrinterChangeNotifyEx");
-	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, NULL), "");
-	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, printer_option), "");
+	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, NULL, &info), "");
+	torture_assert(tctx, test_RouterRefreshPrinterChangeNotify(tctx, p, &handle, printer_option, &info), "");
 	torture_assert(tctx, test_SetPrinter(tctx, p, &handle), "");
 	tmp = last_packet(received_packets);
 	torture_assert_int_equal(tctx, tmp->opnum, NDR_SPOOLSS_ROUTERREPLYPRINTEREX,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list