bbaumbach/samba-autobuild/.git
4 years agoidl: drsuapi_DsaAddressListItem_V1 limit recursion
Gary Lockyer [Wed, 29 Jan 2020 19:52:34 +0000 (08:52 +1300)]
idl: drsuapi_DsaAddressListItem_V1 limit recursion

Limit number of drsuapi_DsaAddressListItem_V1 elements to 1024

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19820
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14254

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopidl: Add recursive depth checks.
Gary Lockyer [Wed, 29 Jan 2020 19:51:47 +0000 (08:51 +1300)]
pidl: Add recursive depth checks.

Add new parameter to elements "max_recursion" and modify pidl to call
NDR_RECURSION_CHECK and NDR_RECURSION_UNWIND for element tagged with
that attribute.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19820
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14254

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr: add recursion check macros
Gary Lockyer [Wed, 29 Jan 2020 19:49:07 +0000 (08:49 +1300)]
librpc ndr: add recursion check macros

Add macros to check the recursion depth.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19280
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14254

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr: Stack-overflow in ndr_pull_drsuapi_DsaAddressListItem_V1
Gary Lockyer [Wed, 29 Jan 2020 20:47:11 +0000 (09:47 +1300)]
librpc ndr: Stack-overflow in ndr_pull_drsuapi_DsaAddressListItem_V1

Reproducer for oss-fuzz Issue 19280

Project: samba
Fuzzing Engine: libFuzzer
Fuzz Target: fuzz_ndr_drsuapi_TYPE_OUT
Job Type: libfuzzer_asan_samba
Platform Id: linux

Crash Type: Stack-overflow
Crash Address: 0x7ffcb4cc2ff8
Crash State:
  ndr_pull_drsuapi_DsaAddressListItem_V1

Sanitizer: address (ASAN)

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19280
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14254

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agobuild: fix the coverage build
Gary Lockyer [Wed, 12 Feb 2020 21:54:06 +0000 (10:54 +1300)]
build: fix the coverage build

"make lcov" was failing with:
   Processing file bin/default/<stdout>
   genhtml: ERROR: cannot read ... <stdout>

Flex adds "#line nnn <stdout>" to the generated source, which then causes
issues with lcov. This commit adds a SAMBA_GENERATOR for es_lexer.l and
sparql_lexer.l that strips out the offending lines.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb: change the version to 2.2.0 for Samba 4.13
Stefan Metzmacher [Tue, 25 Feb 2020 10:30:04 +0000 (11:30 +0100)]
ldb: change the version to 2.2.0 for Samba 4.13

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Feb 26 23:11:39 UTC 2020 on sn-devel-184

4 years agos3:smb2_tcon: pass down in_flags to smbd_smb2_tree_connect_send()
Stefan Metzmacher [Mon, 3 Sep 2018 13:28:21 +0000 (15:28 +0200)]
s3:smb2_tcon: pass down in_flags to smbd_smb2_tree_connect_send()

SMB 3.1.1 converted the reserved field to a flags field.

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

4 years agos3:lib: Allow open_socket_out without a timeout
Volker Lendecke [Tue, 27 Nov 2018 09:15:39 +0000 (10:15 +0100)]
s3:lib: Allow open_socket_out without a timeout

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib/async_req: remove useless "reentrant" support from async_connect_send()
Stefan Metzmacher [Wed, 26 Feb 2020 13:16:05 +0000 (14:16 +0100)]
lib/async_req: remove useless "reentrant" support from async_connect_send()

Now that open_socket_out*() doesn't do the strange reentrant calls,
we can remove support for this in async_connect_send(), so that we'll
never get any new users of this.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:lib: avoid calling async_connect_send() again and again in open_socket_out*()
Stefan Metzmacher [Wed, 26 Feb 2020 12:36:05 +0000 (13:36 +0100)]
s3:lib: avoid calling async_connect_send() again and again in open_socket_out*()

There's really no need to do that!

Once connect() is called and returned EINPROGRESS, the kernel
knowns what to do and reports any state change via
TEVENT_FD_READ or TEVENT_FD_WRITE.
The actual success or failure is available via
getsockopt(.., SOL_SOCKET, SO_ERROR, ...).

Before this commit we called connect() (via async_connect_send()) again
and again until we reached the final caller provided timeout,
even if the kernel already found out that the destination is
unreachable.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:lib: avoid goto's in open_socket_out_send()
Stefan Metzmacher [Wed, 26 Feb 2020 12:27:32 +0000 (13:27 +0100)]
s3:lib: avoid goto's in open_socket_out_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:lib: s/result/req in open_socket_out_send()
Stefan Metzmacher [Wed, 26 Feb 2020 12:21:15 +0000 (13:21 +0100)]
s3:lib: s/result/req in open_socket_out_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib/async_req: make sure we return errors early from async_connect_send/recv
Stefan Metzmacher [Wed, 2 Oct 2019 14:56:30 +0000 (07:56 -0700)]
lib/async_req: make sure we return errors early from async_connect_send/recv

While it is true that [e]poll() only needs POLLOUT
and POLLERR/POLLHUP are added implicitly.
For tevent we need TEVENT_FD_READ in order to see POLLERR/POLLHUP.

The socket becomes only readable when we hit an error.
Waiting for TEVENT_FD_WRITE is needed for getting success,
while TEVENT_FD_READ is required to get failures.

This matches what we have in tstream_bsd_connect_send().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib/tsocket: add a comment regarding TEVENT_FD_READ in tstream_bsd_connect_send()
Stefan Metzmacher [Wed, 26 Feb 2020 15:36:30 +0000 (16:36 +0100)]
lib/tsocket: add a comment regarding TEVENT_FD_READ in tstream_bsd_connect_send()

This is different compared to the raw usage of [e]poll
where [E]POLLOUT is enough to see errors via POLLERR/POLLHUP.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:wscript: split out dsgetdcname subsystem
Stefan Metzmacher [Wed, 30 Oct 2019 14:55:32 +0000 (15:55 +0100)]
s3:wscript: split out dsgetdcname subsystem

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:wscript: move libsmb/clidgram.c to LIBNMB
Stefan Metzmacher [Wed, 30 Oct 2019 15:20:19 +0000 (16:20 +0100)]
s3:wscript: move libsmb/clidgram.c to LIBNMB

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: move cli_set_message() to source3/libsmb/nmblib.c
Stefan Metzmacher [Wed, 30 Oct 2019 15:19:40 +0000 (16:19 +0100)]
s3:libsmb: move cli_set_message() to source3/libsmb/nmblib.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: use only a timeout of 250ms in name_resolve_bcast_send()
Stefan Metzmacher [Thu, 31 Oct 2019 06:47:53 +0000 (07:47 +0100)]
s3:libsmb: use only a timeout of 250ms in name_resolve_bcast_send()

We use the same value for broadcasts in name_query().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: pass dest_ss to cli_cm_open()
Stefan Metzmacher [Thu, 23 Aug 2018 07:21:41 +0000 (09:21 +0200)]
s3:libsmb: pass dest_ss to cli_cm_open()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: pass dest_ss to cli_cm_connect() down to cli_connect_nb()
Stefan Metzmacher [Thu, 23 Aug 2018 07:20:49 +0000 (09:20 +0200)]
s3:libsmb: pass dest_ss to cli_cm_connect() down to cli_connect_nb()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Fill in device which we don't get from cli_posix_stat
Volker Lendecke [Mon, 24 Feb 2020 17:43:12 +0000 (09:43 -0800)]
libsmb: Fill in device which we don't get from cli_posix_stat

SMB1 unix extensions don't carry st_dev for stat

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

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): Wed Feb 26 00:50:32 UTC 2020 on sn-devel-184

4 years agolibsmb: Pass the correct path to cli_posix_stat()
Volker Lendecke [Mon, 24 Feb 2020 17:42:46 +0000 (09:42 -0800)]
libsmb: Pass the correct path to cli_posix_stat()

This fixes doing strlen() on talloc_tos(), about which valgrind is pretty
unhappy. Without this patch we survive the tests because we have fallbacks to
the non-posix flavors of stat(). With this patch in place cli_posix_stat()
becomes functional in this code path. This creates conflicts with the readdir
libsmbclient tests, which need fixing separately.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Slightly simplify setting up libsmbclient tests
Volker Lendecke [Sun, 23 Feb 2020 12:34:18 +0000 (04:34 -0800)]
selftest: Slightly simplify setting up libsmbclient tests

We'll add per-test arguments soon

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): Tue Feb 25 19:30:27 UTC 2020 on sn-devel-184

4 years agoselftest: We don't need an AD DC for libsmbclient tests
Volker Lendecke [Sun, 23 Feb 2020 11:42:03 +0000 (12:42 +0100)]
selftest: We don't need an AD DC for libsmbclient tests

In case we would start to actually test kerberos auth via the libsmbclient API
(which we right now don't), this will change again. Until then,

make test TESTS=libsmbclient

is a lot faster this way.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Consolidate planning libsmbclient tests to source4
Volker Lendecke [Sun, 23 Feb 2020 11:22:47 +0000 (12:22 +0100)]
selftest: Consolidate planning libsmbclient tests to source4

We don't need to plan those tests both in source3 and source4's
tests.py. The source4 version seems more "advanced", it uses
smbtorture4_testsuites() to list all tests, making it less
error-prone, and it also does the tests for all SMB1 and SMB3

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture4: Use higher-level torture macros
Volker Lendecke [Sun, 23 Feb 2020 14:04:52 +0000 (06:04 -0800)]
torture4: Use higher-level torture macros

Makes an easier read of torture_libsmbclient_readdirplus_seek()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture4: Use torture_assert_not_null where appropriate
Volker Lendecke [Sun, 23 Feb 2020 10:15:06 +0000 (11:15 +0100)]
torture4: Use torture_assert_not_null where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Don't pass "sbuf" to cli_posix_stat_send()
Volker Lendecke [Sat, 22 Feb 2020 13:55:07 +0000 (14:55 +0100)]
libsmb: Don't pass "sbuf" to cli_posix_stat_send()

Don't pass in the result buffer upon _send(), let the _recv() function
fill this in. Internal API only, adapt to current conventions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Avoid casts
Volker Lendecke [Sat, 22 Feb 2020 10:52:51 +0000 (11:52 +0100)]
libsmb: Avoid casts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Use IS[DOT]DOT
Volker Lendecke [Sat, 22 Feb 2020 10:48:45 +0000 (11:48 +0100)]
libsmb: Use IS[DOT]DOT

strequal is not necessary here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Remove a pointless ZERO_STRUCT()
Volker Lendecke [Sat, 22 Feb 2020 10:21:44 +0000 (11:21 +0100)]
libsmb: Remove a pointless ZERO_STRUCT()

"c" is a pointer that was initialized to NULL above

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Simplify callers of SMBC_dlist_contains()
Volker Lendecke [Fri, 21 Feb 2020 21:35:44 +0000 (22:35 +0100)]
libsmb: Simplify callers of SMBC_dlist_contains()

This function already does the NULL check on the file pointer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make SMBC_dlist_contains return bool
Volker Lendecke [Fri, 21 Feb 2020 21:13:49 +0000 (22:13 +0100)]
libsmb: Make SMBC_dlist_contains return bool

It returned True/False, and is used as boolean only. Modernize
formatting a bit.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Align calls to SMBC_dlist_contains()
Volker Lendecke [Fri, 21 Feb 2020 21:31:06 +0000 (22:31 +0100)]
libsmb: Align calls to SMBC_dlist_contains()

Everywhere else it's called as !SMBC_dlist_contains()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Add a NULL check
Volker Lendecke [Fri, 21 Feb 2020 21:07:19 +0000 (22:07 +0100)]
libsmb: Add a NULL check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoVFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode
Ralph Boehme [Mon, 24 Feb 2020 14:03:56 +0000 (15:03 +0100)]
VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode

This had been missing in the initial async dosmode implementation. It's the
responsibility of the sync and async dosmode functions to call
vfswrap_is_offline() since the offline functionality has been converted from a
first class VFS function to be a part of the DOS attributes VFS functions.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoVFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()
Ralph Boehme [Mon, 24 Feb 2020 13:30:37 +0000 (14:30 +0100)]
VFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()

full_path_tos() returns a ssize_t.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoVFS: default: avoid a crash in vfswrap_getxattrat_do_sync()
Ralph Boehme [Mon, 24 Feb 2020 13:29:01 +0000 (14:29 +0100)]
VFS: default: avoid a crash in vfswrap_getxattrat_do_sync()

Must use tevent_req_data() to get our tevent_req state, talloc_get_type_abort()
will just crash as struct tevent_req != struct vfswrap_getxattrat_state.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoVFS: default: remove unused arg from vfswrap_is_offline()
Ralph Boehme [Mon, 24 Feb 2020 13:28:19 +0000 (14:28 +0100)]
VFS: default: remove unused arg from vfswrap_is_offline()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoVFS: default: let vfswrap_is_offline() take conn, not handle
Ralph Boehme [Mon, 24 Feb 2020 13:24:12 +0000 (14:24 +0100)]
VFS: default: let vfswrap_is_offline() take conn, not handle

vfswrap_is_offline() has been converted to a "helper" function some time ago, it
had been a VFS interface function before. To make this change more obvious let
it take a struct connection_struct instead of a struct vfs_handle_struct which
is the canonical first parameter to VFS functions.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoldb: version 2.1.1
Stefan Metzmacher [Tue, 25 Feb 2020 10:06:27 +0000 (11:06 +0100)]
ldb: version 2.1.1

* Bug 14270:
  Samba 4.11 and later give incorrect results for SCOPE_ONE searches

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Tue Feb 25 12:59:02 UTC 2020 on sn-devel-184

4 years agoldb: Add tests aimed at the SCOPE_ONELEVEL bug in particular
Andrew Bartlett [Wed, 12 Feb 2020 03:28:01 +0000 (16:28 +1300)]
ldb: Add tests aimed at the SCOPE_ONELEVEL bug in particular

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agoldb: Fix search with scope ONE and small result sets
Andrew Bartlett [Fri, 7 Feb 2020 03:56:13 +0000 (16:56 +1300)]
ldb: Fix search with scope ONE and small result sets

This changes the LDB behaviour in the combination of a SCOPE_ONE search and
an index returning less than 10 results.

After b6b5b5fe355fee2a4096e9214831cb88c7a2a4c6 the list->strict flag
became set to false in all cases, rather than being left to the
value set by the caller.

This changes the ldb_kv_index_dn_one() code to force strict
mode on success instead.

Thanks to Marcus Granér, ICEYE Oy for reporting.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agoldb: Ensure @IDXONE modes is tested in ldb.python (apy.py) tests
Andrew Bartlett [Wed, 12 Feb 2020 00:44:44 +0000 (13:44 +1300)]
ldb: Ensure @IDXONE modes is tested in ldb.python (apy.py) tests

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agoldb: Add tests aimed at the SCOPE_ONELEVEL particular
Andrew Bartlett [Tue, 11 Feb 2020 22:45:36 +0000 (11:45 +1300)]
ldb: Add tests aimed at the SCOPE_ONELEVEL particular

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agoldb: Add tests for one-level indexes in conjunction with other indexes
Andrew Bartlett [Mon, 10 Feb 2020 01:08:29 +0000 (14:08 +1300)]
ldb: Add tests for one-level indexes in conjunction with other indexes

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agolib:util: Add (PULL|PUSH)_(BE|LE)_I(8|16|32|64) byterarray macros
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

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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

4 years 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>
4 years 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>
4 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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 years 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>