samba.git
3 years agovfs_xattr_tdb: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:32:57 +0000 (22:32 +0200)]
vfs_xattr_tdb: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_virusfilter: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:31:04 +0000 (22:31 +0200)]
vfs_virusfilter: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_unityed_media: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:24:37 +0000 (22:24 +0200)]
vfs_unityed_media: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_syncops: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:22:26 +0000 (22:22 +0200)]
vfs_syncops: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_streams_xattr: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:18:54 +0000 (22:18 +0200)]
vfs_streams_xattr: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_streams_depot: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:07:20 +0000 (23:07 +0200)]
vfs_streams_depot: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_snapper: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:02:48 +0000 (22:02 +0200)]
vfs_snapper: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_preopen: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 19:51:00 +0000 (21:51 +0200)]
vfs_preopen: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_prealloc: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 19:46:41 +0000 (21:46 +0200)]
vfs_prealloc: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_media_harmony: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 19:43:26 +0000 (21:43 +0200)]
vfs_media_harmony: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_gpfs: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 19:34:35 +0000 (21:34 +0200)]
vfs_gpfs: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 19:32:30 +0000 (21:32 +0200)]
vfs_glusterfs: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_fruit: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:04:26 +0000 (23:04 +0200)]
vfs_fruit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_widelinks: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:03:30 +0000 (23:03 +0200)]
vfs_widelinks: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_time_audit: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:03:18 +0000 (23:03 +0200)]
vfs_time_audit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_shadow_copy2: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:03:05 +0000 (23:03 +0200)]
vfs_shadow_copy2: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_full_audit: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:02:39 +0000 (23:02 +0200)]
vfs_full_audit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_extd_audit: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:02:20 +0000 (23:02 +0200)]
vfs_extd_audit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_error_inject: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:02:06 +0000 (23:02 +0200)]
vfs_error_inject: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_default: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:01:54 +0000 (23:01 +0200)]
vfs_default: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_commit: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:01:16 +0000 (23:01 +0200)]
vfs_commit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_ceph_snapshots: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:01:04 +0000 (23:01 +0200)]
vfs_ceph_snapshots: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_ceph: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:00:52 +0000 (23:00 +0200)]
vfs_ceph: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_catia: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:59:05 +0000 (22:59 +0200)]
vfs_catia: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: VFS: catia: Change saved_errno to catia_saved_errno in a macro.
Jeremy Allison [Thu, 21 May 2020 18:03:14 +0000 (11:03 -0700)]
s3: VFS: catia: Change saved_errno to catia_saved_errno in a macro.

This is a common variable name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agovfs_cap: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:58:56 +0000 (22:58 +0200)]
vfs_cap: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_audit: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:58:47 +0000 (22:58 +0200)]
vfs_audit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_aio_pthread: implement SMB_VFS_OPENAT()
Ralph Boehme [Wed, 20 May 2020 20:58:29 +0000 (22:58 +0200)]
vfs_aio_pthread: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_aio_pthread: add dirfsp arg to create_private_open_data()
Ralph Boehme [Wed, 20 May 2020 14:47:05 +0000 (16:47 +0200)]
vfs_aio_pthread: add dirfsp arg to create_private_open_data()

Prepares for an upcoming aio_pthread_openat_fn(). open_async() passes fspcwd.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_aio_pthread: realign create_private_open_data() args
Ralph Boehme [Wed, 20 May 2020 14:44:15 +0000 (16:44 +0200)]
vfs_aio_pthread: realign create_private_open_data() args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_aio_pthread: realign create_private_open_data args
Ralph Boehme [Wed, 20 May 2020 14:43:11 +0000 (16:43 +0200)]
vfs_aio_pthread: realign create_private_open_data args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs: add SMB_VFS_OPENAT()
Ralph Boehme [Fri, 15 May 2020 14:29:44 +0000 (16:29 +0200)]
vfs: add SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_fruit: pass down cwdfsp as dirfsp in fruit_open()
Ralph Boehme [Wed, 20 May 2020 15:51:23 +0000 (17:51 +0200)]
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>
3 years agos3/vfs: add vfs_at_fspcwd()
Ralph Boehme [Wed, 20 May 2020 15:01:48 +0000 (17:01 +0200)]
s3/vfs: add vfs_at_fspcwd()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove redundant conn arg from non_widelink_open()
Ralph Boehme [Fri, 8 May 2020 13:46:02 +0000 (15:46 +0200)]
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

3 years agosmbd: realign non_widelink_open() args
Ralph Boehme [Fri, 8 May 2020 13:45:11 +0000 (15:45 +0200)]
smbd: realign non_widelink_open() args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove redundant conn arg from fd_open()
Ralph Boehme [Fri, 10 Apr 2020 14:58:16 +0000 (16:58 +0200)]
smbd: remove redundant conn arg from fd_open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove redundant conn arg from fd_open_atomic()
Ralph Boehme [Fri, 10 Apr 2020 14:54:53 +0000 (16:54 +0200)]
smbd: remove redundant conn arg from fd_open_atomic()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: realign fd_open_atomic() args
Ralph Boehme [Fri, 8 May 2020 13:24:04 +0000 (15:24 +0200)]
smbd: realign fd_open_atomic() args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: realign args to fd_open_atomic() in open_file()
Ralph Boehme [Thu, 7 May 2020 18:52:18 +0000 (20:52 +0200)]
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>
3 years agosmbd: realign args to open_file() in open_file_ntcreate()
Ralph Boehme [Thu, 7 May 2020 18:46:06 +0000 (20:46 +0200)]
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>
3 years agosmbd: remove redundant conn arg from open_file()
Ralph Boehme [Fri, 10 Apr 2020 14:52:07 +0000 (16:52 +0200)]
smbd: remove redundant conn arg from open_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: assert (fsp->dirfsp == conn->cwd_fsp) in open_file_ntcreate()
Ralph Boehme [Mon, 18 May 2020 10:24:30 +0000 (12:24 +0200)]
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>
3 years agosmbd: set dirfsp in the SMB2 DH reconnect
Ralph Boehme [Sat, 16 May 2020 06:23:24 +0000 (08:23 +0200)]
smbd: set dirfsp in the SMB2 DH reconnect

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: set fsp->dirfsp in create_file_unixpath()
Ralph Boehme [Thu, 7 May 2020 14:52:20 +0000 (16:52 +0200)]
smbd: set fsp->dirfsp in create_file_unixpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: use dirfsp in mkdir_internal()
Ralph Boehme [Fri, 10 Apr 2020 13:38:55 +0000 (15:38 +0200)]
smbd: use dirfsp in mkdir_internal()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: fix check_parent_access() args alignment in mkdir_internal()
Ralph Boehme [Mon, 18 May 2020 10:09:32 +0000 (12:09 +0200)]
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>
3 years agosmbd: fix SMB_VFS_MKDIRAT() arg alignment in mkdir_internal()
Ralph Boehme [Thu, 7 May 2020 15:51:42 +0000 (17:51 +0200)]
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>
3 years agosmbd: pass dirfsp to mkdir_internal()
Ralph Boehme [Fri, 10 Apr 2020 13:36:34 +0000 (15:36 +0200)]
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>
3 years agosmbd: set fsp->dirfsp in open_directory()
Ralph Boehme [Mon, 18 May 2020 12:30:56 +0000 (14:30 +0200)]
smbd: set fsp->dirfsp in open_directory()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: use dirfsp in open_directory()
Ralph Boehme [Mon, 18 May 2020 15:07:53 +0000 (17:07 +0200)]
smbd: use dirfsp in open_directory()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: pass dirfsp to open_directory()
Ralph Boehme [Thu, 7 May 2020 14:51:35 +0000 (16:51 +0200)]
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>
3 years agosmbd: realign args in calls to open_directory()
Ralph Boehme [Thu, 7 May 2020 14:50:20 +0000 (16:50 +0200)]
smbd: realign args in calls to open_directory()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: pass dirfsp to create_file_unixpath()
Ralph Boehme [Thu, 7 May 2020 14:32:10 +0000 (16:32 +0200)]
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>
3 years agosmbd: realign create_file_unixpath() args
Ralph Boehme [Thu, 7 May 2020 14:24:16 +0000 (16:24 +0200)]
smbd: realign create_file_unixpath() args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: add dirfsp arg to SMB_VFS_CREATE_FILE()
Ralph Boehme [Thu, 14 May 2020 12:00:22 +0000 (14:00 +0200)]
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>
3 years agosmbd: handling of fsp->dirfsps in close_file()
Ralph Boehme [Mon, 18 May 2020 12:37:18 +0000 (14:37 +0200)]
smbd: handling of fsp->dirfsps in close_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: add flag "is_dirfsp" to the fsp_flags
Ralph Boehme [Mon, 6 Apr 2020 13:41:41 +0000 (15:41 +0200)]
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>
3 years agovfs: add dirfsp to struct files_struct
Ralph Boehme [Fri, 15 May 2020 14:18:13 +0000 (16:18 +0200)]
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>
3 years agosmbd: move fstat from create_internal_dirfsp() to open_internal_dirfsp()
Ralph Boehme [Fri, 15 May 2020 13:25:07 +0000 (15:25 +0200)]
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>
3 years agosmbd: rename create_internal_dirfsp_at() to create_internal_dirfsp()
Ralph Boehme [Fri, 15 May 2020 13:14:26 +0000 (15:14 +0200)]
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>
3 years agosmbd: rename open_internal_dirfsp_at() to open_internal_dirfsp()
Ralph Boehme [Fri, 15 May 2020 13:14:26 +0000 (15:14 +0200)]
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>
3 years agovfs_aio_pthread: avoid parent_smb_fname()
Ralph Boehme [Thu, 14 May 2020 15:08:15 +0000 (17:08 +0200)]
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>
3 years agovfs_aio_pthread: SMB_VFS_OPEN() is called with cwd=parent directory of the file
Ralph Boehme [Thu, 14 May 2020 15:00:57 +0000 (17:00 +0200)]
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>
3 years agovfs_aio_pthread: pass smb_fname to create_private_open_data()
Ralph Boehme [Thu, 14 May 2020 14:52:16 +0000 (16:52 +0200)]
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>
3 years agovfs_aio_pthread: pass smb_fname to open_async()
Ralph Boehme [Thu, 14 May 2020 14:50:40 +0000 (16:50 +0200)]
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>
3 years agosmbd: remove dirfsp arg from [create|open]_internal_dirfsp_at()
Ralph Boehme [Thu, 14 May 2020 16:38:51 +0000 (18:38 +0200)]
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>
3 years agosmbd: set fsp_name of conn->cwd_fsp
Ralph Boehme [Tue, 14 Apr 2020 19:07:24 +0000 (21:07 +0200)]
smbd: set fsp_name of conn->cwd_fsp

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: move conn_rootdir_fname to non_widelink_open()
Ralph Boehme [Tue, 7 Apr 2020 16:41:15 +0000 (18:41 +0200)]
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>
3 years agosmbd: prepare for replacing SMB_VFS_READLINKAT() with SMB_VFS_STATX() in the future
Ralph Boehme [Thu, 9 Apr 2020 13:42:59 +0000 (15:42 +0200)]
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>
3 years agosmbd: remove unused variable twrp_name from filename_convert_internal()
Ralph Boehme [Thu, 7 May 2020 09:50:58 +0000 (11:50 +0200)]
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>
3 years agosmbd: update function documentation header to match actual function argument names
Ralph Boehme [Tue, 31 Mar 2020 16:57:55 +0000 (18:57 +0200)]
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>
3 years agosmbd: add open_flags arg to in open_internal_dirfsp_at()
Ralph Boehme [Thu, 9 Apr 2020 16:24:26 +0000 (18:24 +0200)]
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>
3 years agosmbd: exit early in the error case in fd_open()
Ralph Boehme [Wed, 4 Mar 2020 09:32:43 +0000 (10:32 +0100)]
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>
3 years agosmbd: refactor flags computation for fd_open() in open_directory() a bit
Ralph Boehme [Wed, 4 Mar 2020 09:56:56 +0000 (10:56 +0100)]
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>
3 years agoadd some missing FSCTL defines
Björn Jacke [Wed, 6 May 2020 15:45:29 +0000 (17:45 +0200)]
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

3 years agodocs-xml: update list of posible VFS operations for vfs_full_audit
Björn Jacke [Tue, 19 May 2020 10:42:31 +0000 (12:42 +0200)]
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>
3 years agodocs: improve desription of map acl inherit
Björn Jacke [Thu, 7 May 2020 14:00:14 +0000 (16:00 +0200)]
docs: improve desription of map acl inherit

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agotevent: Fix a tevent tutorial error
Volker Lendecke [Mon, 18 May 2020 08:38:41 +0000 (10:38 +0200)]
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

3 years agowinbindd: Fix a use-after-free when winbind clients exit
Volker Lendecke [Fri, 15 May 2020 13:19:45 +0000 (15:19 +0200)]
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

3 years agos3: lib: Paranoia around use of snprintf copying into a fixed-size buffer from a...
Jeremy Allison [Fri, 15 May 2020 19:18:02 +0000 (12:18 -0700)]
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

3 years agogitlab-ci: Add new runner for samba-admem-fips
Andreas Schneider [Fri, 15 May 2020 10:08:27 +0000 (12:08 +0200)]
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

3 years agoautobuild: Use sane random sleep values for samba-admem-mit
Andreas Schneider [Fri, 15 May 2020 14:09:47 +0000 (16:09 +0200)]
autobuild: Use sane random sleep values for samba-admem-mit

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoautobuild: Add ad_member_fips target
Andreas Schneider [Fri, 15 May 2020 10:07:04 +0000 (12:07 +0200)]
autobuild: Add ad_member_fips target

Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoselftest: Run some tests against ad_member_fips
Andreas Schneider [Fri, 15 May 2020 09:41:55 +0000 (11:41 +0200)]
selftest: Run some tests against ad_member_fips

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoselftest: Add ad_member_fips target
Andreas Schneider [Fri, 15 May 2020 09:30:35 +0000 (11:30 +0200)]
selftest: Add ad_member_fips target

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoselftest: Add force_fips_mode support to provision_ad_member()
Andreas Schneider [Fri, 15 May 2020 09:30:02 +0000 (11:30 +0200)]
selftest: Add force_fips_mode support to provision_ad_member()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoselftest: Split out a provision_ad_member() function
Andreas Schneider [Wed, 13 May 2020 14:54:39 +0000 (16:54 +0200)]
selftest: Split out a provision_ad_member() function

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoselftest: Use Kerberos to join an ad_member
Andreas Schneider [Wed, 13 May 2020 14:43:06 +0000 (16:43 +0200)]
selftest: Use Kerberos to join an ad_member

Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agos4/torture: Unlink test file at the beginning of smb2.read.position
Michael Adam [Wed, 13 May 2020 08:15:11 +0000 (13:45 +0530)]
s4/torture: Unlink test file at the beginning of smb2.read.position

Pair-Programmed-With: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri May 15 16:02:47 UTC 2020 on sn-devel-184

3 years agos3:gencache: Allow to open gencache as read-only
Andreas Schneider [Wed, 6 May 2020 15:10:51 +0000 (17:10 +0200)]
s3:gencache: Allow to open gencache as read-only

This allows client tools to access the cache for ready-only operations
as a normal user.

Example:
    net ads status

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May 15 14:40:32 UTC 2020 on sn-devel-184

3 years agolib:util: Add test for path_expand_tilde()
Andreas Schneider [Mon, 11 May 2020 10:50:11 +0000 (12:50 +0200)]
lib:util: Add test for path_expand_tilde()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:util: Add path_expand_tilde()
Andreas Schneider [Thu, 7 May 2020 10:25:24 +0000 (12:25 +0200)]
lib:util: Add path_expand_tilde()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest: add python S4U2Self tests including unkeyed checksums
Isaac Boukris [Mon, 4 May 2020 16:09:53 +0000 (18:09 +0200)]
selftest: add python S4U2Self tests including unkeyed checksums

To test the CRC32 I reverted the unkeyed-checksum fix (43958af1)
and the weak-crypto fix (389d1b97). Note that the unkeyed-md5
still worked even with weak-crypto disabled, and that the
unkeyed-sha1 never worked but I left it anyway.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 15 12:25:40 UTC 2020 on sn-devel-184

3 years agoRevert "CVE-2018-16860 selftest: Add test for S4U2Self with unkeyed checksum"
Isaac Boukris [Thu, 7 May 2020 15:17:12 +0000 (17:17 +0200)]
Revert "CVE-2018-16860 selftest: Add test for S4U2Self with unkeyed checksum"

This reverts commit 5639e973c1f6f1b28b122741763f1d05b47bc2d8.

This is no longer needed as the next commit includes a Python
test for this, without the complexity of being inside krb5.kdc.canon.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoRevert "selftest: mitm-s4u2self: use zlib for CRC32_checksum calc"
Isaac Boukris [Thu, 7 May 2020 15:17:00 +0000 (17:17 +0200)]
Revert "selftest: mitm-s4u2self: use zlib for CRC32_checksum calc"

This reverts commit 151f8c0f31d3d17b9418db3793ec14ba7dbf2143.

This allows a clean revert (and so removal) of the test.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoRevert "selftest: allow any kdc error in mitm-s4u2self test"
Isaac Boukris [Thu, 7 May 2020 15:16:53 +0000 (17:16 +0200)]
Revert "selftest: allow any kdc error in mitm-s4u2self test"

This reverts commit a53fa8ffe3e36f7921baf5d31a1052747f90aa7d.

This allows a clean revert (and so removal) of the test.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agosmb2_server: do async shutdown for pending multi-channel requests
Stefan Metzmacher [Fri, 4 Oct 2019 12:55:52 +0000 (14:55 +0200)]
smb2_server: do async shutdown for pending multi-channel requests

We have wait until all pending requests are done before we can
TALLOC_FREE() the connection structure.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri May 15 10:26:29 UTC 2020 on sn-devel-184

3 years agosmbXsrv_session: add a smbXsrv_session_disconnect_xconn() helper
Stefan Metzmacher [Fri, 4 Oct 2019 10:11:00 +0000 (12:11 +0200)]
smbXsrv_session: add a smbXsrv_session_disconnect_xconn() helper

This removes the connection references from the session channel
array for each session that's used on the connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
3 years agosmb2_server: call smbXsrv_connection_disconnect_transport() early on network errors
Stefan Metzmacher [Fri, 4 Oct 2019 12:56:40 +0000 (14:56 +0200)]
smb2_server: call smbXsrv_connection_disconnect_transport() early on network errors

It's good to remember the first error we got and makes sure we don't try
any further io on the connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>