]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agosmbd: use open_pathref_fsp() in filename_convert_internal()
Ralph Boehme [Sat, 13 Jun 2020 17:16:39 +0000 (19:16 +0200)] 
smbd: use open_pathref_fsp() in filename_convert_internal()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use common exit in filename_convert_internal()
Ralph Boehme [Mon, 23 Nov 2020 05:40:16 +0000 (06:40 +0100)] 
smbd: use common exit in filename_convert_internal()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add need_fsa arg and logic to file_find_di_(first|next)
Ralph Boehme [Thu, 19 Nov 2020 10:35:23 +0000 (11:35 +0100)] 
smbd: add need_fsa arg and logic to file_find_di_(first|next)

All callers except rename_open_files() can ignore non FSA fsps.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: ignore non FSA fsps in file_find_dif()
Ralph Boehme [Thu, 19 Nov 2020 10:21:42 +0000 (11:21 +0100)] 
smbd: ignore non FSA fsps in file_find_dif()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: reduce indentation in file_find_dif()
Ralph Boehme [Thu, 19 Nov 2020 10:10:35 +0000 (11:10 +0100)] 
smbd: reduce indentation in file_find_dif()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: README.Coding fixes in file_find_dif()
Ralph Boehme [Thu, 19 Nov 2020 10:09:05 +0000 (11:09 +0100)] 
smbd: README.Coding fixes in file_find_dif()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use move_smb_fname_fsp_link() in fsp_set_smb_fname()
Ralph Boehme [Mon, 23 Nov 2020 05:23:12 +0000 (06:23 +0100)] 
smbd: use move_smb_fname_fsp_link() in fsp_set_smb_fname()

This ensures that fsp->fsp_name->fsp is again set to the fsp and also preserves
the link fsp->fsp_name->fsp_link.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: maintain correct destructor order in fsp_free()
Ralph Boehme [Wed, 10 Jun 2020 13:21:35 +0000 (15:21 +0200)] 
smbd: maintain correct destructor order in fsp_free()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add move_smb_fname_fsp_link()
Ralph Boehme [Mon, 23 Nov 2020 05:00:40 +0000 (06:00 +0100)] 
smbd: add move_smb_fname_fsp_link()

Function to move fsps from one smb_fname to another.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add smb_fname_fsp_unlink()
Ralph Boehme [Mon, 23 Nov 2020 04:59:02 +0000 (05:59 +0100)] 
smbd: add smb_fname_fsp_unlink()

Remove the link between an smb_fname and it's embedded smb_fname->fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add openat_pathref_fsp()
Ralph Boehme [Tue, 29 Sep 2020 08:14:47 +0000 (10:14 +0200)] 
smbd: add openat_pathref_fsp()

open_pathref_fsp() opens an "embedded" fsp inside smb_fname as
smb_fname->fsp. We call such an fsp a "pathref" fsp.

On system that support O_PATH the low level openat() is done with O_PATH. On
systems that lack support for O_PATH, we impersonate the root user as a
fallback.

Setting "is_pathref" in the fsp_flags before calling fd_openat() is what
triggers the special low-level behaviour inside the VFS.

The use of pathref fsps allows updating all callers of path based VFS functions
like

  dos_mode(smb_fname)
  -> SMB_VFS_GET_DOS_ATTRIBUTES(smb_fname)
     -> SMB_VFS_GETXATTR(smb_fname)

to use the handle based VFS function like

  fdos_mode(smb_fname->fsp)
  -> SMB_VFS_FGET_DOS_ATTRIBUTES(fsp)
     -> SMB_VFS_FGETXATTR(fsp)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove SMB_VFS_FSTAT() from open_file()
Ralph Boehme [Tue, 17 Nov 2020 15:05:11 +0000 (16:05 +0100)] 
smbd: remove SMB_VFS_FSTAT() from open_file()

This is now done in non_widelink_open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: always fstat in non_widelink_open()
Ralph Boehme [Mon, 16 Nov 2020 12:54:49 +0000 (13:54 +0100)] 
smbd: always fstat in non_widelink_open()

This way we can avoid stating twice: once here and possibly a second time in
the caller open_file().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: convert non_widelink_open() and process_symlink_open() to return NTSTATUS
Ralph Boehme [Tue, 24 Nov 2020 11:30:58 +0000 (12:30 +0100)] 
smbd: convert non_widelink_open() and process_symlink_open() to return NTSTATUS

non_widelink_open() now also returns NT_STATUS_STOPPED_ON_SYMLINK in case an
attempt was made to either

1. open a symlink from a POSIX client, or

2. open a symlink from a Windows client but any of the symlink behaviour
   configuring options "follow symlink", "wide links" or "allow insecure wide
   links" prevents access to the symlink target

Caller open_file() has already been updated to map NT_STATUS_STOPPED_ON_SYMLINK
to NT_STATUS_NT_STATUS_OBJECT_PATH_NOT_FOUND.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: maps NT_STATUS_STOPPED_ON_SYMLINK to NT_STATUS_OBJECT_PATH_NOT_FOUND in open_file()
Ralph Boehme [Fri, 23 Oct 2020 10:16:38 +0000 (12:16 +0200)] 
smbd: maps NT_STATUS_STOPPED_ON_SYMLINK to NT_STATUS_OBJECT_PATH_NOT_FOUND in open_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass private_flags to open_file()
Ralph Boehme [Mon, 26 Oct 2020 11:31:10 +0000 (12:31 +0100)] 
smbd: pass private_flags to open_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: deal with real dirfsps in non_widelink_open()
Ralph Boehme [Tue, 24 Nov 2020 11:30:28 +0000 (12:30 +0100)] 
smbd: deal with real dirfsps in non_widelink_open()

If we get a real dirfsp, skip the parent-directory logic. Just pass the dirfsp
to SMB_VFS_OPENAT() which by now supports real dirfsps.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: simplify setting and resetting fsp->fsp_name in non_widelink_open()
Ralph Boehme [Mon, 19 Oct 2020 08:19:28 +0000 (10:19 +0200)] 
smbd: simplify setting and resetting fsp->fsp_name in non_widelink_open()

Instead of setting and resetting the name to the relative name every time we
call into the VFS, just set it once and reset it at the end and when recursing
via process_symlink_open().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use orig_fsp_name as variable name in non_widelink_open()
Ralph Boehme [Mon, 19 Oct 2020 08:16:06 +0000 (10:16 +0200)] 
smbd: use orig_fsp_name as variable name in non_widelink_open()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove unused cwdfsp from non_widelink_open()
Ralph Boehme [Tue, 13 Oct 2020 14:47:51 +0000 (16:47 +0200)] 
smbd: remove unused cwdfsp from non_widelink_open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass dirfsp down to non_widelink_open() and process_symlink_open()
Ralph Boehme [Tue, 13 Oct 2020 14:38:18 +0000 (16:38 +0200)] 
smbd: pass dirfsp down to non_widelink_open() and process_symlink_open()

Callers still all pass conn->cwd_fsp so no change in behaviour yet.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass a dirfsp to fd_open() and rename it to fd_openat()
Ralph Boehme [Tue, 13 Oct 2020 12:38:28 +0000 (14:38 +0200)] 
smbd: pass a dirfsp to fd_open() and rename it to fd_openat()

For now no change in behaviour as all callers still pass conn->cwd_fsp. This
just prepared fd_openat() to deal with real dirfsp's pass by callers later on
when adding calls to fd_openat(dirfspm ...) in the directory enumeration loop.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: catch O_PATH opens of symlinks in in non_widelink_open()
Ralph Boehme [Tue, 29 Sep 2020 08:00:21 +0000 (10:00 +0200)] 
smbd: catch O_PATH opens of symlinks in in non_widelink_open()

Calling openat() with O_PATH|O_NOFOLLOW will open a handle on the symlink
itself. That would be a nice feature if it would be supported on more platforms,
but being a Linux only thing, we have to preserve the behaviour of failing to
open a handle on symlinks.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: already set fsp fd in non_widelink_open()
Ralph Boehme [Mon, 12 Oct 2020 11:21:07 +0000 (13:21 +0200)] 
smbd: already set fsp fd in non_widelink_open()

A subsequent commit will add a consumer of the fd to non_widelink_open() (by
calling SMB_VFS_FSTAT()), so we need to set the fd already here. And it makes
more sense anyway. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: check for pathref fd's in vfs_set_blocking()
Ralph Boehme [Mon, 26 Oct 2020 13:39:02 +0000 (14:39 +0100)] 
smbd: check for pathref fd's in vfs_set_blocking()

Don't try to set pathref fd's to non-blocking, they're not used with IO.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy2: deal with real dirfsps in shadow_copy2_openat()
Ralph Boehme [Fri, 16 Oct 2020 10:28:39 +0000 (12:28 +0200)] 
vfs_shadow_copy2: deal with real dirfsps in shadow_copy2_openat()

Prepare shadow_copy2_openat() for real dirfsps flying by.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: add full_path_from_dirfsp_atname()
Ralph Boehme [Tue, 14 Apr 2020 15:44:37 +0000 (17:44 +0200)] 
s3: add full_path_from_dirfsp_atname()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_glusterfs: implement pathref opens with become_root() fallback
Ralph Boehme [Thu, 1 Oct 2020 13:44:15 +0000 (15:44 +0200)] 
vfs_glusterfs: implement pathref opens with become_root() fallback

Until glusterfs supports O_PATH, fallback to become_root().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph: implement pathref opens in cephwrap_openat()
Ralph Boehme [Thu, 1 Oct 2020 13:44:15 +0000 (15:44 +0200)] 
vfs_ceph: implement pathref opens in cephwrap_openat()

Ceph supports O_PATH since v0.93 from 2015:

https://ceph.io/geen-categorie/v0-93-hammer-release-candidate-released/

This seems to be old enough so we can hopefully use this without a runtime
version check.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: implement pathref opens in vfswrap_openat()
Ralph Boehme [Fri, 9 Oct 2020 12:24:43 +0000 (14:24 +0200)] 
vfs_default: implement pathref opens in vfswrap_openat()

If the system supports O_PATH we use that, otherwise we fallback to root opens.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd/posix_acls: support pathref fd's in posix_sys_acl_blob_get_fd()
Ralph Boehme [Thu, 1 Oct 2020 13:22:18 +0000 (15:22 +0200)] 
smbd/posix_acls: support pathref fd's in posix_sys_acl_blob_get_fd()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_posixacl: support pathref fd's in posixacl_sys_acl_set_fd()
Ralph Boehme [Thu, 1 Oct 2020 13:21:45 +0000 (15:21 +0200)] 
vfs_posixacl: support pathref fd's in posixacl_sys_acl_set_fd()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_posixacl: support pathref fd's in posixacl_sys_acl_get_fd()
Ralph Boehme [Thu, 1 Oct 2020 13:20:56 +0000 (15:20 +0200)] 
vfs_posixacl: support pathref fd's in posixacl_sys_acl_get_fd()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: skip Netatalk locking checks for path-ref fd's
Ralph Boehme [Sat, 1 Aug 2020 14:19:20 +0000 (16:19 +0200)] 
vfs_fruit: skip Netatalk locking checks for path-ref fd's

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: support pathref fd's in vfswrap_fsetxattr()
Ralph Boehme [Tue, 29 Sep 2020 09:11:53 +0000 (11:11 +0200)] 
vfs_default: support pathref fd's in vfswrap_fsetxattr()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: support pathref fd's in vfswrap_fremovexattr()
Ralph Boehme [Tue, 29 Sep 2020 09:10:51 +0000 (11:10 +0200)] 
vfs_default: support pathref fd's in vfswrap_fremovexattr()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: support pathref fd's in vfswrap_flistxattr()
Ralph Boehme [Tue, 29 Sep 2020 08:56:19 +0000 (10:56 +0200)] 
vfs_default: support pathref fd's in vfswrap_flistxattr()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: support pathref fd's in vfswrap_fgetxattr()
Ralph Boehme [Tue, 29 Sep 2020 08:55:52 +0000 (10:55 +0200)] 
vfs_default: support pathref fd's in vfswrap_fgetxattr()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: initialize conn->have_proc_fds
Ralph Boehme [Wed, 25 Nov 2020 06:05:20 +0000 (07:05 +0100)] 
vfs_default: initialize conn->have_proc_fds

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: fix indentation
Ralph Boehme [Wed, 25 Nov 2020 06:04:31 +0000 (07:04 +0100)] 
vfs_default: fix indentation

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: add fsp flag "have_proc_fds"
Ralph Boehme [Tue, 24 Nov 2020 11:20:23 +0000 (12:20 +0100)] 
vfs: add fsp flag "have_proc_fds"

This flag is used by the VFS layer to tell the FSA layer that it is allowed to
reopen an fsp by using an exisiting pathref fd with /proc/PID/fd/FD to open a
full fd.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: add struct connection_struct flag "have_proc_fds"
Ralph Boehme [Wed, 25 Nov 2020 04:32:19 +0000 (05:32 +0100)] 
vfs: add struct connection_struct flag "have_proc_fds"

Allows the VFS layer to tell the higher layers if fds opened by the openat() VFS
implementation are visible objects inside a /proc/PID/fd/FD filesystem.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_error_inject: ignore path_ref_fd's
Ralph Boehme [Mon, 15 Jun 2020 09:33:39 +0000 (11:33 +0200)] 
vfs_error_inject: ignore path_ref_fd's

This avoids failing opens triggered by filename_convert() ->
openat_pathref_fsp().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/lib: add proc fds infrastructure
Ralph Boehme [Wed, 30 Sep 2020 12:45:34 +0000 (14:45 +0200)] 
s3/lib: add proc fds infrastructure

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: make struct fd_handle private
Ralph Boehme [Sun, 27 Sep 2020 17:39:37 +0000 (19:39 +0200)] 
vfs: make struct fd_handle private

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove redundant initialisation of the fsp fd
Ralph Boehme [Fri, 2 Oct 2020 15:40:51 +0000 (17:40 +0200)] 
smbd: remove redundant initialisation of the fsp fd

This is already set to -1 by fd_handle_create().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fd_handle_create()
Ralph Boehme [Sun, 27 Sep 2020 19:16:03 +0000 (21:16 +0200)] 
smbd: use fd_handle_create()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fh_[get|set]_refcount()
Ralph Boehme [Mon, 28 Sep 2020 08:37:36 +0000 (10:37 +0200)] 
smbd: use fh_[get|set]_refcount()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fh_[get|set]_private_options()
Ralph Boehme [Fri, 23 Oct 2020 15:47:46 +0000 (17:47 +0200)] 
smbd: use fh_[get|set]_private_options()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fh_[get|set]_gen_id()
Ralph Boehme [Mon, 28 Sep 2020 08:35:32 +0000 (10:35 +0200)] 
smbd: use fh_[get|set]_gen_id()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fh_[get|set]_pos() and fh_[get|set]_position_information()
Ralph Boehme [Mon, 28 Sep 2020 08:32:29 +0000 (10:32 +0200)] 
smbd: use fh_[get|set]_pos() and fh_[get|set]_position_information()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_pathref_fd() for logical fd comparisons
Ralph Boehme [Mon, 5 Oct 2020 05:51:50 +0000 (07:51 +0200)] 
smbd: use fsp_get_pathref_fd() for logical fd comparisons

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_pathref_fd() for fstat() calls
Ralph Boehme [Mon, 5 Oct 2020 05:50:16 +0000 (07:50 +0200)] 
smbd: use fsp_get_pathref_fd() for fstat() calls

If we can access the path to a file, by default we have FILE_READ_ATTRIBUTES
from the containing directory. See the section: "Algorithm to Check Access to an
Existing File" in MS-FSA.pdf.

So it's also safe to use a root opened pathref fd, as the root open is done on
the final component after a chdir() to the parent directory was done while still
impersonating the use. Qed.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_pathref_fd() for "internal" xattr functions
Ralph Boehme [Sun, 4 Oct 2020 12:48:48 +0000 (14:48 +0200)] 
smbd: use fsp_get_pathref_fd() for "internal" xattr functions

We're using xattr data storage for internal reasons in these places, so in all
places it's safe to use a possibly root opened fd.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_pathref_fd() for *at related directory handles
Ralph Boehme [Sat, 17 Oct 2020 15:01:47 +0000 (17:01 +0200)] 
smbd: use fsp_get_pathref_fd() for *at related directory handles

Obviously correct to use fsp_get_pathref_fd() here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_pathref_fd() when close()ing fds
Ralph Boehme [Sat, 3 Oct 2020 19:24:29 +0000 (21:24 +0200)] 
smbd: use fsp_get_pathref_fd() when close()ing fds

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_pathref_fd() as part of DEBUG and syslog messages
Ralph Boehme [Sat, 3 Oct 2020 15:41:17 +0000 (17:41 +0200)] 
smbd: use fsp_get_pathref_fd() as part of DEBUG and syslog messages

Nothing really dangerous is done with the fds here, so we can safely use
fsp_get_pathref_fd() in these cases.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_get_io_fd() when accessing a file or it's associated metadata
Ralph Boehme [Sat, 26 Sep 2020 19:52:52 +0000 (21:52 +0200)] 
smbd: use fsp_get_io_fd() when accessing a file or it's associated metadata

In all places where we access or modify a file or it's associated metadata, we
use fsp_get_io_fd() to fetch the low-level fd from the fsp. This ensures we
don't accidentally use a pathref fsp where the fd would be opened as root on
systems lacking O_PATH.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use fsp_set_fd()
Ralph Boehme [Sat, 26 Sep 2020 19:46:51 +0000 (21:46 +0200)] 
smbd: use fsp_set_fd()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add fd_handle.[c|h]
Ralph Boehme [Sun, 27 Sep 2020 11:14:30 +0000 (13:14 +0200)] 
smbd: add fd_handle.[c|h]

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: add "is_fsa" flag to struct files_struct
Ralph Boehme [Sun, 22 Nov 2020 12:54:51 +0000 (13:54 +0100)] 
vfs: add "is_fsa" flag to struct files_struct

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: add "is_pathref" to struct files_struct
Ralph Boehme [Tue, 14 Jul 2020 08:10:19 +0000 (10:10 +0200)] 
vfs: add "is_pathref" to struct files_struct

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoCI: skip kernel-oplocks tests on older kernels
Ralph Boehme [Tue, 15 Dec 2020 06:20:55 +0000 (07:20 +0100)] 
CI: skip kernel-oplocks tests on older kernels

The kernel of the gitlab shared runners container host has a bug in the
interaction between kernel oplocks and O_PATH opens which was fixed by
387e3746d01c34457d6a73688acd90428725070b in 5.3.1:

<https://kernel.googlesource.com/pub/scm/linux/kernel/git/jlayton/linux/+/refs/tags/locks-v5.3-1%5E%21/>

Don't actually start the OPLOCK5 test is kernel oplocks are not available,
instead of relying on the #ifdef HAVE_KERNEL_OPLOCKS_LINUX magic in torture.c.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoCI: add samba-no-opath
Ralph Boehme [Mon, 22 Jun 2020 11:32:45 +0000 (13:32 +0200)] 
CI: add samba-no-opath

Add a job that builds with O_PATH undefined.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:smbd:trans2.c - add twrp to tmp smb_fname in smbd_do_qfsinfo
Andrew Walker [Tue, 8 Dec 2020 15:36:10 +0000 (10:36 -0500)] 
s3:smbd:trans2.c - add twrp to tmp smb_fname in smbd_do_qfsinfo

Preserve VSS-related timestamp in temporary smb_filename before
calling vfs_stat_fn() in smbd_do_qfsinfo. Otherwise, we can fail
here on smb2_getinfo requests if file does not exist outside of
shadow copy path.

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Dec 15 15:32:18 UTC 2020 on sn-devel-184

4 years agodbcheck: clarify check_object userparams
Douglas Bagnall [Tue, 8 Dec 2020 22:50:37 +0000 (11:50 +1300)] 
dbcheck: clarify check_object userparams

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: check_object/userparams: use variable for clarity
Douglas Bagnall [Tue, 8 Dec 2020 22:38:48 +0000 (11:38 +1300)] 
dbcheck: check_object/userparams: use variable for clarity

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: reduce useless use of str(attrname)
Douglas Bagnall [Tue, 8 Dec 2020 22:37:48 +0000 (11:37 +1300)] 
dbcheck: reduce useless use of str(attrname)

it's already a string!

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: better disambiguate 'attrs'
Douglas Bagnall [Tue, 8 Dec 2020 22:34:50 +0000 (11:34 +1300)] 
dbcheck: better disambiguate 'attrs'

We had too many things called 'attrs'; now we have just one, but we
don't want it to look like it is *the* one.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: split out attr calculations from check_object()
Douglas Bagnall [Fri, 4 Dec 2020 00:17:24 +0000 (13:17 +1300)] 
dbcheck: split out attr calculations from check_object()

check_object is too long!

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: add a helper function for attr tracking
Douglas Bagnall [Fri, 4 Dec 2020 00:10:49 +0000 (13:10 +1300)] 
dbcheck: add a helper function for attr tracking

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: do not add duplicate attrs for checking
Douglas Bagnall [Fri, 4 Dec 2020 00:06:25 +0000 (13:06 +1300)] 
dbcheck: do not add duplicate attrs for checking

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: check_object() caches of lower case attr names
Douglas Bagnall [Thu, 3 Dec 2020 23:57:57 +0000 (12:57 +1300)] 
dbcheck: check_object() caches of lower case attr names

The construct `'name' in map(str.lower, attrs)` is doubly inefficient,
because not only is it running the lower() function too often, it is
searching linearly in a temporary iterator for membership.

So we make a set, and use that.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agodbcheck: make rIDSetReferences attr check case-insensitve
Douglas Bagnall [Fri, 4 Dec 2020 00:56:56 +0000 (13:56 +1300)] 
dbcheck: make rIDSetReferences attr check case-insensitve

Yes, it looks inefficient, but that's because it is just trying to fit
in. Very soon we will fix it it properly.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agobootstrap: Update distro list in README.md
Martin Schwenke [Fri, 11 Dec 2020 04:57:37 +0000 (15:57 +1100)] 
bootstrap: Update distro list in README.md

Update examples to make them valid.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Dec 15 12:03:58 UTC 2020 on sn-devel-184

4 years agobootstrap: Cope with case changes in CentOS 8 repo names
Martin Schwenke [Tue, 8 Dec 2020 13:03:47 +0000 (00:03 +1100)] 
bootstrap: Cope with case changes in CentOS 8 repo names

RN: Be more flexible with repository names in CentOS 8 test environments

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14594
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibsmb: Remove unused ads_dns_query_* routines
Volker Lendecke [Sun, 29 Nov 2020 19:21:21 +0000 (20:21 +0100)] 
libsmb: Remove unused ads_dns_query_* routines

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Dec 11 19:30:16 UTC 2020 on sn-devel-184

4 years agolibsmb: Remove unused dns_lookup_list_async()
Volker Lendecke [Sun, 29 Nov 2020 18:34:54 +0000 (19:34 +0100)] 
libsmb: Remove unused dns_lookup_list_async()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotest: test site-aware DC lookup via "net lookup ldap"
Volker Lendecke [Fri, 4 Dec 2020 19:00:28 +0000 (20:00 +0100)] 
test: test site-aware DC lookup via "net lookup ldap"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonet: Use dns_rr_srv->ss_s in "net lookup ldap"
Volker Lendecke [Wed, 2 Dec 2020 20:18:04 +0000 (21:18 +0100)] 
net: Use dns_rr_srv->ss_s in "net lookup ldap"

ads_dns_query_srv() always fills it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonet: Use ads_dns_query_srv() in net_lookup_ldap()
Volker Lendecke [Sun, 29 Nov 2020 18:17:30 +0000 (19:17 +0100)] 
net: Use ads_dns_query_srv() in net_lookup_ldap()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonet: Add "sitename" support to "net lookup ldap"
Volker Lendecke [Wed, 2 Dec 2020 20:20:32 +0000 (21:20 +0100)] 
net: Add "sitename" support to "net lookup ldap"

This will be used in a test later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: No need to call dns_lookup_list_async() in discover_dc_dns()
Volker Lendecke [Sun, 29 Nov 2020 18:32:33 +0000 (19:32 +0100)] 
libsmb: No need to call dns_lookup_list_async() in discover_dc_dns()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Use ads_dns_query_srv() in discover_dc_dns()
Volker Lendecke [Sun, 29 Nov 2020 18:13:46 +0000 (19:13 +0100)] 
libsmb: Use ads_dns_query_srv() in discover_dc_dns()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: No need to call dns_lookup_list_async() in resolve_ads()
Volker Lendecke [Sun, 29 Nov 2020 18:27:15 +0000 (19:27 +0100)] 
libsmb: No need to call dns_lookup_list_async() in resolve_ads()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Use ads_dns_query_srv() in resolve_ads()
Volker Lendecke [Sun, 29 Nov 2020 18:02:31 +0000 (19:02 +0100)] 
libsmb: Use ads_dns_query_srv() in resolve_ads()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: Add ads_dns_query_srv_send()/recv()
Volker Lendecke [Sun, 29 Nov 2020 17:25:32 +0000 (18:25 +0100)] 
libcli: Add ads_dns_query_srv_send()/recv()

This issues the "query" for SRV records site-aware and siteless. If
there are SRV records returned without IP addresses, it will issue A
and AAAA requests, waiting up to async_dns_timeout seconds. If that
timeout is reached, ads_dns_query_srv_recv() returns whatever is
around.

Superdebug added by Jeremy <jra@samba.org> :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agobuild: Wrap a long line
Volker Lendecke [Sun, 29 Nov 2020 17:04:12 +0000 (18:04 +0100)] 
build: Wrap a long line

There will be one more .c file

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: Add required #includes to dnsquery.h
Volker Lendecke [Sun, 29 Nov 2020 17:17:10 +0000 (18:17 +0100)] 
libcli: Add required #includes to dnsquery.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: Add required #includes to libcli/dns/dns.h
Volker Lendecke [Sun, 29 Nov 2020 17:16:30 +0000 (18:16 +0100)] 
libcli: Add required #includes to libcli/dns/dns.h

Also, make it safe against being included twice

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Make dnsquery.h #ifdef align to our conventions
Volker Lendecke [Sun, 29 Nov 2020 16:57:52 +0000 (17:57 +0100)] 
lib: Make dnsquery.h #ifdef align to our conventions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoWHATSNEW: samba-tool gpo manage command
David Mulder [Fri, 4 Dec 2020 15:53:54 +0000 (08:53 -0700)] 
WHATSNEW: samba-tool gpo manage command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Wed Dec  9 18:42:29 UTC 2020 on sn-devel-184

4 years agosamba-tool: Add a gpo command for setting smb.conf Group Policy
David Mulder [Fri, 13 Nov 2020 15:39:26 +0000 (08:39 -0700)] 
samba-tool: Add a gpo command for setting smb.conf Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Test gpo smb.conf set command
David Mulder [Fri, 13 Nov 2020 14:28:00 +0000 (07:28 -0700)] 
samba-tool: Test gpo smb.conf set command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Add a gpo command for listing smb.conf Group Policies
David Mulder [Thu, 12 Nov 2020 18:19:37 +0000 (11:19 -0700)] 
samba-tool: Add a gpo command for listing smb.conf Group Policies

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Test gpo smb.conf list command
David Mulder [Thu, 12 Nov 2020 18:13:50 +0000 (11:13 -0700)] 
samba-tool: Test gpo smb.conf list command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Add a gpo command for listing Security Group Policies
David Mulder [Fri, 6 Nov 2020 17:44:28 +0000 (10:44 -0700)] 
samba-tool: Add a gpo command for listing Security Group Policies

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Test gpo Security list
David Mulder [Mon, 9 Nov 2020 23:28:11 +0000 (16:28 -0700)] 
samba-tool: Test gpo Security list

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Add a gpo command for setting Security Group Policy
David Mulder [Fri, 6 Nov 2020 19:19:12 +0000 (12:19 -0700)] 
samba-tool: Add a gpo command for setting Security Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agosamba-tool: Test gpo Security set command
David Mulder [Tue, 10 Nov 2020 15:05:37 +0000 (08:05 -0700)] 
samba-tool: Test gpo Security set command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>