Bug deleting driver files
Martin Zielinski
mz at seh.de
Mon Sep 10 12:02:51 GMT 2007
Hi,
There's still a bug in deleting driver files (Samba 3.0.25c):
Files that are in use by other drivers may become deleted.
It's because the check and trim of the NT_PRINTER_DRIVER_INFO_LEVEL_3
breaks out of the loop, when at least one overlapping file ist found.
The other drivers, that might also contain overlapping files, are not
checked.
See nt_printing.c line 4881 ff.:
if ( trim_overlap_drv_files(info, driver.info_3) ) {
free_a_printer_driver(driver, 3);
SAFE_FREE( list );
return True;
}
the "info" is not trimmed against the drivers, that will come later in
"list".
Possible fix (which might be bloat, if DPD_DELETE_ALL_FILES is set):
--- samba-3.0.25c.orig/source/printing/nt_printing.c 2007-05-11
00:09:34.000000000 +0200
+++ samba-3.0.25c/source/printing/nt_printing.c 2007-09-10
13:12:01.000000000 +0200
@@ -4719,6 +4719,9 @@
static BOOL drv_file_in_use( char* file,
NT_PRINTER_DRIVER_INFO_LEVEL_3 *info )
{
int i = 0;
+
+ if ( !file[0] )
+ return False;
if ( !info )
return False;
@@ -4844,6 +4847,7 @@
uint32 version;
fstring *list = NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
+ BOOL in_use = False;
if ( !info )
return False;
@@ -4879,9 +4883,7 @@
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;
+ in_use = True;
}
}
@@ -4897,7 +4899,7 @@
if ( DEBUGLEVEL >= 20 )
dump_a_printer_driver( driver, 3 );
- return False;
+ return in_use;
}
/****************************************************************************
--------------
Bye,
Martin
P.S. This has been bug 4942.
More information about the samba-technical
mailing list