summaryrefslogtreecommitdiff
path: root/source3/smbd
AgeCommit message (Collapse)AuthorFilesLines
2013-10-25smb2_ioctl: add support for FSCTL_SRV_COPYCHUNK_WRITEDavid Disseldorp1-10/+34
FSCTL_SRV_COPYCHUNK can only be used when the client has the copy-chunk target file open with FILE_WRITE_DATA and FILE_READ_DATA. FSCTL_SRV_COPYCHUNK_WRITE requires only FILE_WRITE_DATA access on the target, and is therefore suitable for cp --reflink, which opens the target file O_WRONLY. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
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 Lendecke4-7/+6
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-24smbd: Unify parameters to set_oplock_typeVolker Lendecke1-1/+1
Some lines above we set fsp->oplock_type = e->op_type. I don't see how this might have changed. This change will unify both callers of set_file_oplock. In the next step the second parameter to set_file_oplock will be removed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24smbd: Make release_file_oplock staticVolker Lendecke2-2/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24smbd: Use remove_oplock() in close_normal_fileVolker Lendecke1-1/+1
remove_oplock is a wrapper around release_file_oplock. This streamlines the exports of oplock.c a bit. Reason for this patch: In a later patch I will add functionality to remove_oplock that is required in close_normal_file as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24Fix bug 10196 - RW Deny for a specific user is not overriding RW Allow for a ↵Jeremy Allison1-38/+41
group. When the ID returned is ID_TYPE_BOTH we must *always* add it as both a user and a group, not just in the owning case. Otherwise DENY entries are not correctly processed. Confirmed by the reporter as fixing the problem. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10196 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-23smbd: Remove MSG_SMB_ASYNC_LEVEL2_BREAKVolker Lendecke1-84/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23smbd: Use MSG_SMB_BREAK_REQUEST for async l2 breaksVolker Lendecke1-2/+10
Now that we transmit the level we want to break to via the msg.op_type we can unify MSG_SMB_BREAK_REQUEST and MSG_SMB_ASYNC_LEVEL2_BREAK and thus simplify the code a bit. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@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 Lendecke2-10/+29
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-17s3:smbd: use new function cluster_probe_ok()Michael Adam1-9/+3
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2013-10-17smbd/winbindd: Do an early check if ctdbd is functionalVolker Lendecke1-0/+11
This will avoid panic calls when smbd and winbind is started in cluster mode before ctdb is functional. It still logs something sane at debug level 0, but it does not panic and core anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@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:smb2: fix crash when smb2 session reauth failsMichael Adam1-3/+17
https://bugzilla.samba.org/show_bug.cgi?id=10208 Authentication error in smb2 session reauth invalidates the session. In this case the session must in contrast to successful session setup requests be torn down and live no longer than the request. The talloc move of the session from the global session table to the request ensures that the session setup reply can still be correctly signed, but subsequent requests on the connection don't find a session any more. Pair-Programmed-With: Jeremy Allison <jra@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
2013-10-15smbd: Inline break_level2_to_none_asyncVolker Lendecke1-38/+32
With the special case for bug 5980 in do_break_to_none we only have one caller: process_oplock_async_level2_break_message. The further goal is to merge process_oplock_async_level2_break_message with process_oplock_break_message. 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): Tue Oct 15 03:42:53 CEST 2013 on sn-devel-104
2013-10-15smbd: Remove a special case for level2 breakVolker Lendecke1-33/+12
With the level2 indicator in brlock.tdb this race condition does not exist anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-15smbd: Remove some FAKE_LEVEL_II commentsVolker Lendecke2-8/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-15smbd: Add debugs to brlock.cVolker Lendecke1-0/+6
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-15smbd: Remove FAKE_LEVEL_II_OPLOCKVolker Lendecke3-44/+77
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: Convert some dbgtxt to DEBUGVolker Lendecke1-19/+12
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-06smbd: Fix a commentVolker Lendecke1-1/+1
This has been converted from a timed event to an immediate one in e7dab403c0ca6f6 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-06smbd: Fix confusing commentsVolker Lendecke2-4/+2
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-10-05smbd:smb2: clarify and comment code treating dh2c blob check.Michael Adam1-6/+22
This makes the code that checks for extra create blobs in the case of the dh2c blob look very similar to the corresponding (slightly mode complex) code for the dhnc blob. With this preparation it will be easier and more obvious how to add proper treatment of the lease request blobs when leases get implemented. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sat Oct 5 15:56:11 CEST 2013 on sn-devel-104
2013-10-05smbd:smb2: ignore an dhnq blob along with a dhnc in createMichael Adam1-6/+26
This is according to MS-SMB2, 3.3.5.9.7 "Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context" Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05smbd:smb2_create: fix return code for durable handle create blob combinationsMichael Adam1-8/+16
According to MS-SMB2: 3.3.5.9.7 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context 3.3.5.9.12 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context and verified by test results. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05smbd:smb2: successfully answer a DHnC request when the initial create was DH2QMichael Adam3-7/+18
I.e. the durable reconnect attempt is v1 while the original create was durable v2 including the create guid. Implement this by skipping the create_guid verification when the reconnect request is v1. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05smbd:smb2_create: add comment about validity of check reconnect blob being ↵Michael Adam1-0/+4
only one With leases this will not be true any more. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-02smbd:smb2: fix error code when the header says the request is signed but we ↵Michael Adam1-1/+1
don't have a sesseion I.e. when the request is a session setup. We replied with ACCESS_DENIED, but windows expects USER_SESSION_DELETED Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Oct 2 22:07:44 CEST 2013 on sn-devel-104