s3-rpc_client: Close policy handles before creating defaults.
authorAndreas Schneider <asn@samba.org>
Mon, 25 Jul 2011 20:16:20 +0000 (22:16 +0200)
committerAndreas Schneider <asn@samba.org>
Wed, 27 Jul 2011 06:49:58 +0000 (08:49 +0200)
We reopen the hive and key so close them before reopen.

source3/rpc_client/cli_winreg_spoolss.c

index ebdd419a6557971850eece980379b116491edb86..e3d8a3d20548e55aeea9afcd129b08ca49df74e7 100644 (file)
@@ -1666,6 +1666,21 @@ 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,
+                                                      tmp_ctx,
+                                                      &key_hnd,
+                                                      &ignore);
+                       }
+
+                       if (is_valid_policy_hnd(&hive_hnd)) {
+                               dcerpc_winreg_CloseKey(winreg_handle,
+                                                      tmp_ctx,
+                                                      &hive_hnd,
+                                                      &ignore);
+                       }
                        goto create_default;
                }
                goto done;