samba.git
3 years agoutils/asn1: avoid undefined behaviour warning
Douglas Bagnall [Sat, 5 Sep 2020 21:35:49 +0000 (09:35 +1200)]
utils/asn1: avoid undefined behaviour warning

UBSAN does not like an int >= 1<<24 being shifted left.
We check the overflow in the very next line.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25436

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Sep 11 05:05:59 UTC 2020 on sn-devel-184

3 years agos4:torture/rpc: move test_fsrvp_seq_timeout as last
David Disseldorp [Mon, 7 Sep 2020 23:20:51 +0000 (01:20 +0200)]
s4:torture/rpc: move test_fsrvp_seq_timeout as last

test_fsrvp_seq_timeout may see share snapshots left-over, which can
cause problems if subsequent tests expect a clean slate
(i.e. enum_created).

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos4:torture/rpc: flip order of netlogon tests
David Disseldorp [Sun, 6 Sep 2020 16:46:38 +0000 (18:46 +0200)]
s4:torture/rpc: flip order of netlogon tests

The previous change to not run rpc tests in reverse order results in
the following failure:
  Testing netr_LogonGetDomainInfo
  UNEXPECTED(failure): samba4.rpc.netlogon with
                       seal,padcheck.netlogon.GetDomainInfo(ad_dc)
  REASON: Exception: ../../source4/torture/rpc/netlogon.c:320:
      Expression `plain_pass != ((void *)0)' failed: plain_pass

Restore the dependent order of netlogon tests by reversing the
torture_rpc_tcase_add_test*() calls for the suite.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos4:torture/rpc: run tests in the order that they're added
David Disseldorp [Sun, 6 Sep 2020 08:57:41 +0000 (10:57 +0200)]
s4:torture/rpc: run tests in the order that they're added

torture_rpc_tcase_add_test*() uses DLIST_ADD(), which sees them executed
in reverse order to which they're added. Use DLIST_ADD_END() instead to
fix this.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoctdb: Prevent man page duplication
David Mulder [Thu, 10 Sep 2020 17:50:53 +0000 (11:50 -0600)]
ctdb: Prevent man page duplication

The new waf detects a duplicate instance of
ctdb_mutex_ceph_rados_helper.7.xml, which is due
to manpages_extra being a pointer to
manpages_misc, therefore each call to build()
added duplicate entries to the manpages_misc
global entry.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agooss-fuzz: standardise on RUNPATH for the static-ish binaries
Andrew Bartlett [Wed, 26 Aug 2020 03:37:57 +0000 (15:37 +1200)]
oss-fuzz: standardise on RUNPATH for the static-ish binaries

We use ld.bfd for the coverage builds, rather than the faster ld.gold.

We run the oss-fuzz autobuild target on Ubuntu 16.04 to more closely
mirror the environment provided by the Google oss-fuzz build
container.

On Ubuntu 16.04, when linking with ld.bfd built binaries get a RPATH,
but builds in Ubuntu 18.04 and those using ld.gold get a RUNPATH.

Just convert them all to RUNPATH to make the check_build.sh test (run
by the oss-fuzz autobuild target) easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoidmap_ad: Honor "client ldap sasl wrapping" config setting
Christof Schmitt [Wed, 22 Jul 2020 18:18:20 +0000 (11:18 -0700)]
idmap_ad: Honor "client ldap sasl wrapping" config setting

Instead of hard-coding SIGN and SEAL for the connections from this idmap
module, query the desired wrapping from "client ldap sasl wrapping".

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 10 23:19:56 UTC 2020 on sn-devel-184

3 years agos3: libsmb: Fix bug in get_dc_list() introduced by ip-service cleanup.
Jeremy Allison [Wed, 9 Sep 2020 01:19:07 +0000 (18:19 -0700)]
s3: libsmb: Fix bug in get_dc_list() introduced by ip-service cleanup.

Do an early return on error. On success assign to the correct
variables that are going to get copied into the 'out' parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Sep  9 10:31:17 UTC 2020 on sn-devel-184

3 years agotest_vfs_gpfs: Add test for file id generation
Christof Schmitt [Tue, 18 Aug 2020 21:54:09 +0000 (14:54 -0700)]
test_vfs_gpfs: Add test for file id generation

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Tue Sep  8 22:57:03 UTC 2020 on sn-devel-184

3 years agotest_vfs_gpfs: Add test for winattr mappings
Christof Schmitt [Tue, 18 Aug 2020 21:17:32 +0000 (14:17 -0700)]
test_vfs_gpfs: Add test for winattr mappings

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotest_vfs_gpfs: Add test for lease mapping function
Christof Schmitt [Tue, 18 Aug 2020 20:54:07 +0000 (13:54 -0700)]
test_vfs_gpfs: Add test for lease mapping function

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: Add unit test for vfs_gpfs
Christof Schmitt [Fri, 21 Feb 2020 15:52:08 +0000 (16:52 +0100)]
selftest: Add unit test for vfs_gpfs

The mapping functions of the vfs_gpfs module can be easily unit tested.
Begin a cmocka test to cover those.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: Add function for checking whether a module is enabled
Christof Schmitt [Wed, 19 Aug 2020 18:54:43 +0000 (11:54 -0700)]
selftest: Add function for checking whether a module is enabled

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowscript: Make list of shared modules available in STRING_SHARED_MODULES
Christof Schmitt [Wed, 19 Aug 2020 18:48:55 +0000 (11:48 -0700)]
wscript: Make list of shared modules available in STRING_SHARED_MODULES

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib/replace: move lib/replace/closefrom.c from ROKEN_HOSTCC_SOURCE to REPLACE_HOSTCC_...
Stefan Metzmacher [Tue, 8 Sep 2020 10:13:20 +0000 (10:13 +0000)]
lib/replace: move lib/replace/closefrom.c from ROKEN_HOSTCC_SOURCE to REPLACE_HOSTCC_SOURCE

This is where it really belongs and we avoid the strange interaction
with source4/heimdal_build/config.h. This a follow up for commit
f31333d40e6fa38daa32a3ebb32d5a317c06fc62.

This fixes a build problem if libbsd-dev is not installed.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Sep  8 13:59:58 UTC 2020 on sn-devel-184

3 years agogitlab-ci: Fix the sha1sum
Andreas Schneider [Mon, 7 Sep 2020 15:36:58 +0000 (17:36 +0200)]
gitlab-ci: Fix the sha1sum

The images where build with an invalid sha1sum.

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): Mon Sep  7 23:57:48 UTC 2020 on sn-devel-184

3 years agos3: libsmb: Cleanup in get_dc_list()
Noel Power [Fri, 4 Sep 2020 11:23:14 +0000 (12:23 +0100)]
s3: libsmb: Cleanup in get_dc_list()

Don't modify out params (unless successful result),

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Sep  7 14:46:58 UTC 2020 on sn-devel-184

3 years agos3: libsmb: Now we only have namecache_store_sa(), rename it back to namecache_store().
Jeremy Allison [Thu, 27 Aug 2020 19:17:07 +0000 (12:17 -0700)]
s3: libsmb: Now we only have namecache_store_sa(), rename it back to namecache_store().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove use of struct ip_service from the namecache code.
Jeremy Allison [Thu, 27 Aug 2020 19:14:13 +0000 (12:14 -0700)]
s3: libsmb: Remove use of struct ip_service from the namecache code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove the last caller of namecache_store().
Jeremy Allison [Thu, 27 Aug 2020 19:04:50 +0000 (12:04 -0700)]
s3: libsmb: Remove the last caller of namecache_store().

Convert to a struct samba_sockaddr array and use namecache_store_sa().

We can now remove the use of 'struct ip_list' from
the namecache code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Add internal conversion function ip_service_to_samba_sockaddr().
Jeremy Allison [Thu, 27 Aug 2020 18:59:20 +0000 (11:59 -0700)]
s3: libsmb: Add internal conversion function ip_service_to_samba_sockaddr().

Compiles but commented out as not yet used. Next commit will
change that.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: winbindd: Use namecache_store_sa() inside dcip_check_name().
Jeremy Allison [Thu, 27 Aug 2020 18:52:57 +0000 (11:52 -0700)]
s3: winbindd: Use namecache_store_sa() inside dcip_check_name().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Use namecache_store_sa() instead of namecache_store().
Jeremy Allison [Thu, 27 Aug 2020 18:49:07 +0000 (11:49 -0700)]
s3: libsmb: Use namecache_store_sa() instead of namecache_store().

Removes one more struct ip_service usage.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Add namecache_store_sa(). Doesn't store ports and takes a samba_sockaddr...
Jeremy Allison [Thu, 27 Aug 2020 18:45:17 +0000 (11:45 -0700)]
s3: libsmb: Add namecache_store_sa(). Doesn't store ports and takes a samba_sockaddr array.

Now uses ipstr_list_make_sa(). Now convert
the callers, remove namecache_store() and
then rename namecache_store_sa() back to namecache_store().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Add internal ipstr_list_make_sa().
Jeremy Allison [Thu, 27 Aug 2020 18:40:10 +0000 (11:40 -0700)]
s3: libsmb: Add internal ipstr_list_make_sa().

Duplicates ipstr_list_make() with samba_sockaddr, but doesn't store
ports. The duplication is temporary as the ipstr_list_make() function
will go away once namecache_store is converted to samba_sockaddr.

Compiles but commented out as not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup - resolve_name() get names from internal_resolve_names() which...
Jeremy Allison [Thu, 27 Aug 2020 18:33:20 +0000 (11:33 -0700)]
s3: libsmb: Cleanup - resolve_name() get names from internal_resolve_names() which is guaranteed not to return zero addresses.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove commented out wrapper for internal_resolve_name().
Jeremy Allison [Thu, 27 Aug 2020 18:23:08 +0000 (11:23 -0700)]
s3: libsmb: Remove commented out wrapper for internal_resolve_name().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Comment out wrapper function internal_resolve_name(). Rename _internal_re...
Jeremy Allison [Thu, 27 Aug 2020 18:14:10 +0000 (11:14 -0700)]
s3: libsmb: Comment out wrapper function internal_resolve_name(). Rename _internal_resolve_name() -> internal_resolve_name().

We can now remove the wrapper.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove now unused dup_ip_service_array().
Jeremy Allison [Thu, 27 Aug 2020 18:12:17 +0000 (11:12 -0700)]
s3: libsmb: Remove now unused dup_ip_service_array().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Finally change _internal_resolve_name() to return a talloc'ed ip_service...
Jeremy Allison [Thu, 27 Aug 2020 02:05:28 +0000 (19:05 -0700)]
s3: libsmb: Finally change _internal_resolve_name() to return a talloc'ed ip_service array.

The wrapper internal_resolve_name() is now functionaly identical to _internal_resolve_name()
so we can remove it and rename _internal_resolve_name() back to internal_resolve_name().

dup_ip_service_array() is now no longer used, so comment it
out as it's a staic function.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Make _internal_resolve_name() return a size_t pointer for count.
Jeremy Allison [Wed, 26 Aug 2020 23:42:29 +0000 (16:42 -0700)]
s3: libsmb: Make _internal_resolve_name() return a size_t pointer for count.

Getting closer to being a idential to the wrapper function
internal_resolve_name() which we can then remove.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: _internal_resolve_name() code cleanup.
Jeremy Allison [Wed, 26 Aug 2020 23:38:32 +0000 (16:38 -0700)]
s3: libsmb: _internal_resolve_name() code cleanup.

Only set *return_iplist just before success return.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: _internal_resolve_name() code cleanup.
Jeremy Allison [Wed, 26 Aug 2020 23:34:57 +0000 (16:34 -0700)]
s3: libsmb: _internal_resolve_name() code cleanup.

Only set *return_count just before success return.
Preparing to move all counts to size_t.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3/libsmb: Cleanup coding in convert_ss2service()
Noel Power [Fri, 4 Sep 2020 02:22:21 +0000 (19:22 -0700)]
s3/libsmb: Cleanup coding in convert_ss2service()

Don't update out params when unsuccessful

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: libsmb: Cleanup coding in convert_ss2service().
Jeremy Allison [Wed, 26 Aug 2020 22:57:27 +0000 (15:57 -0700)]
s3: libsmb: Cleanup coding in convert_ss2service().

Will make it easier to return a talloc'ed array.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Change convert_ss2service() and it's one caller to take and return unsign...
Jeremy Allison [Wed, 26 Aug 2020 22:54:49 +0000 (15:54 -0700)]
s3: libsmb: Change convert_ss2service() and it's one caller to take and return unsigned counts.

Getting closer to making _internal_resolve_name() return a pointer to size_t
for a count.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Make namecache_store() take an unsigned count.
Jeremy Allison [Wed, 26 Aug 2020 22:45:35 +0000 (15:45 -0700)]
s3: libsmb: Make namecache_store() take an unsigned count.

Counts can never be negative.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: _internal_resolve_name(). Remove unused free(s).
Jeremy Allison [Wed, 26 Aug 2020 22:43:46 +0000 (15:43 -0700)]
s3: libsmb: _internal_resolve_name(). Remove unused free(s).

*return_iplist is guaranteeded to be always NULL here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Convert namecache_fetch() and it's only caller to return a talloc'ed...
Jeremy Allison [Wed, 26 Aug 2020 22:42:15 +0000 (15:42 -0700)]
s3: libsmb: Convert namecache_fetch() and it's only caller to return a talloc'ed array of struct samba_sockaddr.

Eventually everything will be talloced arrays of samba_sockaddr.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup the code to do one address return given an IP address to _interna...
Jeremy Allison [Wed, 26 Aug 2020 22:26:54 +0000 (15:26 -0700)]
s3: libsmb: Cleanup the code to do one address return given an IP address to _internal_resolve_name().

Will make easier to move to talloc later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Change remove_duplicate_addrs2() to take and return size_t, not int.
Jeremy Allison [Wed, 26 Aug 2020 22:16:48 +0000 (15:16 -0700)]
s3: libsmb: Change remove_duplicate_addrs2() to take and return size_t, not int.

Will make converting _internal_resolve_name() to return a size_t easier.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Move talloc_stackframe() initialization to the front of _internal_resolve...
Jeremy Allison [Wed, 26 Aug 2020 20:59:14 +0000 (13:59 -0700)]
s3: libsmb: Move talloc_stackframe() initialization to the front of _internal_resolve_name().

Ensure we free correctly on all exit paths.
This will allow us to move the internal calls to
talloc more easily.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Rename internal_resolve_name_talloc() -> internal_resolve_name().
Jeremy Allison [Wed, 26 Aug 2020 20:56:50 +0000 (13:56 -0700)]
s3: libsmb: Rename internal_resolve_name_talloc() -> internal_resolve_name().

No more non-talloc callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove internal_resolve_name() externally. All callers now use internal_r...
Jeremy Allison [Wed, 26 Aug 2020 20:53:35 +0000 (13:53 -0700)]
s3: libsmb: Remove internal_resolve_name() externally. All callers now use internal_resolve_name_talloc().

Make the wrapped internal_resolve_name() function static as _internal_resolve_name().

Now we can rename the callers back from internal_resolve_name_talloc() -> internal_resolve_name()
as all external callers are talloc-based.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3/libsmb: Cleanup, don't modify out params except on success
Noel Power [Fri, 4 Sep 2020 02:11:08 +0000 (19:11 -0700)]
s3/libsmb: Cleanup, don't modify out params except on success

All callers don't use out params on failure.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: libsmb: Make discover_dc_netbios() use internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:47:55 +0000 (13:47 -0700)]
s3: libsmb: Make discover_dc_netbios() use internal_resolve_name_talloc().

No more external users of internal_resolve_name().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Make get_dc_list() use internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:41:15 +0000 (13:41 -0700)]
s3: libsmb: Make get_dc_list() use internal_resolve_name_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Make get_pdc_ip() use internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:35:22 +0000 (13:35 -0700)]
s3: libsmb: Make get_pdc_ip() use internal_resolve_name_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Make find_master_ip() use internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:32:15 +0000 (13:32 -0700)]
s3: libsmb: Make find_master_ip() use internal_resolve_name_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3/libsmb: resolve_name_list don't update out params except for success
Noel Power [Fri, 4 Sep 2020 02:07:08 +0000 (19:07 -0700)]
s3/libsmb: resolve_name_list don't update out params except for success

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: libsmb: Make resolve_name_list() use internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:30:02 +0000 (13:30 -0700)]
s3: libsmb: Make resolve_name_list() use internal_resolve_name_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: namequery - Make resolve_name() use internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:28:12 +0000 (13:28 -0700)]
s3: libsmb: namequery - Make resolve_name() use internal_resolve_name_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: namequery - Add internal_resolve_name_talloc().
Jeremy Allison [Wed, 26 Aug 2020 20:25:07 +0000 (13:25 -0700)]
s3: libsmb: namequery - Add internal_resolve_name_talloc().

This is a wrapper function for internal_resolve_name()
that converts the replies from malloc() -> talloc().

Now to move the callers, and I can move the talloc
code down one level again.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Make get_dc_list() internal to namequery.c return talloc'ed ip_service...
Jeremy Allison [Wed, 26 Aug 2020 19:31:53 +0000 (12:31 -0700)]
s3: libsmb: Make get_dc_list() internal to namequery.c return talloc'ed ip_service array.

Moving closer to the target of making internal_resolve_name()
use talloc.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup - use early return in get_dc_list().
Jeremy Allison [Wed, 26 Aug 2020 19:19:31 +0000 (12:19 -0700)]
s3: libsmb: Cleanup - use early return in get_dc_list().

No logic change. Makes later code changes clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Change get_dc_list() to return a size_t count parameter.
Jeremy Allison [Wed, 26 Aug 2020 19:13:08 +0000 (12:13 -0700)]
s3: libsmb: Change get_dc_list() to return a size_t count parameter.

Remove paranoia checks and casts from callers, move internally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Change to an early return in get_dc_list().
Jeremy Allison [Wed, 26 Aug 2020 19:07:18 +0000 (12:07 -0700)]
s3: libsmb: Change to an early return in get_dc_list().

No logic change. Will make later code changes clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup - rename ctx -> frame for a talloc_stackframe to match modern...
Jeremy Allison [Wed, 26 Aug 2020 19:05:06 +0000 (12:05 -0700)]
s3: libsmb: Cleanup - rename ctx -> frame for a talloc_stackframe to match modern coding standards.

We will be passing in a real TALLOC_CTX soon.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Rename get_sorted_dc_list_talloc() -> get_sorted_dc_list()
Jeremy Allison [Wed, 26 Aug 2020 19:03:31 +0000 (12:03 -0700)]
s3: libsmb: Rename get_sorted_dc_list_talloc() -> get_sorted_dc_list()

There are no non-talloc callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove get_sorted_dc_list().
Jeremy Allison [Wed, 26 Aug 2020 19:01:18 +0000 (12:01 -0700)]
s3: libsmb: Remove get_sorted_dc_list().

No more callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: winbindd: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 19:00:00 +0000 (12:00 -0700)]
s3: winbindd: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: net lookup: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:56:00 +0000 (11:56 -0700)]
s3: net lookup: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:53:07 +0000 (11:53 -0700)]
s3: libsmb: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libads: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:50:46 +0000 (11:50 -0700)]
s3: libads: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Add get_sorted_dc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:47:44 +0000 (11:47 -0700)]
s3: libsmb: Add get_sorted_dc_list_talloc().

Talloc version of get_sorted_dc_list_talloc().
Makes use of dup_ip_service_array().
Now to move the callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libads: Rename get_kdc_list_talloc() -> get_kdc_list().
Jeremy Allison [Wed, 26 Aug 2020 18:43:32 +0000 (11:43 -0700)]
s3: libads: Rename get_kdc_list_talloc() -> get_kdc_list().

It's the only version now.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Remove now unused get_kdc_list() (non-talloc version).
Jeremy Allison [Wed, 26 Aug 2020 18:39:54 +0000 (11:39 -0700)]
s3: libsmb: Remove now unused get_kdc_list() (non-talloc version).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: utils: net_lookup. Convert to use get_kdc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:38:31 +0000 (11:38 -0700)]
s3: utils: net_lookup. Convert to use get_kdc_list_talloc().

No more users of get_kdc_list().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3/libads: Cleanup() get_kdc_ip_string, free kdc_str on error
Noel Power [Fri, 4 Sep 2020 11:02:58 +0000 (12:02 +0100)]
s3/libads: Cleanup() get_kdc_ip_string, free kdc_str on error

kdc_str will be cleaned up when the passed ctx is freed,
it just seems odd that we now return NULL without cleaning up allocated mem.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/libads: Only set result to kdc_str on success
Noel Power [Fri, 4 Sep 2020 09:38:27 +0000 (10:38 +0100)]
s3/libads: Only set result to kdc_str on success

Prior to this change result was set even when any or all errors
occured in the function.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: libads: Make get_kdc_ip_string() use get_kdc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:30:36 +0000 (11:30 -0700)]
s3: libads: Make get_kdc_ip_string() use get_kdc_list_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Add get_kdc_list_talloc().
Jeremy Allison [Wed, 26 Aug 2020 18:26:33 +0000 (11:26 -0700)]
s3: libsmb: Add get_kdc_list_talloc().

Talloc version of get_kdc_list(). Makes use of dup_ip_service_array().
Now to move the callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Add utility funtion dup_ip_service_array().
Jeremy Allison [Tue, 25 Aug 2020 17:22:10 +0000 (10:22 -0700)]
s3: libsmb: Add utility funtion dup_ip_service_array().

Preparing to return ip_service arrays as talloc, not
malloc. Commented out as not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup - Use helper variable for return from namecache_fetch() in intern...
Jeremy Allison [Wed, 26 Aug 2020 22:20:22 +0000 (15:20 -0700)]
s3: libsmb: Cleanup - Use helper variable for return from namecache_fetch() in internal_resolve_name().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup in resolve_name_list().
Noel Power [Wed, 2 Sep 2020 17:52:08 +0000 (10:52 -0700)]
s3: libsmb: Cleanup in resolve_name_list().

Don't modify out params (unless successful result).

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: libsmb: Cleanup - correctly error on sockaddr_storage_to_samba_sockaddr() fail.
Jeremy Allison [Thu, 27 Aug 2020 16:49:05 +0000 (09:49 -0700)]
s3: libsmb: Cleanup - correctly error on sockaddr_storage_to_samba_sockaddr() fail.

Instead of jumping out and leaking the memory onto ctx,
skip bad conversions and error out if there are no addresses
to return (and cleanup the memory there).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when...
Noel Power [Fri, 4 Sep 2020 02:03:52 +0000 (19:03 -0700)]
s3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when calling resolve_name_list()

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when...
Jeremy Allison [Wed, 2 Sep 2020 17:05:48 +0000 (10:05 -0700)]
s3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when calling get_sorted_dc_list() that may not touch returns on error.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when...
Jeremy Allison [Wed, 2 Sep 2020 16:58:30 +0000 (09:58 -0700)]
s3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when calling get_kdc_list() that may not touch returns on error.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos3: libsmb: discover_dc_netbios(). Remember to free on error return.
Jeremy Allison [Wed, 26 Aug 2020 20:45:43 +0000 (13:45 -0700)]
s3: libsmb: discover_dc_netbios(). Remember to free on error return.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
3 years agos4:smb_server: Use cli_credentials_init_server() for negprot
Andreas Schneider [Mon, 7 Sep 2020 07:19:43 +0000 (09:19 +0200)]
s4:smb_server: Use cli_credentials_init_server() for negprot

Signed-off-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Sep  7 13:22:26 UTC 2020 on sn-devel-184

3 years agos4:rpc_server: Use cli_credentials_init_server()
Andreas Schneider [Fri, 4 Sep 2020 10:21:36 +0000 (12:21 +0200)]
s4:rpc_server: Use cli_credentials_init_server()

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agoauth:creds: Add cli_credentials_init_server()
Andreas Schneider [Fri, 4 Sep 2020 10:21:21 +0000 (12:21 +0200)]
auth:creds: Add cli_credentials_init_server()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoauth:gensec: If Kerberos is required, keep schannel for machine account auth
Stefan Metzmacher [Fri, 4 Sep 2020 15:00:45 +0000 (17:00 +0200)]
auth:gensec: If Kerberos is required, keep schannel for machine account auth

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agoauth:gensec: Pass use_kerberos and keep_schannel to gensec_use_kerberos_mechs()
Stefan Metzmacher [Fri, 4 Sep 2020 12:41:43 +0000 (14:41 +0200)]
auth:gensec: Pass use_kerberos and keep_schannel to gensec_use_kerberos_mechs()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoauth:gensec: Make gensec_use_kerberos_mechs() a static function
Stefan Metzmacher [Fri, 4 Sep 2020 12:39:15 +0000 (14:39 +0200)]
auth:gensec: Make gensec_use_kerberos_mechs() a static function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos4:ldap_server: Use samba_server_gensec_start() in ldapsrv_backend_Init()
Stefan Metzmacher [Fri, 4 Sep 2020 08:48:27 +0000 (10:48 +0200)]
s4:ldap_server: Use samba_server_gensec_start() in ldapsrv_backend_Init()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoauth:gensec: Add gensec_security_sasl_names()
Stefan Metzmacher [Fri, 4 Sep 2020 08:47:54 +0000 (10:47 +0200)]
auth:gensec: Add gensec_security_sasl_names()

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 years agowaf: upgrade to 2.0.20
David Mulder [Mon, 24 Aug 2020 19:12:46 +0000 (13:12 -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>
3 years agobootstrap: install perl-JSON on on rpm distributions
Stefan Metzmacher [Fri, 3 Apr 2020 10:16:08 +0000 (12:16 +0200)]
bootstrap: install perl-JSON on on rpm distributions

This will be needed for the next heimdal import.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agobootstrap: document git push -o ci.variable='SAMBA_CI_REBUILD_IMAGES=yes'
Stefan Metzmacher [Thu, 6 Aug 2020 13:27:24 +0000 (15:27 +0200)]
bootstrap: document git push -o ci.variable='SAMBA_CI_REBUILD_IMAGES=yes'

This is much easier than going through the web interface.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopython/tests/gpo: this should fix a Popen deadlock
Stefan Metzmacher [Mon, 7 Sep 2020 08:31:36 +0000 (10:31 +0200)]
python/tests/gpo: this should fix a Popen deadlock

It is inspired by commit 5dc773a5b00834c7a53130a73a48f49048bd55e8
   Author: Joe Guo <joeg@catalyst.net.nz>
   Date:   Fri Sep 15 16:13:26 2017 +1200

      python: use communicate to fix Popen deadlock

      `Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the
      child process generates large output to a pipe such that it blocks waiting for
      the OS pipe buffer to accept more data. Use communicate() to avoid that.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
      Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
      Autobuild-Date(master): Thu Oct 19 09:27:16 CEST 2017 on sn-devel-144

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
3 years agos3:libads: Also add a realm entry for the domain name
Andreas Schneider [Thu, 3 Sep 2020 11:49:33 +0000 (13:49 +0200)]
s3:libads: Also add a realm entry for the domain name

This is required if we try to authenticate as Administrator@DOMAIN so it
can find the KDC. This fixes 'net ads join' for ad_member_fips if we
require Kerberos auth.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Sep  7 09:25:33 UTC 2020 on sn-devel-184

3 years agos3:libads: Only add RC4 if weak crypto is allowed
Andreas Schneider [Thu, 3 Sep 2020 09:45:33 +0000 (11:45 +0200)]
s3:libads: Only add RC4 if weak crypto is allowed

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
3 years agos3:libads: Remove DES legacy types for Kerberos
Andreas Schneider [Thu, 3 Sep 2020 09:11:14 +0000 (11:11 +0200)]
s3:libads: Remove DES legacy types for Kerberos

We already removed DES support for Kerberos in Samba 4.12.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
3 years agoFixed arrow keys typo to the computer move command utility
Hezekiah [Tue, 1 Sep 2020 09:54:39 +0000 (12:54 +0300)]
Fixed arrow keys typo to the computer move command utility

Signed-off-by: Hezekiah <hezekiahmaina3@gmail.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Fri Sep  4 16:57:30 UTC 2020 on sn-devel-184

3 years agobuild: avoid some unnecessary list.extend() calls
David Disseldorp [Wed, 2 Sep 2020 13:19:52 +0000 (15:19 +0200)]
build: avoid some unnecessary list.extend() calls

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Thu Sep  3 13:33:54 UTC 2020 on sn-devel-184

3 years agobuild: avoid unnecessary TO_LIST() calls for static strings
David Disseldorp [Wed, 2 Sep 2020 12:35:21 +0000 (14:35 +0200)]
build: avoid unnecessary TO_LIST() calls for static strings

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agobuild: toggle vfs_snapper using --with-shared-modules
David Disseldorp [Wed, 2 Sep 2020 08:50:04 +0000 (10:50 +0200)]
build: toggle vfs_snapper using --with-shared-modules

7ae03a19b3c ("build: add configure option to control vfs_snapper build")
added new --enable-snapper and --disable-snapper configure parameters to
control whether the vfs_snapper module was built.
The new parameters conflicted with existing
--with-shared-modules=[!]vfs_snapper behaviour.

This change reinstates working --with-shared-modules=[!]vfs_snapper
functionality. vfs_snapper stays enabled by default, but only on Linux.
Linux systems lacking the dbus library and header files should
explicitly disable the module via --with-shared-modules=!vfs_snapper as
documented.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Sep  2 16:24:50 UTC 2020 on sn-devel-184

3 years agotests: Make sure that idmap_ad retrieves unix nss attributes
Volker Lendecke [Sun, 30 Aug 2020 09:45:56 +0000 (11:45 +0200)]
tests: Make sure that idmap_ad retrieves unix nss attributes

Make sure that unix_primary_group and unix_nss_info idmap_ad options
work. We have two domains here and test wbinfo -i for both domains, so
we also run the test without those options for the trusted domain.

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 Sep  2 10:35:53 UTC 2020 on sn-devel-184