summaryrefslogtreecommitdiff
path: root/source3/printing/nt_printing.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-04-24 15:02:23 -0700
committerJeremy Allison <jra@samba.org>2008-04-24 15:02:23 -0700
commit501562f15cf1aa7798b0acefc7fb283cfb8c2b62 (patch)
tree7f518100a4dd092080a08fe781a92c74dabbcb68 /source3/printing/nt_printing.c
parent189eb93b73c4ff0737b702a0682727f5a22bcc38 (diff)
downloadsamba-501562f15cf1aa7798b0acefc7fb283cfb8c2b62.tar.gz
samba-501562f15cf1aa7798b0acefc7fb283cfb8c2b62.tar.bz2
samba-501562f15cf1aa7798b0acefc7fb283cfb8c2b62.zip
Fix from Martin Zielinski <mz@seh.de>. Don't delete files when
they're in use by other drivers. Jeremy. (This used to be commit 205c352caeb32693a02fcfaeb3f18515719ac373)
Diffstat (limited to 'source3/printing/nt_printing.c')
-rw-r--r--source3/printing/nt_printing.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 7b03a32fa8..c31a48c585 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -4992,10 +4992,15 @@ bool printer_driver_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3 )
static bool drv_file_in_use( char* file, NT_PRINTER_DRIVER_INFO_LEVEL_3 *info )
{
int i = 0;
-
+
if ( !info )
return False;
-
+
+ /* mz: skip files that are in the list but already deleted */
+ if (!file || !file[0]) {
+ return false;
+ }
+
if ( strequal(file, info->driverpath) )
return True;
@@ -5108,6 +5113,12 @@ static bool trim_overlap_drv_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *src,
Upon return, *info has been modified to only contain the driver files
which are not in use
+
+ Fix from mz:
+
+ This needs to check all drivers to ensure that all files in use
+ have been removed from *info, not just the ones in the first
+ match.
****************************************************************************/
bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info )
@@ -5117,7 +5128,8 @@ bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info )
uint32 version;
fstring *list = NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
-
+ bool in_use = false;
+
if ( !info )
return False;
@@ -5152,9 +5164,10 @@ bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info )
if ( !strequal(info->name, driver.info_3->name) ) {
if ( trim_overlap_drv_files(info, driver.info_3) ) {
- free_a_printer_driver(driver, 3);
- SAFE_FREE( list );
- return True;
+ /* mz: Do not instantly return -
+ * we need to ensure this file isn't
+ * also in use by other drivers. */
+ in_use = true;
}
}
@@ -5170,7 +5183,7 @@ bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info )
if ( DEBUGLEVEL >= 20 )
dump_a_printer_driver( driver, 3 );
- return False;
+ return in_use;
}
/****************************************************************************