diff options
author | Jeremy Allison <jra@samba.org> | 2012-05-22 12:28:04 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-05-25 09:19:38 -0700 |
commit | 50fdb32a4d30128d3e23d98833b31b84fc3f8215 (patch) | |
tree | 8fe743df1f5bcab8682373891a254520d4274250 | |
parent | 89cf7ea944b8947d5b64b5e2819936ea8af1e661 (diff) | |
download | samba-50fdb32a4d30128d3e23d98833b31b84fc3f8215.tar.gz samba-50fdb32a4d30128d3e23d98833b31b84fc3f8215.tar.bz2 samba-50fdb32a4d30128d3e23d98833b31b84fc3f8215.zip |
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 <metze@samba.org>
-rw-r--r-- | source3/smbd/open.c | 23 |
1 files changed, 20 insertions, 3 deletions
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; } |