svn commit: samba r20796 - in branches: SAMBA_3_0/source/printing SAMBA_3_0/source/smbd SAMBA_3_0_24/source/printing SAMBA_3_0_24/source/smbd

vlendec at samba.org vlendec at samba.org
Mon Jan 15 09:17:12 GMT 2007


Author: vlendec
Date: 2007-01-15 09:17:11 +0000 (Mon, 15 Jan 2007)
New Revision: 20796

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20796

Log:
Fix the same problem Jeremy has fixed (improper handling of deferred opens)
for delete_driver_files. Proper fix pending... :-)

Jeremy, please check.

Volker

Modified:
   branches/SAMBA_3_0/source/printing/nt_printing.c
   branches/SAMBA_3_0/source/smbd/reply.c
   branches/SAMBA_3_0_24/source/printing/nt_printing.c
   branches/SAMBA_3_0_24/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/printing/nt_printing.c
===================================================================
--- branches/SAMBA_3_0/source/printing/nt_printing.c	2007-01-15 09:02:58 UTC (rev 20795)
+++ branches/SAMBA_3_0/source/printing/nt_printing.c	2007-01-15 09:17:11 UTC (rev 20796)
@@ -4853,7 +4853,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting driverfile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 		
@@ -4862,7 +4862,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting configfile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 	
@@ -4871,7 +4871,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting datafile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 	
@@ -4880,7 +4880,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting helpfile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 	
@@ -4896,7 +4896,7 @@
 				pstrcpy( file, p );
 				driver_unix_convert(file, conn, NULL, &st);
 				DEBUG(10,("deleting dependent file [%s]\n", file));
-				unlink_internals(conn, 0, file, False);
+				unlink_internals(conn, 0, file, False, False);
 			}
 			
 			i++;

Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2007-01-15 09:02:58 UTC (rev 20795)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2007-01-15 09:17:11 UTC (rev 20796)
@@ -1679,7 +1679,8 @@
  Check if a user is allowed to delete a file.
 ********************************************************************/
 
-static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
+static NTSTATUS can_delete(connection_struct *conn, char *fname,
+			   uint32 dirtype, BOOL can_defer)
 {
 	SMB_STRUCT_STAT sbuf;
 	uint32 fattr;
@@ -1777,7 +1778,7 @@
 				    FILE_OPEN,
 				    0,
 				    FILE_ATTRIBUTE_NORMAL,
-				    0,
+				    can_defer ? 0 : INTERNAL_OPEN_ONLY,
 				    NULL, &fsp);
 
 	if (NT_STATUS_IS_OK(status)) {
@@ -1791,7 +1792,8 @@
  code.
 ****************************************************************************/
 
-NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, BOOL has_wild)
+NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype,
+			  char *name, BOOL has_wild, BOOL can_defer)
 {
 	pstring directory;
 	pstring mask;
@@ -1835,7 +1837,7 @@
 		if (dirtype == 0) {
 			dirtype = FILE_ATTRIBUTE_NORMAL;
 		}
-		status = can_delete(conn,directory,dirtype);
+		status = can_delete(conn,directory,dirtype,can_defer);
 		if (!NT_STATUS_IS_OK(status))
 			return status;
 
@@ -1885,7 +1887,8 @@
 					continue;
 				
 				slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname);
-				status = can_delete(conn, fname, dirtype);
+				status = can_delete(conn, fname, dirtype,
+						    can_defer);
 				if (!NT_STATUS_IS_OK(status)) {
 					continue;
 				}
@@ -1931,7 +1934,8 @@
 	
 	DEBUG(3,("reply_unlink : %s\n",name));
 	
-	status = unlink_internals(conn, dirtype, name, path_contains_wcard);
+	status = unlink_internals(conn, dirtype, name, path_contains_wcard,
+				  True);
 	if (!NT_STATUS_IS_OK(status)) {
 		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
 			/* We have re-scheduled this call. */

Modified: branches/SAMBA_3_0_24/source/printing/nt_printing.c
===================================================================
--- branches/SAMBA_3_0_24/source/printing/nt_printing.c	2007-01-15 09:02:58 UTC (rev 20795)
+++ branches/SAMBA_3_0_24/source/printing/nt_printing.c	2007-01-15 09:17:11 UTC (rev 20796)
@@ -4853,7 +4853,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting driverfile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 		
@@ -4862,7 +4862,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting configfile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 	
@@ -4871,7 +4871,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting datafile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 	
@@ -4880,7 +4880,7 @@
 			pstrcpy( file, s );
 			driver_unix_convert(file, conn, NULL, &st);
 			DEBUG(10,("deleting helpfile [%s]\n", s));
-			unlink_internals(conn, 0, file, False);
+			unlink_internals(conn, 0, file, False, False);
 		}
 	}
 	
@@ -4896,7 +4896,7 @@
 				pstrcpy( file, p );
 				driver_unix_convert(file, conn, NULL, &st);
 				DEBUG(10,("deleting dependent file [%s]\n", file));
-				unlink_internals(conn, 0, file, False);
+				unlink_internals(conn, 0, file, False, False);
 			}
 			
 			i++;

Modified: branches/SAMBA_3_0_24/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/reply.c	2007-01-15 09:02:58 UTC (rev 20795)
+++ branches/SAMBA_3_0_24/source/smbd/reply.c	2007-01-15 09:17:11 UTC (rev 20796)
@@ -1678,7 +1678,8 @@
  Check if a user is allowed to delete a file.
 ********************************************************************/
 
-static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
+static NTSTATUS can_delete(connection_struct *conn, char *fname,
+			   uint32 dirtype, BOOL can_defer)
 {
 	SMB_STRUCT_STAT sbuf;
 	uint32 fattr;
@@ -1776,7 +1777,7 @@
 				    FILE_OPEN,
 				    0,
 				    FILE_ATTRIBUTE_NORMAL,
-				    0,
+				    can_defer ? 0 : INTERNAL_OPEN_ONLY,
 				    NULL, &fsp);
 
 	if (NT_STATUS_IS_OK(status)) {
@@ -1790,7 +1791,8 @@
  code.
 ****************************************************************************/
 
-NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, BOOL has_wild)
+NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype,
+			  char *name, BOOL has_wild, BOOL can_defer)
 {
 	pstring directory;
 	pstring mask;
@@ -1834,7 +1836,7 @@
 		if (dirtype == 0) {
 			dirtype = FILE_ATTRIBUTE_NORMAL;
 		}
-		status = can_delete(conn,directory,dirtype);
+		status = can_delete(conn,directory,dirtype,can_defer);
 		if (!NT_STATUS_IS_OK(status))
 			return status;
 
@@ -1884,7 +1886,8 @@
 					continue;
 				
 				slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname);
-				status = can_delete(conn, fname, dirtype);
+				status = can_delete(conn, fname, dirtype,
+						    can_defer);
 				if (!NT_STATUS_IS_OK(status)) {
 					continue;
 				}
@@ -1930,7 +1933,8 @@
 	
 	DEBUG(3,("reply_unlink : %s\n",name));
 	
-	status = unlink_internals(conn, dirtype, name, path_contains_wcard);
+	status = unlink_internals(conn, dirtype, name, path_contains_wcard,
+				  True);
 	if (!NT_STATUS_IS_OK(status)) {
 		if (open_was_deferred(SVAL(inbuf,smb_mid))) {
 			/* We have re-scheduled this call. */



More information about the samba-cvs mailing list