From 1cea3dc96fb09a6016f46aad86b79af4f1600c85 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 21 Jan 1999 02:41:42 +0000 Subject: Added code to let NT do a 'delete on close' request on an open directory handle. WinCenter (multi-user NT system) is doing this. This code still needs testing.... Jeremy. --- source/smbd/nttrans.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'source/smbd/nttrans.c') diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c index 5ea2ae0c73a..e7811c605b5 100644 --- a/source/smbd/nttrans.c +++ b/source/smbd/nttrans.c @@ -789,7 +789,7 @@ int reply_ntcreate_and_X(connection_struct *conn, if(fsp->is_directory) { if(dos_stat(fsp->fsp_name, &sbuf) != 0) { - close_directory(fsp); + close_directory(fsp,True); restore_case_semantics(file_attributes); return(ERROR(ERRDOS,ERRnoaccess)); } @@ -1384,6 +1384,33 @@ static void remove_pending_change_notify_requests_by_mid(int mid) } } +/**************************************************************************** + Delete entries by filename and cnum from the change notify pending queue. + Always send reply. +*****************************************************************************/ + +void remove_pending_change_notify_requests_by_filename(files_struct *fsp) +{ + change_notify_buf *cnbp = (change_notify_buf *)ubi_slFirst( &change_notify_queue ); + change_notify_buf *prev = NULL; + + while(cnbp != NULL) { + /* + * We know it refers to the same directory if the connection number and + * 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,0,NT_STATUS_CANCELLED); + free((char *)ubi_slRemNext( &change_notify_queue, prev)); + cnbp = (change_notify_buf *)(prev ? ubi_slNext(prev) : ubi_slFirst(&change_notify_queue)); + continue; + } + + prev = cnbp; + cnbp = (change_notify_buf *)ubi_slNext(cnbp); + } +} + /**************************************************************************** Process the change notify queue. Note that this is only called as root. *****************************************************************************/ -- cgit