Author: jra
Date: 2007-07-17 00:09:56 +0000 (Tue, 17 Jul 2007)
New Revision: 23906

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

Log:
Fix POSIX unlink bug found by Steve. If we
used lstat during the open (which we always
do for POSIX) then use lstat for the unlink.
Jeremy.

Modified:
   branches/SAMBA_3_0_25/source/smbd/close.c
   branches/SAMBA_3_2/source/smbd/close.c
   branches/SAMBA_3_2_0/source/smbd/close.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/close.c   2007-07-16 23:38:29 UTC (rev 
23905)
+++ branches/SAMBA_3_0_25/source/smbd/close.c   2007-07-17 00:09:56 UTC (rev 
23906)
@@ -153,6 +153,7 @@
        struct share_mode_lock *lck;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status = NT_STATUS_OK;
+       int ret;
 
        /*
         * Lock the share entries, and determine if we should delete
@@ -245,8 +246,14 @@
 
        /* We can only delete the file if the name we have is still valid and
           hasn't been renamed. */
-       
-       if(SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf) != 0) {
+
+       if (fsp->posix_open) {
+               ret = SMB_VFS_LSTAT(conn,fsp->fsp_name,&sbuf);
+       } else {
+               ret = SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf);
+       }
+
+       if (ret != 0) {
                DEBUG(5,("close_remove_share_mode: file %s. Delete on close "
                         "was set and stat failed with error %s\n",
                         fsp->fsp_name, strerror(errno) ));

Modified: branches/SAMBA_3_2/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/close.c      2007-07-16 23:38:29 UTC (rev 
23905)
+++ branches/SAMBA_3_2/source/smbd/close.c      2007-07-17 00:09:56 UTC (rev 
23906)
@@ -154,6 +154,7 @@
        struct share_mode_lock *lck;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status = NT_STATUS_OK;
+       int ret;
        struct file_id id;
 
        /*
@@ -247,8 +248,14 @@
 
        /* We can only delete the file if the name we have is still valid and
           hasn't been renamed. */
-       
-       if(SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf) != 0) {
+
+       if (fsp->posix_open) {
+               ret = SMB_VFS_LSTAT(conn,fsp->fsp_name,&sbuf);
+       } else {
+               ret = SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf);
+       }
+
+       if (ret != 0) {
                DEBUG(5,("close_remove_share_mode: file %s. Delete on close "
                         "was set and stat failed with error %s\n",
                         fsp->fsp_name, strerror(errno) ));

Modified: branches/SAMBA_3_2_0/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_2_0/source/smbd/close.c    2007-07-16 23:38:29 UTC (rev 
23905)
+++ branches/SAMBA_3_2_0/source/smbd/close.c    2007-07-17 00:09:56 UTC (rev 
23906)
@@ -154,6 +154,7 @@
        struct share_mode_lock *lck;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status = NT_STATUS_OK;
+       int ret;
        struct file_id id;
 
        /*
@@ -247,8 +248,14 @@
 
        /* We can only delete the file if the name we have is still valid and
           hasn't been renamed. */
-       
-       if(SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf) != 0) {
+
+       if (fsp->posix_open) {
+               ret = SMB_VFS_LSTAT(conn,fsp->fsp_name,&sbuf);
+       } else {
+               ret = SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf);
+       }
+
+       if (ret != 0) {
                DEBUG(5,("close_remove_share_mode: file %s. Delete on close "
                         "was set and stat failed with error %s\n",
                         fsp->fsp_name, strerror(errno) ));

Reply via email to