samba.git
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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

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

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

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

4 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

4 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

4 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