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

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

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

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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 years agosamba-tool: Add a gpo command for removing Sudoers Group Policy
David Mulder [Fri, 6 Nov 2020 16:54:59 +0000 (09:54 -0700)]
samba-tool: Add a gpo command for removing Sudoers Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agosamba-tool: Test gpo Sudoers remove command
David Mulder [Mon, 9 Nov 2020 23:08:59 +0000 (16:08 -0700)]
samba-tool: Test gpo Sudoers remove command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agosamba-tool: Add a gpo command for adding Sudoers Group Policy
David Mulder [Fri, 6 Nov 2020 16:30:35 +0000 (09:30 -0700)]
samba-tool: Add a gpo command for adding Sudoers Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agosamba-tool: Test gpo Sudoers add command
David Mulder [Mon, 9 Nov 2020 22:48:28 +0000 (15:48 -0700)]
samba-tool: Test gpo Sudoers add command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agosamba-tool: Add a gpo command for listing Sudoers Group Policies
David Mulder [Fri, 6 Nov 2020 16:29:57 +0000 (09:29 -0700)]
samba-tool: Add a gpo command for listing Sudoers Group Policies

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agosamba-tool: Test gpo Sudoers list command
David Mulder [Mon, 9 Nov 2020 15:34:28 +0000 (08:34 -0700)]
samba-tool: Test gpo Sudoers list command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agodbcheck: err_normalise-mismatch_replace: no msg if no error
Douglas Bagnall [Thu, 3 Dec 2020 22:53:48 +0000 (11:53 +1300)]
dbcheck: err_normalise-mismatch_replace: no msg if no error

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Dec  9 17:04:23 UTC 2020 on sn-devel-184

3 years agodbcheck: fix doc for err_normalise_mismatch*
Douglas Bagnall [Thu, 3 Dec 2020 22:52:40 +0000 (11:52 +1300)]
dbcheck: fix doc for err_normalise_mismatch*

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: fix doc for do_rename()
Douglas Bagnall [Thu, 3 Dec 2020 22:51:42 +0000 (11:51 +1300)]
dbcheck: fix doc for do_rename()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: remove unused fix_incorrect_deleted_objects flag
Douglas Bagnall [Thu, 3 Dec 2020 22:19:50 +0000 (11:19 +1300)]
dbcheck: remove unused fix_incorrect_deleted_objects flag

This was introduced in db15993401f927fd2fcea1687c4155dce2272aa8
but not actually referenced then or since.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: improve some duplicate doc strings
Douglas Bagnall [Thu, 3 Dec 2020 21:15:24 +0000 (10:15 +1300)]
dbcheck: improve some duplicate doc strings

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: drop py2 support from dump_attr_values()
Douglas Bagnall [Thu, 3 Dec 2020 21:10:50 +0000 (10:10 +1300)]
dbcheck: drop py2 support from dump_attr_values()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: don't try to stringify values list twice
Douglas Bagnall [Thu, 3 Dec 2020 21:12:08 +0000 (10:12 +1300)]
dbcheck: don't try to stringify values list twice

dump_attr_values already turns it into a comma separated list.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: add docstring for err_odd_userParameters
Douglas Bagnall [Thu, 3 Dec 2020 23:34:52 +0000 (12:34 +1300)]
dbcheck: add docstring for err_odd_userParameters

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: fix documentation for err_doubled_userParameters
Douglas Bagnall [Thu, 3 Dec 2020 23:34:22 +0000 (12:34 +1300)]
dbcheck: fix documentation for err_doubled_userParameters

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: fix documentation and typo for err_utf_userParameters
Douglas Bagnall [Thu, 3 Dec 2020 23:34:02 +0000 (12:34 +1300)]
dbcheck: fix documentation and typo for err_utf_userParameters

pseudo, not psudo.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: fix documentation for err_base64_userParameters
Douglas Bagnall [Thu, 3 Dec 2020 23:33:27 +0000 (12:33 +1300)]
dbcheck: fix documentation for err_base64_userParameters

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodbcheck: fix documentation for err_duplicate_values
Douglas Bagnall [Thu, 3 Dec 2020 22:56:00 +0000 (11:56 +1300)]
dbcheck: fix documentation for err_duplicate_values

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agoselftest/subunit: python file modernisation
Douglas Bagnall [Thu, 19 Nov 2020 03:44:42 +0000 (16:44 +1300)]
selftest/subunit: python file modernisation

Python idioms for iterating over a line and closing it have improved,
and we should keep up.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agodrs_utils: remove unused sendRemoveDsServer()
Douglas Bagnall [Wed, 18 Nov 2020 23:43:01 +0000 (12:43 +1300)]
drs_utils: remove unused sendRemoveDsServer()

The only caller of this was `samba-tool domain demote` which stopped
using it in 2015 with commit f121173cbf46fe64746d73adf40015c43d5c55fc.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agopython: remove unused provision.check_install()
Douglas Bagnall [Wed, 18 Nov 2020 23:23:45 +0000 (12:23 +1300)]
python: remove unused provision.check_install()

Unused for at last 10 years.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agosamba-tool gpo: use common attr_default
Douglas Bagnall [Wed, 18 Nov 2020 22:24:47 +0000 (11:24 +1300)]
samba-tool gpo: use common attr_default

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agosamba-tool drs: move attr_default to common
Douglas Bagnall [Wed, 18 Nov 2020 22:24:25 +0000 (11:24 +1300)]
samba-tool drs: move attr_default to common

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agosamba-tool pso uses common timestamp functions
Douglas Bagnall [Wed, 18 Nov 2020 22:20:35 +0000 (11:20 +1300)]
samba-tool pso uses common timestamp functions

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agosamba-tool domain: move timestamp functions to common
Douglas Bagnall [Wed, 18 Nov 2020 22:19:04 +0000 (11:19 +1300)]
samba-tool domain: move timestamp functions to common

Other tools use identical functions, and they too can use common.py

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos4:torture:smb2: remove unused fallback defines in oplock.c
Stefan Metzmacher [Mon, 7 Dec 2020 11:06:11 +0000 (12:06 +0100)]
s4:torture:smb2: remove unused fallback defines in oplock.c

F_SETLEASE/F_SETSIG were all included in the kernel
and glibc in 2002, there's no need to have fallbacks 18 years later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Dec  7 20:07:18 UTC 2020 on sn-devel-184

3 years agos3:smbd: remove unused fallback defines in oplock_linux.c
Stefan Metzmacher [Mon, 7 Dec 2020 11:06:11 +0000 (12:06 +0100)]
s3:smbd: remove unused fallback defines in oplock_linux.c

F_GETLEASE/F_SETLEASE/F_SETSIG were all included in the kernel
and glibc in 2002, there's no need to have fallbacks 18 years later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/wscript: only check for F_SETLEASE being available at compile time
Stefan Metzmacher [Mon, 7 Dec 2020 10:38:59 +0000 (11:38 +0100)]
s3/wscript: only check for F_SETLEASE being available at compile time

F_GETLEASE/F_SETLEASE are available (at least) since Linux 2.4.0 from
2002.

We also should not have the configure check depend on the filesystem
we find at build time. It's very common that the build-environment is
much more restricted than the runtime-environment will be.

As a history we had this check on Samba 3.6:

 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <fcntl.h>
 #ifndef F_GETLEASE
 #define F_GETLEASE 1025
 #endif
 main() {
        int fd = open("/dev/null", O_RDONLY);
        return fcntl(fd, F_GETLEASE, 0) == -1;
 }
 ],
 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
    AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
 fi

which didn't depend on the filesystem.

Then we got a broken check introduced in Samba 4.0 (a copy of the
F_NOTIFY check):

 # Check for Linux kernel oplocks
 conf.CHECK_CODE('''
 #include <sys/types.h>
 #include <fcntl.h>
 #include <signal.h>
 #ifndef F_NOTIFY
 #define F_NOTIFY 1026
 #endif
 main() {
         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
        msg="Checking for Linux kernel oplocks")

this got "fixed" in Samba 4.7 (and backports to 4.6, 4.5 and 4.4) into

 # Check for Linux kernel oplocks
 conf.CHECK_CODE('''
 #include <sys/types.h>
 #include <fcntl.h>
 #include <signal.h>
 #ifndef F_GETLEASE
 #define F_GETLEASE 1025
 #endif
 main() {
         exit(fcntl(open("/tmp", O_RDONLY), F_GETLEASE, 0) == -1 ?  1 : 0);
 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
        msg="Checking for Linux kernel oplocks")

Lately it became dependend on the filesystem in the build-environment:

 # Check for Linux kernel oplocks
 conf.CHECK_CODE('''
 #include <sys/types.h>
 #include <fcntl.h>
 #include <signal.h>
 #ifndef F_GETLEASE
 #define F_GETLEASE 1025
 #endif
 main() {
       const char *fname="/tmp/oplock-test.txt";
       int fd = open(fname, O_RDWR|O_CREAT, 0644);
       int ret = fcntl(fd, F_SETLEASE, F_WRLCK);
       unlink(fname);
       return (ret == -1) ? 1 : 0;
 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
        msg="Checking for Linux kernel oplocks")

Now we just check for F_SETLEASE being available in linux/fcntl.h.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/wscript: remove unused check for F_NOTIFY
Stefan Metzmacher [Mon, 7 Dec 2020 10:24:43 +0000 (11:24 +0100)]
s3/wscript: remove unused check for F_NOTIFY

There're no references to F_NOTIFY nor HAVE_KERNEL_CHANGE_NOTIFY in the
code, so the configure check is not needed at all.

We only use the inotify or fam abstractions.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4/samba: call force_check_log_size() in standard_new_task()
Ralph Boehme [Thu, 26 Nov 2020 14:24:44 +0000 (15:24 +0100)]
s4/samba: call force_check_log_size() in standard_new_task()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248
RN: samba process does not honor max log size

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): Mon Dec  7 18:54:29 UTC 2020 on sn-devel-184

3 years agos4/samba: call force_check_log_size() in standard_accept_connection()
Ralph Boehme [Thu, 26 Nov 2020 14:24:26 +0000 (15:24 +0100)]
s4/samba: call force_check_log_size() in standard_accept_connection()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4/samba: call force_check_log_size() in prefork_reload_after_fork()
Ralph Boehme [Thu, 26 Nov 2020 14:23:58 +0000 (15:23 +0100)]
s4/samba: call force_check_log_size() in prefork_reload_after_fork()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
3 years agos4: call reopen_logs_internal() in the SIGHUP handler of the prefork process model
Ralph Boehme [Mon, 23 Nov 2020 15:44:04 +0000 (16:44 +0100)]
s4: call reopen_logs_internal() in the SIGHUP handler of the prefork process model

With debug_schedule_reopen_logs() the actual reopen only takes place at some
point in the future when a DEBUG message is processed.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4: replace low-level SIGUP handler with a tevent handler
Ralph Boehme [Fri, 20 Nov 2020 14:21:03 +0000 (15:21 +0100)]
s4: replace low-level SIGUP handler with a tevent handler

Replace the low-level signal handler for SIGHUP with a nice tevent signal
handler. The low-level handler sig_hup() installed by setup_signals() remains
being used during early startup before a tevent context is available.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4: install tevent tracing hooks to trigger logfile rotation
Ralph Boehme [Thu, 26 Nov 2020 13:21:58 +0000 (14:21 +0100)]
s4: install tevent tracing hooks to trigger logfile rotation

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4: add samba server tevent trace helper stuff
Ralph Boehme [Mon, 23 Nov 2020 16:53:57 +0000 (17:53 +0100)]
s4: add samba server tevent trace helper stuff

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodebug: detect logrotation by checking inode number
Ralph Boehme [Mon, 23 Nov 2020 15:04:03 +0000 (16:04 +0100)]
debug: detect logrotation by checking inode number

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodebug: pass struct debug_class *config to do_one_check_log_size()
Ralph Boehme [Mon, 23 Nov 2020 14:51:09 +0000 (15:51 +0100)]
debug: pass struct debug_class *config to do_one_check_log_size()

Pass a pointer to the struct instead of all struct members individually. No
change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodebug: pass struct debug_class *config to reopen_one_log()
Ralph Boehme [Mon, 23 Nov 2020 14:46:47 +0000 (15:46 +0100)]
debug: pass struct debug_class *config to reopen_one_log()

Pass a pointer to the struct instead of all struct members individually. No
change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoloadparm: setup debug subsystem setting max_log_size from config
Ralph Boehme [Fri, 13 Nov 2020 11:34:50 +0000 (12:34 +0100)]
loadparm: setup debug subsystem setting max_log_size from config

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoWHATSNEW.txt: fix version to 4.14
Stefan Metzmacher [Sat, 5 Dec 2020 21:19:07 +0000 (22:19 +0100)]
WHATSNEW.txt: fix version to 4.14

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Dec  5 22:35:04 UTC 2020 on sn-devel-184

3 years agosmbd: Remove "have_share_modes" from "struct share_mode_data"
Volker Lendecke [Thu, 3 Dec 2020 16:16:25 +0000 (17:16 +0100)]
smbd: Remove "have_share_modes" from "struct share_mode_data"

Nobody in share_mode_lock.c looked at that value anymore, so we don't
need to manually maintain it.

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  4 22:32:38 UTC 2020 on sn-devel-184

3 years agosmbd: Simplify share_mode_entry_do()
Volker Lendecke [Thu, 3 Dec 2020 16:12:20 +0000 (17:12 +0100)]
smbd: Simplify share_mode_entry_do()

Rely on the truth in locking.tdb wrt existence of share entries

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Remove a comment that was not helpful for me
Volker Lendecke [Thu, 3 Dec 2020 16:03:32 +0000 (17:03 +0100)]
smbd: Remove a comment that was not helpful for me

Also avoid an "else" branch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Simplify share_mode_lock_destructor()
Volker Lendecke [Thu, 3 Dec 2020 16:02:10 +0000 (17:02 +0100)]
smbd: Simplify share_mode_lock_destructor()

Rely on the truth in the database whether we found share modes or
not, share_mode_data_store() has that information for free.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Remove unused share_mode_have_entries()
Volker Lendecke [Thu, 3 Dec 2020 15:23:58 +0000 (16:23 +0100)]
smbd: Remove unused share_mode_have_entries()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Simplify open_mode_check()
Volker Lendecke [Thu, 3 Dec 2020 15:18:25 +0000 (16:18 +0100)]
smbd: Simplify open_mode_check()

The call to share_mode_have_entries() was put in before
fresh_share_mode_lock() initialized d->flags to be completely
permissive. With that correct initialization the call to
share_conflict() a few lines down will also make open_mode_check()
pass for any share_access/access_mask.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Simplify share_mode_memcache_fetch()
Volker Lendecke [Tue, 1 Dec 2020 12:50:32 +0000 (13:50 +0100)]
smbd: Simplify share_mode_memcache_fetch()

Take a struct file_id instead of a locking.tdb key,
share_mode_memcache_store() also operates on the implicit fid in
struct share_mode_data.

To do this, parse_share_modes() also needs to take file_id.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agobuild: Fix kernel oplock test
Volker Lendecke [Fri, 20 Nov 2020 13:19:21 +0000 (14:19 +0100)]
build: Fix kernel oplock test

In a pure docker environment with overlayfs F_GETLEASE works on /tmp,
but F_SETLEASE does not. This test now correctly detects that.

The effect is that the samba-fileserver environment would run fine in
a shared gitlab runner, at the price of not testing kernel oplocks. We
could move the kernel oplock tests to another environment that for
other reasons can't run on shared gitlab runners.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Align integer types
Volker Lendecke [Tue, 1 Dec 2020 12:27:11 +0000 (13:27 +0100)]
smbd: Align integer types

full_path_tos() return ssize_t

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>