summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
AgeCommit message (Collapse)AuthorFilesLines
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>
2012-11-19Add comments explaining exactly *why* we don't check FILE_READ_ATTRIBUTES ↵Jeremy Allison1-3/+21
when evaluating file/directory ACE's. If we can access the path to this file, by default we have FILE_READ_ATTRIBUTES from the containing directory. See the section. "Algorithm to Check Access to an Existing File" in MS-FSA.pdf. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2012-10-17s3:smbd: fix brace placements in validate_my_share_entries() for readabilityMichael Adam1-2/+4
according to coding guidelines Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Oct 17 14:37:58 CEST 2012 on sn-devel-104
2012-10-11smbd: Add mem_ctx to {f,}get_nt_acl VFS callAndrew Bartlett1-8/+14
This makes it clear which context the returned SD is allocated on, as a number of callers do not want it on talloc_tos(). As the ACL transformation allocates and then no longer needs a great deal of memory, a talloc_stackframe() call is used to contain the memory that is not returned further up the stack. Andrew Bartlett
2012-10-04Revert "When creating a new file/directory, we need to obey the create ↵Jeremy Allison1-15/+0
mask/directory mask parameters." This reverts commit c251a6b0442abc13bc8be4ff8de324c1d7706a78. Remove this as we're planning to remove the security mask, directory security mask parameters and only use create mask/directory mask.
2012-10-02When creating a new file/directory, we need to obey the create ↵Jeremy Allison1-0/+15
mask/directory mask parameters. Currently we call FSET_NT_ACL to inherit any ACLs on create. However FSET_NT_ACL uses the security mask/directory security mask parameters instead of the create mask/directory mask parameters. Swap them temporarily when creating to ensure the correct masks are applied. Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Oct 2 22:27:17 CEST 2012 on sn-devel-104
2012-09-29s3: Fix opening a file under kernel oplocksVolker Lendecke1-0/+79
With the prior code we assumed that we do not have kernel oplocks around when we open a file because we handled samba-internal oplock breaks before the open attempt. Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sat Sep 29 19:29:36 CEST 2012 on sn-devel-104
2012-09-29s3: Remove a SMB_ASSERTVolker Lendecke1-2/+0
With the simplified logic this became unnecessary
2012-09-29s3: Close the now opened file descriptor in error pathsVolker Lendecke1-0/+3
2012-09-29s3: No code change, just re-indentVolker Lendecke1-188/+187
Look at this with "git diff -b" if you don't believe me :-)
2012-09-29s3: Remove share mode handling before we open the fileVolker Lendecke1-204/+1
This is a significant behaviour change: We do not open the file under the share mode lock anymore. This might lead to more open calls in case of oplock breaks or sharing violations, but those are slow error paths and as such might be not too performance sensitive. The benefit of this patch is a significant reduction of complexity of open_file_ntcreate()
2012-09-29s3: Fix fcb_or_dos_open after logic changeVolker Lendecke1-1/+2
With the new behaviour, we call fcb_or_dos_open after open_file(). It is open_file() that sets up the fsp so that fcb_or_dos_open can find it in the list of fsps. Avoid finding the fsp we are just setting up.
2012-09-29s3: Copy share mode handling from before to after open_fileVolker Lendecke1-17/+124
This is a 1:1 copy&paste of the oplock/sharemode code that we do before an existing file is opened. It is a prerequiste for a patch that removes all of that handling before we open the file.
2012-09-27s3: Fix rejecting mkdir on read-only sharesVolker Lendecke1-1/+1
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-26s3: Slightly simplify open_file()Volker Lendecke1-1/+2
The "else" is not necessary. In the if-branch we just returned. Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Sep 26 18:08:03 CEST 2012 on sn-devel-104
2012-09-26s3: Slightly simplify calculate_open_access_flagsVolker Lendecke1-9/+10
2012-09-26s3: Slightly simplify calculate_open_access_flagsVolker Lendecke1-13/+17
2012-09-26s3: Factor out calculate_open_access_flagsVolker Lendecke1-15/+31
Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Sep 26 00:22:56 CEST 2012 on sn-devel-104
2012-09-25s3: Fix a typoVolker Lendecke1-1/+1
2012-09-25s3: Slightly simplify is_stat_openVolker Lendecke1-3/+2
The "access_bits" clause is redundant. is_stat_open says that exactly at least one of the stat_open_bits must be set and none else. Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Sep 25 20:05:06 CEST 2012 on sn-devel-104
2012-09-25s3: Make is_stat_open() a bit more readableVolker Lendecke1-4/+7
2012-09-25s3: Fix indentation of if-expressionsVolker Lendecke1-2/+3
To me this makes open_file_ntcreate a little easier to understand Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Sep 25 10:08:15 CEST 2012 on sn-devel-104
2012-09-25Fix bug #9189 - SMB2 Create doesn't return correct MAX ACCESS access mask in ↵Jeremy Allison1-0/+7
blob. If we aren't already granted DELETE access, check if we have DELETE_CHILD in the containing directory.
2012-09-21s3:smbd: release the share mode lock before calling exit_server() (bug #9191)Stefan Metzmacher1-0/+2
metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Sep 21 22:36:57 CEST 2012 on sn-devel-104
2012-09-15Add 'bool use_privs' to smbd_calculate_access_mask().Jeremy Allison1-4/+7
Replaces blanket root allow if set. Set to 'false' for all current callers. Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Sep 15 00:37:49 CEST 2012 on sn-devel-104
2012-09-14Fix bad string in debug message (remove it).Jeremy Allison1-4/+2
2012-09-14Add bool use_privs parameter to smbd_check_access_rights()Jeremy Allison1-4/+12
If this is set we should use it in preference to blindly assuming root can do anything. Currently set to 'false' in (most) callers.
2012-09-10s3: delete requests are not specialVolker Lendecke1-16/+0
The only difference between batch and exclusive oplocks is the time of the check: Batch is checked before the share mode check, exclusive after. Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-08s3:smbd: make fd_open() publicMichael Adam1-4/+4