summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-07-25 17:48:08 +0200
committerAndreas Schneider <asn@samba.org>2011-07-27 08:49:58 +0200
commitf8afaa76f225e4e7a477a59fa0a4b8f040afb2b6 (patch)
tree906d7e7d6ad8a2c76a8c31a0ef6a95eb4a120cb8 /source3/rpc_client
parenta0597b75e6794d8bfe7e43bf36378b2421afc9c7 (diff)
downloadsamba-f8afaa76f225e4e7a477a59fa0a4b8f040afb2b6.tar.gz
samba-f8afaa76f225e4e7a477a59fa0a4b8f040afb2b6.tar.bz2
samba-f8afaa76f225e4e7a477a59fa0a4b8f040afb2b6.zip
s3-rpc_client: Close the hive handle before we open it again.
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_winreg_spoolss.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index d0c048c3cc..ebdd419a65 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -599,6 +599,7 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
uint32_t i, count = ARRAY_SIZE(subkeys);
uint32_t info2_mask = 0;
WERROR result = WERR_OK;
+ WERROR ignore;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_stackframe();
@@ -634,6 +635,13 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
goto done;
}
+ 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);
+ }
+
/* Create the main key */
result = winreg_printer_openkey(tmp_ctx,
winreg_handle,
@@ -902,15 +910,11 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
secdesc);
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);