samba.git
2 days agolib:util: Add (PULL|PUSH)_(BE|LE)_I(8|16|32|64) byterarray macros master
Andreas Schneider [Tue, 4 Feb 2020 16:47:51 +0000 (17:47 +0100)]
lib:util: Add (PULL|PUSH)_(BE|LE)_I(8|16|32|64) byterarray macros

The only difference is that the pull macros do the correct casting of
the integer in the end.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Feb 21 03:35:58 UTC 2020 on sn-devel-184

2 days agolib:util: Do not expose internal header files
Andreas Schneider [Mon, 18 Feb 2019 16:39:36 +0000 (17:39 +0100)]
lib:util: Do not expose internal header files

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolibrpc:ndr: Remove byteorder.h from libndr.h
Andreas Schneider [Mon, 18 Feb 2019 16:39:01 +0000 (17:39 +0100)]
librpc:ndr: Remove byteorder.h from libndr.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolibrpc:ndr: Use bytearray.h in ndr_basic.c
Andreas Schneider [Mon, 18 Feb 2019 16:35:42 +0000 (17:35 +0100)]
librpc:ndr: Use bytearray.h in ndr_basic.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Add comments to use bytearray.h to byteorder.h
Andreas Schneider [Thu, 17 Jan 2019 10:00:23 +0000 (11:00 +0100)]
lib:util: Add comments to use bytearray.h to byteorder.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Use (PULL|PUSH)_BE_(U16|U32|U64) for R*VAL*
Andreas Schneider [Thu, 20 Dec 2018 10:24:29 +0000 (11:24 +0100)]
lib:util: Use (PULL|PUSH)_BE_(U16|U32|U64) for R*VAL*

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Use PUSH_LE_(U16|U32) for S(I|S)VALS
Andreas Schneider [Thu, 20 Dec 2018 10:57:08 +0000 (11:57 +0100)]
lib:util: Use PUSH_LE_(U16|U32) for S(I|S)VALS

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Use PUSH_LE_(U16|U32) for S(S|I)VAL
Andreas Schneider [Thu, 20 Dec 2018 10:23:46 +0000 (11:23 +0100)]
lib:util: Use PUSH_LE_(U16|U32) for S(S|I)VAL

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Use PULL_LE_(U16|U32) for SVAL and IVAL
Andreas Schneider [Fri, 21 Dec 2018 08:48:29 +0000 (09:48 +0100)]
lib:util: Use PULL_LE_(U16|U32) for SVAL and IVAL

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Use _DATA_BYTE(_CONST) from bytearray.h
Andreas Schneider [Thu, 20 Dec 2018 10:21:00 +0000 (11:21 +0100)]
lib:util: Use _DATA_BYTE(_CONST) from bytearray.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Add test to verify old and new macros are the same
Andreas Schneider [Thu, 17 Jan 2019 09:52:25 +0000 (10:52 +0100)]
lib:util: Add test to verify old and new macros are the same

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib:util: Add bytearray.h
Andreas Schneider [Thu, 20 Dec 2018 07:37:32 +0000 (08:37 +0100)]
lib:util: Add bytearray.h

This is an implementation which doesn't have undefined behavior
problems. It casts correctly that calculations are don in the correct
integer space. Also the naming is less confusing than what we have in
byteorder.h.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agosmbd: Separate aio_pthread indicator from normal EINTR
Volker Lendecke [Thu, 20 Feb 2020 13:13:35 +0000 (14:13 +0100)]
smbd: Separate aio_pthread indicator from normal EINTR

According to Posix and the Linux open(2) manpage, the open-syscall can
return EINTR. If that happens, core smbd saw this as an indication
that aio_pthread's open function was doing its job. With a real EINTR
without aio_pthread this meant we ended up in a server_exit after 20
seconds, because there was nobody to do the retry.

EINTR is mapped to NT_STATUS_RETRY. Handle this by just retrying after
a second.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14285
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 20 22:14:25 UTC 2020 on sn-devel-184

3 days agolib: Map EINPROGRESS->NT_STATUS_MORE_PROCESSING_REQUIRED
Volker Lendecke [Thu, 20 Feb 2020 09:25:16 +0000 (10:25 +0100)]
lib: Map EINPROGRESS->NT_STATUS_MORE_PROCESSING_REQUIRED

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14285
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 days agotest: Show that smbd does not handle EINTR from open() correctly
Volker Lendecke [Wed, 19 Feb 2020 14:25:38 +0000 (15:25 +0100)]
test: Show that smbd does not handle EINTR from open() correctly

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14285
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 days agotest: Intercept open in vfs_error_inject
Volker Lendecke [Wed, 19 Feb 2020 13:44:11 +0000 (14:44 +0100)]
test: Intercept open in vfs_error_inject

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14285
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 days agoautobuild: samba-ctdb does not need an AD DC
Volker Lendecke [Fri, 14 Feb 2020 16:20:22 +0000 (17:20 +0100)]
autobuild: samba-ctdb does not need an AD DC

Speed up the build a bit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Feb 19 11:28:56 UTC 2020 on sn-devel-184

4 days agoautobuild: Split a long line
Volker Lendecke [Fri, 14 Feb 2020 16:19:46 +0000 (17:19 +0100)]
autobuild: Split a long line

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Run a clustered test
Martin Schwenke [Fri, 14 Feb 2020 15:58:51 +0000 (16:58 +0100)]
selftest: Run a clustered test

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest:clusteredmember: Build a unclist for every share
Martin Schwenke [Tue, 4 Feb 2020 08:44:11 +0000 (19:44 +1100)]
selftest:clusteredmember: Build a unclist for every share

This is fairly cheap and it is simple to do.  This allows the Python
code to be able to specify a unclist quite simply.  The level of
coupling doesn't seem worse than anything else in the
selftest/autobuild code.

There may be cleverer ways of doing this (e.g. a wrapper in
testprogs/blackbox/clusteredmember_smbtorture or similar) but cleverer
code isn't necessarily better code... and they'll probably involve
code duplication.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 days agoautobuild: Run a simple test for clustered samba
Volker Lendecke [Tue, 16 Oct 2018 11:56:14 +0000 (13:56 +0200)]
autobuild: Run a simple test for clustered samba

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoautobuild: Avoid clusteredmember in normal environments
Volker Lendecke [Tue, 28 Jan 2020 09:18:37 +0000 (10:18 +0100)]
autobuild: Avoid clusteredmember in normal environments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest:Samba3: add a clusteredmember environment
Michael Adam [Tue, 12 Jul 2016 11:12:24 +0000 (13:12 +0200)]
selftest:Samba3: add a clusteredmember environment

Allow running tests against a CTDB setup, thereby covering the
dbrwap_ctdb->ctdb stack in real SMB tests.

Sets up a 3 node cluster.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Split up a long line
Volker Lendecke [Wed, 22 Aug 2018 15:24:38 +0000 (17:24 +0200)]
selftest: Split up a long line

We'll add another argument soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: net command needs to think it is root in clustered case
Martin Schwenke [Thu, 16 Jan 2020 22:42:19 +0000 (09:42 +1100)]
selftest: net command needs to think it is root in clustered case

So just run it "as root" all the time.

Something similar is already done for other things in
Samba3::provision(), such as running smbpasswd in
Samba3::createuser().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 days agoselftest: Allow passing fork_and_exec()'s child_cleanup
Volker Lendecke [Thu, 30 Jan 2020 15:06:48 +0000 (16:06 +0100)]
selftest: Allow passing fork_and_exec()'s child_cleanup

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Convert Samba3::check_or_start() to named parameters
Volker Lendecke [Thu, 30 Jan 2020 15:01:09 +0000 (16:01 +0100)]
selftest: Convert Samba3::check_or_start() to named parameters

Another parameter will be added soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Parameterize clean up in the child process
Volker Lendecke [Thu, 30 Jan 2020 14:49:59 +0000 (15:49 +0100)]
selftest: Parameterize clean up in the child process

Default to closing the write end of the parent->child pipe.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Fix an uninitialised variable warning.
Martin Schwenke [Thu, 6 Feb 2020 06:57:32 +0000 (17:57 +1100)]
selftest: Fix an uninitialised variable warning.

If $nmbd is not "yes" then this can result in a warning.

Introduced in commit 676261fa08273114b888bb46f65de3de091b615b.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 days agoselftest: Fix a warning message
Volker Lendecke [Thu, 16 Jan 2020 12:23:40 +0000 (13:23 +0100)]
selftest: Fix a warning message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Add "share_dir" as an argument to Samba3::provision()
Volker Lendecke [Mon, 27 Jan 2020 13:16:30 +0000 (14:16 +0100)]
selftest: Add "share_dir" as an argument to Samba3::provision()

Default to the previous value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agoselftest: Allow "netbios name" to be overriden in Samba3::provision()
Volker Lendecke [Fri, 24 Jan 2020 10:55:36 +0000 (11:55 +0100)]
selftest: Allow "netbios name" to be overriden in Samba3::provision()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agolib: Remove unneded #include malloc.h
Volker Lendecke [Tue, 11 Feb 2020 20:20:32 +0000 (21:20 +0100)]
lib: Remove unneded #include malloc.h

We do the mallinfo() call in talloc_report_printf.c now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agotorture4: Align integer types
Volker Lendecke [Mon, 10 Feb 2020 20:48:00 +0000 (21:48 +0100)]
torture4: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agotorture4: Use strlcpy() with size check instead of snprintf()
Volker Lendecke [Mon, 10 Feb 2020 20:45:00 +0000 (21:45 +0100)]
torture4: Use strlcpy() with size check instead of snprintf()

It's just test code, but we should give good examples where possible

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agosmbd: Fix a typo
Volker Lendecke [Thu, 13 Feb 2020 16:08:16 +0000 (17:08 +0100)]
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agolib: Fix rotating nonstandard debug class log files
Volker Lendecke [Thu, 13 Feb 2020 15:44:38 +0000 (16:44 +0100)]
lib: Fix rotating nonstandard debug class log files

Looking at the same pointer in the loop does not really make sense to
me

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 days agos3: DFS: Remove is_msdfs_link_internal() - no longer used.
Jeremy Allison [Wed, 12 Feb 2020 21:54:08 +0000 (13:54 -0800)]
s3: DFS: Remove is_msdfs_link_internal() - no longer used.

All DFS links are now read through the VFS and not via
symlink calls.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Feb 18 22:34:16 UTC 2020 on sn-devel-184

4 days agos3: DFS: Change the last use of is_msdfs_link_internal() -> SMB_VFS_READ_DFS_PATHAT...
Jeremy Allison [Wed, 12 Feb 2020 21:52:58 +0000 (13:52 -0800)]
s3: DFS: Change the last use of is_msdfs_link_internal() -> SMB_VFS_READ_DFS_PATHAT() inside form_junctions().

is_msdfs_link_internal() is no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: DFS: Replace calls to is_msdfs_link_internal() inside dfs_path_lookup() with...
Jeremy Allison [Wed, 12 Feb 2020 21:41:56 +0000 (13:41 -0800)]
s3: DFS: Replace calls to is_msdfs_link_internal() inside dfs_path_lookup() with SMB_VFS_READ_DFS_PATHAT().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: DFS: Change dfs_path_lookup() to return struct referral list and count directly.
Jeremy Allison [Wed, 12 Feb 2020 21:17:51 +0000 (13:17 -0800)]
s3: DFS: Change dfs_path_lookup() to return struct referral list and count directly.

Remove external parse of returned link targetpath, expose
the parsing previously added to dfs_path_lookup().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: DFS: Parse the returned target path in dfs_path_lookup().
Jeremy Allison [Tue, 11 Feb 2020 22:21:12 +0000 (14:21 -0800)]
s3: DFS: Parse the returned target path in dfs_path_lookup().

Currently unused, but this will ease the transition to
using SMB_VFS_READ_DFS_PATHAT().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: DFS: Change simple is_msdfs_link() call to use SMB_VFS_READ_DFS_PATHAT().
Jeremy Allison [Tue, 11 Feb 2020 21:35:53 +0000 (13:35 -0800)]
s3: DFS: Change simple is_msdfs_link() call to use SMB_VFS_READ_DFS_PATHAT().

This will need an extra dirfsp parameter in future, but this
is the easiest change for now.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: vfs_time_audit: Add read_dfs_pathat().
Jeremy Allison [Fri, 14 Feb 2020 21:08:04 +0000 (13:08 -0800)]
s3: VFS: vfs_time_audit: Add read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: vfs_full_audit: Add read_dfs_pathat().
Jeremy Allison [Tue, 11 Feb 2020 18:02:18 +0000 (10:02 -0800)]
s3: VFS: vfs_full_audit: Add read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: catia: Add read_dfs_pathat().
Jeremy Allison [Tue, 11 Feb 2020 18:02:00 +0000 (10:02 -0800)]
s3: VFS: catia: Add read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: cap: Add cap_read_dfs_pathat().
Jeremy Allison [Tue, 11 Feb 2020 17:48:05 +0000 (09:48 -0800)]
s3: VFS: cap: Add cap_read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: shadow_copy2: Add shadow_copy2_read_dfs_pathat().
Jeremy Allison [Tue, 28 Jan 2020 20:12:09 +0000 (12:12 -0800)]
s3: VFS: shadow_copy2: Add shadow_copy2_read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: gluster: Add vfs_gluster_read_dfs_pathat().
Jeremy Allison [Tue, 28 Jan 2020 18:46:43 +0000 (10:46 -0800)]
s3: VFS: gluster: Add vfs_gluster_read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: ceph: Add vfswrap_ceph_read_dfs_pathat().
Jeremy Allison [Tue, 28 Jan 2020 18:18:04 +0000 (10:18 -0800)]
s3: VFS: ceph: Add vfswrap_ceph_read_dfs_pathat().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: VFS: Add SMB_VFS_READ_DFS_PATHAT().
Jeremy Allison [Tue, 28 Jan 2020 17:51:17 +0000 (09:51 -0800)]
s3: VFS: Add SMB_VFS_READ_DFS_PATHAT().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Clean up exits / talloc heirarchy in parse_msdfs_symlink().
Jeremy Allison [Tue, 28 Jan 2020 17:36:26 +0000 (09:36 -0800)]
s3: smbd: dfs: Clean up exits / talloc heirarchy in parse_msdfs_symlink().

Ensure on error or clean return we don't leave memory on mem_ctx.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Make parameter names consistent.
Jeremy Allison [Tue, 28 Jan 2020 17:28:30 +0000 (09:28 -0800)]
s3: smbd: dfs: Make parameter names consistent.

Initialize reflist to NULL.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Allow parse_msdfs_symlink() to be called with NULL pointers.
Jeremy Allison [Tue, 28 Jan 2020 00:45:20 +0000 (16:45 -0800)]
s3: smbd: dfs: Allow parse_msdfs_symlink() to be called with NULL pointers.

In case we don't want all the data.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Apply some README.Coding to parse_msdfs_symlink().
Jeremy Allison [Tue, 28 Jan 2020 00:42:11 +0000 (16:42 -0800)]
s3: smbd: dfs: Apply some README.Coding to parse_msdfs_symlink().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Make parse_msdfs_symlink() external.
Jeremy Allison [Tue, 28 Jan 2020 00:35:25 +0000 (16:35 -0800)]
s3: smbd: dfs: Make parse_msdfs_symlink() external.

So it can be called by a future new VFS call.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Move lp_msdfs_shuffle_referrals() call out of parse_msdfs_symlink().
Jeremy Allison [Tue, 28 Jan 2020 00:31:52 +0000 (16:31 -0800)]
s3: smbd: dfs: Move lp_msdfs_shuffle_referrals() call out of parse_msdfs_symlink().

Removes dependency on snum for what is text parsing code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: smbd: dfs: Cleanup, reformat calls to parse_msdfs_symlink()
Jeremy Allison [Tue, 28 Jan 2020 00:29:46 +0000 (16:29 -0800)]
s3: smbd: dfs: Cleanup, reformat calls to parse_msdfs_symlink()

Make parameter easier to change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: DFS: Don't allow link deletion on a read-only share.
Jeremy Allison [Fri, 7 Feb 2020 00:20:59 +0000 (16:20 -0800)]
s3: DFS: Don't allow link deletion on a read-only share.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3: DFS: Don't allow link creation on a read-only share.
Jeremy Allison [Thu, 6 Feb 2020 23:55:13 +0000 (15:55 -0800)]
s3: DFS: Don't allow link creation on a read-only share.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agos3:tests: Add test for a dropbox with dir mode 0733
Andreas Schneider [Thu, 13 Feb 2020 12:48:17 +0000 (13:48 +0100)]
s3:tests: Add test for a dropbox with dir mode 0733

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Feb 18 21:07:44 UTC 2020 on sn-devel-184

5 days agolib: Fix a shutdown crash with "clustering = yes"
Volker Lendecke [Tue, 11 Feb 2020 21:10:32 +0000 (22:10 +0100)]
lib: Fix a shutdown crash with "clustering = yes"

This is a bit confusing now, sorry for that:

register_msg_pool_usage() in the ctdb case uses
messaging_ctdb_register_tevent_context(), which talloc_reference()s
the central struct messaging_ctdb_fde_ev of the
messaging_ctdb_context. In messaging_reinit(), we talloc_free only one
of those references and allocate a new messaging_ctdb_fde_ev. The
remaining messaging_ctdb_fde_ev should have been deleted as well, but
due to the second reference this does not happen. When doing the
shutdown messaging_ctdb_fde_ev_destructor() is called twice, once on
the properly reinitialized fde_ev, and once much later on the leftover
one which references invalid data structures.

By the way, this is not a problem with talloc_reference(), this would
have happened with explicit refcounting too.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Tue Feb 18 13:05:53 UTC 2020 on sn-devel-184

5 days agolib: Introduce messaging_context->per_process_talloc_ctx
Volker Lendecke [Tue, 11 Feb 2020 20:57:42 +0000 (21:57 +0100)]
lib: Introduce messaging_context->per_process_talloc_ctx

Consolidate "msg_dgm_ref" and "msg_ctdb_ref": The only purpose of
those pointers was to TALLOC_FREE() them in messaging_reinit(). We'll
have a third entity to talloc_free() in the next commit, make that
simpler.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 days agolib: Add a TALLOC_CTX to base register_msg_pool_usage() on
Volker Lendecke [Tue, 11 Feb 2020 20:47:39 +0000 (21:47 +0100)]
lib: Add a TALLOC_CTX to base register_msg_pool_usage() on

Add a simple way to deactivate the registration

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 days agolib: Simplify register_msg_pool_usage()
Volker Lendecke [Tue, 11 Feb 2020 20:26:18 +0000 (21:26 +0100)]
lib: Simplify register_msg_pool_usage()

We can do as much as we want in the filter. This gives us automatic
retry, we don't have to do the messaging_filtered_read_send() over and
over again

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 days agoctdb-docs: Provide example commands for "ctdb event ..."
Martin Schwenke [Wed, 12 Feb 2020 23:09:08 +0000 (10:09 +1100)]
ctdb-docs: Provide example commands for "ctdb event ..."

The example output doesn't tell a user what command generated it.
Adding the command makes the examples much more useful.

Reported-by: Stefan Kania <stefan@kania-online.de>
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): Tue Feb 18 04:22:56 UTC 2020 on sn-devel-184

5 days agoctdb-tests: Flag setup, startup, shutdown failures as test errors
Martin Schwenke [Fri, 6 Dec 2019 05:12:08 +0000 (16:12 +1100)]
ctdb-tests: Flag setup, startup, shutdown failures as test errors

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 days agoctdb-tests: Dump logs on shutdown failure
Martin Schwenke [Fri, 6 Dec 2019 05:11:45 +0000 (16:11 +1100)]
ctdb-tests: Dump logs on shutdown failure

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 days agoctdb-tests: Avoid shutdown error when daemon already cleanly shut down
Martin Schwenke [Mon, 17 Feb 2020 05:29:05 +0000 (16:29 +1100)]
ctdb-tests: Avoid shutdown error when daemon already cleanly shut down

This depends on a small amount of internal knowledge but is the
cleanest way of avoiding errors for nodes that have already been shut
down.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 days agoctdb-tests: Rationalise node stop/start/restart
Martin Schwenke [Wed, 11 Dec 2019 10:44:28 +0000 (21:44 +1100)]
ctdb-tests: Rationalise node stop/start/restart

Separate functions are not needed for stopping/starting/restarting
individual nodes.  The stop and start functions essentially just use
onnode, though for local daemons this is embedded in local_daemons.sh.
So, just provide one stop and one start function that takes an
optional nodespec, defaulting to all nodes.

Restarting becomes common.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 days agoctdb-daemon: Fix signed/unsigned comparison
Martin Schwenke [Mon, 10 Feb 2020 06:50:30 +0000 (17:50 +1100)]
ctdb-daemon: Fix signed/unsigned comparison

csbuild says:

  ctdb/server/ctdb_lock.c: scope_hint: In function ‘ctdb_find_lock_context’
  ctdb/server/ctdb_lock.c:671:33: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 days agoctdb-daemon: Check for lock count underflow
Martin Schwenke [Mon, 17 Feb 2020 05:20:25 +0000 (16:20 +1100)]
ctdb-daemon: Check for lock count underflow

This is a programming error.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 days agoctdb-common: Remove signed/unsigned comparisons
Amitay Isaacs [Mon, 17 Feb 2020 06:00:47 +0000 (17:00 +1100)]
ctdb-common: Remove signed/unsigned comparisons

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 days agos3:modules: add vfs_io_uring module
Stefan Metzmacher [Wed, 5 Jun 2019 15:01:49 +0000 (17:01 +0200)]
s3:modules: add vfs_io_uring module

The module makes use of the new io_uring infrastructure
(intruduced in linux 5.1), see https://lwn.net/Articles/778411/ and
http://git.kernel.dk/cgit/liburing/

Currently this only implements SMB_VFS_{PREAD,PWRITE,FSYNC}_SEND/RECV
and avoids the overhead of our userspace threadpool.

In future we'll hopefully make more use of more advanced io_uring
features.

For now we don't have automated tests as our test infrastructure
doesn't use a recent kernel. At least we're able to do compile tests
on fedora31.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Feb 15 11:37:45 UTC 2020 on sn-devel-184

8 days agobootstrap: replace libaio-dev/libaio-devel with liburing-dev/liburing-devel
Stefan Metzmacher [Fri, 7 Feb 2020 10:00:21 +0000 (11:00 +0100)]
bootstrap: replace libaio-dev/libaio-devel with liburing-dev/liburing-devel

We'll never use libaio, but will soon add a io_uring vfs module.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
8 days agolib/replace: remove unused check for aio.h
Stefan Metzmacher [Fri, 7 Feb 2020 10:02:18 +0000 (11:02 +0100)]
lib/replace: remove unused check for aio.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 days agos3:tests: Add smbclient test for 'force create mode = 0664'
Andreas Schneider [Wed, 12 Feb 2020 15:30:01 +0000 (16:30 +0100)]
s3:tests: Add smbclient test for 'force create mode = 0664'

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Feb 14 20:16:04 UTC 2020 on sn-devel-184

9 days agos4-auth: Allow simple bind login of a user with an @ in the samAccountName
Andrew Bartlett [Sun, 9 Feb 2020 22:52:33 +0000 (11:52 +1300)]
s4-auth: Allow simple bind login of a user with an @ in the samAccountName

LDAP Simple BIND authentications have already been mapped to a
DOMAIN\username pair and should not be mapped twice.

This appears to be a regression in 09e24ce40f89ac2f03d0c5fefa8b59f0d113fa6b
included in Samba 4.7.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Fri Feb 14 17:13:33 UTC 2020 on sn-devel-184

9 days agoauth/credentials: Test connecting to LDAP with a "virtual user" style account
Andrew Bartlett [Sun, 9 Feb 2020 22:07:27 +0000 (11:07 +1300)]
auth/credentials: Test connecting to LDAP with a "virtual user" style account

This type of account is often used by e-mail hosting platforms
that do not wish to create an AD domain for each DNS domain that
they host mail for.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
9 days agogensec: Fix CID 1458419 Control flow issues (NO_EFFECT)
Volker Lendecke [Wed, 12 Feb 2020 14:42:28 +0000 (15:42 +0100)]
gensec: Fix CID 1458419 Control flow issues (NO_EFFECT)

socklen_t can be unsigned

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Feb 14 13:42:26 UTC 2020 on sn-devel-184

9 days agogensec: Fix CID 1458421 OVERRUN
Volker Lendecke [Wed, 12 Feb 2020 14:36:20 +0000 (15:36 +0100)]
gensec: Fix CID 1458421 OVERRUN

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 days agoauth: Fix CID 1458418 Null pointer dereferences (REVERSE_INULL)
Volker Lendecke [Wed, 12 Feb 2020 14:40:32 +0000 (15:40 +0100)]
auth: Fix CID 1458418 Null pointer dereferences (REVERSE_INULL)

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 days agoauth: Fix CID 1458420 Null pointer dereferences (REVERSE_INULL)
Volker Lendecke [Wed, 12 Feb 2020 14:39:54 +0000 (15:39 +0100)]
auth: Fix CID 1458420 Null pointer dereferences (REVERSE_INULL)

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 days agoctdb-tests: Fix getdbmap test so that it actually works sanely
Martin Schwenke [Tue, 10 Dec 2019 01:03:10 +0000 (12:03 +1100)]
ctdb-tests: Fix getdbmap test so that it actually works sanely

* Typo in variable name db_map_pattern
* Variable num_db_init used before set
* dbmap_pattern does not cover database flags

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): Wed Feb 12 04:38:47 UTC 2020 on sn-devel-184

11 days agoctdb-tests: Fix handling of --no-event-scripts option
Martin Schwenke [Wed, 11 Dec 2019 22:43:58 +0000 (09:43 +1100)]
ctdb-tests: Fix handling of --no-event-scripts option

Shellcheck noticed that pnn was never referenced.  Not sure this ever
worked or whether it got broken somewhere along the way.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 days agoctdb-tests: Use a here document to improve readability
Martin Schwenke [Wed, 11 Dec 2019 07:54:42 +0000 (18:54 +1100)]
ctdb-tests: Use a here document to improve readability

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 days agoctdb-tests: Use select_test_node()
Martin Schwenke [Wed, 11 Dec 2019 07:47:29 +0000 (18:47 +1100)]
ctdb-tests: Use select_test_node()

select_test_node_and_ips() is not required in these cases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 days agoctdb-tests: Increase to dumping up to 500 lines of logs on error
Martin Schwenke [Mon, 10 Feb 2020 22:26:58 +0000 (09:26 +1100)]
ctdb-tests: Increase to dumping up to 500 lines of logs on error

100 lines are not enough to debug a current issue.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 days agoctdb-tests: Fix return value of DB test tool delete command
Martin Schwenke [Mon, 10 Feb 2020 06:19:36 +0000 (17:19 +1100)]
ctdb-tests: Fix return value of DB test tool delete command

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 days agoctdb-tcp: Make error handling for outbound connection consistent
Martin Schwenke [Tue, 28 Jan 2020 05:49:14 +0000 (16:49 +1100)]
ctdb-tcp: Make error handling for outbound connection consistent

If we can't bind the local end of an outgoing connection then
something has gone wrong.  Retrying is better than failing into a
zombie state.  The interface might come back up and/or the address my
be reconfigured.

While here, do the same thing for the other (potentially transient)
failures.

The unknown address family failure is special but just handle it via a
retry.  Technically it can't happen because the node address parsing
can only return values with address family AF_INET or AF_INET6.

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

Reported-by: 耿纪超 <gengjichao@jd.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
12 days agosamba-tool domain join: remove sub domain join code
Gary Lockyer [Mon, 10 Feb 2020 21:05:08 +0000 (10:05 +1300)]
samba-tool domain join: remove sub domain join code

Remove the unused sub domain join code, the option was removed by commit
5583208aed0e4647269e48aa1d3c5c48a73001ac. This commit completely removes
the now unused code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Feb 11 17:41:32 UTC 2020 on sn-devel-184

13 days agosmbclient4: Remove unused code
Volker Lendecke [Fri, 7 Feb 2020 12:47:25 +0000 (14:47 +0200)]
smbclient4: Remove unused code

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 10 19:26:37 UTC 2020 on sn-devel-184

13 days agosmbclient: Don't cli_posix_stat() twice
Volker Lendecke [Fri, 7 Feb 2020 12:11:13 +0000 (14:11 +0200)]
smbclient: Don't cli_posix_stat() twice

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 days agodbwrap: Improve an error message
Volker Lendecke [Mon, 27 Jan 2020 13:15:42 +0000 (14:15 +0100)]
dbwrap: Improve an error message

Include the path where db_open() tried to find the ctdb socket

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 days agokrb5_wrap: map KRB5_REALM_UNKNOWN to NT_STATUS_NO_SUCH_DOMAIN
Stefan Metzmacher [Fri, 29 Nov 2019 08:46:21 +0000 (08:46 +0000)]
krb5_wrap: map KRB5_REALM_UNKNOWN to NT_STATUS_NO_SUCH_DOMAIN

This is much better than mapping it to NT_STATUS_UNSUCCESSFUL.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Feb 10 17:59:34 UTC 2020 on sn-devel-184

13 days agokrb5_wrap: map KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN to NT_STATUS_INVALID_COMPUTER_NAME
Stefan Metzmacher [Thu, 14 Nov 2019 14:38:42 +0000 (15:38 +0100)]
krb5_wrap: map KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN to NT_STATUS_INVALID_COMPUTER_NAME

KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN is already mapped to
NT_STATUS_INVALID_ACCOUNT_NAME and we need a way to
distinguish between client and server principal
at the NTSTATUS layer too.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 days agokrb5_wrap: move source3/libads/krb5_errs.c to lib/krb5_wrap/krb5_errs.c
Stefan Metzmacher [Wed, 6 Nov 2019 14:38:23 +0000 (15:38 +0100)]
krb5_wrap: move source3/libads/krb5_errs.c to lib/krb5_wrap/krb5_errs.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 days agoauth/gensec: map NT_STATUS_{INVALID_ACCOUNT_NAME,NO_SUCH_DOMAIN} to NT_STATUS_NO_SUCH...
Stefan Metzmacher [Wed, 11 Dec 2019 13:53:20 +0000 (14:53 +0100)]
auth/gensec: map NT_STATUS_{INVALID_ACCOUNT_NAME,NO_SUCH_DOMAIN} to NT_STATUS_NO_SUCH_USER

This means nt_status_squash() will map NT_STATUS_NO_SUCH_USER to
LOGON_FAILURE later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 days agogensec/spnego: fallback on INVALID_{ACCOUNT,COMPUTER}_NAME and NO_SUCH_DOMAIN
Stefan Metzmacher [Tue, 19 Nov 2019 11:10:11 +0000 (12:10 +0100)]
gensec/spnego: fallback on INVALID_{ACCOUNT,COMPUTER}_NAME and NO_SUCH_DOMAIN

I think it's better to handle them in spnego.c, instead of squashing
them already in the gssapi/gse modules. This is related to
KRB5KDC_ERR_{C,S}_PRINCIPAL_UNKNOWN and KRB5_REALM_UNKNOWN.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 days agowinbindd_cm: fallback to anonymous for INVALID_COMPUTER_NAME and NO_SUCH_DOMAIN too
Stefan Metzmacher [Tue, 19 Nov 2019 11:10:11 +0000 (12:10 +0100)]
winbindd_cm: fallback to anonymous for INVALID_COMPUTER_NAME and NO_SUCH_DOMAIN too

These error codes are soon propagated in addition to
INVALID_ACOUNT_NAME through the gensec/spnego layers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>