]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agopytest: samba-tool dns: allow valid updates
Douglas Bagnall [Thu, 17 Jun 2021 10:22:46 +0000 (22:22 +1200)] 
pytest: samba-tool dns: allow valid updates

Without this patch we will get errors like this when in-place RPC
updates start to work:

   AssertionError: unexpectedly None : Successfully updated record
   '192.168.0.1' to '192.168.0.1', even though the latter is of type
   'A' where 'A' was expected.

That's because we have always rejected updates that try to modify an
existing record. We shouldn't.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: test delete multiple records
Douglas Bagnall [Fri, 18 Jun 2021 06:32:22 +0000 (18:32 +1200)] 
pytest: dns_aging: test delete multiple records

Using dns.DNS_QCLASS_ANY we can delete all the records of a certain
type. What happens to other timestamps? The answer should be nothing.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: test RPC updates of disparate types
Douglas Bagnall [Thu, 17 Jun 2021 11:10:50 +0000 (23:10 +1200)] 
pytest: dns_aging: test RPC updates of disparate types

Can a TXT record be replaced by an A record in an RPC update?

According to Windows, yes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopython dns: dns_record_match() matches IPv6 semantically
Douglas Bagnall [Thu, 17 Jun 2021 23:30:09 +0000 (11:30 +1200)] 
python dns: dns_record_match() matches IPv6 semantically

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: Remove -d10 from test startup
Andrew Bartlett [Fri, 18 Jun 2021 11:49:13 +0000 (23:49 +1200)] 
selftest: Remove -d10 from test startup

It looks like "python:tests: Add SAMR password change tests for fips"
(which is also the title of 9a3ba502d8193b25799ef92917efafd52de2e8c2,
but this is also unrelated) and was a probalby a rebase artifact,
being a debugging aid that should have been omitted.

This reverts commit ebd687335b9accfdbae7dbc65c9882ab4d5c0986.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Mon Jun 21 01:46:58 UTC 2021 on sn-devel-184

4 years agotestprogs/blackbox: Remove joined dc for ldapcmp
Andrew Bartlett [Fri, 18 Jun 2021 11:48:26 +0000 (23:48 +1200)] 
testprogs/blackbox: Remove joined dc for ldapcmp

We don't need this DC once the ldapcmp is over, and it avoids
the running DC spamming the logs looking for it.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agopython/samba/tests: Remove DCs joined to test samba-tool behaviour
Andrew Bartlett [Fri, 18 Jun 2021 08:46:51 +0000 (20:46 +1200)] 
python/samba/tests: Remove DCs joined to test samba-tool behaviour

Otherwise we have the live DCs spamming the logs looking for the
long-gone test servers:

Failed to connect host fd00::5357:5f0b on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND
Failed to connect host fd00::5357:5f0b (6f44653d-18c8-4bf4-b2e7-6f85cf7b0f74._msdcs.addom.samba.example.com) on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND.
Failed to connect host 10.53.57.11 on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND
Failed to connect host 10.53.57.11 (6f44653d-18c8-4bf4-b2e7-6f85cf7b0f74._msdcs.addom.samba.example.com) on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND.
Failed to connect host 10.53.57.12 on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND

This avoids spamming the GitLab pipeline logs with a lot of noise,
as there is a size limit to the output, as well as being cleaner.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoWHATSNEW: Improved cmdline user experience
Andreas Schneider [Thu, 17 Dec 2020 14:58:27 +0000 (15:58 +0100)] 
WHATSNEW: Improved cmdline user experience

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 Jun 21 00:10:21 UTC 2021 on sn-devel-184

4 years agolib:cmdline: Improve doxygen documentation
Andreas Schneider [Tue, 11 May 2021 07:13:51 +0000 (09:13 +0200)] 
lib:cmdline: Improve doxygen documentation

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs-xml: Remove unused manpage entities
Andreas Schneider [Wed, 7 Apr 2021 10:31:10 +0000 (12:31 +0200)] 
docs-xml: Remove unused manpage entities

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs-xml: Update samba-tool manpage for option parser changes
Andreas Schneider [Wed, 7 Apr 2021 12:25:41 +0000 (14:25 +0200)] 
docs-xml: Update samba-tool manpage for option parser changes

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopython: Streamline option parser of python tools
Andreas Schneider [Wed, 7 Apr 2021 12:16:52 +0000 (14:16 +0200)] 
python: Streamline option parser of python tools

The python tools, especially samba-tool should have the same option set
as the rest of the client utils.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs-xml: Use new cmdline entities for traffic_replay.7 manpage
Andreas Schneider [Thu, 11 Feb 2021 13:46:18 +0000 (14:46 +0100)] 
docs-xml: Use new cmdline entities for traffic_replay.7 manpage

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs-xml: Update winexe.1 manpage for new cmdline opition parser
Andreas Schneider [Thu, 11 Feb 2021 13:49:42 +0000 (14:49 +0100)] 
docs-xml: Update winexe.1 manpage for new cmdline opition parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agowinexe: Some code cleanup and fixes
Andreas Schneider [Thu, 8 Apr 2021 08:16:54 +0000 (10:16 +0200)] 
winexe: Some code cleanup and fixes

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agowinexe: Use the new cmdline option parser
Andreas Schneider [Fri, 15 Jan 2021 15:34:55 +0000 (16:34 +0100)] 
winexe: Use the new cmdline option parser

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:lib: Remove obsolete popt cmdline parser
Andreas Schneider [Thu, 14 Jan 2021 12:05:05 +0000 (13:05 +0100)] 
s4:lib: Remove obsolete popt cmdline parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc:tools: Migrate ndrdump to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 10:03:12 +0000 (11:03 +0100)] 
librpc:tools: Migrate ndrdump to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc:tools: Remove '-l' which conflicts with '-l|--log-basename'
Andreas Schneider [Fri, 15 Jan 2021 08:21:56 +0000 (09:21 +0100)] 
librpc:tools: Remove '-l' which conflicts with '-l|--log-basename'

The common cmdline parser already provides '-l'.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs-xml: Update wbinfo.1 manpage for new cmdline opition parser
Andreas Schneider [Thu, 11 Feb 2021 13:35:40 +0000 (14:35 +0100)] 
docs-xml: Update wbinfo.1 manpage for new cmdline opition parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agonsswitch: Migrate wbinfo to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 09:53:35 +0000 (10:53 +0100)] 
nsswitch: Migrate wbinfo to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:nbt: Migrate nmblookup4 to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 09:50:28 +0000 (10:50 +0100)] 
libcli:nbt: Migrate nmblookup4 to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:utils: Migrate oLschema2ldif to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 09:43:33 +0000 (10:43 +0100)] 
s4:utils: Migrate oLschema2ldif to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:registry: Migrate regpatch to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 08:23:25 +0000 (09:23 +0100)] 
s4:registry: Migrate regpatch to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:registry: Migrate regtree to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 08:15:57 +0000 (09:15 +0100)] 
s4:registry: Migrate regtree to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:registry: Migrate regdiff to new cmdline option parser
Andreas Schneider [Thu, 14 Jan 2021 07:59:34 +0000 (08:59 +0100)] 
s4:registry: Migrate regdiff to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:registry: Migrate regshell to new cmdline option parser
Andreas Schneider [Fri, 18 Dec 2020 13:25:32 +0000 (14:25 +0100)] 
s4:registry: Migrate regshell to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb periodic: DNS: split aging from tombstone deletion
Douglas Bagnall [Sat, 10 Apr 2021 02:08:09 +0000 (14:08 +1200)] 
dsdb periodic: DNS: split aging from tombstone deletion

We have been conflating two things (under the term "scavenging"):

1. aging out stale DNS records into tombstones, which only happens if
   this feature is switched on in general and for the zone.

2. removing expired DNS tombstones, which should always happen
   (because we tombstone nodes in *other* ways).

With this patch, we un-conflate.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: add an explanatory comment
Douglas Bagnall [Wed, 14 Apr 2021 04:13:01 +0000 (16:13 +1200)] 
dns scavenging: add an explanatory comment

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: ensure tombstoned node has one record
Douglas Bagnall [Sun, 11 Apr 2021 11:39:24 +0000 (23:39 +1200)] 
dns scavenging: ensure tombstoned node has one record

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: avoid leak in dns_tombstone_records
Douglas Bagnall [Tue, 13 Apr 2021 04:31:10 +0000 (16:31 +1200)] 
dns scavenging: avoid leak in dns_tombstone_records

As always, we forget to free our zones. Also to check our zones.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: log tombstone inconsistency
Douglas Bagnall [Fri, 9 Apr 2021 05:50:59 +0000 (17:50 +1200)] 
dns scavenging: log tombstone inconsistency

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: tighten lifetime of filtered records
Douglas Bagnall [Mon, 14 Jun 2021 11:16:46 +0000 (23:16 +1200)] 
dns scavenging: tighten lifetime of filtered records

We were ending up with everything lasting as long as
kccsrv_periodic_run(), which could add to quite a pile.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: avoid useless copy of msg
Douglas Bagnall [Sun, 11 Apr 2021 01:45:19 +0000 (13:45 +1200)] 
dns scavenging: avoid useless copy of msg

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: simplify copy_current_records
Douglas Bagnall [Mon, 29 Mar 2021 00:09:30 +0000 (13:09 +1300)] 
dns scavenging: simplify copy_current_records

We don't need to pull and push to make a byte identical copy of an ldb
value, nor do we need a temporary array.

As part of this, we avoid leaving a dangling el->num_values pointing
into space where there were no actually allocated values, which is not
how we do things, even briefly.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: avoid passing blobs
Douglas Bagnall [Sun, 11 Apr 2021 01:15:29 +0000 (13:15 +1200)] 
dns scavenging: avoid passing blobs

We can construct these ldb values for each zone with minimal cost and
it is less bamboozling to do so.

While we're fiddling with signatures, we can make this used-once local
function static.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: ensure usual ownership of element values
Douglas Bagnall [Mon, 29 Mar 2021 00:11:01 +0000 (13:11 +1300)] 
dns scavenging: ensure usual ownership of element values

An ldb message, its elements, and their values usually all share a
little talloc sub-tree with each other and nobody else. It is
conceivable that somewhere we rely on that.

In this case we were sharing an out-of-subtree values array across
multiple messages, which seems to be asking for trouble.

Also, add a comment explaining what we want.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: avoid setting same flags twice
Douglas Bagnall [Mon, 29 Mar 2021 00:10:50 +0000 (13:10 +1300)] 
dns scavenging: avoid setting same flags twice

We already did this with db_msg_add_empty(), ~20 lines up.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: avoid another small memory leak
Douglas Bagnall [Wed, 14 Apr 2021 05:35:01 +0000 (17:35 +1200)] 
dns scavenging: avoid another small memory leak

We weren't freeing the zones, which is admittedly tricky with the dlink
list.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: avoid a small memory leak
Douglas Bagnall [Mon, 29 Mar 2021 22:25:36 +0000 (11:25 +1300)] 
dns scavenging: avoid a small memory leak

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: correctly set tombstome timestamp
Douglas Bagnall [Sat, 27 Mar 2021 09:59:08 +0000 (22:59 +1300)] 
dns scavenging: correctly set tombstome timestamp

In a DNS tombstone record, the dwTimestamp is, as always, uint32_t hours
since 1601, while the wType-switched .data.EntombedTime timestamp is NTTIME.

We had that wrong, putting the hours in both places.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns scavenging: tombstone deletion uses correct time units
Douglas Bagnall [Sat, 5 Jun 2021 06:04:55 +0000 (18:04 +1200)] 
dns scavenging: tombstone deletion uses correct time units

Before we were comparing hours to 1e-7 second units.

Now we do it both ways. That's because in dns_tombstone_records (in
this same file) we have been putting hour timestamps in EntombedTime,
but this field is supposed to have NTTIME timestamps, and those
timestamps won't have updated themselves.

This wouldn't matter much in pure Samba networks if we weren't also
using the correct timestamp in dns_common_replace().

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest dns_aging: test tombstone timestamp ranges
Douglas Bagnall [Wed, 16 Jun 2021 22:48:56 +0000 (22:48 +0000)] 
pytest dns_aging: test tombstone timestamp ranges

We have always used hours where we are meant to use NTTIME. Let's make
sure we don't break old tombstones.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: remove a test that fails on Windows
Douglas Bagnall [Wed, 16 Jun 2021 22:51:42 +0000 (22:51 +0000)] 
pytest: dns_aging: remove a test that fails on Windows

This fails on Windows due to apparent races between the RPC, DNS, and
LDAP servers. There is no point having it sit there doing nothing.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: add Samba-specific scavenging test
Douglas Bagnall [Mon, 14 Jun 2021 11:41:14 +0000 (23:41 +1200)] 
pytest: dns_aging: add Samba-specific scavenging test

We can't make scavenging happen on demand on Windows, so we just
concentrate on Samba here.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: try queries of recently tombstoned nodes
Douglas Bagnall [Mon, 14 Jun 2021 11:41:07 +0000 (23:41 +1200)] 
pytest: dns_aging: try queries of recently tombstoned nodes

Windows fails this one.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging tests deletions using DNS update
Douglas Bagnall [Mon, 14 Jun 2021 11:39:53 +0000 (23:39 +1200)] 
pytest: dns_aging tests deletions using DNS update

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: remove/fix unused helper functions
Douglas Bagnall [Mon, 14 Jun 2021 11:30:23 +0000 (23:30 +1200)] 
pytest: dns_aging: remove/fix unused helper functions

self.rpc_delete_txt() will be used next commit.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: helper to get non-tombstoned records
Douglas Bagnall [Mon, 14 Jun 2021 11:37:37 +0000 (23:37 +1200)] 
pytest: dns_aging: helper to get non-tombstoned records

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: add helper for DNS delete updates
Douglas Bagnall [Mon, 14 Jun 2021 11:36:57 +0000 (23:36 +1200)] 
pytest: dns_aging: add helper for DNS delete updates

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: correct typo mis-assertions in 2 tests
Douglas Bagnall [Mon, 14 Jun 2021 11:36:04 +0000 (23:36 +1200)] 
pytest: dns_aging: correct typo mis-assertions in 2 tests

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: remind developers to use fl2003
Douglas Bagnall [Fri, 11 Jun 2021 05:31:54 +0000 (17:31 +1200)] 
pytest: dns_aging: remind developers to use fl2003

By "developers", I of course mean "me".

Other environments insist on secure updates, which these tests don't
do.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: dns_aging: use assert_timestamps_equal() widely
Douglas Bagnall [Thu, 10 Jun 2021 23:31:09 +0000 (23:31 +0000)] 
pytest: dns_aging: use assert_timestamps_equal() widely

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: add A and AAAA aging tests
Douglas Bagnall [Thu, 10 Jun 2021 23:30:19 +0000 (23:30 +0000)] 
pytest: add A and AAAA aging tests

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytest: adjust dns_aging to handle some non-TXT records
Douglas Bagnall [Thu, 10 Jun 2021 23:29:15 +0000 (23:29 +0000)] 
pytest: adjust dns_aging to handle some non-TXT records

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopytests: dns_aging get informative assertions
Douglas Bagnall [Wed, 9 Jun 2021 23:58:43 +0000 (11:58 +1200)] 
pytests: dns_aging get informative assertions

When trying to understand the results of these tests, it is not very
helpful to have messages like:

AssertionError: 3685511 != 3685343

when the only thing you want to know is the difference between these two
numbers. So here we make timestamp specific assertions.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopython:tests: Fix group_edit test with system libldb
Andreas Schneider [Thu, 17 Jun 2021 13:02:59 +0000 (15:02 +0200)] 
python:tests: Fix group_edit test with system libldb

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): Sun Jun 20 22:52:05 UTC 2021 on sn-devel-184

4 years agopython:tests: Fix user_edit test with system libldb
Andreas Schneider [Thu, 17 Jun 2021 13:00:21 +0000 (15:00 +0200)] 
python:tests: Fix user_edit test with system libldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopython:tests: Fix contact_edit test with system libldb
Andreas Schneider [Thu, 17 Jun 2021 12:57:41 +0000 (14:57 +0200)] 
python:tests: Fix contact_edit test with system libldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool: Ensure commands don't crash without ad-dc
David Mulder [Thu, 17 Jun 2021 21:20:41 +0000 (15:20 -0600)] 
samba-tool: Ensure commands don't crash without ad-dc

This simply ensures against import errors when
samba is built without the ad-dc. Calling every
help message guarantees the imports succeeded.
The test is intentionally run against the
fileserver test environment, because it's
configured --without-ad-dc and does not disable
ads.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodns: Enable dnsserver_common install when not ad dc
David Mulder [Thu, 10 Jun 2021 15:53:56 +0000 (09:53 -0600)] 
dns: Enable dnsserver_common install when not ad dc

dnsserver_common is enabled without the ad-dc to
prevent imports from failing when samba-tool is
called where the ad-dc was not built. The
server-side dns code is used in the client when
we do direct LDAP modification of DNS records.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool: Disable AD DC options in samba-tool domain
David Mulder [Fri, 18 Sep 2020 17:28:02 +0000 (11:28 -0600)] 
samba-tool: Disable AD DC options in samba-tool domain

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool: Enable samba-tool without ad dc (but with ads)
David Mulder [Thu, 17 Sep 2020 19:26:18 +0000 (13:26 -0600)] 
samba-tool: Enable samba-tool without ad dc (but with ads)

Much of samba-tool can operate without the full AD DC,
for remote operations.

However the samba-tool gpo command depends on ads being
built. Without ads, every samba-tool command
crashes because ads imports fail.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:modules: Reduce debug level if file doesn't exists on dfs share
Andreas Schneider [Wed, 26 May 2021 13:04:08 +0000 (15:04 +0200)] 
s3:modules: Reduce debug level if file doesn't exists on dfs share

There is software out there trying to open desktop.ini in every
directory. Avoid spamming the logs with error messages.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun 18 18:14:11 UTC 2021 on sn-devel-184

4 years agos3: smbd: Optimization in non_widelink_open(). Don't need to vfs_ChDir(parent_dir_fna...
Jeremy Allison [Wed, 16 Jun 2021 22:10:37 +0000 (15:10 -0700)] 
s3: smbd: Optimization in non_widelink_open(). Don't need to vfs_ChDir(parent_dir_fname) if parent is "."

Save several system calls if we're operating at the root of the share.

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): Fri Jun 18 17:21:31 UTC 2021 on sn-devel-184

4 years agos3: smbd: change_file_owner_to_parent_fsp(). Don't re-stat the pathref.
Jeremy Allison [Wed, 9 Jun 2021 23:43:04 +0000 (16:43 -0700)] 
s3: smbd: change_file_owner_to_parent_fsp(). Don't re-stat the pathref.

Optimization now becomes clear. We already have a valid stat of the parent
directory so we don't need to re-do a system call.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change change_file_owner_to_parent() -> change_file_owner_to_parent_fsp().
Jeremy Allison [Wed, 9 Jun 2021 19:28:42 +0000 (12:28 -0700)] 
s3: smbd: Change change_file_owner_to_parent() -> change_file_owner_to_parent_fsp().

Same changes as for change_dir_owner_to_parent_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Make change_file_owner_to_parent() static.
Jeremy Allison [Wed, 9 Jun 2021 19:15:42 +0000 (12:15 -0700)] 
s3: smbd: Make change_file_owner_to_parent() static.

Only used inside open.c.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: change_dir_owner_to_parent_fsp(). Don't re-stat the pathref.
Jeremy Allison [Wed, 9 Jun 2021 23:40:08 +0000 (16:40 -0700)] 
s3: smbd: change_dir_owner_to_parent_fsp(). Don't re-stat the pathref.

Optimization now becomes clear. We already have a valid stat of the parent
directory so we don't need to re-do a system call.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change change_dir_owner_to_parent() -> change_dir_owner_to_parent_fsp().
Jeremy Allison [Wed, 9 Jun 2021 19:13:38 +0000 (12:13 -0700)] 
s3: smbd: Change change_dir_owner_to_parent() -> change_dir_owner_to_parent_fsp().

Operate on handles only.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_directory(). Cleanup. We don't need 'int flags' here.
Jeremy Allison [Wed, 9 Jun 2021 19:01:03 +0000 (12:01 -0700)] 
s3: smbd: open_directory(). Cleanup. We don't need 'int flags' here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoutil/charset: warn loudly on unexpected E2BIG
Douglas Bagnall [Thu, 8 Apr 2021 09:20:17 +0000 (21:20 +1200)] 
util/charset: warn loudly on unexpected E2BIG

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun 18 04:27:17 UTC 2021 on sn-devel-184

4 years agoutil/iconv: reject improperly packed UTF-8
Douglas Bagnall [Thu, 8 Apr 2021 09:18:46 +0000 (21:18 +1200)] 
util/iconv: reject improperly packed UTF-8

If we allow a string that encodes say '\0' as a multi-byte sequence,
we are open to confusion where we mix NUL terminated strings with
sized data blobs, which is to say EVERYWHERE.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture: talloc_string_sub tests for utf-8 brevity
Douglas Bagnall [Wed, 16 Jun 2021 05:35:19 +0000 (17:35 +1200)] 
torture: talloc_string_sub tests for utf-8 brevity

If we allow overly long UTF-8 sequences (in the tests, encoding '\0'
as 2, 3, or 4 bytes), it might be possible for bad strings to slip
through.

We fail. But wait for the next commit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonetcmd: Incorrect arguments to Exception constructor
Garming Sam [Mon, 23 Sep 2019 03:25:42 +0000 (15:25 +1200)] 
netcmd: Incorrect arguments to Exception constructor

Discovered by Semmle code analysis:
https://lgtm.com/projects/g/samba-team/samba

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Jun 17 05:12:03 UTC 2021 on sn-devel-184

4 years agoupgradeprovision: Remove duplicate key
Garming Sam [Mon, 23 Sep 2019 01:28:44 +0000 (13:28 +1200)] 
upgradeprovision: Remove duplicate key

Discovered by Semmle code analysis:
https://lgtm.com/projects/g/samba-team/samba

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agoperf_tests: Implicit string concatenation
Garming Sam [Mon, 23 Sep 2019 01:27:13 +0000 (13:27 +1200)] 
perf_tests: Implicit string concatenation

Discovered by Semmle code analysis:
https://lgtm.com/projects/g/samba-team/samba

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agojoin: provision_fill does not return anything
Garming Sam [Mon, 23 Sep 2019 01:25:47 +0000 (13:25 +1200)] 
join: provision_fill does not return anything

Discovered by Semmle code analysis:
https://lgtm.com/projects/g/samba-team/samba

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agoheimdal_build: Improve error and warning handling on old and new compilers
Andrew Bartlett [Wed, 16 Jun 2021 04:51:14 +0000 (16:51 +1200)] 
heimdal_build: Improve error and warning handling on old and new compilers

The previous commit 1eadeaed0a6ca3a58eb9fd176a7ae5bcc28f64ef had a couple of
errors, the unpicky flags were being set on all builds (not just old
compiler builds) due to confusing variable names, and Ubuntu 16.04
would not build (for fuzzing) because it thought some variables
were maybe-uninitialized.

This keeps stricter warnings->errors on modern compilers while
allowing the full build, even in the near future when a modern
Heimdal is imported.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jun 16 14:43:17 UTC 2021 on sn-devel-184

4 years agos3: smbd: Fix smbd crash on dangling symlink with posix connection calling several...
Jeremy Allison [Tue, 15 Jun 2021 22:42:33 +0000 (15:42 -0700)] 
s3: smbd: Fix smbd crash on dangling symlink with posix connection calling several non-posix info levels.

Tidy up fsp == NULL checks. Remove knownfail.

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

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 Jun 16 11:58:00 UTC 2021 on sn-devel-184

4 years agos3: torture: Add POSIX-SYMLINK-SETPATHINFO regression test.
Jeremy Allison [Tue, 15 Jun 2021 22:11:20 +0000 (15:11 -0700)] 
s3: torture: Add POSIX-SYMLINK-SETPATHINFO regression test.

This ensure we never blunder into indirecting a NULL fsp pointer
in the server. Currently this crashes the server in several info
levels.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agomdssvc: avoid direct filesystem access, use the VFS
Ralph Boehme [Mon, 10 May 2021 10:34:32 +0000 (12:34 +0200)] 
mdssvc: avoid direct filesystem access, use the VFS

This ensures mdssvc uses the same FileIDs as the fileserver as well as Spotlight
can be used working on a virtual filesystem like GlusterFS.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jun 16 05:59:13 UTC 2021 on sn-devel-184

4 years agomdssvc: chdir() to the conn of the RPC request
Ralph Boehme [Tue, 15 Jun 2021 12:14:52 +0000 (14:14 +0200)] 
mdssvc: chdir() to the conn of the RPC request

In preperation of calling VFS functions.

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

Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agomdssvc: maintain a connection struct in the mds_ctx
Ralph Boehme [Mon, 10 May 2021 10:10:08 +0000 (12:10 +0200)] 
mdssvc: maintain a connection struct in the mds_ctx

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add create_conn_struct_cwd()
Ralph Boehme [Fri, 28 May 2021 07:25:22 +0000 (09:25 +0200)] 
smbd: add create_conn_struct_cwd()

Compared to create_conn_struct_tos_cwd() this takes a TALLOC_CTX and
tevent_context as additional arguments and the resulting connection_struct is
stable across the lifetime of mem_ctx and ev.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass tevent context to create_conn_struct_as_root()
Ralph Boehme [Tue, 15 Jun 2021 09:17:57 +0000 (11:17 +0200)] 
smbd: pass tevent context to create_conn_struct_as_root()

The next commit will add another caller of create_conn_struct_as_root() that is
going to pass a long-lived tevent context.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agomdssvc: pass messaging context to mds_init_ctx()
Ralph Boehme [Mon, 10 May 2021 10:08:17 +0000 (12:08 +0200)] 
mdssvc: pass messaging context to mds_init_ctx()

This is needed in a subsequent commit. Note that I prefer to do the event
context unwrapping in the caller and pass both the event and messaging context
explicitly to mds_init_ctx().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agomdssvc: don't fail mds_add_result() if result is not found in CNID set
Ralph Boehme [Mon, 10 May 2021 09:07:27 +0000 (11:07 +0200)] 
mdssvc: don't fail mds_add_result() if result is not found in CNID set

Just skip adding the result to the pending results set, don't return an
error. Returning an error triggers an error at the MDSSVC RPC error which is NOT
what we want here.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agomdssvc: use a helper variable in mds_add_result()
Ralph Boehme [Mon, 10 May 2021 09:04:38 +0000 (11:04 +0200)] 
mdssvc: use a helper variable in mds_add_result()

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib:ldb-samba: Migrate samba extensions to new cmdline option parser
Andreas Schneider [Wed, 2 Dec 2020 17:06:24 +0000 (18:06 +0100)] 
lib:ldb-samba: Migrate samba extensions to new cmdline option parser

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): Wed Jun 16 01:25:28 UTC 2021 on sn-devel-184

4 years agolib:ldb-samba: Use talloc_zero_array() and use ldb as the mem context
Andreas Schneider [Fri, 18 Dec 2020 07:38:22 +0000 (08:38 +0100)] 
lib:ldb-samba: Use talloc_zero_array() and use ldb as the mem context

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:ldb-samba: Improve calculate_popt_array_length()
Andreas Schneider [Thu, 17 Dec 2020 18:16:13 +0000 (19:16 +0100)] 
lib:ldb-samba: Improve calculate_popt_array_length()

Note that memcmp() doesn't work well with padding bytes. So avoid it!

(gdb) ptype/o struct poptOption
/* offset    |  size */  type = struct poptOption {
/*    0      |     8 */    const char *longName;
/*    8      |     1 */    char shortName;
/* XXX  3-byte hole  */
/*   12      |     4 */    unsigned int argInfo;
/*   16      |     8 */    void *arg;
/*   24      |     4 */    int val;
/* XXX  4-byte hole  */
/*   32      |     8 */    const char *descrip;
/*   40      |     8 */    const char *argDescrip;

                           /* total size (bytes):   48 */

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:ldb: Use C99 initializers for builtin_popt_options[]
Andreas Schneider [Thu, 17 Dec 2020 10:56:08 +0000 (11:56 +0100)] 
lib:ldb: Use C99 initializers for builtin_popt_options[]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Migrate masktest to new cmdline option parser
Andreas Schneider [Thu, 17 Dec 2020 16:12:10 +0000 (17:12 +0100)] 
s4:torture: Migrate masktest to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Migrate locktest to new cmdline option parser
Andreas Schneider [Thu, 17 Dec 2020 16:05:51 +0000 (17:05 +0100)] 
s4:torture: Migrate locktest to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Change -U|--user to --user1 and --user2
Andreas Schneider [Thu, 17 Dec 2020 15:55:02 +0000 (16:55 +0100)] 
s4:torture: Change -U|--user to --user1 and --user2

The '-U' option is already defined by the default cmdline parser!

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Migrate gentest to new cmdline option parser
Andreas Schneider [Thu, 17 Dec 2020 15:25:08 +0000 (16:25 +0100)] 
s4:torture: Migrate gentest to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Change -U|--user to --user1 and --user2
Andreas Schneider [Thu, 17 Dec 2020 15:24:48 +0000 (16:24 +0100)] 
s4:torture: Change -U|--user to --user1 and --user2

The '-U' option is already defined by the default cmdline parser!

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotestprogs: Add smbtorture tests with new options
Andreas Schneider [Thu, 3 Dec 2020 07:02:58 +0000 (08:02 +0100)] 
testprogs: Add smbtorture tests with new options

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:torture: Migrate smbtorture to new cmdline option parser
Andreas Schneider [Wed, 2 Dec 2020 16:24:22 +0000 (17:24 +0100)] 
s4:torture: Migrate smbtorture to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>