]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 years agos3: rpc_server: pass DCE/RPC handle type to find_policy_handle
Samuel Cabrero [Wed, 6 May 2020 11:56:46 +0000 (13:56 +0200)] 
s3: rpc_server: pass DCE/RPC handle type to find_policy_handle

Following changes in commit c7a4578d06427a82ead287f0c5248c1a54cc9336
pass the handle type to the handle search functions. The handle type will
be verified unless passing DCESRV_HANDLE_ANY to find functions.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agos3: rpc_server: Strip out access check field from s3 handles implementation
Samuel Cabrero [Tue, 29 Oct 2019 11:39:10 +0000 (12:39 +0100)] 
s3: rpc_server: Strip out access check field from s3 handles implementation

The handle based security model is a SAMR specific feature. The access
granted is stored in the handle's associated data after creating it and
the access is verified after searching the handle.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agolibrpc: core: Move the s4 handles implementation to the RPC server core
Samuel Cabrero [Tue, 29 Oct 2019 10:04:43 +0000 (11:04 +0100)] 
librpc: core: Move the s4 handles implementation to the RPC server core

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoselftest: Add test for handle types
Samuel Cabrero [Fri, 8 May 2020 10:40:55 +0000 (12:40 +0200)] 
selftest: Add test for handle types

The test is written for SAMR, but as the handle type is verified by the
server core library it also applies to other RPC services.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: also use portable __has_attribute macro to check for attribute support
Björn Jacke [Sun, 24 May 2020 12:04:37 +0000 (14:04 +0200)] 
ldb: also use portable __has_attribute macro to check for attribute support

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotalloc: also use portable __has_attribute macro to check for attribute support
Björn Jacke [Sun, 24 May 2020 11:56:22 +0000 (13:56 +0200)] 
talloc: also use portable __has_attribute macro to check for attribute support

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotdb: also use __has_attribute macro to check for attribute support
Björn Jacke [Sun, 24 May 2020 11:55:02 +0000 (13:55 +0200)] 
tdb: also use __has_attribute macro to check for attribute support

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoreplace, attr.: use function attributes only if supported by feature macro (or old...
Björn Jacke [Sun, 24 May 2020 11:57:46 +0000 (13:57 +0200)] 
replace, attr.: use function attributes only if supported by feature macro (or old gcc)

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agogitlab-ci: Create a single samba-fips runner
Andreas Schneider [Tue, 19 May 2020 05:21:25 +0000 (07:21 +0200)] 
gitlab-ci: Create a single samba-fips runner

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoctdb-tests: Add a new fetch ring test that also checks hot keys
Martin Schwenke [Mon, 4 May 2020 07:15:19 +0000 (17:15 +1000)] 
ctdb-tests: Add a new fetch ring test that also checks hot keys

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri May 22 08:05:54 UTC 2020 on sn-devel-184

6 years agoctdb-tests: Update fetch_ring to take database and key on command line
Martin Schwenke [Mon, 4 May 2020 06:58:38 +0000 (16:58 +1000)] 
ctdb-tests: Update fetch_ring to take database and key on command line

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Fix sorting of hot keys
Martin Schwenke [Thu, 23 Apr 2020 08:59:47 +0000 (18:59 +1000)] 
ctdb-daemon: Fix sorting of hot keys

The current code only ever swaps with slot 0.  This will only ever
happen with slots 0 and 1, so probably never sorts.

Replace with qsort().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Add extra logging of hot keys
Martin Schwenke [Fri, 1 May 2020 06:44:22 +0000 (16:44 +1000)] 
ctdb-daemon: Add extra logging of hot keys

ctdbd currently only logs when a new hot key is added.  If a key gets
hotter then nothing new is logged.

Log hot key updates when the number of migrations has doubled since
the last time that key was logged.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Update hot key logging
Martin Schwenke [Fri, 1 May 2020 06:24:27 +0000 (16:24 +1000)] 
ctdb-daemon: Update hot key logging

This message indicates that a hot key was added, so say that.  After
all the hot key slots have been filled the id will always be 0, so
don't bother logging it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Fix bug in slot 0 comparison optimisation
Martin Schwenke [Thu, 14 May 2020 10:25:22 +0000 (20:25 +1000)] 
ctdb-daemon: Fix bug in slot 0 comparison optimisation

This is only valid if all slots are in use.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Switch some variables to unsigned
Martin Schwenke [Thu, 23 Apr 2020 08:59:24 +0000 (18:59 +1000)] 
ctdb-daemon: Switch some variables to unsigned

These should be unsigned but luck is currently on our side.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Add separate hot keys array for database statistics
Martin Schwenke [Thu, 23 Apr 2020 08:51:40 +0000 (18:51 +1000)] 
ctdb-daemon: Add separate hot keys array for database statistics

There are 2 reasons for this.  Sorting of hot keys is broken and will
be changed to an implementation that needs a named (i.e. not
anonymous) structure.  Also, at least one non-protocol field will be
added to facilitate more useful logging.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-build: Fix a typo
Martin Schwenke [Thu, 21 May 2020 10:19:17 +0000 (20:19 +1000)] 
ctdb-build: Fix a typo

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agosmbd: prepare DH disconnect for AT-names
Ralph Boehme [Sun, 17 May 2020 06:05:47 +0000 (08:05 +0200)] 
smbd: prepare DH disconnect for AT-names

This ensure cookie.base_name is set to the full path to deal with fsp->fsp_name
being an atname in the future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 21 22:01:25 UTC 2020 on sn-devel-184

6 years agosmbd: prepare fsp_str_dbg() for atnames
Ralph Boehme [Sun, 17 May 2020 05:53:42 +0000 (07:53 +0200)] 
smbd: prepare fsp_str_dbg() for atnames

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: use fd_openat()
Ralph Boehme [Fri, 8 May 2020 14:32:56 +0000 (16:32 +0200)] 
smbd: use fd_openat()

This leaves basically two callers of fd_open():

* open_internal_dirfsp_at()
* smbd_smb2_query_directory_send()

Those will be the only codepaths that use full paths relative to the share root
and so require and use the symlink race protection provided by
non_widelink_open().

Of course, until we actuall start passing real dirfsps to fd_openat(),
fd_openat() internally calls fd_open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: add fd_openat()
Ralph Boehme [Thu, 14 May 2020 19:20:22 +0000 (21:20 +0200)] 
smbd: add fd_openat()

Until we actually start passing real dirfsps to fd_openat(), fd_openat()
internally calls fd_open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agovfs: remove SMB_VFS_OPEN()
Ralph Boehme [Wed, 20 May 2020 21:26:14 +0000 (23:26 +0200)] 
vfs: remove SMB_VFS_OPEN()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3/torture: use SMB_VFS_OPENAT() in cmd_set_nt_acl()
Ralph Boehme [Tue, 19 May 2020 19:35:56 +0000 (21:35 +0200)] 
s3/torture: use SMB_VFS_OPENAT() in cmd_set_nt_acl()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3/torture: use SMB_VFS_OPENAT() in cmd_open()
Ralph Boehme [Tue, 19 May 2020 19:34:26 +0000 (21:34 +0200)] 
s3/torture: use SMB_VFS_OPENAT() in cmd_open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3/pysmbd: use SMB_VFS_OPENAT() in init_files_struct()
Ralph Boehme [Tue, 19 May 2020 19:33:00 +0000 (21:33 +0200)] 
s3/pysmbd: use SMB_VFS_OPENAT() in init_files_struct()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: use SMB_VFS_OPENAT() in non_widelink_open()
Ralph Boehme [Tue, 19 May 2020 19:30:24 +0000 (21:30 +0200)] 
smbd: use SMB_VFS_OPENAT() in non_widelink_open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agovfs_shadow_copy2: use SMB_VFS_NEXT_OPENAT() in shadow_copy2_get_shadow_copy_data()
Ralph Boehme [Wed, 20 May 2020 20:48:36 +0000 (22:48 +0200)] 
vfs_shadow_copy2: use SMB_VFS_NEXT_OPENAT() in shadow_copy2_get_shadow_copy_data()

These are paths not under user control, so it should be safe to call it with
AT_FDCWD and multi-component paths.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3: VFS: fruit. Now we've gotten rid of SMB_VFS_OPEN(), add const to the functions...
Jeremy Allison [Thu, 21 May 2020 18:56:14 +0000 (11:56 -0700)] 
s3: VFS: fruit. Now we've gotten rid of SMB_VFS_OPEN(), add const to the functions called by fruit_openat().

Remove the hack that allowed openat() to call non-const functions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agovfs_fruit: use SMB_VFS_NEXT_OPENAT()
Ralph Boehme [Wed, 20 May 2020 21:05:07 +0000 (23:05 +0200)] 
vfs_fruit: use SMB_VFS_NEXT_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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

6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>