samba.git
8 hours agoscript:autobuild: Make sure we can send a failure mail master
Andreas Schneider [Wed, 25 Jan 2023 16:08:58 +0000 (17:08 +0100)]
script:autobuild: Make sure we can send a failure mail

We should not run into an exception if the file doesn't exist.

Traceback (most recent call last):
  File "script/autobuild.py", line 1781, in <module>
    email_failure(-1, 'rebase', 'rebase', 'rebase',
  File "script/autobuild.py", line 1677, in email_failure
    f = open("%s/%s.stdout" % (gitroot, failed_tag), 'r')
FileNotFoundError: [Errno 2] No such file or directory:
  'samba-autobuild/rebase.stdout'

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 Jan 30 10:00:27 UTC 2023 on atb-devel-224

9 hours agopython: Replace calls to deprecated methods
Joseph Sutton [Wed, 18 Jan 2023 19:37:03 +0000 (08:37 +1300)]
python: Replace calls to deprecated methods

These aliases are deprecated and have been removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 hours agosamba-tool: Use ntstatus constants in gpo commands
David Mulder [Wed, 7 Dec 2022 17:56:54 +0000 (10:56 -0700)]
samba-tool: Use ntstatus constants in gpo commands

Replace all the hard coded instances of ntstatus
codes in the samba-tool gpo commands with
constants from samba.ntstatus.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 hours agosamba-tool: Test gpo show/load handling of utf-16-le strings
David Mulder [Thu, 24 Mar 2022 17:35:02 +0000 (11:35 -0600)]
samba-tool: Test gpo show/load handling of utf-16-le strings

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo show/load handle utf-16-le strings
David Mulder [Thu, 24 Mar 2022 17:05:13 +0000 (17:05 +0000)]
samba-tool: gpo show/load handle utf-16-le strings

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load provide option for replace vs merge
David Mulder [Thu, 17 Feb 2022 17:38:46 +0000 (10:38 -0700)]
samba-tool: gpo load provide option for replace vs merge

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load set ntacl with SYSVOL file creation
David Mulder [Wed, 16 Feb 2022 10:11:34 +0000 (03:11 -0700)]
samba-tool: gpo load set ntacl with SYSVOL file creation

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load add Registry ext by default
David Mulder [Tue, 15 Feb 2022 21:45:41 +0000 (14:45 -0700)]
samba-tool: gpo load add Registry ext by default

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load extension names
David Mulder [Tue, 15 Feb 2022 18:09:12 +0000 (11:09 -0700)]
samba-tool: gpo load extension names

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load/remove increment GPT.INI
David Mulder [Mon, 14 Feb 2022 20:34:39 +0000 (13:34 -0700)]
samba-tool: gpo load/remove increment GPT.INI

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load/remove bytes
David Mulder [Mon, 24 Jan 2022 16:21:47 +0000 (09:21 -0700)]
samba-tool: gpo load/remove bytes

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: Test gpo load/remove commands
David Mulder [Fri, 21 Jan 2022 18:48:48 +0000 (11:48 -0700)]
samba-tool: Test gpo load/remove commands

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: gpo load/remove commands
David Mulder [Tue, 29 Jun 2021 19:38:02 +0000 (19:38 +0000)]
samba-tool: gpo load/remove commands

These commands allow the setting of various group
policies on the sysvol.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
9 hours agosamba-tool: Move smb_connection to a common file
David Mulder [Wed, 7 Dec 2022 18:32:30 +0000 (11:32 -0700)]
samba-tool: Move smb_connection to a common file

This is in preparation for needing it here later.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 hours agosamba-tool: Move create_directory_hier to a common file
David Mulder [Wed, 7 Dec 2022 18:27:00 +0000 (11:27 -0700)]
samba-tool: Move create_directory_hier to a common file

This is in preparation for needing it here later.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 hours agosamba-tool: gpo show command list policies
David Mulder [Thu, 3 Jun 2021 17:05:42 +0000 (17:05 +0000)]
samba-tool: gpo show command list policies

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Tested-by: Kees van Vloten <keesvanvloten@gmail.com>
3 days agos3:lib: Change file_modtime() to return an error code and a struct timespec.
Jeremy Allison [Thu, 26 Jan 2023 17:39:10 +0000 (09:39 -0800)]
s3:lib: Change file_modtime() to return an error code and a struct timespec.

Removes need for external stat() code when checking for timechange.

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 Jan 27 08:30:35 UTC 2023 on atb-devel-224

3 days agospelling fixes for 4.18 (errror implemenation proces Controler)
Michael Tokarev [Fri, 20 Jan 2023 18:12:54 +0000 (21:12 +0300)]
spelling fixes for 4.18 (errror implemenation proces Controler)

One of changes is somewhat interesting, it is "tfork waiter proces"
process title in tfork.c. I wonder why no one noticed this before.
There's another similar process title in there, "tfork waiter process(%d)".
Hopefully no one does grep for "proces$" (and there's no reason to).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Rowland Penny <rpenny@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan 26 20:46:11 UTC 2023 on atb-devel-224

4 days agos3/lib: Prevent use after free of messaging_ctdb_fde_ev structs
Noel Power [Wed, 25 Jan 2023 17:03:07 +0000 (17:03 +0000)]
s3/lib: Prevent use after free of messaging_ctdb_fde_ev structs

In a cluster setup samba-bgqd async callback
cups_pcap_load_async can access messaging_ctdb_fde_ev associated
with already destructed global_ctdb_ctx_destructor

==26053== Invalid read of size 8
==26053==    at 0x71692E1: messaging_ctdb_fde_ev_destructor (messages_ctdb.c:181)
==26053==    by 0x40B2309: _tc_free_internal (talloc.c:1158)
==26053==    by 0x40B3539: _tc_free_children_internal (talloc.c:1669)
==26053==    by 0x40B24C4: _tc_free_internal (talloc.c:1184)
==26053==    by 0x40B3539: _tc_free_children_internal (talloc.c:1669)
==26053==    by 0x40B24C4: _tc_free_internal (talloc.c:1184)
==26053==    by 0x40B2685: _talloc_free_internal (talloc.c:1248)
==26053==    by 0x40B3963: _talloc_free (talloc.c:1792)
==26053==    by 0x4056BCA: tevent_req_received (tevent_req.c:301)
==26053==    by 0x405673D: tevent_req_destructor (tevent_req.c:135)
==26053==    by 0x40B2309: _tc_free_internal (talloc.c:1158)
==26053==    by 0x40B3539: _tc_free_children_internal (talloc.c:1669)
==26053==    by 0x40B24C4: _tc_free_internal (talloc.c:1184)
==26053==    by 0x40B2685: _talloc_free_internal (talloc.c:1248)
==26053==    by 0x40B3963: _talloc_free (talloc.c:1792)
==26053==    by 0x1384EF: cups_pcap_load_async (print_cups.c:507)
==26053==    by 0x13894B: cups_cache_reload (print_cups.c:602)
==26053==    by 0x1373AE: pcap_cache_reload (pcap.c:140)
==26053==    by 0x1369D2: register_printing_bq_handlers (queue_process.c:323)
==26053==    by 0x122AD6: main (samba-bgqd.c:316)
==26053==  Address 0xed64d48 is 120 bytes inside a block of size 128 free'd
==26053==    at 0x4C370EB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26053==    by 0x40B25E1: _tc_free_internal (talloc.c:1222)
==26053==    by 0x40B2685: _talloc_free_internal (talloc.c:1248)
==26053==    by 0x40B3963: _talloc_free (talloc.c:1792)
==26053==    by 0x71691F6: messaging_ctdb_destroy (messages_ctdb.c:141)
==26053==    by 0x7169C21: msg_ctdb_ref_destructor (messages_ctdb_ref.c:142)
==26053==    by 0x40B2309: _tc_free_internal (talloc.c:1158)
==26053==    by 0x40B3539: _tc_free_children_internal (talloc.c:1669)
==26053==    by 0x40B24C4: _tc_free_internal (talloc.c:1184)
==26053==    by 0x40B2685: _talloc_free_internal (talloc.c:1248)
==26053==    by 0x40B3963: _talloc_free (talloc.c:1792)
==26053==    by 0x4157380: messaging_reinit (messages.c:646)
==26053==    by 0x416C01E: reinit_after_fork (util.c:488)
==26053==    by 0x13844C: cups_pcap_load_async (print_cups.c:498)
==26053==    by 0x13894B: cups_cache_reload (print_cups.c:602)
==26053==    by 0x1373AE: pcap_cache_reload (pcap.c:140)
==26053==    by 0x1369D2: register_printing_bq_handlers (queue_process.c:323)
==26053==    by 0x122AD6: main (samba-bgqd.c:316)
==26053==  Block was alloc'd at
==26053==    at 0x4C346A4: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26053==    by 0x40B1989: __talloc_with_prefix (talloc.c:783)
==26053==    by 0x40B1B23: __talloc (talloc.c:825)
==26053==    by 0x40B1ECC: _talloc_named_const (talloc.c:982)
==26053==    by 0x40B49C3: _talloc_zero (talloc.c:2421)
==26053==    by 0x7168E68: messaging_ctdb_init (messages_ctdb.c:93)
==26053==    by 0x716979D: messaging_ctdb_ref (messages_ctdb_ref.c:75)
==26053==    by 0x415702A: messaging_init_internal (messages.c:563)
==26053==    by 0x41572FD: messaging_init (messages.c:622)
==26053==    by 0x4163ED3: global_messaging_context (global_contexts.c:62)
==26053==    by 0x12273B: main (samba-bgqd.c:271)
==26053==

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

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Jan 26 16:03:49 UTC 2023 on atb-devel-224

4 days agos3:test: Test winbind call depth trace
Pavel Filipenský [Wed, 25 Jan 2023 01:01:22 +0000 (02:01 +0100)]
s3:test: Test winbind call depth trace

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 26 15:07:57 UTC 2023 on atb-devel-224

4 days agos3:winbind: Move tevent_req_create() before debug macros to have the right call depth
Pavel Filipenský [Mon, 12 Sep 2022 14:06:09 +0000 (16:06 +0200)]
s3:winbind: Move tevent_req_create() before debug macros to have the right call depth

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agos3:winbind: Deactivate call depth tracking in child winbindd
Pavel Filipenský [Fri, 17 Jun 2022 16:03:35 +0000 (18:03 +0200)]
s3:winbind: Deactivate call depth tracking in child winbindd

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agos3:winbind: Activate the call depth tracking in main winbindd
Pavel Filipenský [Thu, 16 Jun 2022 15:56:39 +0000 (17:56 +0200)]
s3:winbind: Activate the call depth tracking in main winbindd

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agodebug: Call depth: Indent the debug text
Pavel Filipenský [Fri, 26 Aug 2022 09:42:42 +0000 (11:42 +0200)]
debug: Call depth: Indent the debug text

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agodebug: Call depth: Print ", depth=..." in the debug header
Pavel Filipenský [Fri, 26 Aug 2022 09:42:42 +0000 (11:42 +0200)]
debug: Call depth: Print ", depth=..." in the debug header

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agodebug: Call depth: Interface
Pavel Filipenský [Fri, 26 Aug 2022 09:41:44 +0000 (11:41 +0200)]
debug: Call depth: Interface

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agodebug: Fix whitespaces in debug.c
Pavel Filipenský [Fri, 10 Jun 2022 13:35:53 +0000 (15:35 +0200)]
debug: Fix whitespaces in debug.c

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agoselftest: Update devel_env.sh for SAMBA_DCERPCD_DONT_LOG_STDOUT=1
Andreas Schneider [Wed, 25 Jan 2023 16:26:17 +0000 (17:26 +0100)]
selftest: Update devel_env.sh for SAMBA_DCERPCD_DONT_LOG_STDOUT=1

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
4 days agos3:tests: Add support for SMBD_DONT_LOG_STDOUT=1 in test_chdir_cache.sh
Andreas Schneider [Mon, 23 Jan 2023 09:21:33 +0000 (10:21 +0100)]
s3:tests: Add support for SMBD_DONT_LOG_STDOUT=1 in test_chdir_cache.sh

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agoselftest: Only run samba.tests.smb3unix in developer mode
Andreas Schneider [Wed, 25 Jan 2023 09:46:03 +0000 (10:46 +0100)]
selftest: Only run samba.tests.smb3unix in developer mode

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 26 13:13:50 UTC 2023 on atb-devel-224

4 days agopython:tests: Avoid exceptions in cleanup code if a test fails in smb3unix.py
Andreas Schneider [Tue, 24 Jan 2023 08:18:46 +0000 (09:18 +0100)]
python:tests: Avoid exceptions in cleanup code if a test fails in smb3unix.py

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agoparam: Use a higher time resolution for lp_file_list_changed()
Andreas Schneider [Tue, 24 Jan 2023 20:44:34 +0000 (21:44 +0100)]
param: Use a higher time resolution for lp_file_list_changed()

It is possible that in our test environment one of the config 'include' files
change more than once per second. To avoid missing a file update we use a
higher time resolution than seconds.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agolib:param: Remove trailing whitespaces from loadparm.c
Andreas Schneider [Tue, 24 Jan 2023 20:43:09 +0000 (21:43 +0100)]
lib:param: Remove trailing whitespaces from loadparm.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agolib:util: Print data in ISO 8601 format
Andreas Schneider [Tue, 24 Jan 2023 21:31:17 +0000 (22:31 +0100)]
lib:util: Print data in ISO 8601 format

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 days agolib:util: Remove trailing whitespaces from time.c
Andreas Schneider [Tue, 24 Jan 2023 21:31:00 +0000 (22:31 +0100)]
lib:util: Remove trailing whitespaces from time.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 days agosmbd: Use smbXsrv_open_global_parse_record() in .._verify_record()
Volker Lendecke [Thu, 19 Jan 2023 11:29:20 +0000 (12:29 +0100)]
smbd: Use smbXsrv_open_global_parse_record() in .._verify_record()

Signed-off-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jan 24 09:15:26 UTC 2023 on atb-devel-224

6 days agosmbd: Simplify smbXsrv_open_global_parse_record()
Volker Lendecke [Thu, 19 Jan 2023 11:25:21 +0000 (12:25 +0100)]
smbd: Simplify smbXsrv_open_global_parse_record()

It does not need a db_record.

Signed-off-by: Volker Lendecke <vl@samba.org>
6 days agosmbd: Move smbXsrv_open_global_parse_record() up in smbXsrv_open.c
Volker Lendecke [Thu, 19 Jan 2023 11:22:33 +0000 (12:22 +0100)]
smbd: Move smbXsrv_open_global_parse_record() up in smbXsrv_open.c

Avoid a prototype in the next patches

Signed-off-by: Volker Lendecke <vl@samba.org>
6 days agosmbd: Simplify smbXsrv_open_global_verify_record()
Volker Lendecke [Fri, 6 Jan 2023 15:25:03 +0000 (16:25 +0100)]
smbd: Simplify smbXsrv_open_global_verify_record()

Don't depend on the record to be passed in, return NTSTATUS. The two
flags were a bit confusing to me, now NT_STATUS_OK means "found a
valid record with a live process", and NT_STATUS_FATAL_APP_EXIT means
we found a stale record from a crashed smbd

Signed-off-by: Volker Lendecke <vl@samba.org>
6 days agosmbd: Save a few lines in smb2srv_open_lookup_replay_cache()
Volker Lendecke [Wed, 11 Jan 2023 10:44:29 +0000 (11:44 +0100)]
smbd: Save a few lines in smb2srv_open_lookup_replay_cache()

Directly initialize variables, don't leave dangling pointers in TDB_DATA

Signed-off-by: Volker Lendecke <vl@samba.org>
6 days agosmbd: Fix a typo
Volker Lendecke [Wed, 11 Jan 2023 07:18:35 +0000 (08:18 +0100)]
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 days agopython: Don't use deprecated escape sequences
Andreas Schneider [Thu, 19 Jan 2023 07:30:19 +0000 (08:30 +0100)]
python: Don't use deprecated escape sequences

Certain escape sequences are not valid in Python string literals, and
will eventually result in a SyntaxError.

Follow up patch of 5045382c6dd04b1bae0eaaae823be908213ff079

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan 20 09:06:49 UTC 2023 on atb-devel-224

10 days agos3:rpc_server/mdssvc: don't crash mdssvc_tracker_shutdown with NULL glue
Stefan Metzmacher [Wed, 11 Jan 2023 22:48:11 +0000 (23:48 +0100)]
s3:rpc_server/mdssvc: don't crash mdssvc_tracker_shutdown with NULL glue

If mdssvc_tracker_shutdown() is called without any mds_tracker_connect()
we would crash as mdssvc_tracker_init() don't call
mdssvc_tracker_prepare().

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): Thu Jan 19 19:46:01 UTC 2023 on atb-devel-224

10 days agos3:auth: call wbcFreeMemory(info) in auth3_generate_session_info_pac()
Stefan Metzmacher [Thu, 16 Dec 2021 17:24:16 +0000 (18:24 +0100)]
s3:auth: call wbcFreeMemory(info) in auth3_generate_session_info_pac()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 days agos4:dnsserver: Rename dns_name_equal() to samba_dns_name_equal()
Samuel Cabrero [Wed, 18 Jan 2023 16:25:29 +0000 (17:25 +0100)]
s4:dnsserver: Rename dns_name_equal() to samba_dns_name_equal()

This function already exists in bind9 but takes different arguments, so when
the DLZ is loaded and this function is called bind crashes:

  named[1523]: samba_dlz: allowing update of signer=DESKTOP-8BUKMBK\$\@AFOREST.AD name=118.101.168.192.in-addr.arpa tcpaddr=192.168.101.118  type=PTR key=1264-ms-7.1-2ac9.9ef238e1-9747-11ed-9f95-525400dc6981/159/0
  named[1523]: samba_dlz: allowing update of signer=DESKTOP-8BUKMBK\$\@AFOREST.AD name=118.101.168.192.in-addr.arpa tcpaddr=192.168.101.118  type=PTR key=1264-ms-7.1-2ac9.9ef238e1-9747-11ed-9f95-525400dc6981/159/0
  named[1523]: client @0x7f26caa90f68 192.168.101.118#58223/key DESKTOP-8BUKMBK\$\@AFOREST.AD: updating zone '101.168.192.in-addr.arpa/NONE': deleting rrset at '118.101.168.192.in-addr.ar
  named[1523]: name.c:664: REQUIRE(((name1) != ((void *)0) && ((const isc__magic_t *)(name1))->magic == ((('D') << 24 | ('N') << 16 | ('S') << 8 | ('n'))))) failed, back trace

Backtrace:

  #0  0x00007f2716c957ec in __pthread_kill_implementation () from /lib64/libc.so.6
  #1  0x00007f2716c42816 in raise () from /lib64/libc.so.6
  #2  0x00007f2716c2b81c in abort () from /lib64/libc.so.6
  #3  0x000055d4de847995 in assertion_failed (file=<optimized out>, line=<optimized out>,
      type=<optimized out>, cond=<optimized out>) at /usr/src/debug/bind-9.18.10/bin/named/main.c:237
  #4  0x00007f27176388fc in isc_assertion_failed (file=file@entry=0x7f27173b0df6 "name.c",
      line=line@entry=664, type=type@entry=isc_assertiontype_require,
      cond=cond@entry=0x7f27173b0268 "((name1) != ((void *)0) && ((const isc__magic_t *)(name1))->magic == ((('D') << 24 | ('N') << 16 | ('S') << 8 | ('n'))))")
      at /usr/src/debug/bind-9.18.10/lib/isc/assertions.c:48
  #5  0x00007f27172946f9 in dns_name_equal (name1=<optimized out>, name2=<optimized out>)
      at /usr/src/debug/bind-9.18.10/lib/dns/name.c:664

  **** Here bind's dns_name_equal() is called instead of samba's dns_name_equal() ****

  #6  0x00007f27077ad6f2 in dns_record_match (rec1=0x7f26f8042d70, rec2=0x7f26f8044d10)
      at ../../source4/dns_server/dnsserver_common.c:1346
  #7  0x00007f271404732c in b9_record_match (rec1=0x7f26f8042d70, rec2=0x7f26f8044d10)
      at ../../source4/dns_server/dlz_bind9.c:1830
  #8  0x00007f2714047daa in dlz_subrdataset (name=0x7f2706ff82f0 "118.101.168.192.in-addr.arpa",
      rdatastr=0x7f26c9c10000 "118.101.168.192.in-addr.arpa.\t1200\tIN\tPTR\tDESKTOP-8BUKMBK.aforest.ad.",
      dbdata=0x7f271003d300, version=0x7f26f8044b20) at ../../source4/dns_server/dlz_bind9.c:2077
  #9  0x000055d4de84afb4 in dlopen_dlz_subrdataset (name=0x7f2706ff82f0 "118.101.168.192.in-addr.arpa",
      rdatastr=<optimized out>, driverarg=<optimized out>, dbdata=0x7f270430f680, version=<optimized out>)
      at /usr/src/debug/bind-9.18.10/bin/named/dlz_dlopen_driver.c:483
  #10 0x00007f271738e734 in modrdataset.constprop.0 (db=0x7f2704291740, node=0x7f26c9c006e0,
      version=0x7f26f8044b20, rdataset=0x7f2706ff8830,
      mod_function=0x55d4de84af80 <dlopen_dlz_subrdataset>, options=<optimized out>)
      at /usr/src/debug/bind-9.18.10/lib/dns/sdlz.c:1107
  #11 0x00007f2717251855 in diff_apply (diff=diff@entry=0x7f2706ff8df0, db=db@entry=0x7f2704291740,
      ver=ver@entry=0x7f26f8044b20, warn=warn@entry=true) at /usr/src/debug/bind-9.18.10/lib/dns/diff.c:370
  #12 0x00007f2717251c8a in dns_diff_apply (diff=diff@entry=0x7f2706ff8df0, db=db@entry=0x7f2704291740,
      ver=ver@entry=0x7f26f8044b20) at /usr/src/debug/bind-9.18.10/lib/dns/diff.c:465
  #13 0x00007f2717d105aa in do_one_tuple (tuple=tuple@entry=0x7f2706ff8e50, db=db@entry=0x7f2704291740,
      ver=ver@entry=0x7f26f8044b20, diff=diff@entry=0x7f2706ff9400)
      at /usr/src/debug/bind-9.18.10/lib/ns/update.c:454
  #14 0x00007f2717d10fff in update_one_rr (rdata=0x7f2706ff8ee8, ttl=<optimized out>,
      name=<optimized out>, op=DNS_DIFFOP_DEL, diff=0x7f2706ff9400, ver=0x7f26f8044b20, db=0x7f2704291740)
      at /usr/src/debug/bind-9.18.10/lib/ns/update.c:505
  #15 delete_if_action (data=<optimized out>, rr=0x7f2706ff8ee0)
      at /usr/src/debug/bind-9.18.10/lib/ns/update.c:1427
  #16 0x00007f2717d10ccd in foreach_rr (db=0x7f2704291740, ver=<optimized out>, name=0x7f26caa61d00,
      type=<optimized out>, covers=<optimized out>,
      rr_action=rr_action@entry=0x7f2717d10f60 <delete_if_action>, rr_action_data=0x7f2706ff9280)
      at /usr/src/debug/bind-9.18.10/lib/ns/update.c:736
  #17 0x00007f2717d10e76 in delete_if (predicate=predicate@entry=0x7f2717d0fb10 <true_p>,
      db=<optimized out>, ver=<optimized out>, name=<optimized out>, type=<optimized out>,
      covers=<optimized out>, update_rr=0x7f2706ff94b0, diff=0x7f2706ff9400)
      at /usr/src/debug/bind-9.18.10/lib/ns/update.c:1454
  #18 0x00007f2717d1bccd in update_action (task=<optimized out>, event=<optimized out>)
      at /usr/src/debug/bind-9.18.10/lib/ns/update.c:3299
  #19 0x00007f271765eb4c in task_run (task=0x7f27155ccf00)
      at /usr/src/debug/bind-9.18.10/lib/isc/task.c:823
  #20 isc_task_run (task=0x7f27155ccf00) at /usr/src/debug/bind-9.18.10/lib/isc/task.c:904
  #21 0x00007f271762cb12 in isc__nm_async_task (worker=0x7f2716236560, ev0=0x7f26caa07000)
      at netmgr/netmgr.c:840
  #22 process_netievent (worker=worker@entry=0x7f2716236560, ievent=0x7f26caa07000) at netmgr/netmgr.c:918
  #23 0x00007f271762d197 in process_queue (worker=worker@entry=0x7f2716236560,
      type=type@entry=NETIEVENT_TASK) at netmgr/netmgr.c:1011
  #24 0x00007f271762d3b3 in process_all_queues (worker=0x7f2716236560) at netmgr/netmgr.c:765
  #25 async_cb (handle=0x7f27162368c0) at netmgr/netmgr.c:794
  #26 0x00007f2717c4cb0d in uv__async_io (loop=0x7f2716236570, w=<optimized out>, events=<optimized out>)
      at src/unix/async.c:163
  #27 0x00007f2717c6825d in uv__io_poll (loop=0x7f2716236570, timeout=<optimized out>)
      at src/unix/epoll.c:374
  #28 0x00007f2717c5247a in uv__io_poll (timeout=<optimized out>, loop=0x7f2716236570)
      at src/unix/udp.c:122
  #29 uv_run (loop=loop@entry=0x7f2716236570, mode=mode@entry=UV_RUN_DEFAULT) at src/unix/core.c:406
  #30 0x00007f271762d834 in nm_thread (worker0=0x7f2716236560) at netmgr/netmgr.c:696
  #31 0x00007f27176627f5 in isc__trampoline_run (arg=0x55d4dfe3ad70)
      at /usr/src/debug/bind-9.18.10/lib/isc/trampoline.c:189
  #32 0x00007f2716c9398d in start_thread () from /lib64/libc.so.6
  #33 0x00007f2716d19344 in clone () from /lib64/libc.so.6

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Thu Jan 19 10:20:27 UTC 2023 on atb-devel-224

11 days agokdc: Don't reference ENODATA in platform-independent code
Volker Lendecke [Wed, 18 Jan 2023 10:49:00 +0000 (11:49 +0100)]
kdc: Don't reference ENODATA in platform-independent code

FreeBSD has ENOATTR but not ENODATA, Linux has ENODATA but not ENOATTR for
returning "attr does not exist". With 2eb899de6a2 we settled on ENOATTR to
handle this case.

Alternatively we could

 #define ENODATA ENOATTR

on FreeBSD...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: douglas.bagnall@catalyst.net.nz
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 19 09:24:15 UTC 2023 on atb-devel-224

12 days agoldb: change the version to 2.8.0 for Samba 4.19
Stefan Metzmacher [Wed, 18 Jan 2023 10:53:33 +0000 (11:53 +0100)]
ldb: change the version to 2.8.0 for Samba 4.19

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jule Anger <janger@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jan 18 17:25:51 UTC 2023 on atb-devel-224

12 days agoWHATSNEW: Start release notes for Samba 4.19.0pre1.
Jule Anger [Wed, 18 Jan 2023 15:50:10 +0000 (16:50 +0100)]
WHATSNEW: Start release notes for Samba 4.19.0pre1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
12 days agoVERSION: Bump version up to 4.19.0pre1...
Jule Anger [Wed, 18 Jan 2023 15:47:32 +0000 (16:47 +0100)]
VERSION: Bump version up to 4.19.0pre1...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
12 days agoVERSION: Disable GIT_SNAPSHOT for the Samba 4.18.0rc1 release. v4-18-stable samba-4.18.0rc1
Jule Anger [Wed, 18 Jan 2023 15:44:14 +0000 (16:44 +0100)]
VERSION: Disable GIT_SNAPSHOT for the Samba 4.18.0rc1 release.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
12 days agoWHATSNEW: Up to Samba 4.18.0rc1.
Jule Anger [Wed, 18 Jan 2023 15:43:03 +0000 (16:43 +0100)]
WHATSNEW: Up to Samba 4.18.0rc1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
12 days agoldb: version 2.7.0 ldb-2.7.0
Stefan Metzmacher [Wed, 18 Jan 2023 14:53:46 +0000 (15:53 +0100)]
ldb: version 2.7.0

* Support python 3.12
* Have python functions operating on DNs raise LdbError
* don't call comparison() directly in LDB_TYPESAFE_QSORT
* Use ldb_ascii_toupper() for case folding to support
  tr_TR.UTF-8 and other dotless i locales,
  see https://bugzilla.samba.org/show_bug.cgi?id=15248

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jule Anger <janger@samba.org>
12 days agotevent: version 0.14.0 tevent-0.14.0
Stefan Metzmacher [Wed, 9 Nov 2022 12:32:04 +0000 (13:32 +0100)]
tevent: version 0.14.0

- Support python 3.12
- remove solaris port backend (it's not maintainable)
- make tevent_find_ops_byname() available for callers.
- allow the "standard" backend to be overloaded
- add interface for request/subrequest call depth tracking:
  - tevent_thread_call_depth_activate
  - tevent_thread_call_depth_deactivate
  - tevent_thread_call_depth_start
  - tevent_thread_call_depth_stop
  - tevent_thread_call_depth_reset_from_req

Note the changes to ABI/tevent-0.13.0.sigs only
revert the temporary changes made there...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: Call depth tracking
Pavel Filipenský [Thu, 16 Jun 2022 14:23:22 +0000 (16:23 +0200)]
tevent: Call depth tracking

The change to lib/tevent/ABI/tevent-0.13.0.sigs will be reverted
in the commit for the 0.14.0 release...

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: expose tevent_find_ops_byname() to callers
Stefan Metzmacher [Fri, 28 Oct 2022 12:10:15 +0000 (14:10 +0200)]
tevent: expose tevent_find_ops_byname() to callers

This makes it more flexible and allow a caller to overload
a tevent backend. Which will be used by Samba in order to
glue in io_uring support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: allow the "standard" backend to be overloaded
Stefan Metzmacher [Sat, 12 Nov 2022 15:27:30 +0000 (15:27 +0000)]
tevent: allow the "standard" backend to be overloaded

We'll export tevent_find_ops_byname() soon and will allow
the context_init() function of backends to find that standard ops
and hand over to standard_ops->context_init().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: remove solaris port backend
Stefan Metzmacher [Wed, 9 Nov 2022 11:26:38 +0000 (12:26 +0100)]
tevent: remove solaris port backend

There's no way to verify changes we would have to do tevent_port.c,
as we don't have access to a solaris build machine.

So better use the poll backend instead. In performance critical code
we typically don't deal with a lot of file descriptors so the impact
should be fairly minimal.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: remove unused register_backend() from python bindings
Stefan Metzmacher [Tue, 23 Aug 2022 06:27:37 +0000 (08:27 +0200)]
tevent: remove unused register_backend() from python bindings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: remove unused tevent_liboop.c
Stefan Metzmacher [Tue, 23 Aug 2022 06:24:33 +0000 (08:24 +0200)]
tevent: remove unused tevent_liboop.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: Fix trailing whitespaces in tevent.c
Pavel Filipenský [Thu, 16 Jun 2022 17:09:03 +0000 (19:09 +0200)]
tevent: Fix trailing whitespaces in tevent.c

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotevent: use samba_tevent_set_debug() in testsuite.c
Stefan Metzmacher [Tue, 10 Jan 2023 11:57:58 +0000 (12:57 +0100)]
tevent: use samba_tevent_set_debug() in testsuite.c

Note testsuite.c is only used in Samba's smbtorture as
'smbtorture //a/b local.event'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agolib/util: install a tevent_abort callback using smb_panic()
Stefan Metzmacher [Wed, 9 Nov 2022 13:05:59 +0000 (14:05 +0100)]
lib/util: install a tevent_abort callback using smb_panic()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agos4:lib/events: let s4_event_context_init() use samba_tevent_context_init()
Stefan Metzmacher [Thu, 27 Oct 2022 20:17:55 +0000 (22:17 +0200)]
s4:lib/events: let s4_event_context_init() use samba_tevent_context_init()

This is no real change, but it makes sure we only have to
change samba_tevent_context_init() in future in order to
distribute the change to all places.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
12 days agotdb: version 1.4.8 tdb-1.4.8
Stefan Metzmacher [Wed, 18 Jan 2023 10:53:02 +0000 (11:53 +0100)]
tdb: version 1.4.8

* Support python 3.12

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jule Anger <janger@samba.org>
12 days agotalloc: version 2.4.0 talloc-2.4.0
Stefan Metzmacher [Wed, 18 Jan 2023 10:52:33 +0000 (11:52 +0100)]
talloc: version 2.4.0

* Add talloc_asprintf_addbuf()
* Support python 3.12

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jule Anger <janger@samba.org>
12 days agobootstrap: Update to Ubuntu 22.04 as base default OS
Stefan Metzmacher [Wed, 2 Nov 2022 15:56:31 +0000 (16:56 +0100)]
bootstrap: Update to Ubuntu 22.04 as base default OS

We'll try to move autobuild to ubuntu 22.04 soon.

Note we leave ubuntu 18.04 for the coverage and 32bit builds
for now. As well as 20.04 for samba-fuzz.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jan 18 14:17:23 UTC 2023 on atb-devel-224

12 days agothird_party: Update uid_wrapper to version 1.3.0
Stefan Metzmacher [Mon, 16 Jan 2023 21:14:03 +0000 (22:14 +0100)]
third_party: Update uid_wrapper to version 1.3.0

This is mainly needed in order to have some interaction
with socket_wrapper 1.4.0 regarding the implementation
of syscall().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jan 18 12:47:48 UTC 2023 on sn-devel-184

12 days agothird_party: Update socket_wrapper to version 1.4.0
Stefan Metzmacher [Mon, 16 Jan 2023 21:13:35 +0000 (22:13 +0100)]
third_party: Update socket_wrapper to version 1.4.0

The key feature is support for sendmmsg and recvmmsg,
which is required by modern libuv versions, e.g.
nsupdate -g makes use of libuv, so we need this for samba.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 days agoctdb: Fix the build on FreeBSD
Volker Lendecke [Wed, 18 Jan 2023 07:59:17 +0000 (08:59 +0100)]
ctdb: Fix the build on FreeBSD

"basename" is define in libgen.h included from system/dir.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Modernize DBG statements in smbXsrv_open_global_store()
Volker Lendecke [Thu, 5 Jan 2023 15:06:40 +0000 (16:06 +0100)]
smbd: Modernize DBG statements in smbXsrv_open_global_store()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Make smbXsrv_open_global_id_to_key() a bit more type-safe
Volker Lendecke [Wed, 4 Jan 2023 19:09:32 +0000 (20:09 +0100)]
smbd: Make smbXsrv_open_global_id_to_key() a bit more type-safe

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Directly initialize key in smbXsrv_open_global_fetch_locked()
Volker Lendecke [Wed, 11 Jan 2023 13:07:42 +0000 (14:07 +0100)]
smbd: Directly initialize key in smbXsrv_open_global_fetch_locked()

Don't leave the key.dptr pointer uninitialized

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Remove unused smbXsrv_open_global_key_to_id()
Volker Lendecke [Wed, 4 Jan 2023 15:50:01 +0000 (16:50 +0100)]
smbd: Remove unused smbXsrv_open_global_key_to_id()

This isn't exactly rocket science we would need to keep around

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Slightly simplify smbXsrv_open_create()
Volker Lendecke [Wed, 4 Jan 2023 13:30:28 +0000 (14:30 +0100)]
smbd: Slightly simplify smbXsrv_open_create()

Move allocation of smbXsrv_open_global0 out of
smbXsrv_open_global_allocate()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Remove smbXsrv_open_global_destructor()
Volker Lendecke [Wed, 11 Jan 2023 13:01:29 +0000 (14:01 +0100)]
smbd: Remove smbXsrv_open_global_destructor()

This did not do much.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agosmbd: Slightly simplify smb2srv_open_recreate()
Volker Lendecke [Wed, 4 Jan 2023 13:05:55 +0000 (14:05 +0100)]
smbd: Slightly simplify smb2srv_open_recreate()

This moves the bit-fiddling right next to the check we do,
"global_zeros" was only used for this one purpose and its assignment
was a few lines away.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
12 days agolib/tsocket: fix a typo in the tsocket guide doc
Björn Baumbach [Tue, 17 Jan 2023 11:28:36 +0000 (12:28 +0100)]
lib/tsocket: fix a typo in the tsocket guide doc

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Tue Jan 17 18:23:18 UTC 2023 on sn-devel-184

13 days agos3/libsmb: fix a typo in parameter description
Björn Baumbach [Tue, 17 Jan 2023 11:29:28 +0000 (12:29 +0100)]
s3/libsmb: fix a typo in parameter description

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 days agosamba-tool domain: fix a typo in samba-tool passwordsettings option description
Björn Baumbach [Tue, 17 Jan 2023 11:27:01 +0000 (12:27 +0100)]
samba-tool domain: fix a typo in samba-tool passwordsettings option description

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 days agoauth/creds: fix a typo in a comment
Björn Baumbach [Tue, 17 Jan 2023 11:26:10 +0000 (12:26 +0100)]
auth/creds: fix a typo in a comment

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agos3: smbd: Tweak openat_pathref_dirfsp_nosymlink() to NULL out fsp->fsp_name after...
Jeremy Allison [Thu, 12 Jan 2023 19:20:08 +0000 (11:20 -0800)]
s3: smbd: Tweak openat_pathref_dirfsp_nosymlink() to NULL out fsp->fsp_name after calling fd_close() on intermediate directories, rather than before.

vfs_virusfilter expects a non-NULL fsp->fsp_name to use for printing debugs
(it always indirects fsp->fsp_name). vfs_fruit also does the same, so would
also crash in fruit_close() with 'debug level = 10' and vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no
set (we don't test with that which is why we haven't noticed
this before).

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jan 13 08:33:47 UTC 2023 on sn-devel-184

2 weeks agoselftest: Show vfs_virusscanner crashes when traversing a 2-level directory tree.
Jeremy Allison [Thu, 12 Jan 2023 18:22:09 +0000 (10:22 -0800)]
selftest: Show vfs_virusscanner crashes when traversing a 2-level directory tree.

Modify check_infected_read() test to use a 2-level deep
directory.

We must have vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no
set on the virusscanner share as otherwise the openat flag
shortcut defeats the test.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 weeks agoCI: add a test for @GMT mask in SMB1 find
Ralph Boehme [Thu, 24 Nov 2022 15:59:49 +0000 (16:59 +0100)]
CI: add a test for @GMT mask in SMB1 find

Without FLAGS2_REPARSE_PATH a path containing an @GMT token can be used to
create a file including the @GMT token in the name and a directory list will
also return the file as result. Verified against Windows. Samba behaves exactly
the same.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 13 01:13:01 UTC 2023 on sn-devel-184

2 weeks agolib: Fix a use-after-free in "net vfs getntacl"
Volker Lendecke [Thu, 12 Jan 2023 11:00:26 +0000 (12:00 +0100)]
lib: Fix a use-after-free in "net vfs getntacl"

Don't hang "sd" off "fsp", which is free'ed before printing

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 Jan 12 16:41:07 UTC 2023 on sn-devel-184

2 weeks agolib: Fix out-of-bounds access in print_ace_flags()
Volker Lendecke [Thu, 12 Jan 2023 10:55:04 +0000 (11:55 +0100)]
lib: Fix out-of-bounds access in print_ace_flags()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agolib: Use talloc_asprintf_addbuf() in print_ace_flags()
Volker Lendecke [Thu, 12 Jan 2023 10:51:50 +0000 (11:51 +0100)]
lib: Use talloc_asprintf_addbuf() in print_ace_flags()

Simplifies code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agobuild: Don't compile source3/lib/util_sd.c four times
Volker Lendecke [Thu, 12 Jan 2023 11:11:49 +0000 (12:11 +0100)]
build: Don't compile source3/lib/util_sd.c four times

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agos3:utils:mdsearch go to cmdline_messaging_context_free
Jones Syue [Thu, 12 Jan 2023 07:47:20 +0000 (15:47 +0800)]
s3:utils:mdsearch go to cmdline_messaging_context_free

mdsearch utility would exit earlier with failure in several cases like:
a. samba server is not running yet,
[~] # mdsearch -Uuser%password1 ${server} Public '*=="Samba"'
main: Cannot connect to server: NT_STATUS_CONNECTION_REFUSED

b. spotlight backend service is not ready yet,
[~] # mdsearch -Uuser%password1 ${server} Public '*=="Samba"'
Failed to connect mdssvc

c. mdsearch utility paramters is not as expecred,
[~] # mdsearch -Uuser%password1 ${server} share_not_exist '*=="Samba"'
mdscli_search failed

And in the mean while once mdsearch utility exit earlier with failure,
the lock files are left behind in the directory 'msg.sock' and 'msg.lock'.
If a script to run mdsearch utility in a loop,
this might result in used space slowly growing-up on underlying filesystem.

Supposed to add a new label 'fail_free_messaging',
make it go through the cmdline_messaging_context_free() which deletes the
lock files in the directory msg.sock and msg.lock before mdsearch utility
is exiting with failure.

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

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 12 11:40:19 UTC 2023 on sn-devel-184

2 weeks agos3:smbstatus: go to cmdline_messaging_context_free
Jones Syue [Wed, 11 Jan 2023 08:59:42 +0000 (16:59 +0800)]
s3:smbstatus: go to cmdline_messaging_context_free

If the locking.tdb is not found,
(for example, fresh new installed samba server is not running yet)
smbstatus utility would exit earlier,
and lock files are left behind in the directory 'msg.sock' and 'msg.lock'.
Consider that a script to run smbstatus utility in a loop,
this might result in used space slowly growing-up on the underlying filesystem.
Since the samba server is not running yet,
there is no cleanupd daemon could delete these files to reclaim space.

Supposed to use 'ret = 0; goto done;' instead of exit(0),
this would go through the cmdline_messaging_context_free() which deletes
the lock files in the directory msg.sock and msg.lock before smbstatus
utility is exiting.

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

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-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 Jan 11 17:08:10 UTC 2023 on sn-devel-184

2 weeks agos3: smbd: Move check_fsp_open() and check_fsp() to smb1_reply.c
Jeremy Allison [Tue, 10 Jan 2023 01:33:14 +0000 (17:33 -0800)]
s3: smbd: Move check_fsp_open() and check_fsp() to smb1_reply.c

As these functions can implicitly call reply_nterror(..., NT_STATUS_INVALID_HANDLE)
they should never be available to SMB2 code paths.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jan 11 08:17:04 UTC 2023 on sn-devel-184

2 weeks agos3: smbd: Ensure check_fsp_ntquota_handle() doesn't send SMB1 error packets.
Jeremy Allison [Tue, 10 Jan 2023 01:22:12 +0000 (17:22 -0800)]
s3: smbd: Ensure check_fsp_ntquota_handle() doesn't send SMB1 error packets.

check_fsp_ntquota_handle() is called from SMB2 codepaths as
well as from SMB1. Even in the SMB1 cases the callers of
check_fsp_ntquota_handle() handle sendng the error packet when
check_fsp_ntquota_handle returns false so on a 'return false'
we'd end up sending an error packet twice.

The SMB2 callers of check_fsp_ntquota_handle()
already check that fsp is valid, so there's
no danger of us sending an SMB1 error packet
over the SMB2 stream (so I'm not classing
this as a bug to be back-ported).

Fix check_fsp_ntquota_handle() by inlineing
the check_fsp_open() functionality without
the reply_nterror() calls.

This will allow the next commit to move check_fsp_open()
with the implicit reply_nterror() and also check_fsp()
(which calls check_fsp_open()) into the SMB1 smb1_reply.c
file as SMB1-only code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 weeks agos3: smbd: SMB1 check_fsp_open() implicitly calls reply_nterror(.., NT_STATUS_INVALID_...
Jeremy Allison [Tue, 10 Jan 2023 01:28:06 +0000 (17:28 -0800)]
s3: smbd: SMB1 check_fsp_open() implicitly calls reply_nterror(.., NT_STATUS_INVALID_HANDLE) on error so don't duplicate in reply_close().

We'd end up sending 2 SMB1 error packets in this case.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 weeks agotests/krb5: Use Python bindings for LZ77+Huffman compression
Joseph Sutton [Mon, 19 Dec 2022 20:19:47 +0000 (09:19 +1300)]
tests/krb5: Use Python bindings for LZ77+Huffman compression

We can now remove our existing decompression implementation in Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 10 21:18:01 UTC 2023 on sn-devel-184

2 weeks agolib/compression: Fix length check
Joseph Sutton [Mon, 9 Jan 2023 02:00:14 +0000 (15:00 +1300)]
lib/compression: Fix length check

Put the division on the correct side of the inequality.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 weeks agos4:rpc_server/dnsserver: Zero-initialise pointers
Joseph Sutton [Tue, 10 Jan 2023 00:06:31 +0000 (13:06 +1300)]
s4:rpc_server/dnsserver: Zero-initialise pointers

Ensuring pointers are always initialised simplifies the code and avoids
compilation errors with FORTIFY_SOURCE=2.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 weeks agolib/tfork: Don't overwrite 'ret' in cleanup phase
Joseph Sutton [Tue, 10 Jan 2023 00:06:25 +0000 (13:06 +1300)]
lib/tfork: Don't overwrite 'ret' in cleanup phase

The cleanup phase of tfork_create() saves errno prior to calling
functions that might modify it, with the intention of restoring it
afterwards. However, the value of 'ret' is accidentally overwritten. It
will always be equal to 0, and hence errno will not be restored.

Fix this by introducing a new variable, ret2, for calling functions in
the cleanup phase.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 weeks agolib/talloc: Zero-initialise chunk pointers
Joseph Sutton [Tue, 10 Jan 2023 00:06:16 +0000 (13:06 +1300)]
lib/talloc: Zero-initialise chunk pointers

Ensuring pointers are always initialised avoids compilation errors with
FORTIFY_SOURCE=2.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 weeks agosmbd: Use an idtree for local IDs
Volker Lendecke [Wed, 4 Jan 2023 11:18:44 +0000 (12:18 +0100)]
smbd: Use an idtree for local IDs

Volatile file handle IDs are purely per-process, in fact we used a
dbwrap_rbt for this. To get a unique ID we however have the
specialized idtree data structure, we don't need to repeat the
allocation algorithm that already exists there.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 10 01:23:38 UTC 2023 on sn-devel-184

2 weeks agolib: Remove idtree from samba_util.h
Volker Lendecke [Thu, 5 Jan 2023 09:04:23 +0000 (10:04 +0100)]
lib: Remove idtree from samba_util.h

No need to recompile the world when only a few files need this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 weeks agosmbd: Simplify smbXsrv_open_set_replay_cache() with dbwrap_store_bystring()
Volker Lendecke [Wed, 4 Jan 2023 11:34:43 +0000 (12:34 +0100)]
smbd: Simplify smbXsrv_open_set_replay_cache() with dbwrap_store_bystring()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>