s3-rpc_client: Migrate to dcerpc_winreg_delete_subkeys_recursive().
authorVicentiu Ciorbaru <cvicentiu@gmail.com>
Tue, 12 Jul 2011 16:50:57 +0000 (19:50 +0300)
committerAndreas Schneider <asn@samba.org>
Wed, 13 Jul 2011 09:31:22 +0000 (11:31 +0200)
Functions now use dcerpc_winreg_delete_subkeys_recursive() instead of the more
specific printer function winreg_printer_delete_subkeys().

Signed-off-by: Andreas Schneider <asn@samba.org>
source3/rpc_client/cli_winreg_spoolss.c

index a7e2cdb9b9dfb1cf0b483b86ce46b8b85c5db661..83ea617946e043519d05dd826ee9523224f1c5ea 100644 (file)
@@ -2632,6 +2632,7 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
        char *keyname;
        char *path;
        WERROR result;
+       NTSTATUS status;
        TALLOC_CTX *tmp_ctx;
 
        tmp_ctx = talloc_stackframe();
@@ -2682,11 +2683,20 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
                }
        }
 
-       result = winreg_printer_delete_subkeys(tmp_ctx,
-                                              winreg_handle,
-                                              &hive_hnd,
-                                              access_mask,
-                                              keyname);
+       status = dcerpc_winreg_delete_subkeys_recursive(tmp_ctx,
+                                                       winreg_handle,
+                                                       &hive_hnd,
+                                                       access_mask,
+                                                       keyname,
+                                                       &result);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("winreg_delete_printer_key: Could not delete key %s: %s\n",
+                         key, nt_errstr(status)));
+               result = ntstatus_to_werror(status);
+               goto done;
+       }
+
        if (!W_ERROR_IS_OK(result)) {
                DEBUG(0, ("winreg_delete_printer_key: Could not delete key %s: %s\n",
                          key, win_errstr(result)));
@@ -4057,6 +4067,7 @@ WERROR winreg_del_driver(TALLOC_CTX *mem_ctx,
        TALLOC_CTX *tmp_ctx;
        char *key_name;
        WERROR result;
+       NTSTATUS status;
 
        ZERO_STRUCT(hive_hnd);
        ZERO_STRUCT(key_hnd);
@@ -4104,11 +4115,21 @@ WERROR winreg_del_driver(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       result = winreg_printer_delete_subkeys(tmp_ctx,
-                                              winreg_handle,
-                                              &hive_hnd,
-                                              access_mask,
-                                              key_name);
+       status = dcerpc_winreg_delete_subkeys_recursive(tmp_ctx,
+                                                       winreg_handle,
+                                                       &hive_hnd,
+                                                       access_mask,
+                                                       key_name,
+                                                       &result);
+
+       if (!NT_STATUS_IS_OK(status)){
+               DEBUG(0, ("winreg_del_driver: "
+                         "Could not open driver (%s,%s,%u): %s\n",
+                         info8->driver_name, info8->architecture,
+                         version, nt_errstr(status)));
+               goto done;
+       }
+
        if (!W_ERROR_IS_OK(result)) {
                DEBUG(0, ("winreg_del_driver: "
                          "Could not open driver (%s,%s,%u): %s\n",