samba.git
2 years agovfs_preopen: make use of any hints from samba_path_matching_check_last_component()
Stefan Metzmacher [Fri, 11 Jun 2021 21:08:19 +0000 (21:08 +0000)]
vfs_preopen: make use of any hints from samba_path_matching_check_last_component()

samba_path_matching_check_last_component() may return the start and end
offset of a submatch (for us the bytes where the digits are expected).

We use that in order to allow preopen_parse_fname() to just
look at these bytes and ignore any trailing digits after the submatch.

For the current use of samba_path_matching_mswild_create(),
there's no difference as we'll always get replace_start=-1 and
replace_end=-1. But the next commit will make optional use of
samba_path_matching_regex_sub1_create(), which will change the situation
and allow to return hints we got from regexec().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: cap the queue length to the maximum number that fits into the digits...
Stefan Metzmacher [Fri, 18 Jun 2021 18:29:31 +0000 (18:29 +0000)]
vfs_preopen: cap the queue length to the maximum number that fits into the digits space

If we have a single digit we only replace up to '9', which also fits
into a single digit.

We operate on numbers from 0 to 9999999999999999999 independent of the
architecture.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: introduce helper variables in preopen_parse_fname()
Stefan Metzmacher [Fri, 11 Jun 2021 21:08:19 +0000 (21:08 +0000)]
vfs_preopen: introduce helper variables in preopen_parse_fname()

Calculating the start_idx and num_digits at the first possible place
will make the following commits much easier.

At the end we just want to assign the return values without any logic.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: completely reset the queue if the name structure changes
Stefan Metzmacher [Fri, 18 Jun 2021 13:31:58 +0000 (13:31 +0000)]
vfs_preopen: completely reset the queue if the name structure changes

There's no point in trying to check if the current number is part
of the existing queue. This makes the logic at least more unstandable
to me.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: only reset the queue state if preopen_parse_fname() found matching digits
Stefan Metzmacher [Fri, 11 Jun 2021 20:03:49 +0000 (20:03 +0000)]
vfs_preopen: only reset the queue state if preopen_parse_fname() found matching digits

Otherwise there's no point in stopping the existing queue to continue
via pending preopen_helper_readable() invocations.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: make use of new samba_path_matching_* infrastructure
Stefan Metzmacher [Wed, 9 Jun 2021 13:08:38 +0000 (15:08 +0200)]
vfs_preopen: make use of new samba_path_matching_* infrastructure

There should not be any logic change in this commit,
for now we'll keep the same ms wildcard matching we had before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: only try to preopen if we can construct an absolute path
Stefan Metzmacher [Fri, 11 Jun 2021 20:05:14 +0000 (20:05 +0000)]
vfs_preopen: only try to preopen if we can construct an absolute path

So we make sure the dirfsp contains an absolute path to begin with
and smb_fname is a relative name within the directory.

Note: dirfsp->fsp_name->base_name[0] is only '/' because currently all callers pass
conn->cwd_fsp as dirfsp ... though there's already one caller that calls
fd_openat() with a real dirfsp, that is in vfs_fruit though on the
resource fork stream so doesn't really effect us currently.

If more callers are changed in future the situation may change,
but I guess then this is not the only place with potential problems.
We most likely need a generic helper function that returns the absolute
path of a dirfsp and use it here.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_preopen: introduce "preopen" debug class
Stefan Metzmacher [Tue, 8 Jun 2021 08:56:22 +0000 (10:56 +0200)]
vfs_preopen: introduce "preopen" debug class

It might be useful to change the level/location
of debug messages specific to this module.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agodocs-xml: document dynamic debug classes from modules
Stefan Metzmacher [Mon, 28 Jun 2021 09:44:27 +0000 (11:44 +0200)]
docs-xml: document dynamic debug classes from modules

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agolib/util: improve debug message about unknown classes
Stefan Metzmacher [Fri, 18 Jun 2021 12:18:00 +0000 (12:18 +0000)]
lib/util: improve debug message about unknown classes

debug classes registered by vfs modules are not available immediately.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3:lib: add samba_path_matching_regex_sub1_create()
Stefan Metzmacher [Fri, 11 Jun 2021 19:03:42 +0000 (19:03 +0000)]
s3:lib: add samba_path_matching_regex_sub1_create()

This will allow the usage 'POSIX Basic Regular Expression'
instead of 'ms wildcard' strings.

We allow exactly one 'subexpression' starting with '\(' and
ending with '\)' in order to find a replacement (byte) region
in the matching string.

This will be used in the vfs_preopen module in the following
commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3:lib: add a new samba_path_matching* infrastructure
Stefan Metzmacher [Wed, 9 Jun 2021 12:44:39 +0000 (14:44 +0200)]
s3:lib: add a new samba_path_matching* infrastructure

This aims to replace the current is_in_path() code in the long run.

For now it implements samba_path_matching_mswild_create()
in order to replace is_in_path() in the long run.

But there will be other "backends" using regexec() too.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3:torture: add STR-MATCH-MSWILD test for is_in_path()
Stefan Metzmacher [Fri, 18 Jun 2021 21:54:27 +0000 (21:54 +0000)]
s3:torture: add STR-MATCH-MSWILD test for is_in_path()

I want to assert at least some of the behavior as the
next commits will add a new abstraction that should
at least partly behave the same.

Note: case_[in]sensitive_idx is the index to the patterns
in the namelist, set to -1 on non-match, otherwise to
a value >= 0.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_default: use copy_file_range()
Ralph Boehme [Thu, 24 Jun 2021 14:21:42 +0000 (16:21 +0200)]
vfs_default: use copy_file_range()

Original file on an XFS filesystem:

  $ ls -l /mnt/test/1048578-file
  -rw-rw-r--. 1 slow slow 1048578 Jun 25 11:40 /mnt/test/1048578-file

  $ xfs_bmap /mnt/test/1048578-file
  /mnt/test/1048578-file:
          0: [0..2055]: 192..2247

Copy created with cp --reflink=never:

  $ xfs_bmap /mnt/test/1048578-file-reflink-never
  /mnt/test/1048578-file-reflink-never:
          0: [0..2055]: 2248..4303

Copy created with cp --reflink=always

  $ xfs_bmap /mnt/test/1048578-file-reflink-always
  /mnt/test/1048578-file-reflink-always:
          0: [0..2055]: 192..2247

Copy done from a Windows client:

  $ xfs_bmap /mnt/test/1048578-file\ -\ Copy
  /mnt/test/1048578-file - Copy:
          0: [0..2055]: 192..2247

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

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): Wed Jun 30 17:40:23 UTC 2021 on sn-devel-184

2 years agosmbd: use sys_io_ranges_overlap() in fsctl_dup_extents_check_overlap()
Ralph Boehme [Mon, 28 Jun 2021 13:50:32 +0000 (15:50 +0200)]
smbd: use sys_io_ranges_overlap() in fsctl_dup_extents_check_overlap()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: add sys_io_ranges_overlap()
Ralph Boehme [Sat, 26 Jun 2021 10:21:19 +0000 (12:21 +0200)]
lib: add sys_io_ranges_overlap()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs_default: properly track written bytes for copy-chunk
Ralph Boehme [Fri, 25 Jun 2021 13:47:38 +0000 (15:47 +0200)]
vfs_default: properly track written bytes for copy-chunk

No change in behavour, this just makes the logic slightly more
understandable. In theory it would also allow the logic to be adjusted for
allowing short reads which is not quite clear from MS-SMB2 if we should allow
it. The file could be truncated while we're reading it.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoreplace: copy_file_range()
Ralph Boehme [Thu, 24 Jun 2021 12:13:50 +0000 (14:13 +0200)]
replace: copy_file_range()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3: VFS: fake_acls. Remove two static 'recursion' global booleans.
Jeremy Allison [Mon, 28 Jun 2021 23:48:51 +0000 (16:48 -0700)]
s3: VFS: fake_acls. Remove two static 'recursion' global booleans.

Ralph made me feel really guilty about this, so I cleaned it up :-).

This may also be the way we can finally get rid of SMB_VFS_GETXATTR()
from adouble.c too.

This will go away once we have SMB_VFS_STATX() and we will
have a way for a caller to as for specific stat fields in a
granular way. Then we will know exactly what fields the caller
wants, so we won't have to fill in everything.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 29 22:08:02 UTC 2021 on sn-devel-184

2 years agos3: VFS: Update status of SMB_VFS_CHFLAGS
Noel Power [Thu, 17 Jun 2021 09:03:05 +0000 (10:03 +0100)]
s3: VFS: Update status of SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Jun 29 09:10:00 UTC 2021 on sn-devel-184

2 years agoVFS: Remove SMB_VFS_CHFLAGS, not used anymore
Noel Power [Fri, 11 Jun 2021 15:58:24 +0000 (16:58 +0100)]
VFS: Remove SMB_VFS_CHFLAGS, not used anymore

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: unityed_media: Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:34:01 +0000 (16:34 +0100)]
VFS: unityed_media: Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: snapper: Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:33:30 +0000 (16:33 +0100)]
VFS: snapper: Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: shadow_copy2: Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:33:02 +0000 (16:33 +0100)]
VFS: shadow_copy2: Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: media_harmony: Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:32:41 +0000 (16:32 +0100)]
VFS: media_harmony: Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: glusterfs Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:32:04 +0000 (16:32 +0100)]
VFS: glusterfs Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: catia: Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:30:04 +0000 (16:30 +0100)]
VFS: catia: Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: ceph_snapshot Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:31:38 +0000 (16:31 +0100)]
VFS: ceph_snapshot Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: ceph: Remove SMB_VFS_CHFLAGS
Noel Power [Fri, 11 Jun 2021 15:31:13 +0000 (16:31 +0100)]
VFS: ceph: Remove SMB_VFS_CHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3/smbd: smb_set_file_unix_info2: SMB_VFS_CHFLAGS -> SMB_VFS_FCHFLAGS
Noel Power [Fri, 11 Jun 2021 15:23:12 +0000 (16:23 +0100)]
s3/smbd: smb_set_file_unix_info2: SMB_VFS_CHFLAGS -> SMB_VFS_FCHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: snapper: Add SMB_VFS_FCHFLAGS implementation
Noel Power [Fri, 11 Jun 2021 14:46:56 +0000 (15:46 +0100)]
VFS: snapper: Add SMB_VFS_FCHFLAGS implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: shadow_copy2: Add SMB_VFS_FCHFLAGS implementation
Noel Power [Fri, 11 Jun 2021 14:46:30 +0000 (15:46 +0100)]
VFS: shadow_copy2: Add SMB_VFS_FCHFLAGS implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: glusterfs: Add SMB_VFS_FCHFLAGS implementation
Noel Power [Fri, 11 Jun 2021 14:46:07 +0000 (15:46 +0100)]
VFS: glusterfs: Add SMB_VFS_FCHFLAGS implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: ceph_snapshots: Add SMB_VFS_FCHFLAGS implementation
Noel Power [Fri, 11 Jun 2021 14:45:51 +0000 (15:45 +0100)]
VFS: ceph_snapshots: Add SMB_VFS_FCHFLAGS implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: ceph: Add SMB_VFS_FCHFLAGS implementation
Noel Power [Fri, 11 Jun 2021 14:45:38 +0000 (15:45 +0100)]
VFS: ceph: Add SMB_VFS_FCHFLAGS implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoVFS: Add initial implemenataion for SMB_VFS_FCHFLAGS
Noel Power [Thu, 10 Jun 2021 15:31:40 +0000 (16:31 +0100)]
VFS: Add initial implemenataion for SMB_VFS_FCHFLAGS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoidl: secrets_domain_info1_change is not a recursive structure
Pavel Filipenský [Tue, 22 Jun 2021 14:00:00 +0000 (16:00 +0200)]
idl: secrets_domain_info1_change is not a recursive structure

575d39048e3b4f619d65d65303ac809c40c5d495 has marked
several structures as recursive, they contain typically a
backpointer named '* next'. secrets_domain_info1 is not self
recursive, it only contains a pointer named '*next_change'.

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jun 29 03:07:17 UTC 2021 on sn-devel-184

2 years agos4:dsdsb: Check return code of cli_credentials_guess()
Andreas Schneider [Tue, 22 Jun 2021 07:37:13 +0000 (09:37 +0200)]
s4:dsdsb: Check return code of cli_credentials_guess()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libsmb: Check return code of cli_credentials_guess()
Andreas Schneider [Tue, 22 Jun 2021 07:35:47 +0000 (09:35 +0200)]
s3:libsmb: Check return code of cli_credentials_guess()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libnetapi: Check return code of cli_credentials_guess()
Andreas Schneider [Tue, 22 Jun 2021 07:34:39 +0000 (09:34 +0200)]
s3:libnetapi: Check return code of cli_credentials_guess()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoauth:creds: Check return code of cli_credentials_guess()
Andreas Schneider [Tue, 22 Jun 2021 07:24:38 +0000 (09:24 +0200)]
auth:creds: Check return code of cli_credentials_guess()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:cmdline: Ignore the return code of cli_credentials_guess()
Andreas Schneider [Tue, 27 Apr 2021 14:19:31 +0000 (16:19 +0200)]
lib:cmdline: Ignore the return code of cli_credentials_guess()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoauth:creds: Return bool for cli_credentials_guess()
Andreas Schneider [Tue, 27 Apr 2021 14:15:30 +0000 (16:15 +0200)]
auth:creds: Return bool for cli_credentials_guess()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoauth:creds: Add sanity check for env variables
Andreas Schneider [Tue, 27 Apr 2021 14:11:48 +0000 (16:11 +0200)]
auth:creds: Add sanity check for env variables

CID 710829

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:rpc_server: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 22 Jun 2021 07:48:42 +0000 (09:48 +0200)]
s4:rpc_server: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kpasswd: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 22 Jun 2021 07:47:23 +0000 (09:47 +0200)]
s4:kpasswd: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:dns_server: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 22 Jun 2021 07:46:14 +0000 (09:46 +0200)]
s4:dns_server: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:dns:bind_dlz: Check return codes of cli_credentials functions
Andreas Schneider [Tue, 22 Jun 2021 07:44:44 +0000 (09:44 +0200)]
s4:dns:bind_dlz: Check return codes of cli_credentials functions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:auth: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 22 Jun 2021 07:41:36 +0000 (09:41 +0200)]
s4:auth: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:auth: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 22 Jun 2021 07:39:53 +0000 (09:39 +0200)]
s4:auth: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:winbindd: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 4 May 2021 09:24:55 +0000 (11:24 +0200)]
s3:winbindd: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:passdb: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 4 May 2021 09:08:28 +0000 (11:08 +0200)]
s3:passdb: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libsmb: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 4 May 2021 09:06:23 +0000 (11:06 +0200)]
s3:libsmb: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:auth: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 4 May 2021 09:05:27 +0000 (11:05 +0200)]
s3:auth: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoauth:creds: Check return code of cli_credentials_set_conf()
Andreas Schneider [Tue, 4 May 2021 09:02:02 +0000 (11:02 +0200)]
auth:creds: Check return code of cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoauth:creds: Return a bool for cli_credentials_set_conf()
Andreas Schneider [Thu, 1 Apr 2021 15:02:10 +0000 (17:02 +0200)]
auth:creds: Return a bool for cli_credentials_set_conf()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorpc/dnsserver: check talloc_strndup return
Douglas Bagnall [Thu, 22 Apr 2021 13:00:12 +0000 (01:00 +1200)]
rpc/dnsserver: check talloc_strndup return

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorpc dnsserver: improve handling of serial numbers
Douglas Bagnall [Fri, 28 May 2021 10:48:00 +0000 (22:48 +1200)]
rpc dnsserver: improve handling of serial numbers

This is not correct, but it gets closer. We need to save the updated
serial number in the SOA.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorpc dnsserver: set the record rank
Douglas Bagnall [Fri, 28 May 2021 10:45:52 +0000 (22:45 +1200)]
rpc dnsserver: set the record rank

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorpc dnsserver: updates reset more than timestamp
Douglas Bagnall [Fri, 28 May 2021 10:44:28 +0000 (22:44 +1200)]
rpc dnsserver: updates reset more than timestamp

This is based on observed Windows behaviour.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorpc:dnsserver: allow update replacing with similar record
Douglas Bagnall [Fri, 28 May 2021 07:09:17 +0000 (19:09 +1200)]
rpc:dnsserver: allow update replacing with similar record

We have been refusing to handle the case where the replaced record
matches the replacement according to dns_record_match() (meaning the
wType and data are semantically identical). In Windows this is
explicitly used for changing TTL.

There are further changes we need to properly handle this case.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agorpc:dnsserver: split off record rank setting logic
Douglas Bagnall [Sat, 10 Apr 2021 23:40:59 +0000 (11:40 +1200)]
rpc:dnsserver: split off record rank setting logic

We want to do this also in update (in following commits), and we later
will want to fix the logic.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: VFS: fake_acls. Add missing NULL check for return of cp_smb_filename().
Jeremy Allison [Mon, 28 Jun 2021 17:20:49 +0000 (10:20 -0700)]
s3: VFS: fake_acls. Add missing NULL check for return of cp_smb_filename().

Found by Coverity.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 28 20:03:33 UTC 2021 on sn-devel-184

2 years agos3: smbd: Cleanup - rename get_ea_names_from_file() -> get_ea_names_from_fsp().
Jeremy Allison [Wed, 23 Jun 2021 19:12:30 +0000 (12:12 -0700)]
s3: smbd: Cleanup - rename get_ea_names_from_file() -> get_ea_names_from_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Jun 25 16:37:59 UTC 2021 on sn-devel-184

2 years agos3: smbd: Rename get_ea_value() -> get_ea_value_fsp().
Jeremy Allison [Wed, 23 Jun 2021 00:53:29 +0000 (17:53 -0700)]
s3: smbd: Rename get_ea_value() -> get_ea_value_fsp().

Remove the connection struct and smb_filename parameters.

There are now no more callers of SMB_VFS_GETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: Rename get_xattr_size() -> get_xattr_size_fsp().
Jeremy Allison [Wed, 23 Jun 2021 00:03:20 +0000 (17:03 -0700)]
s3: VFS: streams_xattr: Rename get_xattr_size() -> get_xattr_size_fsp().

It now only needs 2 parameters, fsp and EA name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_stat() - ~S_IFMT already removes S_IFDIR.
Jeremy Allison [Fri, 25 Jun 2021 04:42:16 +0000 (21:42 -0700)]
s3: VFS: streams_xattr: In streams_xattr_stat() - ~S_IFMT already removes S_IFDIR.

We don't need to do this separately.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: Use openat_pathref_fsp() to create a smb_fname->fsp (and...
Jeremy Allison [Tue, 22 Jun 2021 23:49:11 +0000 (16:49 -0700)]
s3: VFS: streams_xattr: Use openat_pathref_fsp() to create a smb_fname->fsp (and the smb_fname->fsp->base_fsp) if the incoming name doesn't have one.

Use new smb_fname->fsp->base_fsp parameter in get_xattr_size(), change name parameter to NULL.

If openat_pathref_fsp() fails, return the correct error code (thanks Ralph!).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_stat(), make use of smb_fname->fsp->base_fsp...
Jeremy Allison [Tue, 22 Jun 2021 21:24:15 +0000 (14:24 -0700)]
s3: VFS: streams_xattr: In streams_xattr_stat(), make use of smb_fname->fsp->base_fsp if it has one.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: Bring streams_xattr_stat_base() inline into streams_xattr_stat().
Jeremy Allison [Tue, 22 Jun 2021 21:19:13 +0000 (14:19 -0700)]
s3: VFS: streams_xattr: Bring streams_xattr_stat_base() inline into streams_xattr_stat().

That was its only caller.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: Simplify streams_xattr_lstat().
Jeremy Allison [Tue, 22 Jun 2021 21:16:04 +0000 (14:16 -0700)]
s3: VFS: streams_xattr: Simplify streams_xattr_lstat().

There can never be EA's on a symlink. Windows will never
see a symlink, and in SMB_FILENAME_POSIX_PATH mode we don't
allow EA's on a symlink.

All of the previous code boiled down to errno = ENOENT, return -1
so make that explicit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: Use fsp->base_fsp for the fsp parameter to get_xattr_size...
Jeremy Allison [Tue, 22 Jun 2021 20:47:46 +0000 (13:47 -0700)]
s3: VFS: streams_xattr: Use fsp->base_fsp for the fsp parameter to get_xattr_size() in streams_xattr_fstat().

We no longer need the 'struct smb_filename *smb_fname_base' here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: Add an fsp parameter to get_xattr_size().
Jeremy Allison [Tue, 22 Jun 2021 20:46:01 +0000 (13:46 -0700)]
s3: VFS: streams_xattr: Add an fsp parameter to get_xattr_size().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_openat() we can assume fsp->base_fsp !=...
Jeremy Allison [Wed, 23 Jun 2021 00:23:32 +0000 (17:23 -0700)]
s3: VFS: streams_xattr: In streams_xattr_openat() we can assume fsp->base_fsp != NULL.

It should have been opened/created by this point.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In walk_xattr_streams() use smb_fname->fsp for get_ea_value().
Jeremy Allison [Tue, 22 Jun 2021 19:17:37 +0000 (12:17 -0700)]
s3: VFS: streams_xattr: In walk_xattr_streams() use smb_fname->fsp for get_ea_value().

We know this is a valid fsp as we have already used it above inside
walk_xattr_streams() as an argument to get_ea_names_from_file().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove smb_fname_base.
Jeremy Allison [Wed, 23 Jun 2021 00:38:46 +0000 (17:38 -0700)]
s3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove smb_fname_base.

No longer used and we were leaking it onto the talloc_tos() anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_ftruncate() - use the fsp->base_fsp argument...
Jeremy Allison [Wed, 23 Jun 2021 00:37:51 +0000 (17:37 -0700)]
s3: VFS: streams_xattr: In streams_xattr_ftruncate() - use the fsp->base_fsp argument for get_ea_value().

We know it must be valid here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove conditional.
Jeremy Allison [Wed, 23 Jun 2021 00:36:28 +0000 (17:36 -0700)]
s3: VFS: streams_xattr: In streams_xattr_ftruncate() - remove conditional.

We know fsp->base_fsp must be valid here for SMB_VFS_FSETXATTR()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_pread() - remove smb_fname_base.
Jeremy Allison [Wed, 23 Jun 2021 00:20:08 +0000 (17:20 -0700)]
s3: VFS: streams_xattr: In streams_xattr_pread() - remove smb_fname_base.

No longer used and we were leaking it onto the talloc_tos() anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_pread() - use the fsp->base_fsp argument...
Jeremy Allison [Wed, 23 Jun 2021 00:19:08 +0000 (17:19 -0700)]
s3: VFS: streams_xattr: In streams_xattr_pread() - use the fsp->base_fsp argument for get_ea_value().

We know it must be valid here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_pwrite() - remove smb_fname_base.
Jeremy Allison [Wed, 23 Jun 2021 00:16:09 +0000 (17:16 -0700)]
s3: VFS: streams_xattr: In streams_xattr_pwrite() - remove smb_fname_base.

No longer used and we were leaking it onto the talloc_tos() anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_pwrite() - use the fsp->base_fsp argument...
Jeremy Allison [Wed, 23 Jun 2021 00:14:52 +0000 (17:14 -0700)]
s3: VFS: streams_xattr: In streams_xattr_pwrite() - use the fsp->base_fsp argument for get_ea_value().

We know it must be valid here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_xattr: In streams_xattr_pwrite() - remove conditional.
Jeremy Allison [Wed, 23 Jun 2021 00:10:50 +0000 (17:10 -0700)]
s3: VFS: streams_xattr: In streams_xattr_pwrite() - remove conditional.

We know fsp->base_fsp must be valid here for SMB_VFS_FSETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: ceph_snapshots: Remove ceph_snap_get_btime().
Jeremy Allison [Wed, 23 Jun 2021 18:45:25 +0000 (11:45 -0700)]
s3: VFS: ceph_snapshots: Remove ceph_snap_get_btime().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir() - change to use ceph_snap_get...
Jeremy Allison [Wed, 23 Jun 2021 18:44:23 +0000 (11:44 -0700)]
s3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir() - change to use ceph_snap_get_btime_fsp().

Comment out ceph_snap_get_btime() as it has no more callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: ceph_snapshots: In ceph_snap_fill_label(), use ceph_snap_get_btime_fsp(...
Jeremy Allison [Wed, 23 Jun 2021 18:29:18 +0000 (11:29 -0700)]
s3: VFS: ceph_snapshots: In ceph_snap_fill_label(), use ceph_snap_get_btime_fsp() instead of ceph_snap_get_btime().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: ceph_snapshots: In ceph_snap_fill_label() - pass in dirfsp instead of the...
Jeremy Allison [Wed, 23 Jun 2021 18:14:52 +0000 (11:14 -0700)]
s3: VFS: ceph_snapshots: In ceph_snap_fill_label() - pass in dirfsp instead of the raw path.

We will use this for openat_pathref_fsp() later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: ceph_snapshots: Add ceph_snap_get_btime_fsp().
Jeremy Allison [Wed, 23 Jun 2021 17:58:40 +0000 (10:58 -0700)]
s3: VFS: ceph_snapshots: Add ceph_snap_get_btime_fsp().

Handle-based copy of ceph_snap_get_btime(). Uses
SMB_VFS_NEXT_FGETXATTR() instead of SMB_VFS_NEXT_GETXATTR().

Commented out as nothing uses it yet. This will change shortly.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: Remove unused fake_acls_uid()/fake_acls_gid().
Jeremy Allison [Wed, 23 Jun 2021 17:50:04 +0000 (10:50 -0700)]
s3: VFS: fake_acls: Remove unused fake_acls_uid()/fake_acls_gid().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: In fake_acls_stat() - Now we always have a valid fsp, remove...
Jeremy Allison [Wed, 23 Jun 2021 17:48:49 +0000 (10:48 -0700)]
s3: VFS: fake_acls: In fake_acls_stat() - Now we always have a valid fsp, remove the calls to the path-based functions.

Comment out fake_acls_uid()/fake_acls_gid(), they are no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: In fake_acls_stat() - use openat_pathref_fsp() to always get...
Jeremy Allison [Wed, 23 Jun 2021 17:43:51 +0000 (10:43 -0700)]
s3: VFS: fake_acls: In fake_acls_stat() - use openat_pathref_fsp() to always get a pathref fsp.

Add a recursion guard so that openat_pathref_fsp() doesn't
end up recursing into itself when it calls SMB_VFS_STAT().

We now always have a valid fsp inside fake_acls_stat().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it.
Jeremy Allison [Wed, 23 Jun 2021 02:10:37 +0000 (19:10 -0700)]
s3: VFS: fake_acls: In fake_acls_stat() - if we have a pathref fsp, use it.

We will add a pathref open for the case where we don't next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: In fake_acls_stat() - remove call to get_full_smb_filename().
Jeremy Allison [Wed, 23 Jun 2021 02:05:06 +0000 (19:05 -0700)]
s3: VFS: fake_acls: In fake_acls_stat() - remove call to get_full_smb_filename().

It serves no purpose here. We no longer need the frame pointer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: In fake_acls_lstat() - get a pathref on whatever the link points...
Jeremy Allison [Wed, 23 Jun 2021 17:27:13 +0000 (10:27 -0700)]
s3: VFS: fake_acls: In fake_acls_lstat() - get a pathref on whatever the link points to and use the handle-based functions.

Add a recursion guard so that synthetic_pathref() can't
recurse into itself by calling SMB_VFS_LSTAT().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: fake_acls: In fake_acls_lstat() - remove call to get_full_smb_filename().
Jeremy Allison [Wed, 23 Jun 2021 02:05:57 +0000 (19:05 -0700)]
s3: VFS: fake_acls: In fake_acls_lstat() - remove call to get_full_smb_filename().

It serves no purpose here. We no longer need the frame pointer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR().
Jeremy Allison [Tue, 22 Jun 2021 19:01:13 +0000 (12:01 -0700)]
s3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: lib: adouble: Remove ad_set() - Dead code. Not used anywhere.
Jeremy Allison [Wed, 23 Jun 2021 22:11:47 +0000 (15:11 -0700)]
s3: lib: adouble: Remove ad_set() - Dead code. Not used anywhere.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: lib: adouble: Protect ad_read_meta() from accidently using a NULL fsp.
Jeremy Allison [Fri, 25 Jun 2021 03:23:39 +0000 (20:23 -0700)]
s3: lib: adouble: Protect ad_read_meta() from accidently using a NULL fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: torture: In cmd_getxattr(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR().
Jeremy Allison [Tue, 22 Jun 2021 18:47:25 +0000 (11:47 -0700)]
s3: torture: In cmd_getxattr(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: get_ea_list_from_fsp(). Make it clear we're using only the fsp by replacing...
Jeremy Allison [Tue, 22 Jun 2021 18:43:56 +0000 (11:43 -0700)]
s3: smbd: get_ea_list_from_fsp(). Make it clear we're using only the fsp by replacing the fsp->fsp_name with NULL.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>