diff options
author | David Disseldorp <ddiss@samba.org> | 2012-01-17 17:06:38 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2012-01-23 21:31:08 +0100 |
commit | 6230861e7212fbfa4dfff8bec2ed21de94e52d9d (patch) | |
tree | 5f0c1767faf397eaa6501269322988ac7ccc5ca4 | |
parent | e6ef4d2451f5c35992281772591b8c740392b5a7 (diff) | |
download | samba-6230861e7212fbfa4dfff8bec2ed21de94e52d9d.tar.gz |
s3-spoolss: fix printer_driver_files_in_use() call ordering
printer_driver_files_in_use() performs two tasks: it returns whether any
of the files in the to-be-deleted driver overlap with other drivers, it
also trims such files from the info structure passed in.
In processing a DeletePrinterDataEx request with DPD_DELETE_UNUSED_FILES
set, printer_driver_files_in_use() must be called to ensure files in
use by other drivers are not removed.
https://bugzilla.samba.org/show_bug.cgi?id=4942
(cherry picked from commit 8e3c0ac2815bc25360bf408c50449d154b841f8a)
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 8e4ddc0414f..ea99d10a427 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -2176,16 +2176,19 @@ static WERROR spoolss_dpd_version(TALLOC_CTX *mem_ctx, delete_files = r->in.delete_flags & (DPD_DELETE_ALL_FILES | DPD_DELETE_UNUSED_FILES); - /* fail if any files are in use and DPD_DELETE_ALL_FILES is set */ - - if (delete_files && - (r->in.delete_flags & DPD_DELETE_ALL_FILES) && - printer_driver_files_in_use(mem_ctx, - get_session_info_system(), - b, - info)) { - status = WERR_PRINTER_DRIVER_IN_USE; - goto done; + if (delete_files) { + bool in_use = printer_driver_files_in_use(mem_ctx, + get_session_info_system(), + b, + info); + if (in_use && (r->in.delete_flags & DPD_DELETE_ALL_FILES)) { + status = WERR_PRINTER_DRIVER_IN_USE; + goto done; + } + /* + * printer_driver_files_in_use() has trimmed overlapping files + * from info so they are not removed on DPD_DELETE_UNUSED_FILES + */ } status = winreg_del_driver(mem_ctx, b, info, info->version); |