r20796: Fix the same problem Jeremy has fixed (improper handling of deferred opens)
authorVolker Lendecke <vlendec@samba.org>
Mon, 15 Jan 2007 09:17:11 +0000 (09:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:17:09 +0000 (12:17 -0500)
for delete_driver_files. Proper fix pending... :-)

Jeremy, please check.

Volker

source/printing/nt_printing.c
source/smbd/reply.c

index 8f264bfd1e69afdeafef8dd921e45307c575b75a..aa9075c7db30f9048b407ff2b98672e54d29de68 100644 (file)
@@ -4853,7 +4853,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
                        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 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
                        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 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
                        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 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
                        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 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
                                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++;
index 02cada71aa6673025ae895773949c06347dac19f..3a1514f1aa4146158f0e2e322bcc93d21eabe3cb 100644 (file)
@@ -1679,7 +1679,8 @@ static NTSTATUS can_rename(connection_struct *conn, char *fname, uint16 dirtype,
  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 @@ static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
                                    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 @@ static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
  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 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, B
                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 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, B
                                        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 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
        
        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. */