1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

122208 Commits

Author SHA1 Message Date
Ralph Boehme
d3c16d93d1 vfs_fruit: pass down cwdfsp as dirfsp in fruit_open()
Not yet used, that comes when we add fruit_openat(). Passing cwdfsp as dirfsp
ensures when calling openat() we get the same behaviour as open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 20:38:31 +00:00
Ralph Boehme
19a1ed2cac s3/vfs: add vfs_at_fspcwd()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 20:38:31 +00:00
Ralph Boehme
d708d002d7 smbd: remove redundant conn arg from non_widelink_open()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu May 21 06:43:04 UTC 2020 on sn-devel-184
2020-05-21 06:43:04 +00:00
Ralph Boehme
f22bf66f75 smbd: realign non_widelink_open() args
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
f4b3719191 smbd: remove redundant conn arg from fd_open()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
c0551b22fd smbd: remove redundant conn arg from fd_open_atomic()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
02f744a59b smbd: realign fd_open_atomic() args
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
134114aa16 smbd: realign args to fd_open_atomic() in open_file()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
5c67a3e8ce smbd: realign args to open_file() in open_file_ntcreate()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
a77f28dcca smbd: remove redundant conn arg from open_file()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
dd4d4f8129 smbd: assert (fsp->dirfsp == conn->cwd_fsp) in open_file_ntcreate()
There's a bunch of stuff that needs updating to work with atnames.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
4ae6e5f054 smbd: set dirfsp in the SMB2 DH reconnect
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
5a7ce143bc smbd: set fsp->dirfsp in create_file_unixpath()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:32 +00:00
Ralph Boehme
68b28275f0 smbd: use dirfsp in mkdir_internal()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
435a19eaa7 smbd: fix check_parent_access() args alignment in mkdir_internal()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
0591904bb8 smbd: fix SMB_VFS_MKDIRAT() arg alignment in mkdir_internal()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
31a4a3a5ca smbd: pass dirfsp to mkdir_internal()
Not really used for now and marked with

SMB_ASSERT(dirfsp == conn->cwd_fsp)

because it needs to be updated later to work with real dirfsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
0ca3f13b21 smbd: set fsp->dirfsp in open_directory()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
67373681c5 smbd: use dirfsp in open_directory()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
1f581fb384 smbd: pass dirfsp to open_directory()
As the calls to

* SMB_VFS_LSTAT()
* get_share_mode_lock()

and maybe others still have to be updated to work with atnames, we
assert (dirfsp == conn->cwd_fsp).

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
227e14acd6 smbd: realign args in calls to open_directory()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
9f5fd73846 smbd: pass dirfsp to create_file_unixpath()
As the calls to

* lease_match()
* open_streams_for_delete()
* check_base_file_access
* SMB_VFS_STAT

and others needs to be updated to work with atnames in the
future, we assert (dirfsp == conn->cwd_fsp).

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
12b2844571 smbd: realign create_file_unixpath() args
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
44cd415921 smbd: add dirfsp arg to SMB_VFS_CREATE_FILE()
As create_file_default() still need to be updated in the future to replace the
SMB_VFS_STAT() calls with AT-based versions, it asserts (dirfsp ==
dirfsp->conn->cwd_fsp).

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:31 +00:00
Ralph Boehme
a947b67d78 smbd: handling of fsp->dirfsps in close_file()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
1736ef26c7 smbd: add flag "is_dirfsp" to the fsp_flags
This denotes pure VFS layer dirfsps that are used in *AT varients of VFS
interface functions and which bypass the FSA layer, requiring special handling
in codepaths closing/freeing the fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
373d02da75 vfs: add dirfsp to struct files_struct
As fsp->fsp_name will be a AT-name in the future, we need something to retrieve
the full path for an fsp from for stuff like fsp_str_dbg().

As there are functions like vfs_stat_fsp() that have internal fallbacks to
path-based VFS functions if fsp->fh->fh == -1, having the original dirfsp as
part of the fsp helps in converting the internal VFS functions to AT versions.

In the future when all such internal fallbacks are eliminated we can remove
fsp->dirfsp to avoid the additional fd per fsp and use a fsp->path or similar.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
9557489478 smbd: move fstat from create_internal_dirfsp() to open_internal_dirfsp()
The original idea of doing the fstat in create_internal_dirfsp() was to return
from the function with a valid file_id and that requires valid stat info.

However, as dirfsp->fh->fd will still be -1 at this point vfs_stat_fsp() will
fallback to path-based stat() which must be avoided.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
8883dacb12 smbd: rename create_internal_dirfsp_at() to create_internal_dirfsp()
Having removed the unused dirfsp parameter this is not an AT function.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
84cf205ff4 smbd: rename open_internal_dirfsp_at() to open_internal_dirfsp()
Having removed the unused dirfsp parameter this is not an AT function. Security
is provided by symlink safe fd_open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
ef17a408c8 vfs_aio_pthread: avoid parent_smb_fname()
opd->dname was only needed for debug messages, use opd->fsp_name for that. And
opd->fname can be just made a copy of smb_fname. This avoids calling
parent_smb_fname().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
a30825f29e vfs_aio_pthread: SMB_VFS_OPEN() is called with cwd=parent directory of the file
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
bd87aeb3d0 vfs_aio_pthread: pass smb_fname to create_private_open_data()
Not yet used.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
c51a8f36da vfs_aio_pthread: pass smb_fname to open_async()
Not yet used.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
a6344334c0 smbd: remove dirfsp arg from [create|open]_internal_dirfsp_at()
These are the functions that *create* dirfsps, they can't *take* dirfsps as that
would be recursive...

Both functions just take a pathname and the internal opening of the underlying
fd is secured from symlink races by our chdir("p/a/t/h") ; open(".", O_RDONLY);
logic in non_widelink_open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
4c720a05f0 smbd: set fsp_name of conn->cwd_fsp
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:30 +00:00
Ralph Boehme
97d061237b smbd: move conn_rootdir_fname to non_widelink_open()
No change in behaviour. This just simplifies fd_open() a bit which will make it
easier to add an fd_openat() later.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Ralph Boehme
15303ee19b smbd: prepare for replacing SMB_VFS_READLINKAT() with SMB_VFS_STATX() in the future
Add a large comment inside process_symlink_open() explaining why we need to call
SMB_VFS_READLINKAT().

As we don't make use of the returned name and just rely on SMB_VFS_REALPATH()
doing its job, remove target_fname

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Ralph Boehme
60c47a5d13 smbd: remove unused variable twrp_name from filename_convert_internal()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Ralph Boehme
0b31a9ce9a smbd: update function documentation header to match actual function argument names
Leaving p_cont_wcard unchanges as updating that would break the nice
indentation... :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Ralph Boehme
acffa8f406 smbd: add open_flags arg to in open_internal_dirfsp_at()
The only caller passes in what was used internally, so no change in
behaviour. Prepares for calling open_internal_dirfsp_at() from
filename_convert() with additional flags.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Ralph Boehme
d60b1134b9 smbd: exit early in the error case in fd_open()
No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Ralph Boehme
f1d204c5ba smbd: refactor flags computation for fd_open() in open_directory() a bit
No change in behaviour. A subsequent commit will optionally add an additional
flag, this change allows for a smaller diff of that commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 05:23:29 +00:00
Björn Jacke
799387963c add some missing FSCTL defines
as dodumented in

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/a64e55aa-1152-48e4-8206-edd96444e7f7

FSCTL_SET_OBJECT_ID_EXTENDED
FSCTL_READ_FILE_USN_DATA
FSCTL_WRITE_USN_CLOSE_RECORD
FSCTL_QUERY_ON_DISK_VOLUME_INFO
FSCTL_QUERY_SPARING_INFO
FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX
FSCTL_STORAGE_QOS_CONTROL

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Tue May 19 15:57:08 UTC 2020 on sn-devel-184
2020-05-19 15:57:08 +00:00
Björn Jacke
14470e4e4c docs-xml: update list of posible VFS operations for vfs_full_audit
the list of valid operations can be generated by

grep "{ SMB_VFS_OP_" source3/modules/vfs_full_audit.c |sed 's/.*,[ \t]*"//;s/".*//'|grep -v NULL | sort

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14386

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-19 14:32:28 +00:00
Björn Jacke
f57673d89e docs: improve desription of map acl inherit
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-19 14:32:28 +00:00
Volker Lendecke
ec312ee6fe tevent: Fix a tevent tutorial error
We don't pass a tevent_req but a tevent_context to the _send function

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): Tue May 19 12:07:42 UTC 2020 on sn-devel-184
2020-05-19 12:07:42 +00:00
Volker Lendecke
68380ebaa6 winbindd: Fix a use-after-free when winbind clients exit
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14382

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue May 19 10:45:06 UTC 2020 on sn-devel-184
2020-05-19 10:45:06 +00:00
Jeremy Allison
dd1f750293 s3: lib: Paranoia around use of snprintf copying into a fixed-size buffer from a getenv() pointer.
Post checks for overflow/error.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May 18 23:42:57 UTC 2020 on sn-devel-184
2020-05-18 23:42:57 +00:00
Andreas Schneider
f98b766d94 gitlab-ci: Add new runner for samba-admem-fips
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon May 18 16:06:06 UTC 2020 on sn-devel-184
2020-05-18 16:06:05 +00:00