vlendec/samba-autobuild/.git
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>
3 years agospoolssd: Align integer types
Volker Lendecke [Thu, 3 Dec 2020 15:23:39 +0000 (16:23 +0100)]
spoolssd: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoclitar: Align integer types
Volker Lendecke [Wed, 2 Dec 2020 10:13:11 +0000 (11:13 +0100)]
clitar: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Align integer types
Volker Lendecke [Mon, 30 Nov 2020 12:39:15 +0000 (13:39 +0100)]
lib: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: smbd: Quiet log messages from usershares for an unknown share.
Jeremy Allison [Wed, 2 Dec 2020 19:47:02 +0000 (11:47 -0800)]
s3: smbd: Quiet log messages from usershares for an unknown share.

No need to log missing shares/sharenames at debug level zero.

Keep the debug level zero for all other usershare problems.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Rowland penny <rpenny@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Dec  4 20:54:06 UTC 2020 on sn-devel-184

3 years agovfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE
Ralph Boehme [Mon, 30 Nov 2020 11:28:58 +0000 (12:28 +0100)]
vfs_zfsacl: add missing inherited flag on hidden "magic" everyone@ ACE

This was an omission in the fixes for bug 14470.

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

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 Dec  1 20:29:34 UTC 2020 on sn-devel-184

3 years agovfs_zfsacl: reformatting
Ralph Boehme [Mon, 30 Nov 2020 11:28:00 +0000 (12:28 +0100)]
vfs_zfsacl: reformatting

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: Remove samba3.blackbox.smbclient_tar from flapping tests
Noel Power [Mon, 30 Nov 2020 09:21:50 +0000 (09:21 +0000)]
selftest: Remove samba3.blackbox.smbclient_tar from flapping tests

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoclitar: Use do_list()'s recursion in clitar.c
Volker Lendecke [Tue, 1 Dec 2020 07:58:14 +0000 (08:58 +0100)]
clitar: Use do_list()'s recursion in clitar.c

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
3 years agos3/script/tests: Ensure all remote test files are removed
Jeremy Allison [Mon, 30 Nov 2020 17:19:29 +0000 (17:19 +0000)]
s3/script/tests: Ensure all remote test files are removed

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
3 years agos3/script/tests: call smbclient deltree to remove remote files
Noel Power [Mon, 30 Nov 2020 10:41:57 +0000 (10:41 +0000)]
s3/script/tests: call smbclient deltree to remove remote files

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script/tests: Make smb_client 'die' behaviour configurable
Noel Power [Mon, 30 Nov 2020 10:18:32 +0000 (10:18 +0000)]
s3/script/tests: Make smb_client 'die' behaviour configurable

smb_client behaviour is to die if there is an error. This is
a little heavy handed and make it impossible for example to
use smb_client to run a command that might fail (where such
a failure isn't really an error) E.G. Calling deltree and
the directory doesn't exist

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script/tests: Remove make_path (for remote dir)
Noel Power [Mon, 30 Nov 2020 09:59:58 +0000 (09:59 +0000)]
s3/script/tests: Remove make_path (for remote dir)

LOCALPATH is actually the local path to the share, we should
not need to create the share path (it should already exist)

Note: When we remove the tree located at LOCALPATH we keep the root
      so the share path should always be there

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: make samba3.blackbox.smbclient_tar runnable (even manually)
Noel Power [Mon, 30 Nov 2020 11:15:06 +0000 (11:15 +0000)]
selftest: make samba3.blackbox.smbclient_tar runnable (even manually)

samba3.blackbox.smbclient_tar is marked as flapping so it
seems we have missed that it has stopped working. The local path
passed to script/tests/test_smbclient_tarmode.pl must point to a
valid share

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
Noel Power [Mon, 30 Nov 2020 17:39:25 +0000 (17:39 +0000)]
s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup

Make sure samba3.blackbox.smbclient_tarmode removes data files
not just before running the test but also after

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
Noel Power [Fri, 27 Nov 2020 15:52:27 +0000 (15:52 +0000)]
s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir

Replace rm -rf of local dir (that is hosted remotely)
with smbclient deltree

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
Noel Power [Fri, 27 Nov 2020 15:33:26 +0000 (15:33 +0000)]
s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*

After this change both samba3.blackbox.smbclient_tar &
samba3.blackbox.smbclient_tarmode now use the same dedicated share

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
Noel Power [Fri, 27 Nov 2020 15:25:21 +0000 (15:25 +0000)]
s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode

The other tarmode torture test samba3.blackbox.smbclient_tar now uses a share
'tarmode' which uses the same source path as samba3.blackbox.smbclient_tarmode

Avoid conflicting paths and use a new subdir (of the test share) called
'smbclient_tarmode'

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: Add a new tarmode shares
Noel Power [Thu, 26 Nov 2020 17:31:50 +0000 (17:31 +0000)]
selftest: Add a new tarmode shares

samba3.blackbox.smbclient_tar & samba3.blackbox.smbclient_tar
need separate shares with own xattr tdb(s)

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
Noel Power [Fri, 27 Nov 2020 12:01:49 +0000 (12:01 +0000)]
s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error

'keep_root' is an unrecognised option for make_path/mkpath

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotest: Fix the FreeBSD build
Volker Lendecke [Thu, 26 Nov 2020 13:30:36 +0000 (14:30 +0100)]
test: Fix the FreeBSD build

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 Nov 30 23:48:02 UTC 2020 on sn-devel-184

3 years agosmbd: Fix the 32-bit build on FreeBSD
Volker Lendecke [Thu, 26 Nov 2020 13:23:24 +0000 (14:23 +0100)]
smbd: Fix the 32-bit build on FreeBSD

log->rec_index is not size_t, it's uint64_t

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowbinfo: Align some integer types
Volker Lendecke [Thu, 26 Nov 2020 13:18:20 +0000 (14:18 +0100)]
wbinfo: Align some integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Change make_file_id_from_itime() prototype
Volker Lendecke [Mon, 23 Nov 2020 14:37:44 +0000 (15:37 +0100)]
lib: Change make_file_id_from_itime() prototype

SMB_STRUCT_STAT is defined in includes.h. This way including file_id.h
is possible without including includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture: Align integer types
Volker Lendecke [Mon, 23 Nov 2020 15:15:34 +0000 (16:15 +0100)]
torture: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Slightly beautify internal_resolve_name()
Volker Lendecke [Tue, 24 Nov 2020 20:22:55 +0000 (21:22 +0100)]
libsmb: Slightly beautify internal_resolve_name()

We have "goto done;" at the end of every if-branch, we don't need
else.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Move a variable closer to its use in internal_resolve_name()
Volker Lendecke [Tue, 24 Nov 2020 20:24:34 +0000 (21:24 +0100)]
libsmb: Move a variable closer to its use in internal_resolve_name()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosamldb: Align two integer types
Volker Lendecke [Wed, 25 Nov 2020 15:33:32 +0000 (16:33 +0100)]
samldb: Align two integer types

ARRAY_SIZE is size_t

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotest: smbtorture3's OPLOCK5 test only available with kernel oplocks
Volker Lendecke [Thu, 26 Nov 2020 08:56:50 +0000 (09:56 +0100)]
test: smbtorture3's OPLOCK5 test only available with kernel oplocks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Align integer types
Volker Lendecke [Mon, 23 Nov 2020 11:27:38 +0000 (12:27 +0100)]
libsmb: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Fix a typo
Volker Lendecke [Sat, 21 Nov 2020 20:17:39 +0000 (21:17 +0100)]
libsmb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Align integer types
Volker Lendecke [Sat, 21 Nov 2020 12:02:28 +0000 (13:02 +0100)]
winbind: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibcli: Align integer types
Volker Lendecke [Sat, 14 Nov 2020 15:31:09 +0000 (16:31 +0100)]
libcli: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibrpc: talloc_stackframe() panics on failure
Volker Lendecke [Sat, 14 Nov 2020 09:16:57 +0000 (10:16 +0100)]
librpc: talloc_stackframe() panics on failure

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibrpc: Make ep_register a bit easier to understand
Volker Lendecke [Sat, 14 Nov 2020 09:15:33 +0000 (10:15 +0100)]
librpc: Make ep_register a bit easier to understand

I found the pointer dereference a bit confusing

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibrpc: Fix a talloc_stackframe() leak
Volker Lendecke [Sat, 14 Nov 2020 09:12:20 +0000 (10:12 +0100)]
librpc: Fix a talloc_stackframe() leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibcli: Align a few integer types
Volker Lendecke [Sun, 29 Nov 2020 17:25:07 +0000 (18:25 +0100)]
libcli: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodocs: Fix "async dns timeout" manpage entry
Volker Lendecke [Sun, 29 Nov 2020 12:06:34 +0000 (13:06 +0100)]
docs: Fix "async dns timeout" manpage entry

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoloadparm: Simplify lp_get_async_dns_timeout()
Volker Lendecke [Sun, 29 Nov 2020 12:05:02 +0000 (13:05 +0100)]
loadparm: Simplify lp_get_async_dns_timeout()

Use MAX, and per README.Coding we don't need the intermediate
variable. This can be inspected in the debugger directly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodsgetdcname: Fix talloc hierarchy
Volker Lendecke [Fri, 27 Nov 2020 21:00:10 +0000 (22:00 +0100)]
dsgetdcname: Fix talloc hierarchy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotests python krb5: Extra canonicalization tests
Gary Lockyer [Wed, 18 Nov 2020 01:49:28 +0000 (14:49 +1300)]
tests python krb5: Extra canonicalization tests

Add tests that set the server name to the client name for the machine
account in the kerberos AS_REQ.  This replicates the TEST_AS_REQ_SELF
test phase in source4/torture/krb5/kdc-canon-heimdal.c.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 30 05:21:42 UTC 2020 on sn-devel-184

3 years agovfs_glusterfs: print exact cmdline for disabling write-behind translator
Günther Deschner [Tue, 24 Nov 2020 14:38:41 +0000 (15:38 +0100)]
vfs_glusterfs: print exact cmdline for disabling write-behind translator

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184

3 years agodocs-xml: Add a section about weak crypto in testparm manpage
Andreas Schneider [Fri, 27 Nov 2020 10:22:15 +0000 (11:22 +0100)]
docs-xml: Add a section about weak crypto in testparm manpage

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

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 Nov 27 13:48:20 UTC 2020 on sn-devel-184

3 years agos4: rename source4/smbd/ to source4/samba/
Ralph Boehme [Fri, 20 Nov 2020 14:27:17 +0000 (15:27 +0100)]
s4: rename source4/smbd/ to source4/samba/

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Nov 27 10:07:18 UTC 2020 on sn-devel-184

3 years agosamba-tool: Give better error information when the 'domain backup restore' fails...
Andrew Bartlett [Fri, 13 Nov 2020 02:26:07 +0000 (15:26 +1300)]
samba-tool: Give better error information when the 'domain backup restore' fails with a duplicate SID

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Thu Nov 26 21:15:40 UTC 2020 on sn-devel-184

3 years agos3:libsmb: Return early if dir is NULL
Andreas Schneider [Wed, 25 Nov 2020 12:01:46 +0000 (13:01 +0100)]
s3:libsmb: Return early if dir is NULL

This makes sure we do not dereference a NULL poineter.

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Nov 26 11:07:09 UTC 2020 on sn-devel-184

3 years agos3:mdssd: Fix creating binding string for error message
Andreas Schneider [Wed, 25 Nov 2020 11:55:56 +0000 (12:55 +0100)]
s3:mdssd: Fix creating binding string for error message

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:lsasd: Fix creating binding string for error message
Andreas Schneider [Wed, 25 Nov 2020 11:55:24 +0000 (12:55 +0100)]
s3:lsasd: Fix creating binding string for error message

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:spoolssd: Fix creating binding string for error message
Andreas Schneider [Wed, 25 Nov 2020 10:46:05 +0000 (11:46 +0100)]
s3:spoolssd: Fix creating binding string for error message

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agowinexe: Fix a possible null pointer derference
Andreas Schneider [Wed, 25 Nov 2020 10:38:01 +0000 (11:38 +0100)]
winexe: Fix a possible null pointer derference

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:libsmb: Fix clang warnings that fnum might be used uninitialized
Andreas Schneider [Wed, 25 Nov 2020 10:34:09 +0000 (11:34 +0100)]
s3:libsmb: Fix clang warnings that fnum might be used uninitialized

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agosamba_upgradedns: Do not print confusing logs about missing .zone files
Andrew Bartlett [Mon, 23 Nov 2020 21:15:43 +0000 (10:15 +1300)]
samba_upgradedns: Do not print confusing logs about missing .zone files

samba_upgradedns prints confusing logs about upgrading zone files
and automatically creating DNS zones when the zone already exists.

We need to move the logging to later when we know we what we are
using the parsed information for.

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

Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Nov 26 08:16:04 UTC 2020 on sn-devel-184

3 years agoTest password removal via python proctitle
David Mulder [Fri, 8 Nov 2019 20:06:53 +0000 (20:06 +0000)]
Test password removal via python proctitle

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoRemove password from samba-tool proctitle
Heiko Baumann [Tue, 3 Sep 2019 12:30:18 +0000 (14:30 +0200)]
Remove password from samba-tool proctitle

This fix makes sure the password is removed from the proctitle
of samba-tool so it cannot be exposed by e.g. ps(1).
- Moved code to python/samba/getopt.py as suggested by David Mulder
- Except ModuleNotFoundError when trying to load setproctitle module
- Improved code to keep option separator (space or equal sign) while
  removing password from proctitle.

Signed-off-by: Heiko Baumann <heibau@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
3 years agoDo not create an empty DB when accessing a sam.ldb
Andrew Bartlett [Mon, 23 Nov 2020 06:35:37 +0000 (19:35 +1300)]
Do not create an empty DB when accessing a sam.ldb

Samba already does this for samba-tool and doing this should make
our errors more sensible, particularly in BIND9 if not provisioned
with the correct --dns-backend=DLZ_BIND9

The old error was like:

 named[62954]: samba_dlz: Unable to get basedn for
 /var/lib/samba/private/dns/sam.ldb
  - NULL Base DN invalid for a base search.

The new error will be like (in this case from the torture test):
 Failed to connect to Failed to connect to
 ldb:///home/abartlet/samba/st/chgdcpass/bind-dns/dns/sam.ldb:
 Unable to open tdb '/home/abartlet/samba/st/chgdcpass/bind-dns/dns/sam.ldb':
 No such file or directory: Operations error

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

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
3 years agotorture: Do not call destroy_dlz() on uninitialised memory
Andrew Bartlett [Mon, 23 Nov 2020 07:27:51 +0000 (20:27 +1300)]
torture: Do not call destroy_dlz() on uninitialised memory

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

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
3 years agowaf: upgrade to 2.0.21
Stefan Metzmacher [Wed, 25 Nov 2020 15:29:06 +0000 (16:29 +0100)]
waf: upgrade to 2.0.21

This commit message was wrong:

    commit 5fc3a71d0f54b176d3cb2e399718d0468507e797
    Author: David Mulder <dmulder@suse.com>
    Date:   Mon Aug 24 13:12:46 2020 -0600

        waf: upgrade to 2.0.20

        This contain an important change:
        "Fix gccdeps.scan() returning nodes that no longer exist on disk."
        https://gitlab.com/ita1024/waf/-/merge_requests/2293

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
The fix was in in waf master, but not included in 2.0.20,
but it's now included in 2.0.21.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:lib: Check return code of set_blocking()
Andreas Schneider [Tue, 24 Nov 2020 16:42:24 +0000 (17:42 +0100)]
s3:lib: Check return code of set_blocking()

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:smbd: Check return code of set_blocking()
Andreas Schneider [Tue, 24 Nov 2020 16:40:33 +0000 (17:40 +0100)]
s3:smbd: Check return code of set_blocking()

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli:smb: Check return code of set_blocking
Andreas Schneider [Tue, 24 Nov 2020 16:35:26 +0000 (17:35 +0100)]
libcli:smb: Check return code of set_blocking

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:winbind: Check return code of set_blocking()
Andreas Schneider [Tue, 24 Nov 2020 16:33:26 +0000 (17:33 +0100)]
s3:winbind: Check return code of set_blocking()

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:smbd: Fix a possible null pointer deref in oplock code
Andreas Schneider [Tue, 24 Nov 2020 15:57:12 +0000 (16:57 +0100)]
s3:smbd: Fix a possible null pointer deref in oplock code

Found by cppcheck.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agosamba-tool domain backup: Confirm the sidForRestore we will put into the backup is...
Andrew Bartlett [Tue, 17 Nov 2020 23:11:10 +0000 (12:11 +1300)]
samba-tool domain backup: Confirm the sidForRestore we will put into the backup is free

Otherwise the administrator might only find there is a problem once they
attempt to restore the domain!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14575
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agos3: smbd: Fix misleading comment I added for commit 382a5c4e7ec08ec9291453ffad9541ab3...
Jeremy Allison [Sat, 21 Nov 2020 23:55:08 +0000 (15:55 -0800)]
s3: smbd: Fix misleading comment I added for commit 382a5c4e7ec08ec9291453ffad9541ab36aca274

smbd: Fix failure to check dstdir for delete on close

We're preventing ourselves from holding two locks here,
not protecting from waiting for a lock someone else
holds.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Nov 22 01:22:36 UTC 2020 on sn-devel-184

3 years agotestprogs: Fix MIT KRB5 export keytab with > 1.18
Andreas Schneider [Thu, 19 Nov 2020 16:04:07 +0000 (17:04 +0100)]
testprogs: Fix MIT KRB5 export keytab with > 1.18

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Nov 21 00:11:02 UTC 2020 on sn-devel-184

3 years agosmbd: Fix failure to check dstdir for delete on close
Volker Lendecke [Thu, 19 Nov 2020 11:38:06 +0000 (12:38 +0100)]
smbd: Fix failure to check dstdir for delete on close

In smb2_setinfo.c the call to smbd_do_setfilepathinfo() to perform the
rename takes place while holding a share mode lock. The function
check_parent_access() called below tries to query the destination
directory's locking.tdb entry to check whether the delete on close
flag is set on the destination directory. This fails because the
file to be renamed already has the share mode entry locked, we can't
lock two share mode entries simultaneously.

Convert the check to use fetch_share_mode_unlocked(). This might
introduce races, but this whole check is racy anyway. It does not
really matter whether we do the check for delete_on_close under a lock
or not, fetch_share_mode_unlocked() retrieves a consistent status of
the locking.tdb entry at some point in time as well.

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 Nov 20 00:20:06 UTC 2020 on sn-devel-184

3 years agotests: SMB2 rename fails to check del-on-close on dst dir
Volker Lendecke [Tue, 17 Nov 2020 14:24:43 +0000 (15:24 +0100)]
tests: SMB2 rename fails to check del-on-close on dst dir

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agopylibsmb: Add rename()
Volker Lendecke [Mon, 16 Nov 2020 11:41:35 +0000 (12:41 +0100)]
pylibsmb: Add rename()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotests: Factor out prep_creds()
Volker Lendecke [Tue, 17 Nov 2020 15:11:11 +0000 (16:11 +0100)]
tests: Factor out prep_creds()

3 times the same code can be put together

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Make cli_nt_pipes_close() static
Volker Lendecke [Mon, 9 Nov 2020 18:32:57 +0000 (19:32 +0100)]
libsmb: Make cli_nt_pipes_close() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: g_lock.h references "struct server_id", add #include
Volker Lendecke [Wed, 11 Nov 2020 15:52:07 +0000 (16:52 +0100)]
lib: g_lock.h references "struct server_id", add #include

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Remove unused security_descriptor_append()
Volker Lendecke [Wed, 11 Nov 2020 07:03:46 +0000 (08:03 +0100)]
lib: Remove unused security_descriptor_append()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agobuild: fcvt() and fcvtl() are not used
Volker Lendecke [Mon, 16 Nov 2020 13:37:43 +0000 (14:37 +0100)]
build: fcvt() and fcvtl() are not used

No need to check for them in the configure phase

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: avoid a smb_fname copy in call_trans2setfilepathinfo()
Ralph Boehme [Tue, 17 Nov 2020 10:02:31 +0000 (11:02 +0100)]
smbd: avoid a smb_fname copy in call_trans2setfilepathinfo()

There's no point in doing a copy here, we can just point smb_fname at
fsp->fsp_name.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov 19 21:24:23 UTC 2020 on sn-devel-184

3 years agosmbd: avoid a smb_fname copy in call_trans2qfilepathinfo()
Ralph Boehme [Tue, 20 Oct 2020 15:07:35 +0000 (17:07 +0200)]
smbd: avoid a smb_fname copy in call_trans2qfilepathinfo()

No point in making a copy here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: replace calls to check_access() with smbd_check_access_rights()
Ralph Boehme [Tue, 27 Oct 2020 11:23:00 +0000 (12:23 +0100)]
smbd: replace calls to check_access() with smbd_check_access_rights()

check_access() is a 1:1 wrapper arounf smbd_check_access_rights().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()
Ralph Boehme [Mon, 26 Oct 2020 16:57:00 +0000 (17:57 +0100)]
smbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture: avoid OPLOCK-CANCEL flapping on busy gitlab CI
Ralph Boehme [Mon, 16 Nov 2020 09:44:48 +0000 (10:44 +0100)]
torture: avoid OPLOCK-CANCEL flapping on busy gitlab CI

I saw this test fail a few times on gitlab CI with
NT_STATUS_SHARING_VIOLATION:

  Running OPLOCK-CANCEL
  cli_unlink failed: NT_STATUS_SHARING_VIOLATION
  TEST OPLOCK-CANCEL FAILED!

The only possible explanation I could come up for
this flapping test is that the fnum1 filehandle in cli1 is still not closed when
cli2 tries to open the file deletion 5 seconds after cli1 is thrown away. As
fnum1 doesn't have FILE_SHARE_DELELE the open-for-delete fails with a
SHARING_VIOLATION.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodocs-xml: add "smbd force process locks"
Ralph Boehme [Mon, 16 Nov 2020 10:06:08 +0000 (11:06 +0100)]
docs-xml: add "smbd force process locks"

Avoid a parametric option in a hot codepath.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: remove selftest/knownfail.d/samba3.smbtorture_s3
Ralph Boehme [Mon, 26 Oct 2020 09:03:24 +0000 (10:03 +0100)]
selftest: remove selftest/knownfail.d/samba3.smbtorture_s3

This hunk was inadvertently included in 5161edbdb28.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agopylibsmb: Multi-threaded use is now possible with SMB2
Volker Lendecke [Wed, 18 Nov 2020 14:00:07 +0000 (15:00 +0100)]
pylibsmb: Multi-threaded use is now possible with SMB2

No non-async callees are used anymore

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 Nov 19 04:12:11 UTC 2020 on sn-devel-184

3 years agopylibsmb: Remove unused py_cli_state->is_smb1
Volker Lendecke [Wed, 18 Nov 2020 13:59:15 +0000 (14:59 +0100)]
pylibsmb: Remove unused py_cli_state->is_smb1

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Remove unused sync cli_smb2_list()
Volker Lendecke [Tue, 17 Nov 2020 11:31:20 +0000 (12:31 +0100)]
libsmb: Remove unused sync cli_smb2_list()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agopylibsmb: Remove SMB2 special case for cli_list()
Volker Lendecke [Mon, 16 Nov 2020 07:26:56 +0000 (08:26 +0100)]
pylibsmb: Remove SMB2 special case for cli_list()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Use async cli_smb2_list_send() in cli_list_send()
Volker Lendecke [Mon, 16 Nov 2020 07:26:09 +0000 (08:26 +0100)]
libsmb: Use async cli_smb2_list_send() in cli_list_send()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Prepare cli_list_send()/recv() for single-issue subreqs
Volker Lendecke [Wed, 18 Nov 2020 13:13:22 +0000 (14:13 +0100)]
libsmb: Prepare cli_list_send()/recv() for single-issue subreqs

This prepares cli_list_recv() for the lowerlevel NT_STATUS_RETRY that
will come in once cli_list_send() uses cli_smb2_list_send() as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Convert cli_list_recv() to single-recv
Volker Lendecke [Mon, 26 Oct 2020 08:21:17 +0000 (09:21 +0100)]
libsmb: Convert cli_list_recv() to single-recv

This converts the higher-level cli_list_recv() to the new
cli_smb2_list_recv() calling convention to just issue one entry per
recv() call in preparation of using the async cli_smb2_list_send() in
cli_list_send().

For SMB1 this will be a performance degradation, as we have to make
copies out of the arrays that cli_trans_recv() returns, but soon this
will become a performance improvement for the SMB2 directory
listing. And as hopefully most deployments these days are SMB2, I
think we can live with the SMB1 client directory listing
degradation. Also, we can also convert the lowerlevel SMB1 directory
listing routines in case someone actually sees problems from this
here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Make cli_smb2_list() asynchronous
Volker Lendecke [Sat, 14 Nov 2020 17:31:22 +0000 (18:31 +0100)]
libsmb: Make cli_smb2_list() asynchronous

Return directory entries as soon as possible via
cli_smb2_list_recv(). This returns just one entry per call to
cli_smb2_list_recv() right out of the buffer without assembling
potentially thousands of entries in a big array. You must call
cli_smb2_recv() until an error (except NT_STATUS_RETRY) happens. This
reduces our latency for smbclient's "dir" command significantly for
large directories. In the future I hope I can do the same thing also for
SMBC_readdir_ctx() to improve all users of our published libsmbclient.

Initial attempts of this routine issued fresh smb2_query_directory
requests asynchronously while the receivers of the entries did their
processing, for example showing them in smbclient's "dir"
command. However, this breaks because for example the "showacls"
smbclient option needs to do synchronous smb requests to do their job,
which we can't do while async requests are pending. Thus I came up
with a semi-synchronous approach to issue additional
smb2_query_directory requests from within cli_smb2_list_recv() and
return NT_STATUS_RETRY. This means that we will call back our caller
via the tevent_req_notify function when a fresh entry is available.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agouptodateness.py: remove what appears to be debugging lines
Rowland Penny [Wed, 18 Nov 2020 12:09:16 +0000 (12:09 +0000)]
uptodateness.py: remove what appears to be debugging lines

They do nothing except confuse users.

Signed-off-by: Rowland Penny <rpenny@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Nov 19 00:36:58 UTC 2020 on sn-devel-184

3 years agobootstrap: Add OpenSUSE 15.2
Samuel Cabrero [Tue, 17 Nov 2020 12:32:19 +0000 (13:32 +0100)]
bootstrap: Add OpenSUSE 15.2

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Tue Nov 17 18:50:05 UTC 2020 on sn-devel-184

3 years agoautobuild: Encode text/plain into base64 to wrap long-lines
SATOH Fumiyasu [Tue, 10 Nov 2020 08:15:42 +0000 (17:15 +0900)]
autobuild: Encode text/plain into base64 to wrap long-lines

MIMEText(text, 'plain', 'utf-8') encodes the text into
base64 and adds 'Content-Transfer-Encoding: base64' header.

Signed-off-by: SATOH Fumiyasu <fumiyas@osstech.co.jp>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 16 22:43:35 UTC 2020 on sn-devel-184

3 years agolibsmb: Remove unused sync cli_smb2_rename()
Volker Lendecke [Fri, 13 Nov 2020 15:32:16 +0000 (16:32 +0100)]
libsmb: Remove unused sync cli_smb2_rename()

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 Nov 16 21:18:16 UTC 2020 on sn-devel-184

3 years agolibsmb: Make cli_rename_send()/recv() smb2-capable
Volker Lendecke [Fri, 13 Nov 2020 15:29:23 +0000 (16:29 +0100)]
libsmb: Make cli_rename_send()/recv() smb2-capable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Make cli_rename_send()/_recv() a proper tevent_req engine
Volker Lendecke [Fri, 13 Nov 2020 15:23:48 +0000 (16:23 +0100)]
libsmb: Make cli_rename_send()/_recv() a proper tevent_req engine

This will make it more obvious to add SMB2 soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Make cli_smb2_rename async
Volker Lendecke [Fri, 13 Nov 2020 14:31:16 +0000 (15:31 +0100)]
libsmb: Make cli_smb2_rename async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Make get_fnum_from_path() async
Volker Lendecke [Fri, 13 Nov 2020 11:59:55 +0000 (12:59 +0100)]
libsmb: Make get_fnum_from_path() async

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