diff options
author | Volker Lendecke <vl@samba.org> | 2013-09-26 14:32:09 -0700 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-10-16 00:50:13 +0200 |
commit | 4c0cf9fade8e9118c8da31cf3db3a4497321294b (patch) | |
tree | 9fa508c13bd0fd81ba2f4f96a92311426de2c4e3 | |
parent | 4263d16f134bd93813a880ccb81503bc998a98f3 (diff) | |
download | samba-4c0cf9fade8e9118c8da31cf3db3a4497321294b.tar.gz samba-4c0cf9fade8e9118c8da31cf3db3a4497321294b.tar.bz2 samba-4c0cf9fade8e9118c8da31cf3db3a4497321294b.zip |
smbd: Remove "file_existed" handling from open_mode_check
No clue what this does. In open_directory, "dir_existed" is not used after
open_mode_check. In open_file_ntcreate it's used, but I can't think of a case
right now where we would find a formerly nonexisting file to exist suddenly.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r-- | source3/smbd/open.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 670de5dff9..aaa42b34a8 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1114,8 +1114,7 @@ static bool has_delete_on_close(struct share_mode_lock *lck, static NTSTATUS open_mode_check(connection_struct *conn, struct share_mode_lock *lck, uint32 access_mask, - uint32 share_access, - bool *file_existed) + uint32 share_access) { int i; @@ -1156,16 +1155,10 @@ 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; } @@ -2427,8 +2420,20 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, } status = open_mode_check(conn, lck, - access_mask, share_access, - &file_existed); + access_mask, share_access); + + + if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION) || + (lck->data->num_share_modes > 0)) { + /* + * This comes from ancient times out of open_mode_check. I + * have no clue whether this is still necessary. I can't think + * of a case where this would actually matter further down in + * this function. I leave it here for further investigation + * :-) + */ + file_existed = true; + } if (NT_STATUS_IS_OK(status)) { /* We might be going to allow this open. Check oplock @@ -3159,8 +3164,7 @@ static NTSTATUS open_directory(connection_struct *conn, } status = open_mode_check(conn, lck, - access_mask, share_access, - &dir_existed); + access_mask, share_access); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(lck); |