[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-28a-1156-g46f5e9b

Jeremy Allison jra at samba.org
Tue May 6 18:48:13 GMT 2008


The branch, v3-0-test has been updated
       via  46f5e9ba87f04cf9fc0e90d485226fce5f6e628c (commit)
      from  366aa23becaf99867fdc09e4e6cb06aa10b7edac (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -----------------------------------------------------------------
commit 46f5e9ba87f04cf9fc0e90d485226fce5f6e628c
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 6 11:47:46 2008 -0700

    Fix from Martin Zielinski <mz at seh.de>. Don't delete files when
    they're in use by other drivers.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/printing/nt_printing.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index 6908a67..949b025 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -4754,10 +4754,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;
 
@@ -4870,6 +4875,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 )
@@ -4879,7 +4890,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;
 	
@@ -4914,9 +4926,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;
 			}
 		}
 	
@@ -4932,7 +4945,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;
 }
 
 /****************************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list