ddiss/samba-autobuild/.git
2 years agoctdb-recoverd: Simplify arguments to some election functions
Martin Schwenke [Wed, 8 Dec 2021 08:27:01 +0000 (19:27 +1100)]
ctdb-recoverd: Simplify arguments to some election functions

The pnn and nodemap arguments to force_election() and
send_election_request() are always effectively rec->pnn and
rec->nodemap, so simplify.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Add PNN to recovery daemon context
Martin Schwenke [Wed, 8 Dec 2021 23:33:17 +0000 (10:33 +1100)]
ctdb-recoverd: Add PNN to recovery daemon context

This is currently referenced in a number of inconsistent
ways, including:

* pnn
* rec->ctdb->pnn
* ctdb->pnn
* ctdb_get_pnn(ctdb)
* ctdb_get_pnn(rec->ctdb)

The first of these always requires some thought about the context - is
this the node PNN or some other PNN (e.g. argument to function)?

The intention is to always use rec->pnn when referring to the recovery
daemon's PNN.

Doing this also reduces reliance on struct ctdb_context internals.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Use this_node_is_leader() in an extra context
Martin Schwenke [Thu, 9 Dec 2021 00:47:54 +0000 (11:47 +1100)]
ctdb-recoverd: Use this_node_is_leader() in an extra context

This is arguably clearer.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Factor out and use function this_node_is_leader()
Martin Schwenke [Wed, 8 Dec 2021 08:37:39 +0000 (19:37 +1100)]
ctdb-recoverd: Factor out and use function this_node_is_leader()

Make the code self-documenting.

This preempts an upcoming change to terminology but doing it now saves
a lot of churn.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Pass SIGHUP to running helper
Martin Schwenke [Thu, 30 Sep 2021 11:16:44 +0000 (21:16 +1000)]
ctdb-recoverd: Pass SIGHUP to running helper

The recovery and takeover helpers can run for a while and generate
non-trivial logs, so have them reopen their logs to support log
rotation.

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 Jan 17 04:36:30 UTC 2022 on sn-devel-184

2 years agoctdb-recoverd: Record helper PID in recovery daemon context
Martin Schwenke [Thu, 30 Sep 2021 11:15:56 +0000 (21:15 +1000)]
ctdb-recoverd: Record helper PID in recovery daemon context

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Add log reopening on SIGHUP to helpers
Martin Schwenke [Thu, 30 Sep 2021 11:14:14 +0000 (21:14 +1000)]
ctdb-recoverd: Add log reopening on SIGHUP to helpers

Recovery and takeover helpers can run for a while and generate
non-trivial logs.  They should support log reopening.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-daemon: Enable log reopening for event daemon
Martin Schwenke [Thu, 30 Sep 2021 11:10:33 +0000 (21:10 +1000)]
ctdb-daemon: Enable log reopening for event daemon

Add and call hook to pass on SIGHUP to eventd.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-event: Reopen logs on SIGHUP
Martin Schwenke [Thu, 30 Sep 2021 11:11:44 +0000 (21:11 +1000)]
ctdb-event: Reopen logs on SIGHUP

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-daemon: Enable log reopening for recovery daemon
Martin Schwenke [Thu, 30 Sep 2021 11:08:25 +0000 (21:08 +1000)]
ctdb-daemon: Enable log reopening for recovery daemon

Pass on a SIGHUP to the recovery daemon, which will then reopen its
logs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-recoverd: Add basic log reopening
Martin Schwenke [Thu, 30 Sep 2021 11:03:15 +0000 (21:03 +1000)]
ctdb-recoverd: Add basic log reopening

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-daemon: Add basic top-level log reopening
Martin Schwenke [Thu, 30 Sep 2021 11:06:16 +0000 (21:06 +1000)]
ctdb-daemon: Add basic top-level log reopening

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-common: Add support for reopening logs
Martin Schwenke [Thu, 30 Sep 2021 10:55:27 +0000 (20:55 +1000)]
ctdb-common: Add support for reopening logs

Now that CTDB uses Samba's file logging it is possible to reopen the
logs, so that log rotation can be supported.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-common: Separate sock_daemon's SIGHUP and SIGUSR1 handling
Martin Schwenke [Thu, 18 Nov 2021 10:17:39 +0000 (21:17 +1100)]
ctdb-common: Separate sock_daemon's SIGHUP and SIGUSR1 handling

SIGHUP is for reopening logs, SIGUSR1 is for reconfigure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-common: Use Samba's DEBUG_FILE logging
Martin Schwenke [Thu, 23 Sep 2021 08:37:57 +0000 (18:37 +1000)]
ctdb-common: Use Samba's DEBUG_FILE logging

This has support for log rotation (or re-opening).

The log format is updated to use an RFC5424 timestamp and to include a
hostname.  The addition of the hostname allows trivial merging of log
files from multiple cluster nodes.

The hostname is faked from the CTDB_BASE environment variable during
testing, as per the comment in the code.  It is currently faked in a
similar manner in local_daemons.sh when printing logs, so drop this.

Unit tests need updating because stderr logging no longer produces a
"PROGNAME[PID]: " header.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-common: Switch initial debug type to DEBUG_DEFAULT_STDERR
Martin Schwenke [Fri, 24 Sep 2021 12:17:53 +0000 (22:17 +1000)]
ctdb-common: Switch initial debug type to DEBUG_DEFAULT_STDERR

This can be overridden by DEBUG_FILE, whereas DEBUG_STDERR can not.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agos3: smbd: Add missing pop_sec_ctx() in error code path of close_directory()
Jeremy Allison [Wed, 12 Jan 2022 18:42:48 +0000 (10:42 -0800)]
s3: smbd: Add missing pop_sec_ctx() in error code path of close_directory()

If delete_all_streams() fails.

Found by Andrew Walker <awalker@ixsystems.com>

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 14 03:34:47 UTC 2022 on sn-devel-184

2 years agoctdb-protocol: Print IPv6 sockets with RFC5952 "[2001:db8::1]:80" notation
Martin Schwenke [Thu, 30 Dec 2021 01:29:58 +0000 (12:29 +1100)]
ctdb-protocol: Print IPv6 sockets with RFC5952 "[2001:db8::1]:80" notation

RFC5952 says the existing style is not recommended and the [] style
should be employed.

There are more optimised ways of adding the square brackets but they
tend to be uglier.

Parsing IPv6 sockets without [] is now tested indirectly by parsing
examples in both styles and comparing the results.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 13 17:02:21 UTC 2022 on sn-devel-184

2 years agoctdb-tests: Add extra IPv6 socket parsing tests
Martin Schwenke [Wed, 5 Jan 2022 01:09:45 +0000 (12:09 +1100)]
ctdb-tests: Add extra IPv6 socket parsing tests

Add tests to confirm that square brackets are handled and that
IPv4-mapped IPv6 addresses are parsed as expected.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agoctdb-protocol: Allow rfc5952 "[2001:db8::1]:80" ipv6 notation
Volker Lendecke [Thu, 23 Dec 2021 10:52:38 +0000 (11:52 +0100)]
ctdb-protocol: Allow rfc5952 "[2001:db8::1]:80" ipv6 notation

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14934
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2 years agoctdb-protocol: Save 50 bytes .text segment
Volker Lendecke [Wed, 29 Dec 2021 13:46:14 +0000 (14:46 +0100)]
ctdb-protocol: Save 50 bytes .text segment

Having this as a small static .text is simpler than having to create
this on the stack.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2 years agoctdb-protocol: rindex->strrchr
Volker Lendecke [Wed, 29 Dec 2021 14:10:28 +0000 (15:10 +0100)]
ctdb-protocol: rindex->strrchr

According to "man rindex" on debian bullseye rindex() was deprecated
in Posix.1-2001 and removed from Posix.1-2008.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2 years agodsdb/schema: let dsdb_syntax_DN_BINARY_drsuapi_to_ldb return WERR_DS_INVALID_ATTRIBUT...
Stefan Metzmacher [Mon, 20 Dec 2021 16:48:44 +0000 (17:48 +0100)]
dsdb/schema: let dsdb_syntax_DN_BINARY_drsuapi_to_ldb return WERR_DS_INVALID_ATTRIBUTE_SYNTAX

When Object(OR-Name) uses dsdb_syntax_DN_BINARY_drsuapi_to_ldb() it
should genrate WERR_DS_INVALID_ATTRIBUTE_SYNTAX if the binary part
is not empty.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 12 03:09:52 UTC 2022 on sn-devel-184

2 years agodsdb/schema: add no memory checks for {ldb,dsdb}_dn_get_extended_linearized()
Stefan Metzmacher [Mon, 20 Dec 2021 16:46:47 +0000 (17:46 +0100)]
dsdb/schema: add no memory checks for {ldb,dsdb}_dn_get_extended_linearized()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodsdb/common: dsdb_dn_construct_internal() more strict checking
Stefan Metzmacher [Sat, 5 Jun 2021 21:12:50 +0000 (23:12 +0200)]
dsdb/common: dsdb_dn_construct_internal() more strict checking

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodsdb/schema: fix Object(OR-Name) syntax definition
Stefan Metzmacher [Mon, 20 Dec 2021 16:50:07 +0000 (17:50 +0100)]
dsdb/schema: fix Object(OR-Name) syntax definition

This is a strange one, it uses DN_BINARY in the drsuapi
representation, while the binary part must be 0 bytes.
and the LDAP/ldb representation is a plain DN (without 'B:').

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodsdb/schema/tests: let samba4.local.dsdb.syntax call the validate_dn() hook
Stefan Metzmacher [Sat, 5 Jun 2021 21:12:20 +0000 (23:12 +0200)]
dsdb/schema/tests: let samba4.local.dsdb.syntax call the validate_dn() hook

This demonstrates that our OR-Name syntax is wrong,
which wasn't noticed yet as it's not used in the AD-Schema.

I noticed it by installing the Exchange-Schema on a Samba DC.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos4:rpc_server/netlogon: let CSDVersion="" wipe operatingSystemServicePack
Stefan Metzmacher [Tue, 21 Dec 2021 13:00:34 +0000 (14:00 +0100)]
s4:rpc_server/netlogon: let CSDVersion="" wipe operatingSystemServicePack

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 11 22:03:03 UTC 2022 on sn-devel-184

2 years agos4:torture/rpc: test how CSDVersion="" wipes operatingSystemServicePack
Stefan Metzmacher [Tue, 21 Dec 2021 12:58:07 +0000 (13:58 +0100)]
s4:torture/rpc: test how CSDVersion="" wipes operatingSystemServicePack

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: util: Make nt_time_to_full_timespec() call nt_time_to_unix_timespec_raw() for...
Jeremy Allison [Fri, 7 Jan 2022 19:27:16 +0000 (11:27 -0800)]
lib: util: Make nt_time_to_full_timespec() call nt_time_to_unix_timespec_raw() for the conversion.

Cleanup to eliminate duplicate code.

The high check is now done against ret.tv_sec,
not 'd', as after calling nt_time_to_unix_timespec_raw()
this is identical to the previous intermediate 'd'
variable.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 11 01:36:51 UTC 2022 on sn-devel-184

2 years agolib: util: Make nt_time_to_unix_timespec() call nt_time_to_unix_timespec_raw() for...
Jeremy Allison [Fri, 7 Jan 2022 19:22:03 +0000 (11:22 -0800)]
lib: util: Make nt_time_to_unix_timespec() call nt_time_to_unix_timespec_raw() for the conversion.

Cleanup to eliminate duplicate code.

The low/high checks are now done against ret.tv_sec,
not 'd', as after calling nt_time_to_unix_timespec_raw()
this is identical to the previous intermediate 'd'
variable.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2 years agos3:modules: Fix possible dereference of NULL for fio
Pavel Filipenský [Mon, 10 Jan 2022 12:26:25 +0000 (13:26 +0100)]
s3:modules: Fix possible dereference of NULL for fio

We do not check consistently for fio being NULL in this file.

Found by covescan.

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 11 00:22:09 UTC 2022 on sn-devel-184

2 years agos3:libnet: Fix dereference of NULL win7
Pavel Filipenský [Mon, 10 Jan 2022 12:24:22 +0000 (13:24 +0100)]
s3:libnet: Fix dereference of NULL win7

Found by covscan.

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:libnet: Fix dead code in libnet_join.c
Pavel Filipenský [Fri, 7 Jan 2022 13:11:53 +0000 (14:11 +0100)]
s3:libnet: Fix dead code in libnet_join.c

Found by covscan.

Pair-programmed-with: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoctdb:utils: Improve error handling of hex_decode()
Pavel Filipenský [Fri, 7 Jan 2022 10:57:08 +0000 (11:57 +0100)]
ctdb:utils: Improve error handling of hex_decode()

This has been found by covscan and make analyzers happy.

Pair-programmed-with: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:rpc_server: Fix possible NULL dereference
Pavel Filipenský [Fri, 7 Jan 2022 10:50:16 +0000 (11:50 +0100)]
s3:rpc_server: Fix possible NULL dereference

Found by covscan.

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:smbd: Fix dereferencing null pointer "fsp"
Pavel Filipenský [Fri, 7 Jan 2022 20:18:59 +0000 (21:18 +0100)]
s3:smbd: Fix dereferencing null pointer "fsp"

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

Remove fsp which is always NULL and replace it with smb_fname->fsp.

Found by covscan.

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:smbd: Fix trailing whitespaces in dosmode.c
Pavel Filipenský [Fri, 7 Jan 2022 20:18:59 +0000 (21:18 +0100)]
s3:smbd: Fix trailing whitespaces in dosmode.c

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:modules: Fix the horrible vfs_crossrename module
Pavel Filipenský [Fri, 7 Jan 2022 12:16:26 +0000 (13:16 +0100)]
s3:modules: Fix the horrible vfs_crossrename module

It really has to be removed! ;-)

Found by covscan. The code always leaves here as the dst variable

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

Pair-programmed-with: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:modules: VFS CAP symlinkat always fails
Pavel Filipenský [Fri, 7 Jan 2022 12:55:38 +0000 (13:55 +0100)]
s3:modules: VFS CAP symlinkat always fails

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

Found by covscan.

Since capnew is initialized by NULL, checking it too early makes the
rest of the function a dead code.

Pair-programmed-with: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3: includes: Make the comments describing itime consistent. Always use "invented...
Jones Syue [Mon, 10 Jan 2022 17:29:44 +0000 (09:29 -0800)]
s3: includes: Make the comments describing itime consistent. Always use "invented" time.

It gets confusing if we call it "imaginary" or "instantiation"
in different places.

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jan 10 18:42:02 UTC 2022 on sn-devel-184

2 years agos3: lib: In create_clock_itime(), use timespec_current() -> clock_gettime(CLOCK_REALT...
Jeremy Allison [Mon, 10 Jan 2022 17:01:09 +0000 (09:01 -0800)]
s3: lib: In create_clock_itime(), use timespec_current() -> clock_gettime(CLOCK_REALTIME..).

CLOCK_MONOTONIC (which we previously used) is reset
when the system is rebooted.

CLOCK_REALTIME is a "wall clock" time. It's still affected by NTP
changes (for Linux we should probably use CLOCK_TAI instead
but that is Linux-specific). For most systems CLOCK_REALTIME
will be good enough.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agorpcclient: Fix ncacn_ip_tcp:<ip-address>
Volker Lendecke [Sun, 9 Jan 2022 12:38:37 +0000 (13:38 +0100)]
rpcclient: Fix ncacn_ip_tcp:<ip-address>

inet_pton expects "struct in_addr" or "struct in6_addr" as destination
pointer. It does not fill in a struct
sockaddr_storage. interpret_string_addr() takes care of this.

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 Jan 10 11:47:34 UTC 2022 on sn-devel-184

2 years agotest: Test rpcclient ncacn_ip_tcp:<ip-address>
Volker Lendecke [Sun, 9 Jan 2022 12:39:12 +0000 (13:39 +0100)]
test: Test rpcclient ncacn_ip_tcp:<ip-address>

Right now connecting to an IP address is broken.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3: smbd: Create and use a common function for generating a fileid - create_clock_iti...
Jeremy Allison [Wed, 5 Jan 2022 19:40:46 +0000 (11:40 -0800)]
s3: smbd: Create and use a common function for generating a fileid - create_clock_itime().

This first gets the clock_gettime_mono() value, converts to an NTTIME (as
this is what is stored in the dos attribute EA), then mixes in 8 bits of
randomness shifted up by 55 bits to cope with poor resolution clocks to
avoid duplicate inodes.

Using 8 bits of randomness on top of an NTTIME gives us around 114
years headroom. We can now guarentee returning a itime-based
fileid in a normal share (storing dos attributes in an EA).

Remove knownfail.d/fileid-unique

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jan  8 06:35:22 UTC 2022 on sn-devel-184

2 years agolib: util: Add a function nt_time_to_unix_timespec_raw().
Jeremy Allison [Thu, 6 Jan 2022 21:58:20 +0000 (13:58 -0800)]
lib: util: Add a function nt_time_to_unix_timespec_raw().

Not yet used. Does no checks on the converted values.

A later cleanup will allow us to move nt_time_to_unix_timespec()
and nt_time_to_full_timespec() to use common code.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2 years agotests: Add 2 tests for unique fileid's with top bit set (generated from itime) for...
Jeremy Allison [Thu, 6 Jan 2022 23:11:20 +0000 (15:11 -0800)]
tests: Add 2 tests for unique fileid's with top bit set (generated from itime) for files and directories.

smb2.fileid_unique.fileid_unique
smb2.fileid_unique.fileid_unique-dir

Create 100 files or directories as fast as we can
against a "normal" share, then read info on them
and ensure (a) top bit is set (generated from itime)
and (b) uniqueness across all generated objects
(checks poor timestamp resolution doesn't create
duplicate fileids).

This shows that even on ext4, this is enough to
cause duplicate fileids to be returned.

Add knownfail.d/fileid-unique

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2 years agos3: smbd: Remove now redundent lock_flav parameter from smbd_do_unlocking().
Jeremy Allison [Wed, 17 Nov 2021 01:04:02 +0000 (17:04 -0800)]
s3: smbd: Remove now redundent lock_flav parameter from smbd_do_unlocking().

We already stored this in struct smbd_lock_element.

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): Thu Jan  6 16:03:28 UTC 2022 on sn-devel-184

2 years agos3: smbd: Remove lock_flav argument from smbd_smb1_brl_finish_by_lock().
Jeremy Allison [Wed, 17 Nov 2021 00:56:02 +0000 (16:56 -0800)]
s3: smbd: Remove lock_flav argument from smbd_smb1_brl_finish_by_lock().

We lookup the lock array from the state stored in the passed-in req
and all the locks in an array are always the same flavour, so this
isn't needed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbd: Remove lock_flav argument from internal function smbd_smb1_do_locks_check()
Jeremy Allison [Wed, 17 Nov 2021 00:48:58 +0000 (16:48 -0800)]
s3: smbd: Remove lock_flav argument from internal function smbd_smb1_do_locks_check()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbd: Remove lock_flav argument from smbd_smb1_do_locks_send().
Jeremy Allison [Wed, 17 Nov 2021 00:41:09 +0000 (16:41 -0800)]
s3: smbd: Remove lock_flav argument from smbd_smb1_do_locks_send().

And also inside struct smbd_smb1_do_locks_state.
All calls to this always (a) have one or more locks of the same type.
(the setup for smbd_smb1_do_locks_send() ensures there is always
at least one lock) and (b) always set locks[0].lock_flav correctly before calling.

lock_flav is thus a redundent argument. Removing it means
we can never drift out of sync with the lock_flav element
in the passed in locks array.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbd: In smbd_smb1_do_locks_send() move access of lock_flav until after we know...
Jeremy Allison [Wed, 17 Nov 2021 00:15:54 +0000 (16:15 -0800)]
s3: smbd: In smbd_smb1_do_locks_send() move access of lock_flav until after we know we have locks in the array.

When we remove the lock_flav parameter this will need to look into the array itself.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbd: Remove lock_flav parameter from smbd_do_locks_try().
Jeremy Allison [Tue, 16 Nov 2021 23:06:59 +0000 (15:06 -0800)]
s3: smbd: Remove lock_flav parameter from smbd_do_locks_try().

This is now contained in the struct smbd_lock_element for
each lock.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbd: Move implicit call to lp_posix_cifsu_locktype() out of init_strict_lock_str...
Jeremy Allison [Tue, 16 Nov 2021 23:00:03 +0000 (15:00 -0800)]
s3: smbd: Move implicit call to lp_posix_cifsu_locktype() out of init_strict_lock_struct().

Make it explicit. When we add POSIX handles to SMB2 we will only
look at the handle type. lp_posix_cifsu_locktype() already does this,
but hidden inside init_strict_lock_struct() makes it hard to see.

No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbd: Add "enum brl_flavour" to struct smbd_lock_element.
Jeremy Allison [Tue, 16 Nov 2021 22:26:44 +0000 (14:26 -0800)]
s3: smbd: Add "enum brl_flavour" to struct smbd_lock_element.

Initialized correctly but not yet used.
Will allow 'brl_flavour' to be removed from lock calls.
This will allow SMB2 POSIX handles to call with POSIX_LOCK
flavour instead of always using WINDOWS_LOCK (as now).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agos3: smbclient: In do_host_query(), if we need SMB1, ensure we select NT1 as the clien...
Jeremy Allison [Tue, 4 Jan 2022 00:52:25 +0000 (16:52 -0800)]
s3: smbclient: In do_host_query(), if we need SMB1, ensure we select NT1 as the client max protocol" before continuing.

Remove knownfail: selftest/knownfail.d/list_servers

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Jan  6 11:50:32 UTC 2022 on sn-devel-184

2 years agos3: selftest: Add two tests that show we try and send an SMB1 request over an SMB2...
Jeremy Allison [Tue, 4 Jan 2022 00:48:17 +0000 (16:48 -0800)]
s3: selftest: Add two tests that show we try and send an SMB1 request over an SMB2 connection to list servers if "-mSMB3" is selected.

Add knownfail: knownfail.d/list_servers

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agolib: Fix a typo
Volker Lendecke [Thu, 23 Dec 2021 12:24:27 +0000 (13:24 +0100)]
lib: 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): Wed Jan  5 01:02:38 UTC 2022 on sn-devel-184

2 years agovfs: Modernize a DEBUG statement
Volker Lendecke [Tue, 21 Dec 2021 11:54:56 +0000 (12:54 +0100)]
vfs: Modernize a DEBUG statement

Fix the function name printed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Modernize a DEBUG statement
Volker Lendecke [Sun, 19 Dec 2021 10:02:46 +0000 (11:02 +0100)]
smbd: Modernize a DEBUG statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Inline single-use rpcint_binding_handle_ex()
Volker Lendecke [Thu, 7 Oct 2021 12:52:47 +0000 (14:52 +0200)]
rpc_server3: Inline single-use rpcint_binding_handle_ex()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Inline pipes_struct into dcerpc_ncacn_conn
Volker Lendecke [Wed, 6 Oct 2021 10:20:17 +0000 (12:20 +0200)]
rpc_server3: Inline pipes_struct into dcerpc_ncacn_conn

This makes it clear that our internal representation of a rpc client
connection in the source3/ server is struct dcerpc_ncacn_conn and that
struct pipes_struct is only around for API compatibility with the
existing server stubs.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove dcerpc_ncacn_conn->session_info
Volker Lendecke [Wed, 6 Oct 2021 09:16:21 +0000 (11:16 +0200)]
rpc_server3: Remove dcerpc_ncacn_conn->session_info

This was only used inside rpc_worker_new_client(), a leftover from
times where accepting a client was an async process waiting for the
struct named_pipe_auth_req_info4.

The talloc hierarchy is correctly maintained, dcesrv_endpoint_connect() takes a
talloc_reference() of session_info.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove dcerpc_ncacn_conn->local_server_addr
Volker Lendecke [Wed, 6 Oct 2021 09:16:21 +0000 (11:16 +0200)]
rpc_server3: Remove dcerpc_ncacn_conn->local_server_addr

This was only used inside rpc_worker_new_client(), a leftover from
times where accepting a client was an async process waiting for the
struct named_pipe_auth_req_info4.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove dcerpc_ncacn_conn->remote_client_addr
Volker Lendecke [Wed, 6 Oct 2021 09:16:21 +0000 (11:16 +0200)]
rpc_server3: Remove dcerpc_ncacn_conn->remote_client_addr

This was only used inside rpc_worker_new_client(), a leftover from
times where accepting a client was an async process waiting for the
struct named_pipe_auth_req_info4.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove dcerpc_ncacn_conn->tstream
Volker Lendecke [Wed, 6 Oct 2021 09:16:21 +0000 (11:16 +0200)]
rpc_server3: Remove dcerpc_ncacn_conn->tstream

This was only used inside rpc_worker_new_client(), a leftover from
times where accepting a client was an async process waiting for the
struct named_pipe_auth_req_info4.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove dcerpc_ncacn_conn->dce_ctx
Volker Lendecke [Wed, 6 Oct 2021 09:16:21 +0000 (11:16 +0200)]
rpc_server3: Remove dcerpc_ncacn_conn->dce_ctx

This was only used inside rpc_worker_new_client(), a leftover from
times where accepting a client was an async process waiting for the
struct named_pipe_auth_req_info4.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove dcerpc_ncacn_conn->msg_ctx
Volker Lendecke [Wed, 6 Oct 2021 09:16:21 +0000 (11:16 +0200)]
rpc_server3: Remove dcerpc_ncacn_conn->msg_ctx

This was only used inside rpc_worker_new_client(), a leftover from
times where accepting a client was an async process waiting for the
struct named_pipe_auth_req_info4.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: dcerpc_ncacn_conn->ev_ctx was only set but never used
Volker Lendecke [Wed, 6 Oct 2021 09:14:30 +0000 (11:14 +0200)]
rpc_server3: dcerpc_ncacn_conn->ev_ctx was only set but never used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agowinbind: Don't transfer a pointer that's NULL anyway
Volker Lendecke [Fri, 1 Oct 2021 14:28:57 +0000 (16:28 +0200)]
winbind: Don't transfer a pointer that's NULL anyway

ncacn_conn was created by make_internal_ncacn_conn with talloc_zero(),
and that does not set session_info for the purely one-shot connection
state in winbindd_dual_ndrcmd().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: No linked list for pipes_struct anymore
Volker Lendecke [Wed, 6 Oct 2021 09:39:21 +0000 (11:39 +0200)]
rpc_server3: No linked list for pipes_struct anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove pipes_struct->auth
Volker Lendecke [Mon, 4 Oct 2021 11:50:02 +0000 (13:50 +0200)]
rpc_server3: Remove pipes_struct->auth

Replace with a call to dcesrv_call_auth_info(p->dce_call)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove pipes_struct->session_info
Volker Lendecke [Mon, 4 Oct 2021 11:40:02 +0000 (13:40 +0200)]
rpc_server3: Remove pipes_struct->session_info

This is a big patch, but all it does is replace all "p->session_info"
with "session_info" after introducing a local variable from
dcesrv_call_session_info(p->dce_call).

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove pipes_struct->pipe_bound
Volker Lendecke [Mon, 4 Oct 2021 10:49:56 +0000 (12:49 +0200)]
rpc_server3: Remove pipes_struct->pipe_bound

Only used in pipe_access_check(), superseded by dcesrv_call_auth_info()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Inline make_base_pipes_struct()
Volker Lendecke [Mon, 4 Oct 2021 10:37:30 +0000 (12:37 +0200)]
rpc_server3: Inline make_base_pipes_struct()

This did not even use all its arguments anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove pipes_struct->remote_address
Volker Lendecke [Mon, 4 Oct 2021 10:26:18 +0000 (12:26 +0200)]
rpc_server3: Remove pipes_struct->remote_address

Also available via dcesrv_connection_get_remote_address(p->dce_call->conn)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Remove pipes_struct->local_address
Volker Lendecke [Mon, 4 Oct 2021 10:19:57 +0000 (12:19 +0200)]
rpc_server3: Remove pipes_struct->local_address

Also available via dcesrv_connection_get_local_address(p->dce_call->conn)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Inline make_base_pipes_struct() into rpc_worker.c
Volker Lendecke [Mon, 4 Oct 2021 10:03:55 +0000 (12:03 +0200)]
rpc_server3: Inline make_base_pipes_struct() into rpc_worker.c

This is the only user, and in winbind_dual_ndr.c's
make_internal_ncacn_conn we have another creator of pipes_struct. So
it seems not necessary to keep this public.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agorpc_server3: Inline make_internal_ncacn_conn() into rpc_worker.c
Volker Lendecke [Tue, 28 Sep 2021 11:26:18 +0000 (13:26 +0200)]
rpc_server3: Inline make_internal_ncacn_conn() into rpc_worker.c

This was the only user, and as we have another custom version in
winbind with make_internal_ncacn_conn(), I think this is not really
required to keep around as a separate function.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Avoid a DEBUGADD statement
Volker Lendecke [Tue, 21 Dec 2021 16:12:55 +0000 (17:12 +0100)]
smbd: Avoid a DEBUGADD statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoRemove some unused code
Volker Lendecke [Tue, 12 Oct 2021 10:06:20 +0000 (12:06 +0200)]
Remove some unused code

I think that if we want to work on asn1 routines we should use
libtasn1. We already depend on this via gnutls these days.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Avoid a cast
Volker Lendecke [Mon, 27 Dec 2021 10:25:34 +0000 (11:25 +0100)]
lib: Avoid a cast

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Avoid some casts
Volker Lendecke [Wed, 24 Nov 2021 11:28:34 +0000 (12:28 +0100)]
smbd: Avoid some casts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Remove an unneeded anonymous struct declaration
Volker Lendecke [Fri, 26 Nov 2021 15:36:25 +0000 (16:36 +0100)]
smbd: Remove an unneeded anonymous struct declaration

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Move fast_string_hash() to mangle_hash.c, the only user
Volker Lendecke [Fri, 26 Nov 2021 15:35:44 +0000 (16:35 +0100)]
smbd: Move fast_string_hash() to mangle_hash.c, the only user

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Fix a few typos
Volker Lendecke [Thu, 25 Nov 2021 15:52:41 +0000 (16:52 +0100)]
smbd: Fix a few typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Save a few lines by using cp_smb_filename_nostream()
Volker Lendecke [Thu, 25 Nov 2021 14:37:00 +0000 (15:37 +0100)]
smbd: Save a few lines by using cp_smb_filename_nostream()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoauth/ntlmssp: make sure we return INVALID_PARAMETER for NTLMv2_RESPONSE parsing errors
Stefan Metzmacher [Fri, 17 Dec 2021 22:32:28 +0000 (23:32 +0100)]
auth/ntlmssp: make sure we return INVALID_PARAMETER for NTLMv2_RESPONSE parsing errors

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan  4 20:57:41 UTC 2022 on sn-devel-184

2 years agos4:torture/smb2: add smb2.session.ntlmssp_bug14932 test
Stefan Metzmacher [Fri, 17 Dec 2021 22:23:33 +0000 (23:23 +0100)]
s4:torture/smb2: add smb2.session.ntlmssp_bug14932 test

This demonstrates that an invalid av_pair in NTLMv2_CLIENT_CHALLENGE
should result in NT_STATUS_INVALID_PARAMETER at the NTLMSSP layer.

This is different from the netr_LogonSamLogon*() case, where it is
ignored instead.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibcli/auth: let NTLMv2_RESPONSE_verify_netlogon_creds ignore invalid netapp requests
Stefan Metzmacher [Wed, 15 Dec 2021 16:25:06 +0000 (17:25 +0100)]
libcli/auth: let NTLMv2_RESPONSE_verify_netlogon_creds ignore invalid netapp requests

We should avoid spamming the logs with wellknown messages like:
ndr_pull_error(Buffer Size Error): Pull bytes 39016

They just confuse admins (and developers).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibcli/auth: let NTLMv2_RESPONSE_verify_netlogon_creds ignore BUFFER_TOO_SMALL
Stefan Metzmacher [Wed, 15 Dec 2021 16:25:06 +0000 (17:25 +0100)]
libcli/auth: let NTLMv2_RESPONSE_verify_netlogon_creds ignore BUFFER_TOO_SMALL

Windows doesn't complain about invalid av_pair blobs,
we need to do the same.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos4:torture/rpc: add test for invalid av_pair content in LogonSamLogonEx
Stefan Metzmacher [Fri, 17 Dec 2021 21:28:51 +0000 (22:28 +0100)]
s4:torture/rpc: add test for invalid av_pair content in LogonSamLogonEx

A netapp diag tool uses a NTLMv2_CLIENT_CHALLENGE with invalid bytes
as av_pair blob. Which is supposed to be ignored by DCs.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoauth/credentials: cli_credentials_set_ntlm_response() pass session_keys
Stefan Metzmacher [Sat, 18 Dec 2021 09:40:36 +0000 (10:40 +0100)]
auth/credentials: cli_credentials_set_ntlm_response() pass session_keys

Otherwise cli_credentials_get_ntlm_response() will return session keys
with a 0 length, which leads to errors in the NTLMSSP code.

This wasn't noticed as cli_credentials_set_ntlm_response() has no
callers yet, but that will change in the next commits.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoRemove stray reference to "ldap ssl ads"
David Mulder [Mon, 3 Jan 2022 15:40:56 +0000 (08:40 -0700)]
Remove stray reference to "ldap ssl ads"

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

"ldap ssl ads" has been deprecated and removed.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Isaac Boukris <iboukris@gmail.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan  4 19:58:24 UTC 2022 on sn-devel-184

2 years agoHappy New Year 2022!
Stefan Metzmacher [Sat, 1 Jan 2022 00:31:01 +0000 (01:31 +0100)]
Happy New Year 2022!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Jan  1 01:24:21 UTC 2022 on sn-devel-184

2 years agosmbd: Assert we don't leak fd's in struct fd_handle
Volker Lendecke [Mon, 27 Dec 2021 10:17:22 +0000 (11:17 +0100)]
smbd: Assert we don't leak fd's in struct fd_handle

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Dec 30 11:54:17 UTC 2021 on sn-devel-184

2 years agosmbd: Replace SMB_VFS_CLOSE() calls with fd_close()
Volker Lendecke [Tue, 28 Dec 2021 11:25:59 +0000 (12:25 +0100)]
smbd: Replace SMB_VFS_CLOSE() calls with fd_close()

fd_close() mostly wraps SMB_VFS_CLOSE() but also takes care of refcounting
fsp->fh properly and also makes sure that fsp->fh->fd is set to -1 after close.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agovfs_commit: Reset fsp->fd->fd to -1 after SMB_VFS_CLOSE
Volker Lendecke [Tue, 28 Dec 2021 17:42:00 +0000 (18:42 +0100)]
vfs_commit: Reset fsp->fd->fd to -1 after SMB_VFS_CLOSE

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agopysmbd: Fix file descriptor leaks
Volker Lendecke [Tue, 28 Dec 2021 17:34:20 +0000 (18:34 +0100)]
pysmbd: Fix file descriptor leaks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Fix a fd leak when closing a print file
Volker Lendecke [Tue, 28 Dec 2021 11:25:40 +0000 (12:25 +0100)]
smbd: Fix a fd leak when closing a print file

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>