summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
AgeCommit message (Collapse)AuthorFilesLines
2013-10-25Revert "smbd: Move oplock/sharemode ops into one place"Volker Lendecke1-3/+10
This reverts commit 7b70fa18734d9ceb020fe3e5d4cc0c26cd27a484. This is a change in behaviour which needs much further investigation and testing. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Fri Oct 25 14:22:20 CEST 2013 on sn-devel-104
2013-10-25Revert "smbd: Move oplock handling together"Volker Lendecke1-7/+7
This reverts commit e689b7d51e6ffd848ab10e160dca2c3a03fc750b. This is a change in behaviour which needs much further investigation and testing. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24smbd: Move oplock handling togetherVolker Lendecke1-7/+7
Later on we will have all the oplock/sharemode operations in one routine. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24smbd: Move oplock/sharemode ops into one placeVolker Lendecke1-10/+3
This makes the is_stat_open special case in grant_fsp_oplock_type redundant because in open_file_ntcreate further up we have already set oplock_request to NO_OPLOCK for stat opens. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24smbd: Remove separate oplock_type parameter from set_file_oplockVolker Lendecke1-1/+1
This avoids the question where it could happen that something else but fsp->oplock_type might be useful as an argument here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-23smbd: Fix breaking level2 on OVERWRITE create_dispositionVolker Lendecke1-0/+11
This is shown by the new raw.oplock.level_ii_1 test Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Fix raw.batch.exclusive[59]Volker Lendecke1-6/+23
The level we have to break to depend on the breakers create_disposition: If we overwrite, we have to break to none. This patch overloads the "op_type" field in the break message we send across to the smbd holding the oplock with the oplock level we want to break to. Because it depends on the create_disposition in the breaking open, only the breaker can make that decision. We might want to use a different mechanism for this in the future, but for now using the op_type field seems acceptable to me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Remove unused "mid" from delay_for_oplockVolker Lendecke1-3/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Don't send op_mid in a BREAK messageVolker Lendecke1-5/+3
The callee doesn't use this anyway Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Simplify send_break_messageVolker Lendecke1-4/+4
We don't need an fsp here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Remove unused "oplock_request" arg from send_break_messageVolker Lendecke1-5/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: validate oplock types even for internal and stat opensVolker Lendecke1-18/+3
There's no reason why we should not do this. This has turned into a pure internal consistency check that should apply fine every time. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Fix bug 10216Volker Lendecke1-4/+28
While refactoring find_oplock_types to validate_oplock_types I forgot that stat opens will end up in locking.tdb. So even with a batch oplock around we can have more than one entry. This means the consistency check in validate_oplock_types was wrong and too strict. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-16smbd: Simplify open_file_ntcreateVolker Lendecke1-32/+39
Only one call to delay_for_oplocks left. Metze showed me the new logic: BATCH is broken if we have a sharing violation. Exclusive is broken otherwise. That's it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Oct 16 02:51:53 CEST 2013 on sn-devel-104
2013-10-16smbd: Remove "file_existed" handling from open_mode_checkVolker Lendecke1-12/+16
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>
2013-10-16smbd: Decouple grant_fsp_oplock_type from oplock validationVolker Lendecke1-27/+26
This makes grant_fsp_oplock_type independent from the values computed in validate_oplock_types. It *might* make oplock calculation a bit slower for heavily shared files, as we are walking the share mode array twice. But we are doing so much stuff in open that I doubt the difference is measurable. It clears up the code for me however, and I think that's worth it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-10-16smbd: Reduce the complexity of open_file_ntcreateVolker Lendecke1-24/+40
This removes two variables in open_file_ntcreate based on the observation that for exclusive and batch oplocks there can only be one entry. So in these cases we don't need to keep pointers from find_oplock_types to delay_for_oplocks. We can just reference the only share mode entry around. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-10-15smbd: Make find_oplock_types return boolVolker Lendecke1-15/+27
smb_panic() does not take a printf style argument. This improves debug output by easily printing the index that we fell over. Also, doing smb_panic deep down is bad style IMHO. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-10-15smbd: Make loop index type match loop limitVolker Lendecke1-1/+1
share_mode_data.num_share_modes is a uint32. 48 bytes less in .o text size for -O3 :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-10-15smbd: Unify delay_for_*_oplocksVolker Lendecke1-45/+13
This is the same code in both routines Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-10-15smbd: Simplify find_oplock_types a bitVolker Lendecke1-6/+7
Define a variable to dereference lck->data just once. Believe it or not, this saves a few bytes .o with -O3 :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-10-15smbd: Remove FAKE_LEVEL_II_OPLOCKVolker Lendecke1-25/+16
FAKE_LEVEL_II_OPLOCK was an indicator to break level2 oplock holders on write. This information is now being held in brlock.tdb, which makes the FAKE_LEVEL_II_OPLOCK type unnecessary. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-13smbd: Remove unused create_options from open_mode_checkVolker Lendecke1-3/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Oct 13 14:35:26 CEST 2013 on sn-devel-104
2013-10-13smbd: Remove name_hash param from open_mode_checkVolker Lendecke1-3/+2
This came from delete_on_close handling which was factored out. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-12smbd: Fix the extended *.oplock.doc1 testsVolker Lendecke1-26/+33
We need to check for DELETE_PENDING before the first oplock break Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Oct 12 01:56:18 CEST 2013 on sn-devel-104
2013-10-09smbd: Fix an error path in open_directoryVolker Lendecke1-0/+1
In open_file_ntcreate we do the del_share_mode on error. We should do it here as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Oct 9 01:58:55 CEST 2013 on sn-devel-104
2013-10-08smbd: Convert set_share_mode to return bool for successVolker Lendecke1-5/+14
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-06smbd: Fix confusing commentsVolker Lendecke1-2/+1
The brlock-check is done in grant_fsp_oplock_type Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-09-11smbd: Add brl_num_locks access functionVolker Lendecke1-1/+1
2013-09-10s3:smbd: ease file server upgrades from 3.6 and earlier with "acl allow ↵Michael Adam1-1/+15
execute aways" 3.6 and earlier allowed open for execution when execute permissions are not present on a file. This has been fixed in Samba 4.0. This patch changes smbd to skip the execute bit from the ACL check in the open code if "acl allow execute always = yes", hence re-establishing the old behaviour in this case. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-09-06smbd: Slightly simplify send_break_messageVolker Lendecke1-2/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-09-06smbd: Remove a silly "? true : false"Volker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-09-06smbd: Remove two confusing TALLOC_FREE callsVolker Lendecke1-2/+0
We don't have lck allocated yet at these points. Remove the TALLOC_FREE calls that triggered me looking for the get_share_mode_lock calls. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-09-06smbd: Remove FORCE_OPLOCK_BREAK_TO_NONEVolker Lendecke1-13/+2
This flag existed to break an exclusive or batch oplock in just one instead of two steps down to "no oplock" when we did an allocation or file size change. Running raw.oplock against W2k12 differs in this respect from W2k3: W2k12 takes two steps (via level2) to break to none. This removes the special flag that we only had for compatibility with systems older than W2k12... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Sep 6 00:47:07 CEST 2013 on sn-devel-104
2013-09-03smbd: Simplify find_oplock_typesVolker Lendecke1-9/+10
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-05-07Only do the 1 second delay for sharing violations for SMB1, not SMB2.Jeremy Allison1-1/+2
Match Windows behavior. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-04-27smbd: Do not fetch the record in defer_open_doneVolker Lendecke1-8/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Apr 27 02:06:10 CEST 2013 on sn-devel-104
2013-04-26smbd: We don't use DEFERRED_OPEN_ENTRY anymoreVolker Lendecke1-63/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26smbd: Use dbwrap_record_watch_send for defer_openVolker Lendecke1-1/+67
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17smbd: Convert create_file_unixpath to synthetic_smb_fnameVolker Lendecke1-5/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17smbd: Convert open_streams_for_delete to synthetic_smb_fnameVolker Lendecke1-5/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17smbd: Convert msg_file_was_renamed to synthetic_smb_fnameVolker Lendecke1-3/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17smbd: Convert change_dir_owner_to_parent to synthetic_smb_fnameVolker Lendecke1-3/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17smbd: Convert change_dir_owner_to_parent to synthetic_smb_fnameVolker Lendecke1-5/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17smbd: Convert change_file_owner_to_parent to synthetic_smb_fnameVolker Lendecke1-5/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-15smbd: Fix an error return in change_dir_owner_to_parentVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com> Autobuild-User(master): Richard Sharpe <sharpe@samba.org> Autobuild-Date(master): Mon Apr 15 18:05:06 CEST 2013 on sn-devel-104
2012-12-02s3:smbd/open: fall back to Builtin_Administrators if SYSTEM doesn't map to a ↵Stefan Metzmacher1-0/+54
group Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2012-12-02s3:smbd/open: try the primary sid (user) as group_sid if the token has just ↵Stefan Metzmacher1-1/+5
one sid Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2012-12-02s3:smbd/open: use Builtin_Administrators as owner of files (if possible)Stefan Metzmacher1-4/+41
We do this if the idmap layer resolves Builtin_Administrators as ID_TYPE_BOTH and if the current token has the Builtin_Administrators SID or it's SYSTEM. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-28s4:smbd/open: add missing TALLOC_FREE(frame) to inherit_new_acl()Stefan Metzmacher1-0/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>