samba.git
3 years agoparam: Allow tests to silence deprecation warnings
Andrew Bartlett [Wed, 29 Jul 2020 09:26:55 +0000 (21:26 +1200)]
param: Allow tests to silence deprecation warnings

This helps make output sensitive tests more reliable.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest: Add test for suppression of deprecation warnings
Andrew Bartlett [Mon, 10 Aug 2020 00:18:07 +0000 (12:18 +1200)]
selftest: Add test for suppression of deprecation warnings

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoauth: Fix a typo
Volker Lendecke [Wed, 12 Aug 2020 14:33:54 +0000 (16:33 +0200)]
auth: Fix a typo

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 Aug 17 20:59:51 UTC 2020 on sn-devel-184

3 years agotests: Fix typos
Volker Lendecke [Tue, 11 Aug 2020 10:34:14 +0000 (12:34 +0200)]
tests: Fix typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoFix a comment typo copied around
Volker Lendecke [Sun, 9 Aug 2020 14:14:02 +0000 (16:14 +0200)]
Fix a comment typo copied around

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoldap_server: Fix a typo
Volker Lendecke [Thu, 6 Aug 2020 16:39:01 +0000 (18:39 +0200)]
ldap_server: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture: Align a few integer types
Volker Lendecke [Mon, 3 Aug 2020 19:55:51 +0000 (21:55 +0200)]
torture: Align a few integer types

Also move a variable closer to its use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture: Fix a typo
Volker Lendecke [Tue, 4 Aug 2020 07:43:28 +0000 (09:43 +0200)]
torture: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture: Fix a typo
Volker Lendecke [Mon, 3 Aug 2020 19:48:41 +0000 (21:48 +0200)]
torture: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogensec: Fix a typo
Volker Lendecke [Wed, 22 Jul 2020 09:49:49 +0000 (11:49 +0200)]
gensec: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoauth_log_test: Fix a typo
Volker Lendecke [Sun, 19 Jul 2020 19:38:29 +0000 (21:38 +0200)]
auth_log_test: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotest: Fix a typo
Volker Lendecke [Mon, 29 Jun 2020 12:59:54 +0000 (14:59 +0200)]
test: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Move get_socket_port() to its only consumer
Volker Lendecke [Fri, 17 Jul 2020 20:29:10 +0000 (22:29 +0200)]
lib: Move get_socket_port() to its only consumer

This is only used in netbios_session_retarget()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Remove unused client_socket_port()
Volker Lendecke [Fri, 17 Jul 2020 10:56:43 +0000 (12:56 +0200)]
lib: Remove unused client_socket_port()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Align integer types in same_net()
Volker Lendecke [Tue, 21 Jul 2020 13:45:24 +0000 (15:45 +0200)]
lib: Align integer types in same_net()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Remove unused client_socket_addr()
Volker Lendecke [Fri, 17 Jul 2020 10:55:53 +0000 (12:55 +0200)]
lib: Remove unused client_socket_addr()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Remove unused client_addr()
Volker Lendecke [Fri, 17 Jul 2020 10:52:15 +0000 (12:52 +0200)]
lib: Remove unused client_addr()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Remove unused open_udp_socket()
Volker Lendecke [Fri, 17 Jul 2020 10:48:10 +0000 (12:48 +0200)]
lib: Remove unused open_udp_socket()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Move read_udp_v4_socket() to nmbd
Volker Lendecke [Fri, 17 Jul 2020 10:40:28 +0000 (12:40 +0200)]
lib: Move read_udp_v4_socket() to nmbd

This is the only consumer of it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Move send_keepalive() to smbd/smb1_utils.c
Volker Lendecke [Fri, 17 Jul 2020 10:36:22 +0000 (12:36 +0200)]
lib: Move send_keepalive() to smbd/smb1_utils.c

This is a SMB1-only packet sent from smbd only

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoldap_server: Do an early TALLOC_FREE()
Volker Lendecke [Mon, 10 Aug 2020 12:48:45 +0000 (14:48 +0200)]
ldap_server: Do an early TALLOC_FREE()

We don't need the asn1 struct after this point anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug 17 11:10:04 UTC 2020 on sn-devel-184

3 years agoldap_server: Avoid talloc_memdup() for ldap_decode()
Volker Lendecke [Mon, 10 Aug 2020 12:47:26 +0000 (14:47 +0200)]
ldap_server: Avoid talloc_memdup() for ldap_decode()

Slight optimization for the ldap server: We don't need to copy the
client PDU into the ASN1 struct, the decoding process happens
immediately in the same routine.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoctdb-doc: Link to CTDB page in wiki
Martin Schwenke [Sat, 8 Aug 2020 11:05:55 +0000 (21:05 +1000)]
ctdb-doc: Link to CTDB page in wiki

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Aug 17 06:13:11 UTC 2020 on sn-devel-184

3 years agoWHATSNEW: Document removal of "ctdb isnotrecmaster" command
Martin Schwenke [Fri, 7 Aug 2020 02:21:33 +0000 (12:21 +1000)]
WHATSNEW: Document removal of "ctdb isnotrecmaster" command

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tools: Drop "ctdb isnotrecmaster" command
Martin Schwenke [Fri, 7 Aug 2020 02:19:09 +0000 (12:19 +1000)]
ctdb-tools: Drop "ctdb isnotrecmaster" command

This isn't used anywhere and can easily be checked via "ctdb pnn" and
"ctdb recmaster" commands.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoutil: Add cmocka unit test for directory_create_or_exists
Christof Schmitt [Fri, 14 Aug 2020 19:18:51 +0000 (12:18 -0700)]
util: Add cmocka unit test for directory_create_or_exists

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sun Aug 16 07:06:59 UTC 2020 on sn-devel-184

3 years agoutil: Allow symlinks in directory_create_or_exist
Christof Schmitt [Fri, 14 Aug 2020 16:36:26 +0000 (09:36 -0700)]
util: Allow symlinks in directory_create_or_exist

Commit 9f60a77e0b updated the check to avoid having files or other
objects instead of a directory. This missed the valid case that there
might be a symlink to a directory. Updated the check accordingly to
allow symlinks to directories.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agolib/util: Standardize use of st_[acm]time ns
Matthew DeVore [Wed, 5 Aug 2020 00:49:42 +0000 (17:49 -0700)]
lib/util: Standardize use of st_[acm]time ns

Commit 810397f89a10, and possibly others, broke the build for macOS and
other environments which don't have st_[acm]tim fields on 'struct stat'.

Multiple places in the codebase used the config.h values to determine
how to access the nanosecond or microsecond values of the stat
timestamps, so rather than add more, centralize them all into
lib/util/time.c.

Also allow pvfs_fileinfo.c to read nanosecond-granularity timestamps on
platforms where it didn't before, since its #if branches were not
complete.

Signed-off-by: Matthew DeVore <matvore@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Aug 15 08:51:09 UTC 2020 on sn-devel-184

3 years agos3: lib: Fix unneeded relative path in #include.
Matthew DeVore [Thu, 6 Aug 2020 18:18:58 +0000 (11:18 -0700)]
s3: lib: Fix unneeded relative path in #include.

Signed-off-by: Matthew DeVore <matvore@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agolibsmb: Fix CID 1465860 Control flow issues (DEADCODE)
Volker Lendecke [Tue, 11 Aug 2020 07:51:39 +0000 (09:51 +0200)]
libsmb: Fix CID 1465860 Control flow issues (DEADCODE)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Aug 11 18:00:26 UTC 2020 on sn-devel-184

3 years agopython compat: remove text_type
Douglas Bagnall [Sat, 4 Jul 2020 02:27:06 +0000 (14:27 +1200)]
python compat: remove text_type

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agopython compat: remove binary_type
Douglas Bagnall [Sat, 4 Jul 2020 02:05:16 +0000 (14:05 +1200)]
python compat: remove binary_type

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agopython compat: reduce use of 'if PY3:'
Douglas Bagnall [Sat, 4 Jul 2020 02:01:32 +0000 (14:01 +1200)]
python compat: reduce use of 'if PY3:'

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agopython compat: remove StringIO
Douglas Bagnall [Sat, 4 Jul 2020 01:53:34 +0000 (13:53 +1200)]
python compat: remove StringIO

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agopython compat: remove string_types
Douglas Bagnall [Sat, 4 Jul 2020 01:47:44 +0000 (13:47 +1200)]
python compat: remove string_types

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agopython compat: remove integer_types
Douglas Bagnall [Sat, 4 Jul 2020 01:44:52 +0000 (13:44 +1200)]
python compat: remove integer_types

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
3 years agoRemove depracated "ldap ssl ads" smb.conf option
Isaac Boukris [Mon, 10 Aug 2020 10:15:26 +0000 (12:15 +0200)]
Remove depracated "ldap ssl ads" smb.conf option

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

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Tue Aug 11 10:53:05 UTC 2020 on sn-devel-184

3 years agoRevert "selftest: add tests for net-ads over TLS"
Isaac Boukris [Mon, 10 Aug 2020 10:21:51 +0000 (12:21 +0200)]
Revert "selftest: add tests for net-ads over TLS"

As we are removing the option.

This reverts commit 10f61cd39b9e03e7bb781edf04022ea6ae1f1cac.

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

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolzxpress: add bounds checking to lzxpress_decompress()
Stefan Metzmacher [Thu, 7 Nov 2019 09:03:36 +0000 (10:03 +0100)]
lzxpress: add bounds checking to lzxpress_decompress()

lzxpress_decompress() would wander past the end of the array in
numerous locations.

Credit to OSS-Fuzz.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14190
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19382
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22485
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22667

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Sun Aug  9 00:30:26 UTC 2020 on sn-devel-184

3 years agowinbind: directly use dcerpc_binding_handle_is_connected() in reset_connection_on_err...
Ralph Boehme [Fri, 7 Aug 2020 10:07:28 +0000 (12:07 +0200)]
winbind: directly use dcerpc_binding_handle_is_connected() in reset_connection_on_error() SAMR code

In the end we should avoid rpccli_is_connected(), rpccli_set_timeout() and the
whole rpc_pipe_client concept.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Aug  8 10:59:38 UTC 2020 on sn-devel-184

3 years agos3:rpc_client: reverse rpccli_{is_connected,set_timeout}() and rpccli_bh_{is_connecte...
Stefan Metzmacher [Fri, 7 Aug 2020 13:57:15 +0000 (15:57 +0200)]
s3:rpc_client: reverse rpccli_{is_connected,set_timeout}() and rpccli_bh_{is_connected,set_timeout}()

rpccli->transport should never be used directly,
everything should go via the binding handle.

Internal pipes don't have a transport, so p->transport is always
NULL. rpccli_is_connected() checks this and this causes all SAMR and LSA
requests for the local domain to be processed a second time by the triggered
retry logic.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: libsmb: Cleanup - Remove the last use of a struct sockaddr_storage variable in...
Jeremy Allison [Wed, 5 Aug 2020 18:37:03 +0000 (11:37 -0700)]
s3: libsmb: Cleanup - Remove the last use of a struct sockaddr_storage variable in dsgetdcname.c

Remove from process_dc_netbios().

This is a logic change, but as all the logic did was force a round-trip
through converting an already guaranteed numeric hostname printed by
print_sockaddr() inside discover_dc_netbios() to a struct
sockaddr_storage and then discard the result (!) I think it's harmless.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Aug  7 07:58:14 UTC 2020 on sn-devel-184

3 years agos3: libsmb: Cleanup - Move dsgetdcname.c to using struct samba_sockaddr internally.
Jeremy Allison [Tue, 28 Jul 2020 18:54:02 +0000 (11:54 -0700)]
s3: libsmb: Cleanup - Move dsgetdcname.c to using struct samba_sockaddr internally.

Mostly renames of ss -> sa and access union members. No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Change dns_lookup_list_async() and associated functions to return a struc...
Jeremy Allison [Tue, 28 Jul 2020 23:51:03 +0000 (16:51 -0700)]
s3: libsmb: Change dns_lookup_list_async() and associated functions to return a struct samba_sockaddr * array.

This fullfills the promise to Andreas and Metze
of all new code using struct samba_sockaddr.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Add utility function sockaddr_storage_to_samba_sockaddr().
Jeremy Allison [Tue, 28 Jul 2020 18:28:19 +0000 (11:28 -0700)]
s3: libsmb: Add utility function sockaddr_storage_to_samba_sockaddr().

As requested by Andreas and Metze, ensure new code uses
struct samba_sockaddr. This is part of changing dns_lookup_list_async()
and callers to use struct samba_sockaddr.

Currently putting this into namequery.c even though it's
used inside dsgetdcname.c as I have future patches that
heavily make use of this to convert sockaddr_storage -> samba_sockaddr.

I'm not committed to putting it here, it may fit better
in lib/util/util_net.[ch]. It just needs to be somewhere
other functions inside source/libsmb/*.c can get to it,
and currently namequery.h exports the most stuff.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Make discover_dc_dns() use async DNS.
Jeremy Allison [Wed, 22 Jul 2020 05:09:27 +0000 (22:09 -0700)]
s3: libsmb: Make discover_dc_dns() use async DNS.

Change to call dns_lookup_list_async(). This is
doing the samba SRV lookup followed by A and AAAA
record host lookup as resolve_ads() does and so
benefits from the same changes to make it async.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Make dns_lookup_list_async() available to other Samba callers.
Jeremy Allison [Tue, 21 Jul 2020 21:56:47 +0000 (14:56 -0700)]
s3: libsmb: Make dns_lookup_list_async() available to other Samba callers.

This allows the async DNS lookups to be re-used inside the dsgetdcname() internals
code as previously described.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Remove dns_lookup_list(). No longer used.
Jeremy Allison [Wed, 22 Jul 2020 05:14:02 +0000 (22:14 -0700)]
s3: libsmb: Remove dns_lookup_list(). No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Use dns_lookup_list_async() instead of dns_lookup_list().
Jeremy Allison [Tue, 21 Jul 2020 19:38:42 +0000 (12:38 -0700)]
s3: libsmb: Use dns_lookup_list_async() instead of dns_lookup_list().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: libsmb: Add dns_lookup_list_async() - not yet used.
Jeremy Allison [Tue, 21 Jul 2020 19:34:02 +0000 (12:34 -0700)]
s3: libsmb: Add dns_lookup_list_async() - not yet used.

Take a list of hostnames and does async A and AAAA (if
supported) lookups on them. Interface compatible with
dns_lookup_list() (with the addition of one extra
parameter returning the query name list, for use inside
dsgetdcname() internals later) and we'll replace it in the next
commit. Waits for lp_get_async_dns_timeout() seconds to complete.

Commented out as not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1.
Jeremy Allison [Thu, 23 Jul 2020 20:10:12 +0000 (13:10 -0700)]
s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos4: tests: Add new async DNS unit test - samba4.blackbox.net_ads_dns_async(ad_member...
Jeremy Allison [Wed, 5 Aug 2020 22:46:04 +0000 (15:46 -0700)]
s4: tests: Add new async DNS unit test - samba4.blackbox.net_ads_dns_async(ad_member:local).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: net: Add new 'net ads dns async <name>' command.
Jeremy Allison [Fri, 17 Jul 2020 21:45:45 +0000 (14:45 -0700)]
s3: net: Add new 'net ads dns async <name>' command.

Will test the async DNS lookups in the next commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib: addns: Add code for asynchronously looking up AAAA records.
Jeremy Allison [Fri, 17 Jul 2020 21:30:02 +0000 (14:30 -0700)]
lib: addns: Add code for asynchronously looking up AAAA records.

Returns an array of struct samba_sockaddr.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib: addns: Add code for asynchronously looking up A records.
Jeremy Allison [Fri, 17 Jul 2020 21:21:09 +0000 (14:21 -0700)]
lib: addns: Add code for asynchronously looking up A records.

Returns an array of struct samba_sockaddr.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolibprc/test: add pull_string_array large array test
Douglas Bagnall [Thu, 6 Aug 2020 05:07:09 +0000 (17:07 +1200)]
libprc/test: add pull_string_array large array test

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Aug  7 04:44:17 UTC 2020 on sn-devel-184

3 years agondr: fix ndr_pull_string_array() off by one alloc
Douglas Bagnall [Tue, 4 Aug 2020 23:04:11 +0000 (11:04 +1200)]
ndr: fix ndr_pull_string_array() off by one alloc

The correct line should have been

       talloc_realloc(ndr->current_mem_ctx, a, const char *, count + 2);

because if the loop does not increment count on exit (it exits via
break), so count is left pointing at the thing that just got put in.
i.e., if there was one item it is at a[0], count is 0, but we also
need the trailing NULL byte at a[1] and the length is 2. Thus + 2, not
+ 1.

This will not affect ordinary (that is, non-malicious) traffic,
because talloc_realloc will not actually realloc unless it is saving a
kilobyte. Since the allocation grows slowly with the exponent ~1.25,
the actual reallocs will start happening at some point between 512 and
1024 items.

In the example we have, there were 666 pointers, and space for 824 was
allocated.

Rather than doing the +2 realloc, it is simpler to leave it off
altogether; in the common case (<512 items) it is a no-op anyway, and
in the best possible case it reduces the temporary array by 20%.

Credit to OSS-Fuzz.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agokdc: Remind us that these values need to match other values
Andrew Bartlett [Thu, 20 Sep 2018 02:24:32 +0000 (19:24 -0700)]
kdc: Remind us that these values need to match other values

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoselftest: Work around existing CA certificates to get PKINIT tests working
Andrew Bartlett [Tue, 18 Sep 2018 04:44:20 +0000 (21:44 -0700)]
selftest: Work around existing CA certificates to get PKINIT tests working

This could be reverted in the future, but for now the certificate validation is not what
we are testing and this allows the heimdal upgrade to work.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal_build: Add missing dependency on heimbase
Andrew Bartlett [Thu, 6 Sep 2018 02:55:09 +0000 (14:55 +1200)]
heimdal_build: Add missing dependency on heimbase

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoRevert "build: fix the coverage build"
Andrew Bartlett [Wed, 27 May 2020 09:50:41 +0000 (21:50 +1200)]
Revert "build: fix the coverage build"

This reverts commit 3e072b3fb78f0d3132b1d3ce719b8f3706e8491a.

This is no longer required now that --noline is set globally
and that is a much nicer solution.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal_build: Do not allow warnings in the heimdal code!
Gary Lockyer [Mon, 25 Sep 2017 01:16:48 +0000 (14:16 +1300)]
heimdal_build: Do not allow warnings in the heimdal code!

(const excepted)

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Updated to 2020 requirements since changes in
13a2f70a4dd6dd68e0dbd0379d35409c5f100f06

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCompile .l files (flex) with the waf rule at runtime
Andrew Bartlett [Wed, 27 May 2020 09:31:43 +0000 (21:31 +1200)]
Compile .l files (flex) with the waf rule at runtime

Other parts of Samba already compile these directly.

This makes these files compile with modern compiler warnings.

The primary difference (other than being built with a newer
flex) is the loss of the #include "config.h" but
this is not used in the other .l files elsewehre and does not
seem to matter on modern systems.

The generated output from compile_et asn1_compile has not changed
(so I think the hx509 case is safe).

The mdssvc case just has changed file locations and line numbers.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal_build: provide a prototype with the dummy afs header-only function stubs
Gary Lockyer [Mon, 25 Sep 2017 01:16:09 +0000 (14:16 +1300)]
heimdal_build: provide a prototype with the dummy afs header-only function stubs

We do not do AFS in Samba

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal_build: Include keys.c in the hdb autoproto
Gary Lockyer [Mon, 25 Sep 2017 01:00:51 +0000 (14:00 +1300)]
heimdal_build: Include keys.c in the hdb autoproto

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoMake HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE available in krb5.h
Gary Lockyer [Thu, 21 Sep 2017 04:19:57 +0000 (16:19 +1200)]
Make HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE available in krb5.h

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal: Exclude more of plugin.c if HAVE_DLOPEN (which Samba unsets) is not set
Andrew Bartlett [Wed, 27 May 2020 10:18:31 +0000 (22:18 +1200)]
heimdal: Exclude more of plugin.c if HAVE_DLOPEN (which Samba unsets) is not set

This allows us to avoid warnings and errors due to unsued variables
and functions.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal: Use #ifdef HAVE_DLOPEN around function used by HAVE_DLOPEN
Gary Lockyer [Mon, 25 Sep 2017 00:58:10 +0000 (13:58 +1300)]
heimdal: Use #ifdef HAVE_DLOPEN around function used by HAVE_DLOPEN

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoheimdal: Use #ifdef HAVE_DLOPEN around functions used only by HAVE_DLOPEN
Gary Lockyer [Mon, 25 Sep 2017 01:15:28 +0000 (14:15 +1300)]
heimdal: Use #ifdef HAVE_DLOPEN around functions used only by HAVE_DLOPEN

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agowafsamba: run SAMBA_GENERATOR('VERSION') with group='setup'
Stefan Metzmacher [Wed, 1 Apr 2020 21:51:59 +0000 (23:51 +0200)]
wafsamba: run SAMBA_GENERATOR('VERSION') with group='setup'

This means this is the first thing that's done.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agolibsmb: Fix CID 1465656 Resource leak
Volker Lendecke [Wed, 5 Aug 2020 14:22:10 +0000 (16:22 +0200)]
libsmb: Fix CID 1465656 Resource leak

This is very likely a false positive, because Coverity does not see
that we only assign "dns_addrs" when NT_STATUS_IS_OK(status), so we
might not want this. But it is a fresh finding and looks cleaner this
way.

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 Aug  6 20:23:53 UTC 2020 on sn-devel-184

3 years agolibcli/ldap: Fix CID 1462695 Resource leak
Volker Lendecke [Wed, 5 Aug 2020 09:25:27 +0000 (11:25 +0200)]
libcli/ldap: Fix CID 1462695 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibcli/ldap: Fix CID 1462696 Resource leak
Volker Lendecke [Wed, 5 Aug 2020 09:23:30 +0000 (11:23 +0200)]
libcli/ldap: Fix CID 1462696 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibcli/ldap: Fix CID 1465278 Resource leak
Volker Lendecke [Wed, 5 Aug 2020 09:18:35 +0000 (11:18 +0200)]
libcli/ldap: Fix CID 1465278 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogpo: Remove unused gp_ext_setter code
David Mulder [Wed, 8 Jul 2020 20:50:27 +0000 (14:50 -0600)]
gpo: Remove unused gp_ext_setter code

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Thu Aug  6 18:01:49 UTC 2020 on sn-devel-184

3 years agogpo: Extract Access policy from Security extension
David Mulder [Wed, 8 Jul 2020 20:48:45 +0000 (14:48 -0600)]
gpo: Extract Access policy from Security extension

Rewrite the extension to be easier to understand,
and to remove references to gp_ext_setter.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Extract Kerberos policy from Security extension
David Mulder [Fri, 26 Jun 2020 21:34:02 +0000 (15:34 -0600)]
gpo: Extract Kerberos policy from Security extension

Rewrite the extension to be easier to understand,
and to remove references to gp_ext_setter.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Add RSOP output for Scripts Extension
David Mulder [Mon, 6 Jul 2020 17:16:45 +0000 (11:16 -0600)]
gpo: Add RSOP output for Scripts Extension

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Add RSOP output for Security Extension
David Mulder [Mon, 6 Jul 2020 17:16:14 +0000 (11:16 -0600)]
gpo: Add RSOP output for Security Extension

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Test samba-gpupdate --rsop
David Mulder [Tue, 7 Jul 2020 16:35:25 +0000 (10:35 -0600)]
gpo: Test samba-gpupdate --rsop

Test that the rsop command produces the expected
output.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Add --rsop option to samba-gpupdate
David Mulder [Mon, 6 Jul 2020 14:25:23 +0000 (08:25 -0600)]
gpo: Add --rsop option to samba-gpupdate

This command prints the Resultant Set of Policy
for applicable GPOs, for either the Computer or
User policy (depending on the target specified).
Policy specific output must be implemented for
each client side extension.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Properly decode utf-8/16 inf files from bytes
David Mulder [Mon, 6 Jul 2020 14:13:57 +0000 (08:13 -0600)]
gpo: Properly decode utf-8/16 inf files from bytes

This code was python 2 specific (string handling
has changed dramatically in python 3), and didn't
correctly decode utf-16 in python3. We should
instead read the file as bytes, then attempt a
utf-8 decode (the default), and try utf-16 if
encountering a decode failure.
The existing code actually throws an exception on
the initial file read when the data is utf-16,
since it tries to decode the bytes to a utf-8
string.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Test proper decoding of utf-16 inf files
David Mulder [Tue, 7 Jul 2020 17:10:10 +0000 (11:10 -0600)]
gpo: Test proper decoding of utf-16 inf files

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Apply Group Policy Sudo Rights
David Mulder [Fri, 26 Jun 2020 18:35:20 +0000 (12:35 -0600)]
gpo: Apply Group Policy Sudo Rights

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Test Group Policy Sudo Rights
David Mulder [Fri, 26 Jun 2020 18:37:11 +0000 (12:37 -0600)]
gpo: Test Group Policy Sudo Rights

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Scripts gpo add warning about generated scripts
David Mulder [Thu, 2 Jul 2020 16:13:15 +0000 (10:13 -0600)]
gpo: Scripts gpo add warning about generated scripts

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Scripts extension use 'gp_' prefix, not 'tmp'
David Mulder [Thu, 2 Jul 2020 16:04:36 +0000 (10:04 -0600)]
gpo: Scripts extension use 'gp_' prefix, not 'tmp'

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Move all scripts to a sub-category in samba.admx
David Mulder [Fri, 26 Jun 2020 19:10:43 +0000 (13:10 -0600)]
gpo: Move all scripts to a sub-category in samba.admx

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Apply Group Policy Weekly Scripts
David Mulder [Thu, 25 Jun 2020 21:23:14 +0000 (15:23 -0600)]
gpo: Apply Group Policy Weekly Scripts

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Test gpo weekly scripts apply
David Mulder [Thu, 25 Jun 2020 21:23:35 +0000 (15:23 -0600)]
gpo: Test gpo weekly scripts apply

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Apply Group Policy Monthly Scripts
David Mulder [Thu, 25 Jun 2020 21:02:37 +0000 (15:02 -0600)]
gpo: Apply Group Policy Monthly Scripts

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Test gpo monthly scripts apply
David Mulder [Thu, 25 Jun 2020 21:03:03 +0000 (15:03 -0600)]
gpo: Test gpo monthly scripts apply

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Apply Group Policy Hourly Scripts
David Mulder [Thu, 25 Jun 2020 20:14:09 +0000 (14:14 -0600)]
gpo: Apply Group Policy Hourly Scripts

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agogpo: Test gpo hourly scripts apply
David Mulder [Thu, 25 Jun 2020 20:15:18 +0000 (14:15 -0600)]
gpo: Test gpo hourly scripts apply

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agolib: fix smb_strtox.[c|h] license header
Ralph Boehme [Wed, 5 Aug 2020 08:11:29 +0000 (10:11 +0200)]
lib: fix smb_strtox.[c|h] license header

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Aug  5 10:17:06 UTC 2020 on sn-devel-184

3 years agos3: libsmb: Move all calls to convert_ss2service() to one place now all methods retur...
Jeremy Allison [Tue, 21 Jul 2020 03:52:58 +0000 (20:52 -0700)]
s3: libsmb: Move all calls to convert_ss2service() to one place now all methods return a sockaddr_storage.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Tue Aug  4 10:13:53 UTC 2020 on sn-devel-184

3 years agos3: libsmb: Now all resolution functions return a ss_list on success, we only need...
Jeremy Allison [Tue, 21 Jul 2020 03:40:02 +0000 (20:40 -0700)]
s3: libsmb: Now all resolution functions return a ss_list on success, we only need one local variable for this.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
3 years agos3: libsmb: Change resolve_ads() to return a talloc'ed ss_list, matching the other...
Jeremy Allison [Tue, 21 Jul 2020 03:17:54 +0000 (20:17 -0700)]
s3: libsmb: Change resolve_ads() to return a talloc'ed ss_list, matching the other name resolution methods.

Now we can move all the convert_ss2service() calls to one place.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
3 years agos3: libsmb: Rewrite resolve_ads() to use the previously added dns_lookup_list() function.
Jeremy Allison [Tue, 21 Jul 2020 02:50:04 +0000 (19:50 -0700)]
s3: libsmb: Rewrite resolve_ads() to use the previously added dns_lookup_list() function.

Clean up internals - a LOT.

This one needs careful review. Ditch the (unused) port returns from
the SRV replies.

Internally uses talloc'ed arrays of struct sockaddr_storage
which it then convert to MALLOC'ed struct ip_service.

Still returns struct ip_service but this will be
fixed in the next commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
3 years agos3: libsmb: Add in (currently unused) function dns_lookup_list().
Jeremy Allison [Tue, 21 Jul 2020 01:31:16 +0000 (18:31 -0700)]
s3: libsmb: Add in (currently unused) function dns_lookup_list().

This function takes a list of names returned from a DNS SRV
query which didn't have returned IP addresses and returns an
array of struct sockaddr_storage.

Currently synchronous, but this is the function that will
be changed to be asynchronous later.

Compiles but commented out for now so we don't get "unused
function" warnings.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>