[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Thu May 10 03:08:03 MDT 2012


The branch, master has been updated
       via  31db7d2 Fix bug 8920, null dereference
       via  815eb53 s3: Fix Coverity ID 242714 Uninitialized scalar variable
       via  9b0b60c s3: Fix Coverity ID 242715 Uninitialized scalar variable
       via  6d5bbb9 s3: Fix Coverity ID 242716 Uninitialized scalar variable
       via  bd4701d s3: Fix Coverity ID 242717 Uninitialized scalar variable
       via  2a03d9e s3: Fix Coverity ID 242718 Uninitialized scalar variable
       via  74ca9cc s3: Fix Coverity ID 242719 Uninitialized scalar variable
       via  b2ea585 s3: Fix Coverity ID 242720 Uninitialized scalar variable
       via  a4b7a1e s3: Fix Coverity ID 242721 Uninitialized scalar variable
       via  1e3b5ec s3: Fix Coverity ID 242722 Uninitialized scalar variable
       via  ba6fa9e s3: Fix Coverity ID 242723 Uninitialized scalar variable
       via  4487f26 s3: Fix Coverity ID 241961 Uninitialized scalar variable
       via  446791c s3: Fix Coverity ID 242724 Uninitialized scalar variable
       via  aa220c4 s3: Fix Coverity ID 242725 Uninitialized scalar variable
       via  dead216 s3: Fix Coverity ID 242726 Uninitialized scalar variable
       via  4e05717 s3: Fix Coverity ID 242754 Dereference null return value
       via  d716a9b s3: Fix Coverity ID 242184 Dereference after null check
       via  05e5973 s3: Fix Coverity ID 242691 Dereference before null check
       via  8c2f826 s3: Fix Coverity ID 242692 Dereference before null check
       via  318cf16 s3: Fix Coverity ID 242693 Dereference before null check
       via  c0471d1 s3: Fix Coverity ID 242694 Dereference before null check
       via  39577f1 s3: Fix Coverity ID 242695 Dereference before null check
       via  600c4c9 s3: Fix Coverity ID 242696 Dereference before null check
       via  995ea20 s3: Fix Coverity ID 242697 Dereference before null check
       via  3a8c4ab s3: Fix Coverity ID 242698 Dereference before null check
       via  7527152 s3: Fix Coverity ID 242699 Dereference before null check
       via  f9f4d70 s3: Fix Coverity ID 242700 Dereference before null check
       via  a7b23ce s3: Fix Coverity ID 242701 Dereference before null check
       via  e0bc376 s3: Fix Coverity ID 242702 Dereference before null check
       via  11085bd s3: Fix Coverity ID 242703 Dereference before null check
       via  6c34e1a s3: Fix Coverity ID 242704 Dereference before null check
       via  37b7095 s3: Fix Coverity ID 242705 Dereference before null check
       via  67e3067 s3: Fix Coverity ID 242706 Dereference before null check
      from  37609ba build: Avoid printing the ABI signature normalisation during the default build

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


- Log -----------------------------------------------------------------
commit 31db7d298577f18d70b0a8241a92dc8a1dc782bd
Author: Steve Langasek <steve.langasek at ubuntu.com>
Date:   Wed May 9 07:56:00 2012 +0200

    Fix bug 8920, null dereference
    
    Description: Avoid null dereference in initialize_password_db()
     When initialize_password_db() is called with reload=True, it's assumed that
     the free_private_data member of pdb_methods is non-null.  This is not
     necessarily the case, as the tdb backend has no private data and therefore
     no free function.  Check to see if we have private data that needs freed
     before calling.
    Author: Steve Langasek <steve.langasek at ubuntu.com>
    Bug-Ubuntu: https://bugs.launchpad.net/bugs/829221
    
    Autobuild-User: Volker Lendecke <vl at samba.org>
    Autobuild-Date: Thu May 10 11:07:27 CEST 2012 on sn-devel-104

commit 815eb53b3397495b4b6eeade267442bafb12aa82
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242714 Uninitialized scalar variable
    
    In an error path we are closing domain_handle without opening it

commit 9b0b60c67ed0f819b3616b99d35300e678e18b80
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242715 Uninitialized scalar variable
    
    In an error path we are closing hive_hnd without opening it

commit 6d5bbb9a4bd3d1fb045f4e0873196a9b1d93ae2a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242716 Uninitialized scalar variable
    
    In an error path we are closing key_hnd without opening it

commit bd4701d2869c8f5271c72fe4271c2ba4772acfad
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242717 Uninitialized scalar variable
    
    In an error path we are closing domain_pol without opening it

commit 2a03d9e42c71bc164936d3e46e1240494ca33bd5
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242718 Uninitialized scalar variable
    
    In an error path we are closing user_pol without opening it

commit 74ca9cc957cfd0f9a6c33b6c9cb8d7822ff7e7ff
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242719 Uninitialized scalar variable
    
    In an error path we are closing domain_pol without opening it

commit b2ea585c1459c4ab142378aa973c4979bc52b990
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242720 Uninitialized scalar variable
    
    In an error path we are closing domain_pol without opening it

commit a4b7a1eb26dedb0902c9b0cf447e4f061b877c7a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242721 Uninitialized scalar variable
    
    In an error path we are closing domain_pol without opening it

commit 1e3b5ec9518b302dd13c0c99c23f0a4489469d58
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242722 Uninitialized scalar variable
    
    In an error path we are closing domain_handle without opening it

commit ba6fa9e5271841c30c16907d0c4ad42c3950359a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242723 Uninitialized scalar variable
    
    In an error path we are closing hnd without opening it

commit 4487f26815c9812c3d0af4338406c1a45e2cc3f7
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:59:49 2012 +0200

    s3: Fix Coverity ID 241961 Uninitialized scalar variable

commit 446791c6bf8336c5412c1aa98f0ce0f416950b94
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:56:54 2012 +0200

    s3: Fix Coverity ID 242724 Uninitialized scalar variable
    
    In an error path we are closing pol without opening it

commit aa220c498166f98cfe8bd4177c443f03237e2e9e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:51:54 2012 +0200

    s3: Fix Coverity ID 242725 Uninitialized scalar variable
    
    Not a functional bug, but we copy all of the "key" structure inside
    dcerpc_winreg_CreateKey.

commit dead2168a2fa47d99251baa894e9c932074d1734
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:51:54 2012 +0200

    s3: Fix Coverity ID 242726 Uninitialized scalar variable
    
    Not a functional bug, but we copy all of the "key" structure inside
    dcerpc_winreg_OpenKey.

commit 4e05717559a2649288ac0a9e5df4cdf1543aa559
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:41:06 2012 +0200

    s3: Fix Coverity ID 242754 Dereference null return value

commit d716a9bd06f1d752bd98dfe210133cec601ab617
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 10:30:47 2012 +0200

    s3: Fix Coverity ID 242184 Dereference after null check
    
    rpc_query_user unconditionally dereferences user_info if successfull

commit 05e59739b30073173697974fcfebb871d04801ae
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242691 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 8c2f826553d35fb69cb570ee1b92a2792b603f86
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242692 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 318cf16f7be6df6f4711153c685cbb9a510dfe19
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242693 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit c0471d1d96149f791401a7d5672ad83306bbc85a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242694 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 39577f1e99900c95561fa137e23c0488660bcf5e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242695 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 600c4c9c45396f2521f413abb0a4e1a3567b869c
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242696 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 995ea20fa27cbb13e090246999385047dbbff1b3
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242697 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 3a8c4ab2adaed1080e3448cd82d22c71c248c97e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242698 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 75271528f3289c18794c827ccd17a62ba5196ef7
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242699 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit f9f4d705c2121ce3efddae0b634c43f2fa3ee0d0
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242700 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit a7b23cec6dae3e20b144261705e8674b1d0cca12
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242701 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit e0bc3767e351bdf6ba90ebea00cfa089341aea14
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242702 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 11085bd93ab18a560a2e390f3f3c776b96c8d024
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242703 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 6c34e1a01534e010f744fbfdb5468b7dfacdb23e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242704 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 37b7095c8a408a89e1e8390c89beeabbb88e3823
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242705 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

commit 67e306703b55cb7683bf772c3df36815361701c9
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 9 09:16:54 2012 +0200

    s3: Fix Coverity ID 242706 Dereference before null check
    
    winreg_printer_openkey above already dereferences winreg_handle

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

Summary of changes:
 source3/passdb/pdb_interface.c              |    4 +-
 source3/rpc_client/cli_winreg_spoolss.c     |  244 +++++++++++----------------
 source3/rpc_server/netlogon/srv_netlog_nt.c |    3 +-
 source3/rpcclient/cmd_samr.c                |   15 +-
 source3/rpcclient/cmd_spoolss.c             |    6 +-
 source3/utils/eventlogadm.c                 |    2 +-
 source3/utils/net_rpc_conf.c                |    3 +-
 source3/winbindd/winbindd_samr.c            |    8 +-
 8 files changed, 123 insertions(+), 162 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 6945a42..5931dde 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -195,7 +195,9 @@ static struct pdb_methods *pdb_get_methods_reload( bool reload )
 	static struct pdb_methods *pdb = NULL;
 
 	if ( pdb && reload ) {
-		pdb->free_private_data( &(pdb->private_data) );
+		if (pdb->free_private_data != NULL) {
+			pdb->free_private_data( &(pdb->private_data) );
+		}
 		if ( !NT_STATUS_IS_OK( make_pdb_method_name( &pdb, lp_passdb_backend() ) ) ) {
 			return NULL;
 		}
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index 49b67aa..7bd5033 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -936,6 +936,7 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
 	DATA_BLOB blob;
 	char *path;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -1318,15 +1319,11 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -1351,6 +1348,7 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
 	char *path;
 	NTSTATUS status;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	const char **enum_names = NULL;
 	enum winreg_Type *enum_types = NULL;
 	DATA_BLOB *enum_data_blobs = NULL;
@@ -1598,15 +1596,11 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -1625,6 +1619,7 @@ WERROR winreg_get_printer_secdesc(TALLOC_CTX *mem_ctx,
 	TALLOC_CTX *tmp_ctx;
 	NTSTATUS status;
 	WERROR result;
+	WERROR ignore;
 
 	tmp_ctx = talloc_stackframe();
 	if (tmp_ctx == NULL) {
@@ -1666,7 +1661,6 @@ WERROR winreg_get_printer_secdesc(TALLOC_CTX *mem_ctx,
 	}
 	if (!W_ERROR_IS_OK(result)) {
 		if (W_ERROR_EQUAL(result, WERR_BADFILE)) {
-			WERROR ignore;
 
 			if (is_valid_policy_hnd(&key_hnd)) {
 				dcerpc_winreg_CloseKey(winreg_handle,
@@ -1764,15 +1758,11 @@ create_default:
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	talloc_free(tmp_ctx);
@@ -1792,6 +1782,7 @@ WERROR winreg_set_printer_secdesc(TALLOC_CTX *mem_ctx,
 	TALLOC_CTX *tmp_ctx;
 	NTSTATUS status;
 	WERROR result;
+	WERROR ignore;
 
 	tmp_ctx = talloc_stackframe();
 	if (tmp_ctx == NULL) {
@@ -1882,15 +1873,11 @@ WERROR winreg_set_printer_secdesc(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	talloc_free(tmp_ctx);
@@ -1912,6 +1899,7 @@ WERROR winreg_set_printer_dataex(TALLOC_CTX *mem_ctx,
 	struct winreg_String wvalue = { 0, };
 	char *path;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -1961,15 +1949,11 @@ WERROR winreg_set_printer_dataex(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -1995,6 +1979,7 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
 	uint32_t data_in_size = 0;
 	uint32_t value_len = 0;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -2090,15 +2075,11 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2121,6 +2102,7 @@ WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
 	uint32_t num_values = 0;
 	char *path;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 	const char **enum_names = NULL;
 	enum winreg_Type *enum_types = NULL;
@@ -2201,15 +2183,11 @@ WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2228,6 +2206,7 @@ WERROR winreg_delete_printer_dataex(TALLOC_CTX *mem_ctx,
 	struct winreg_String wvalue = { 0, };
 	char *path;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 
 	TALLOC_CTX *tmp_ctx;
@@ -2273,15 +2252,11 @@ WERROR winreg_delete_printer_dataex(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2303,6 +2278,7 @@ WERROR winreg_enum_printer_key(TALLOC_CTX *mem_ctx,
 	uint32_t num_subkeys = -1;
 
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 
 	TALLOC_CTX *tmp_ctx;
@@ -2357,15 +2333,11 @@ WERROR winreg_enum_printer_key(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2383,6 +2355,7 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
 	char *keyname;
 	char *path;
 	WERROR result;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -2455,15 +2428,11 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2479,6 +2448,7 @@ WERROR winreg_printer_update_changeid(TALLOC_CTX *mem_ctx,
 	char *path;
 	NTSTATUS status;
 	WERROR result;
+	WERROR ignore;
 	TALLOC_CTX *tmp_ctx;
 
 	tmp_ctx = talloc_stackframe();
@@ -2524,15 +2494,11 @@ WERROR winreg_printer_update_changeid(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2550,6 +2516,7 @@ WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx,
 	char *path;
 	NTSTATUS status;
 	WERROR result;
+	WERROR ignore;
 	TALLOC_CTX *tmp_ctx;
 
 	tmp_ctx = talloc_stackframe();
@@ -2601,15 +2568,11 @@ WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2635,6 +2598,7 @@ WERROR winreg_printer_addform1(TALLOC_CTX *mem_ctx,
 	union spoolss_FormInfo *info = NULL;
 	uint32_t i;
 	WERROR result;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -2703,15 +2667,11 @@ WERROR winreg_printer_addform1(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(info);
@@ -2732,6 +2692,7 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx,
 	uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
 	uint32_t i;
 	WERROR result;
+	WERROR ignore;
 	NTSTATUS status;
 	const char **enum_names = NULL;
 	enum winreg_Type *enum_types = NULL;
@@ -2853,15 +2814,11 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(enum_values);
@@ -2879,6 +2836,7 @@ WERROR winreg_printer_deleteform1(TALLOC_CTX *mem_ctx,
 	uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
 	uint32_t i;
 	WERROR result = WERR_OK;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -2932,15 +2890,11 @@ WERROR winreg_printer_deleteform1(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 
 	TALLOC_FREE(tmp_ctx);
@@ -2953,7 +2907,8 @@ WERROR winreg_printer_setform1(TALLOC_CTX *mem_ctx,
 			       struct spoolss_AddFormInfo1 *form)
 {
 	uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
-	struct policy_handle hive_hnd, key_hnd;
+	struct policy_handle hive_hnd = { 0, };
+	struct policy_handle key_hnd = { 0, };
 	struct winreg_String wvalue = { 0, };
 	DATA_BLOB blob;
 	uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
@@ -3059,6 +3014,7 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx,
 	uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
 	uint32_t i;
 	WERROR result;
+	WERROR ignore;
 	NTSTATUS status;
 	TALLOC_CTX *tmp_ctx;
 
@@ -3161,15 +3117,11 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx,
 
 	result = WERR_OK;
 done:
-	if (winreg_handle != NULL) {
-		WERROR ignore;
-
-		if (is_valid_policy_hnd(&key_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
-		}
-		if (is_valid_policy_hnd(&hive_hnd)) {
-			dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
-		}
+	if (is_valid_policy_hnd(&key_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+	}
+	if (is_valid_policy_hnd(&hive_hnd)) {
+		dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list