samba.git
2 years agothird_party: Update waf to verison 2.0.23
Andreas Schneider [Thu, 17 Feb 2022 14:40:20 +0000 (15:40 +0100)]
third_party: Update waf to verison 2.0.23

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Feb 21 10:06:27 UTC 2022 on sn-devel-184

2 years agothird_party:waf: Print the version of waf at the end of the update script
Andreas Schneider [Thu, 17 Feb 2022 14:40:38 +0000 (15:40 +0100)]
third_party:waf: Print the version of waf at the end of the update script

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2 years agoeditorconfig: Final newlines are pycodestyle
Andreas Schneider [Thu, 17 Feb 2022 19:35:50 +0000 (20:35 +0100)]
editorconfig: Final newlines are pycodestyle

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2 years agowaf: re-add missing readlink test
Björn Jacke [Wed, 26 Dec 2018 00:03:29 +0000 (01:03 +0100)]
waf: re-add missing readlink test

this was another portability regression that came with the moving to waf

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Feb 18 23:12:51 UTC 2022 on sn-devel-184

2 years agoreadlink test: inverse return code
Björn Jacke [Wed, 26 Dec 2018 00:01:14 +0000 (01:01 +0100)]
readlink test: inverse return code

We need to return 0 in case readlink is *broken* here - this is because our waf
CHECK_CODE function does only allow generating defines in case the test succeeds

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agowscript: s/default/required/ _static_modules for the acl modules
Björn Jacke [Tue, 15 Feb 2022 13:25:41 +0000 (14:25 +0100)]
wscript: s/default/required/ _static_modules for the acl modules

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs_aixacl: add proper header file
Bjoern Jacke [Fri, 11 Feb 2022 00:45:00 +0000 (00:45 +0000)]
vfs_aixacl: add proper header file

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoacl: fix function arguments for AIX' and Solaris' sys_acl_get_fd()
Björn Jacke [Fri, 11 Feb 2022 02:38:31 +0000 (03:38 +0100)]
acl: fix function arguments for AIX' and Solaris' sys_acl_get_fd()

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3: smbd: Fix our leases code to return the correct error in the non-dynamic share...
Jeremy Allison [Thu, 17 Feb 2022 19:12:39 +0000 (11:12 -0800)]
s3: smbd: Fix our leases code to return the correct error in the non-dynamic share case.

We now return INVALID_PARAMETER when trying to open a
different file with a duplicate lease key on the same
(non-dynamic) share. This will enable us to pass another
Windows test suite leases test.

We now behave the same as Windows10.

Remove knownfail.d/smb2-lease-duplicateopen

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Feb 18 20:12:12 UTC 2022 on sn-devel-184

2 years agos4: torture: Add new SMB2 lease test test_lease_duplicate_open().
Jeremy Allison [Thu, 17 Feb 2022 18:58:32 +0000 (10:58 -0800)]
s4: torture: Add new SMB2 lease test test_lease_duplicate_open().

Checks we return INVALID_PARAMETER when trying to open a
different file with a duplicate lease key on the same share.

Checked against Windows10. Currently fails against smbd
so add knownfail.d/smb2-lease-duplicateopen

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
2 years agos4: torture: Add new SMB2 lease test test_lease_duplicate_create().
Jeremy Allison [Thu, 17 Feb 2022 17:58:27 +0000 (09:58 -0800)]
s4: torture: Add new SMB2 lease test test_lease_duplicate_create().

Checks we return INVALID_PARAMETER when trying to create a
new file with a duplicate lease key on the same share.

Checked against Windows10. Samba already passes this
but we didn't have a test before.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
2 years agosource4/torture: Drop unused variable attribute
Martin Schwenke [Tue, 15 Feb 2022 22:11:43 +0000 (09:11 +1100)]
source4/torture: Drop unused variable attribute

clang complains:

../../source4/client/client.c:1569:11: error: variable 'attribute' set but not used [-Werror,-Wunused-but-set-variable]
        uint16_t attribute = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
                 ^

That is, the variable is initialised and updated but the value is
never used.

Commit 2f377d5101783ed4d8c96a46aaec61895cc7b6ad from 2004 dropped the
use of this variable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Feb 17 19:06:25 UTC 2022 on sn-devel-184

2 years agosource4/torture: Drop unused variable mask
Martin Schwenke [Tue, 15 Feb 2022 22:05:31 +0000 (09:05 +1100)]
source4/torture: Drop unused variable mask

clang complains:

../../source4/torture/smb2/notify.c:871:11: error: variable 'mask' set but not used [-Werror,-Wunused-but-set-variable]
        uint32_t mask;
                 ^

That is, the variable is initialised and updated but the value is
never used.

Looks to have been this way since commit
15d93a5d8e21893e1cca5c989dbf97010aae1622 from 2009.  Just drop it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agosource4/torture: Drop unused variable tdif
Martin Schwenke [Tue, 15 Feb 2022 21:56:10 +0000 (08:56 +1100)]
source4/torture: Drop unused variable tdif

clang complains:

../../source4/torture/basic/denytest.c:1805:11: error: variable 'tdif' set but not used [-Werror,-Wunused-but-set-variable]
                int64_t tdif;
                        ^

That is, the variable is initialised and updated but the value is
never used.

Perhaps it is meant to be used in the nearby torture_comment() call,
but it has been this was since commit
cb1cff90f165d82cbbf1dd87e475a1b13984d45e from 2004.  Just drop it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agosource4/torture: Avoid unused variable
Martin Schwenke [Tue, 15 Feb 2022 21:50:24 +0000 (08:50 +1100)]
source4/torture: Avoid unused variable

clang complains:

../../source4/torture/basic/delete.c:2342:7: error: variable 'correct' set but not used [-Werror,-Wunused-but-set-variable]
        bool correct = true;
             ^

That is, the variable is initialised and updated but the value is
never used.  Similar functions return this variable, so try that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agovfs_not_implemented: do not mark structs with _PUBLIC_
Martin Schwenke [Tue, 15 Feb 2022 21:44:40 +0000 (08:44 +1100)]
vfs_not_implemented: do not mark structs with _PUBLIC_

Commit 5d295e41af4e9316aee1b4cf1c3087663b7c06a4 accidentally marked
some structs with _PUBLIC_, which causes clang to complain:

../../source3/modules/vfs_not_implemented.c:594:1: error: attribute 'visibility' is ignored, place it after "struct" to apply attribute to type declaration [-Werror,-Wignored-attributes]
_PUBLIC_
^
../../lib/replace/replace.h:917:33: note: expanded from macro '_PUBLIC_'
                                ^
../../source3/modules/vfs_not_implemented.c:642:1: error: attribute 'visibility' is ignored, place it after "struct" to apply attribute to type declaration [-Werror,-Wignored-attributes]
_PUBLIC_
^
../../lib/replace/replace.h:917:33: note: expanded from macro '_PUBLIC_'
                                ^

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agoutil: Drop unused variable mask_perms
Martin Schwenke [Tue, 15 Feb 2022 09:27:24 +0000 (20:27 +1100)]
util: Drop unused variable mask_perms

clang complains:

../../source3/smbd/posix_acls.c:2783:9: error: variable 'mask_perms' set but not used [-Werror,-Wunused-but-set-variable]
        mode_t mask_perms = 0;
               ^

That is, the variable is initialised and updated but the value is
never used.

This potentially points to a bug in commit
f735551b9edef66b152261cf6eb2f29b7b69d65b from 2002.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agoutil: Drop unused variable num_received
Martin Schwenke [Tue, 15 Feb 2022 08:37:17 +0000 (19:37 +1100)]
util: Drop unused variable num_received

clang complains:

../../source4/libcli/clilist.c:111:6: error: variable 'num_received' set but not used [-Werror,-Wunused-but-set-variable]
        int num_received = 0;
            ^
../../source4/libcli/clilist.c:268:6: error: variable 'num_received' set but not used [-Werror,-Wunused-but-set-variable]
        int num_received = 0;
            ^

That is, the variable is initialised and updated but the value is
never used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agoutil: Drop unused variable num_chars
Martin Schwenke [Tue, 15 Feb 2022 08:32:52 +0000 (19:32 +1100)]
util: Drop unused variable num_chars

clang complains:

../../lib/util/genrand_util.c:99:9: error: variable 'num_chars' set but not used [-Werror,-Wunused-but-set-variable]
        size_t num_chars = 0;
               ^

That is, the variable is initialised and incremented but the value is
never used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agosmbd: Make strnorm() static to filename.c
Volker Lendecke [Thu, 17 Feb 2022 10:24:38 +0000 (11:24 +0100)]
smbd: Make strnorm() static to filename.c

The caller in vfs_prealloc was a bit unneeded, and strnorm is only
called here.

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): Thu Feb 17 18:11:18 UTC 2022 on sn-devel-184

2 years agovfs: Don't go through strnorm(..., CASE_LOWER)
Volker Lendecke [Thu, 17 Feb 2022 10:19:50 +0000 (11:19 +0100)]
vfs: Don't go through strnorm(..., CASE_LOWER)

With a fixed CASE_LOWER we should go directly to the lowerlevel call, this
makes it more obvious to me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs: Fix a typo
Volker Lendecke [Thu, 17 Feb 2022 10:19:42 +0000 (11:19 +0100)]
vfs: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use ISDOT/ISDOTDOT
Volker Lendecke [Thu, 17 Feb 2022 10:10:00 +0000 (11:10 +0100)]
smbd: Use ISDOT/ISDOTDOT

This is simpler to read for me

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Filter out "::$DATA" for query name information
Volker Lendecke [Fri, 11 Feb 2022 17:09:56 +0000 (18:09 +0100)]
smbd: Filter out "::$DATA" for query name information

Make this piece of code robust against having "::$DATA" passed in.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Simplify open_file_ntcreate()
Volker Lendecke [Fri, 11 Feb 2022 17:07:42 +0000 (18:07 +0100)]
smbd: Simplify open_file_ntcreate()

For streams our caller create_file_unixpath() has already taken care
of properly initializing fsp->base_fsp, so we can rely on
fsp_is_alternate_stream() here instead of looking at the file name.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Only open base_fsp for non-"::$DATA" streams
Volker Lendecke [Fri, 11 Feb 2022 17:09:00 +0000 (18:09 +0100)]
smbd: Only open base_fsp for non-"::$DATA" streams

"is_named_stream()" is more what we really mean here. Make this line robust
against callers passing in "::$DATA".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs: Use is_named_stream() for checking if we have an ADS
Volker Lendecke [Fri, 11 Feb 2022 15:13:07 +0000 (16:13 +0100)]
vfs: Use is_named_stream() for checking if we have an ADS

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use fsp_is_alternate_stream(), we checked for fsp!=NULL above
Volker Lendecke [Fri, 11 Feb 2022 14:59:06 +0000 (15:59 +0100)]
smbd: Use fsp_is_alternate_stream(), we checked for fsp!=NULL above

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Slightly simplify openat_pathref_fsp()
Volker Lendecke [Thu, 30 Dec 2021 17:04:55 +0000 (18:04 +0100)]
smbd: Slightly simplify openat_pathref_fsp()

We don't need to look at the full share-relative path to figure out if
we have a stream name, the original smb_fname is sufficient for this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs: Use fsp_get_pathref_fd() in aio_pthread
Volker Lendecke [Mon, 14 Feb 2022 12:30:43 +0000 (13:30 +0100)]
vfs: Use fsp_get_pathref_fd() in aio_pthread

We only use the fd as "dirfd" in openat, so we don't need an I/O fd
here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Sun, 13 Feb 2022 08:25:54 +0000 (09:25 +0100)]
libsmb: Avoid a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Sun, 13 Feb 2022 08:21:47 +0000 (09:21 +0100)]
libsmb: Avoid a call to SMBC_errno()

This involves converting cli_print_queue() to NTSTATUS. No caller
looked at the number of jobs returned.

Review with "git show -b", most of the patch is indentation

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs_gpfs: use linux oplock specific funcions only when available
Bjoern Jacke [Fri, 14 Jan 2022 17:02:32 +0000 (17:02 +0000)]
vfs_gpfs: use linux oplock specific funcions only when available

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Wed Feb 16 21:38:12 UTC 2022 on sn-devel-184

2 years agodns.idl/dnsp.idl: add missing DNS ressource record types
Björn Jacke [Tue, 8 Feb 2022 23:06:55 +0000 (00:06 +0100)]
dns.idl/dnsp.idl: add missing DNS ressource record types

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Feb 16 20:43:55 UTC 2022 on sn-devel-184

2 years agodnsp.idl: add missing DNS_RPC_RECORD defines
Björn Jacke [Tue, 8 Feb 2022 13:42:29 +0000 (14:42 +0100)]
dnsp.idl: add missing DNS_RPC_RECORD defines

taken from MSDN 2.2.2.2.5:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dnsp/ac793981-1c60-43b8-be59-cdbb5c4ecb8a

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodocs-xml: Fix idmap_autorid documentation
Andreas Schneider [Tue, 1 Feb 2022 09:05:19 +0000 (10:05 +0100)]
docs-xml: Fix idmap_autorid documentation

What we want to avoid:

$ ./bin/testparm -s | grep "idmap config"
        idmap config * : rangesize = 10000
        idmap config * : range = 10000-19999
        idmap config * : backend = autorid

$ ./bin/wbinfo --name-to-sid BUILTIN/Administrators
S-1-5-32-544 SID_ALIAS (4)

$ ./bin/wbinfo --sid-to-gid S-1-5-32-544
10000

$ ./bin/wbinfo --name-to-sid ADDOMAIN/alice
S-1-5-21-4058748110-895691256-3682847423-1107 SID_USER (1)

$ ./bin/wbinfo --sid-to-gid S-1-5-21-984165912-589366285-3903095728-1107
failed to call wbcSidToGid: WBC_ERR_DOMAIN_NOT_FOUND
Could not convert sid S-1-5-21-984165912-589366285-3903095728-1107 to gid

If only one range is configured we are either not able to map users/groups
from our primary *and* the BUILTIN domain. We need at least two ranges to also
cover the BUILTIN domain!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Feb 16 17:04:53 UTC 2022 on sn-devel-184

2 years agos3:utils: Add a testparm check for idmap autorid
Andreas Schneider [Tue, 1 Feb 2022 09:07:50 +0000 (10:07 +0100)]
s3:utils: Add a testparm check for idmap autorid

What we want to avoid:

$ ./bin/testparm -s | grep "idmap config"
        idmap config * : rangesize = 10000
        idmap config * : range = 10000-19999
        idmap config * : backend = autorid

$ ./bin/wbinfo --name-to-sid BUILTIN/Administrators
S-1-5-32-544 SID_ALIAS (4)

$ ./bin/wbinfo --sid-to-gid S-1-5-32-544
10000

$ ./bin/wbinfo --name-to-sid ADDOMAIN/alice
S-1-5-21-4058748110-895691256-3682847423-1107 SID_USER (1)

$ ./bin/wbinfo --sid-to-gid S-1-5-21-984165912-589366285-3903095728-1107
failed to call wbcSidToGid: WBC_ERR_DOMAIN_NOT_FOUND
Could not convert sid S-1-5-21-984165912-589366285-3903095728-1107 to gid

If only one range is configured we are either not able to map users/groups
from our primary *and* the BUILTIN domain. We need at least two ranges to also
cover the BUILTIN domain!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2 years agos3:winbindd: Add a sanity check for the range
Andreas Schneider [Tue, 1 Feb 2022 09:06:30 +0000 (10:06 +0100)]
s3:winbindd: Add a sanity check for the range

What we want to avoid:

$ ./bin/testparm -s | grep "idmap config"
        idmap config * : rangesize = 10000
        idmap config * : range = 10000-19999
        idmap config * : backend = autorid

$ ./bin/wbinfo --name-to-sid BUILTIN/Administrators
S-1-5-32-544 SID_ALIAS (4)

$ ./bin/wbinfo --sid-to-gid S-1-5-32-544
10000

$ ./bin/wbinfo --name-to-sid ADDOMAIN/alice
S-1-5-21-4058748110-895691256-3682847423-1107 SID_USER (1)

$ ./bin/wbinfo --sid-to-gid S-1-5-21-984165912-589366285-3903095728-1107
failed to call wbcSidToGid: WBC_ERR_DOMAIN_NOT_FOUND
Could not convert sid S-1-5-21-984165912-589366285-3903095728-1107 to gid

If only one range is configured we are either not able to map users/groups
from our primary *and* the BUILTIN domain. We need at least two ranges to also
cover the BUILTIN domain!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2 years agobootstrap: Install mold linker on Fedora 35
Andreas Schneider [Sun, 13 Feb 2022 11:08:57 +0000 (12:08 +0100)]
bootstrap: Install mold linker on Fedora 35

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Feb 15 12:31:43 UTC 2022 on sn-devel-184

2 years agobootstrap: If the mold linker is available prefer it over gold
Andreas Schneider [Sun, 13 Feb 2022 11:01:47 +0000 (12:01 +0100)]
bootstrap: If the mold linker is available prefer it over gold

The gold linker will be deprecated soon. However we got a new linker called
mold:

https://github.com/rui314/mold/

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2 years agobuiltools: Make abi_gen.sh less prone to errors
Andreas Schneider [Mon, 14 Feb 2022 06:59:52 +0000 (07:59 +0100)]
builtools: Make abi_gen.sh less prone to errors

The mold linker has more hidden symbols and we would need to filter them out
with nm, where objdump tells us which symbols are actually hidden. So we just
need to filter out whatever is hidden.

The use of awk makes it also easier to get what we want.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2 years agoctdb-tests: Iterate protocol tests internally
Martin Schwenke [Tue, 4 Jan 2022 01:19:49 +0000 (12:19 +1100)]
ctdb-tests: Iterate protocol tests internally

Instead of repeatedly running a test binary.

Run time for these tests reduces from ~90s to ~75s.

When run under valgrind, the run time for protocol_test_001.sh reduces
from ~390s to <1s.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Feb 14 04:32:29 UTC 2022 on sn-devel-184

2 years agoctdb-tests: Add iteration support for protocol tests
Martin Schwenke [Tue, 4 Jan 2022 01:18:33 +0000 (12:18 +1100)]
ctdb-tests: Add iteration support for protocol tests

The current method of repeatedly running a binary has huge overhead,
especially with valgrind.

protocol_test_iterate_tag() allows output that is usually used for
hinting where a test failure occurred to be replaced with a tag
stored in a buffer, which is printed on test failure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-tests: Add a test for stalled node triggering election
Martin Schwenke [Sat, 22 Jan 2022 20:08:02 +0000 (07:08 +1100)]
ctdb-tests: Add a test for stalled node triggering election

A stalled node probably continues to hold the cluster lock, so confirm
elections work in this case.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Feb 14 02:46:01 UTC 2022 on sn-devel-184

2 years agoctdb-tests: Factor out functions to detect when generation changes
Martin Schwenke [Sat, 22 Jan 2022 19:42:52 +0000 (06:42 +1100)]
ctdb-tests: Factor out functions to detect when generation changes

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Consistently log start of election
Martin Schwenke [Sat, 22 Jan 2022 19:21:51 +0000 (06:21 +1100)]
ctdb-recoverd: Consistently log start of election

Elections should now be quite rare, so always log when one begins.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Always send unknown leader broadcast when starting election
Martin Schwenke [Sat, 22 Jan 2022 19:18:51 +0000 (06:18 +1100)]
ctdb-recoverd: Always send unknown leader broadcast when starting election

This is currently missed when the cluster lock is lost.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Consistently have caller set election-in-progress
Martin Schwenke [Sat, 22 Jan 2022 18:49:18 +0000 (05:49 +1100)]
ctdb-recoverd: Consistently have caller set election-in-progress

The problem here is that election-in-progress must be set to
potentially avoid restarting the election broadcast timeout in
main_loop(), so this is already done by leader_handler().

Have force_election() set election-in-progress for all election types
and do not bother setting it in cluster_lock_election().

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Always cancel election in progress
Martin Schwenke [Fri, 21 Jan 2022 07:09:47 +0000 (18:09 +1100)]
ctdb-recoverd: Always cancel election in progress

Election-in-progress is set by unknown leader broadcast, so needs to
be cleared in all cases when election completes.

This was seen in a case where the leader node stalled, so didn't send
leader broadcasts for some time.  The node continued to hold the
cluster lock, so another node could not become leader.  However, after
the node returned to normal it still did not send leader broadcasts
because election-in-progress was never cleared.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agosmbd: Simplify smbd_dirptr_lanman2_mode_fn()
Volker Lendecke [Sun, 2 Jan 2022 18:26:06 +0000 (19:26 +0100)]
smbd: Simplify smbd_dirptr_lanman2_mode_fn()

Avoid an else, we return in the "true" branch

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 Feb 11 21:53:22 UTC 2022 on sn-devel-184

2 years agotorture: Align integer types
Volker Lendecke [Mon, 7 Feb 2022 14:19:35 +0000 (15:19 +0100)]
torture: Align integer types

finfo.stream_info.out.num_streams is declared as "unsigned int"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agondrdump: Small simplification
Volker Lendecke [Mon, 7 Feb 2022 09:11:36 +0000 (10:11 +0100)]
ndrdump: Small simplification

Remove the talloc_steal(), we can allocate on mem_ctx directly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use fstrcpy where possible
Volker Lendecke [Sun, 6 Feb 2022 20:59:05 +0000 (21:59 +0100)]
libsmb: Use fstrcpy where possible

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Safeguards for getpwuid
Volker Lendecke [Thu, 3 Feb 2022 12:20:11 +0000 (13:20 +0100)]
smbd: Safeguards for getpwuid

Attempt to fix

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfstest: Align two integer types
Volker Lendecke [Thu, 3 Feb 2022 14:23:45 +0000 (15:23 +0100)]
vfstest: Align two integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs: Simplify streams_xattr_unlinkat()
Volker Lendecke [Fri, 11 Feb 2022 09:20:54 +0000 (10:20 +0100)]
vfs: Simplify streams_xattr_unlinkat()

It would be a logic error to call rmdir on a stream. This simplifies
the logic a bit.

Signed-off-by: Volker Lendecke <vl@samba.org>
2 years agosmbd: Use fsp_is_alternate_stream() where an fsp is available
Volker Lendecke [Fri, 11 Feb 2022 08:59:16 +0000 (09:59 +0100)]
smbd: Use fsp_is_alternate_stream() where an fsp is available

Make it clear that being an alternate data stream handle is much more
a fsp property than a file name property.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Introduce metadata_fsp()
Volker Lendecke [Fri, 11 Feb 2022 08:45:30 +0000 (09:45 +0100)]
smbd: Introduce metadata_fsp()

Centralize the pattern

if (fsp->base_fsp != NULL) {
fsp = fsp->base_fsp;
}

with a descriptive name.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Introduce fsp_is_alternate_stream()
Volker Lendecke [Fri, 11 Feb 2022 08:37:35 +0000 (09:37 +0100)]
smbd: Introduce fsp_is_alternate_stream()

To me this is more descriptive than "fsp->base_fsp != NULL". If this
turns out to be a performance problem, I would go and make this a
static inline in smbd/proto.h.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agowafsamba: replace 'echo -n' with printf
Sergey V. Lobanov [Wed, 9 Feb 2022 21:02:17 +0000 (00:02 +0300)]
wafsamba: replace 'echo -n' with printf

This patch makes samba_cross.py compatible with old bash (e.g. 3.2)

Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Feb 11 07:58:57 UTC 2022 on sn-devel-184

2 years agos3:modules: Fix virusfilter_vfs_openat
Pavel Filipenský [Mon, 7 Feb 2022 22:06:10 +0000 (23:06 +0100)]
s3:modules: Fix virusfilter_vfs_openat

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14971

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 10 22:09:06 UTC 2022 on sn-devel-184

2 years agos3:selftest: Add test for virus scanner
Pavel Filipenský [Tue, 8 Feb 2022 14:35:48 +0000 (15:35 +0100)]
s3:selftest: Add test for virus scanner

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14971

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoselftest: Fix trailing whitespace in Samba3.pm
Pavel Filipenský [Tue, 8 Feb 2022 14:34:56 +0000 (15:34 +0100)]
selftest: Fix trailing whitespace in Samba3.pm

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14971

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agodocs-xml:manpages: Document 'dummy' virusfilter and 'virusfilter:infected files'
Pavel Filipenský [Tue, 8 Feb 2022 21:35:29 +0000 (22:35 +0100)]
docs-xml:manpages: Document 'dummy' virusfilter and 'virusfilter:infected files'

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14971

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:modules: Implement dummy virus scanner that uses filename matching
Pavel Filipenský [Tue, 8 Feb 2022 11:07:03 +0000 (12:07 +0100)]
s3:modules: Implement dummy virus scanner that uses filename matching

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14971

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoselftest: Do not force -d0 for smbd/nmbd/winbindd
Andreas Schneider [Wed, 9 Feb 2022 15:33:10 +0000 (16:33 +0100)]
selftest: Do not force -d0 for smbd/nmbd/winbindd

We have the env variable SERVER_LOG_LEVEL which allows you to change
the log level on the command line. If we force -d0 this will not work.

make test TESTS="samba" SERVER_LOG_LEVEL=10

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Only file_free() a self-created fsp in create_file_unixpath()
Volker Lendecke [Thu, 3 Feb 2022 16:17:07 +0000 (17:17 +0100)]
smbd: Only file_free() a self-created fsp in create_file_unixpath()

This fixes a use-after-free in smb_full_audit_create_file() when
calling SMB_VFS_CREATE_FILE with fsp->fsp_name as smb_fname.

create_file_unixpath() has this comment:

 * This is really subtle. If someone passes in an smb_fname
 * where smb_fname actually is taken from fsp->fsp_name, then
 * the lifetime of these objects is meant to be the same.

so it seems legitimate to call CREATE_FILE this way.

When CREATE_FILE runs into an error, create_file_unixpath() does a
file_free, which also takes fsp->fsp_name with
it. smb_full_audit_create_file() wants to log the failure including
the smb_fname after NEXT_CREATE_FILE has exited, but this will then
use the already free'ed data.

Fix by only doing the file_free() on an fsp that
create_file_unixpath() created itself.

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): Thu Feb 10 19:11:33 UTC 2022 on sn-devel-184

2 years agosmbd: Introduce close_file_smb()
Volker Lendecke [Wed, 9 Feb 2022 17:03:33 +0000 (18:03 +0100)]
smbd: Introduce close_file_smb()

This does almost everything that close_file_free() does, but it leaves
the fsp around.

A normal close_file() now calls fsp_unbind_smb() twice. Functionally
this is not a problem, fsp_unbind_smb() is idempotent. The only
potential performance penalty might come from the loops in
remove_smb2_chained_fsp(), but those only are potentially large with
deeply queued smb2 requests. If that turns out to be a problem, we'll
cope with it later. The alternative would be to split up file_free()
into even more routines and make it more difficult to figure out which
of the "rundown/unbind/free" routines to call in any particular
situation.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Factor out fsp_unbind_smb() from file_free()
Volker Lendecke [Wed, 9 Feb 2022 16:23:03 +0000 (17:23 +0100)]
smbd: Factor out fsp_unbind_smb() from file_free()

For example, remove our entry from smbXsrv_open_global.tdb

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotorture: Add a test to show that full_audit uses a ptr after free
Volker Lendecke [Thu, 3 Feb 2022 14:25:11 +0000 (15:25 +0100)]
torture: Add a test to show that full_audit uses a ptr after free

Run vfstest with this vfstest.cmd under valgrind and you'll see what
happens. Exact explanation a few patches further down...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Simplify the flow in close_file_free()
Volker Lendecke [Wed, 2 Feb 2022 11:42:08 +0000 (12:42 +0100)]
smbd: Simplify the flow in close_file_free()

We are no longer called on base_fsp's in SHUTDOWN_CLOSE. That
simplifies the logic in the common case, we now have a linear flow for
the very often-called close_file()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: No base fsps to close_file_free() from file_close_user()
Volker Lendecke [Wed, 2 Feb 2022 07:58:15 +0000 (08:58 +0100)]
smbd: No base fsps to close_file_free() from file_close_user()

Same logic as the change for file_close_conn()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Factor out close_file_in_loop() from file_close_conn_fn()
Volker Lendecke [Wed, 2 Feb 2022 11:27:50 +0000 (12:27 +0100)]
smbd: Factor out close_file_in_loop() from file_close_conn_fn()

To be reused in file_close_user(). Deliberately a separate commit to
make the previous commit easier to understand.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: No base fsps to close_file_free() from file_close_conn()
Volker Lendecke [Wed, 2 Feb 2022 07:58:15 +0000 (08:58 +0100)]
smbd: No base fsps to close_file_free() from file_close_conn()

close_file_free() needs to handle base fsps specially. This can be
simplified a lot if we pass the the open files a second time in case
we encountered base_fsps that we could not immediately delete.

file_close_conn() is not our hot code path, and also we don't expect
many thousand open files that we need to walk a second time.

A subsequent patch will simplify close_file_free(), the complicated
logic is now in files.c, where it IMHO belongs because
file_set_base_fsp() are here as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: NULL out "fsp" in close_file()
Volker Lendecke [Tue, 1 Feb 2022 16:47:29 +0000 (17:47 +0100)]
smbd: NULL out "fsp" in close_file()

Quite a few places already had this in the caller, but not all. Rename
close_file() to close_file_free() appropriately. We'll factor out
close_file_smb() doing only parts of close_file_free() later.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Call file_free() just once in close_file()
Volker Lendecke [Tue, 1 Feb 2022 16:21:24 +0000 (17:21 +0100)]
smbd: Call file_free() just once in close_file()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Move the call to file_free() out of close_fake_file()
Volker Lendecke [Tue, 1 Feb 2022 16:19:54 +0000 (17:19 +0100)]
smbd: Move the call to file_free() out of close_fake_file()

Centralize calling file_free(), but leave close_fake_file() in for API
symmetry reasons.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Move the call to file_free() out of close_normal_file()
Volker Lendecke [Tue, 1 Feb 2022 16:17:36 +0000 (17:17 +0100)]
smbd: Move the call to file_free() out of close_normal_file()

Call file_free() just once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Move the call to file_free() out of close_directory()
Volker Lendecke [Tue, 1 Feb 2022 16:14:34 +0000 (17:14 +0100)]
smbd: Move the call to file_free() out of close_directory()

Call file_free() just once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Slightly simplify create_file_unixpath()
Volker Lendecke [Wed, 9 Feb 2022 09:02:46 +0000 (10:02 +0100)]
smbd: Slightly simplify create_file_unixpath()

Avoid the "needs_fsp_unlink" variable, describe the talloc hierarchy a
bit differently in the comments.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:winbind: Reduce the level and improve a couple of debug messages
Samuel Cabrero [Tue, 8 Feb 2022 09:06:18 +0000 (10:06 +0100)]
s3:winbind: Reduce the level and improve a couple of debug messages

The commit 1d5c546 changed the debug message printed when setting
winbind to offline state and offline logons are disabled from
level 10 to level 0. This message isn't really an error and might
scare some users, e.g. https://bugzilla.suse.com/show_bug.cgi?id=1195573

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Feb  9 20:20:36 UTC 2022 on sn-devel-184

2 years agos3/libads: ensure a sockaddr variable is correctly zero initialized
Ralph Boehme [Fri, 28 Jan 2022 16:51:10 +0000 (17:51 +0100)]
s3/libads: ensure a sockaddr variable is correctly zero initialized

is_zero_addr() doesn't work with addresses that have been zero-initialized.

This fixes the logic added in c863cc2ba34025731a18ac735f714b5b888504da.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14674
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2354

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): Tue Feb  8 20:24:12 UTC 2022 on sn-devel-184

2 years agos3/libads: simplify storing existing ads->ldap.ss
Ralph Boehme [Mon, 31 Jan 2022 11:54:12 +0000 (12:54 +0100)]
s3/libads: simplify storing existing ads->ldap.ss

We just need temporal storage for ads->ldap.ss, no need to store it as a struct
samba_sockaddr.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14674
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2354

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Simplify pm_process()
Volker Lendecke [Fri, 4 Feb 2022 11:57:52 +0000 (12:57 +0100)]
lib: Simplify pm_process()

No need to duplicate the fopen/fclose

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): Mon Feb  7 19:58:57 UTC 2022 on sn-devel-184

2 years agovfs: Fix a typo
Volker Lendecke [Sun, 23 Jan 2022 12:15:32 +0000 (13:15 +0100)]
vfs: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Pass "dirfsp" and "smb_fname" to fd_open_atomic()
Volker Lendecke [Tue, 18 Jan 2022 20:14:13 +0000 (21:14 +0100)]
smbd: Pass "dirfsp" and "smb_fname" to fd_open_atomic()

Dereference fsp once instead of four times

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Avoid an "else" in file_set_dosmode()
Volker Lendecke [Tue, 18 Jan 2022 19:07:30 +0000 (20:07 +0100)]
smbd: Avoid an "else" in file_set_dosmode()

Review with git show -b

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Fix open_pathref_base_fsp()'s implicit conn_cwd assumption
Volker Lendecke [Thu, 30 Dec 2021 17:06:18 +0000 (18:06 +0100)]
smbd: Fix open_pathref_base_fsp()'s implicit conn_cwd assumption

Opening a stream base file only worked if "dirfsp == conn->cwd_fsp":
We have replaced fsp->fsp_name with the full dirfsp->relative pathname
at the point where open_pathref_base_fsp() is called. In case dirfsp
is already a subdirectory in a share, this breaks because the
open_pathref_base_fsp() uses fsp->fsp_name, not the original
dirfsp-relative one.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Convert SMBC_getatr() to NTSTATUS
Volker Lendecke [Fri, 21 Jan 2022 20:15:06 +0000 (21:15 +0100)]
libsmb: Convert SMBC_getatr() to NTSTATUS

This avoids a few calls to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Sat, 22 Jan 2022 08:25:34 +0000 (09:25 +0100)]
libsmb: Avoid a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Fri, 21 Jan 2022 19:21:17 +0000 (20:21 +0100)]
libsmb: Avoid a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Fri, 21 Jan 2022 19:29:34 +0000 (20:29 +0100)]
libsmb: Avoid a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid two calls to SMBC_errno()
Volker Lendecke [Fri, 21 Jan 2022 19:38:04 +0000 (20:38 +0100)]
libsmb: Avoid two calls to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Fri, 21 Jan 2022 19:40:17 +0000 (20:40 +0100)]
libsmb: Avoid a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Avoid a call to SMBC_errno()
Volker Lendecke [Fri, 21 Jan 2022 19:43:04 +0000 (20:43 +0100)]
libsmb: Avoid a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Fix CID 1497981: Null pointer dereferences (REVERSE_INULL)
Volker Lendecke [Sun, 6 Feb 2022 10:59:52 +0000 (11:59 +0100)]
smbd: Fix CID 1497981: Null pointer dereferences (REVERSE_INULL)

brown paper bag quality, sorry...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Fix CID 1465285 Double close
Volker Lendecke [Wed, 19 Jan 2022 13:12:23 +0000 (14:12 +0100)]
lib: Fix CID 1465285 Double close

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoscript/autobuild.py: let nm_grep_symbols ignore __gcov_ symbols
Stefan Metzmacher [Sat, 5 Feb 2022 23:16:55 +0000 (00:16 +0100)]
script/autobuild.py: let nm_grep_symbols ignore __gcov_ symbols

Currently the gcov build currently fails with the following error:

samba-libs: [allshared-no-public-nss_winbind] Running nm ./bin/plugins/libnss_winbind.so.2 | egrep -v ' (__bss_start|_edata|_init|_fini|_end)' | egrep -v ' T _nss_winbind_' |egrep ' [BDGTRVWS] ' && exit 1; exit 0; in '/tmp/samba-testbase/samba-libs/.'
0000000000232458 B __gcov_error_file
0000000000226340 D __gcov_master
000000000001c080 T __gcov_sort_n_vals
00000000002324a0 B __gcov_var
samba-libs: [allshared-no-public-nss_winbind] failed 'nm ./bin/plugins/libnss_winbind.so.2 | egrep -v ' (__bss_start|_edata|_init|_fini|_end)' | egrep -v ' T _nss_winbind_' |egrep ' [BDGTRVWS] ' && exit 1; exit 0;' with status 1

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Sun Feb  6 13:39:09 UTC 2022 on sn-devel-184

2 years agobootstrap: Migrate to CentOS8 Stream
Andreas Schneider [Thu, 3 Feb 2022 14:43:54 +0000 (15:43 +0100)]
bootstrap: Migrate to CentOS8 Stream

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Feb  4 21:11:40 UTC 2022 on sn-devel-184

2 years agosharesec: Add SEC_DIR_DELETE_CHILD to CHANGE permissions
Volker Lendecke [Wed, 2 Feb 2022 09:02:37 +0000 (10:02 +0100)]
sharesec: Add SEC_DIR_DELETE_CHILD to CHANGE permissions

Otherwise you can't rename or delete files using CHANGE permissions using
the sharesec or shareacls utility

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 Feb  4 19:36:53 UTC 2022 on sn-devel-184