Author: jra
Date: 2005-10-27 23:30:25 +0000 (Thu, 27 Oct 2005)
New Revision: 11344

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

Log:
I don't think share mode conflicts occur on deleting
a directory when you've got permissions. Need to write
a smbtorture test for this.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/close.c
   branches/SAMBA_3_0/source/smbd/notify.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/close.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/close.c      2005-10-27 23:02:47 UTC (rev 
11343)
+++ branches/SAMBA_3_0/source/smbd/close.c      2005-10-27 23:30:25 UTC (rev 
11344)
@@ -300,8 +300,6 @@
        struct share_mode_lock *lck = 0;
        BOOL delete_dir = False;
 
-       remove_pending_change_notify_requests_by_fid(fsp);
-
        /*
         * NT can set delete_on_close of the last open
         * reference to a directory also.
@@ -320,19 +318,8 @@
 
        delete_dir = lck->delete_on_close;
 
-       if (delete_dir) {
-               int i;
-               /* See if others still have the file open. If this is the
-                * case, then don't delete */
-               for (i=0; i<lck->num_share_modes; i++) {
-                       if (is_valid_share_mode_entry(&lck->share_modes[i])) {
-                               delete_dir = False;
-                               break;
-                       }
-               }
-       }
+       talloc_free(lck);
 
-
        if (normal_close && delete_dir) {
                BOOL ok = rmdir_internals(fsp->conn, fsp->fsp_name);
                DEBUG(5,("close_directory: %s. Delete on close was set - 
deleting directory %s.\n",
@@ -344,13 +331,15 @@
                 */
 
                if(ok) {
-                       remove_pending_change_notify_requests_by_filename(fsp);
+                       remove_pending_change_notify_requests_by_fid(fsp, 
NT_STATUS_DELETE_PENDING);
+                       remove_pending_change_notify_requests_by_filename(fsp, 
NT_STATUS_DELETE_PENDING);
+
                }
                process_pending_change_notify_queue((time_t)0);
+       } else {
+               remove_pending_change_notify_requests_by_fid(fsp, 
NT_STATUS_CANCELLED);
        }
 
-       talloc_free(lck);
-
        /*
         * Do the code common to files and directories.
         */

Modified: branches/SAMBA_3_0/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/notify.c     2005-10-27 23:02:47 UTC (rev 
11343)
+++ branches/SAMBA_3_0/source/smbd/notify.c     2005-10-27 23:30:25 UTC (rev 
11344)
@@ -82,13 +82,14 @@
  Delete entries by fnum from the change notify pending queue.
 *****************************************************************************/
 
-void remove_pending_change_notify_requests_by_fid(files_struct *fsp)
+void remove_pending_change_notify_requests_by_fid(files_struct *fsp, NTSTATUS 
status)
 {
        struct change_notify *cnbp, *next;
 
        for (cnbp=change_notify_list; cnbp; cnbp=next) {
                next=cnbp->next;
                if (cnbp->fsp->fnum == fsp->fnum) {
+                       change_notify_reply_packet(cnbp->request_buf,status);
                        change_notify_remove(cnbp);
                }
        }
@@ -116,7 +117,7 @@
  Always send reply.
 *****************************************************************************/
 
-void remove_pending_change_notify_requests_by_filename(files_struct *fsp)
+void remove_pending_change_notify_requests_by_filename(files_struct *fsp, 
NTSTATUS status)
 {
        struct change_notify *cnbp, *next;
 
@@ -127,7 +128,7 @@
                 * the filename are identical.
                 */
                if((cnbp->fsp->conn == fsp->conn) && 
strequal(cnbp->fsp->fsp_name,fsp->fsp_name)) {
-                       
change_notify_reply_packet(cnbp->request_buf,NT_STATUS_CANCELLED);
+                       change_notify_reply_packet(cnbp->request_buf,status);
                        change_notify_remove(cnbp);
                }
        }

Reply via email to