diff options
author | David Disseldorp <ddiss@samba.org> | 2012-01-17 17:06:38 +0100 |
---|---|---|
committer | David Disseldorp <ddiss@samba.org> | 2012-01-20 17:44:06 +0100 |
commit | 7123b592fe10f879d4e62ca25a35eefe82b02652 (patch) | |
tree | c01143308b628c33f55a5809ed248493456fa65a | |
parent | b37f66c7b79e548aaa477ea0af12954ad2f2d205 (diff) | |
download | samba-7123b592fe10f879d4e62ca25a35eefe82b02652.tar.gz samba-7123b592fe10f879d4e62ca25a35eefe82b02652.tar.bz2 samba-7123b592fe10f879d4e62ca25a35eefe82b02652.zip |
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
Signed-off-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 07a9f82620..c691b4a1f5 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -2173,15 +2173,17 @@ 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, - b, - info)) { - status = WERR_PRINTER_DRIVER_IN_USE; - goto done; + if (delete_files) { + bool in_use = printer_driver_files_in_use(mem_ctx, 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 + */ } |