From 50fdb32a4d30128d3e23d98833b31b84fc3f8215 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 22 May 2012 12:28:04 -0700 Subject: Ensure we only return NT_STATUS_DELETE_PENDING if the share modes are valid. Ensure we only return *file_existed = true if there were valid share modes. Signed-off-by: Stefan Metzmacher --- source3/smbd/open.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'source3') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 774b5fc938..9042e90a84 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -984,12 +984,23 @@ static NTSTATUS open_mode_check(connection_struct *conn, return NT_STATUS_OK; } - *file_existed = True; - /* A delete on close prohibits everything */ if (is_delete_on_close_set(lck, name_hash)) { - return NT_STATUS_DELETE_PENDING; + /* + * Check the delete on close token + * is valid. It could have been left + * after a server crash. + */ + for(i = 0; i < lck->data->num_share_modes; i++) { + if (!share_mode_stale_pid(lck->data, i)) { + + *file_existed = true; + + return NT_STATUS_DELETE_PENDING; + } + } + return NT_STATUS_OK; } if (is_stat_open(access_mask)) { @@ -1029,10 +1040,16 @@ static NTSTATUS open_mode_check(connection_struct *conn, continue; } + *file_existed = true; + return NT_STATUS_SHARING_VIOLATION; } } + if (lck->data->num_share_modes != 0) { + *file_existed = true; + } + return NT_STATUS_OK; } -- cgit