]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 years agoclifuse: Start implementing forget()
Volker Lendecke [Tue, 22 Aug 2023 10:58:29 +0000 (12:58 +0200)] 
clifuse: Start implementing forget()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoclifuse: Use an empty array for holding the inode path
Volker Lendecke [Tue, 22 Aug 2023 07:22:13 +0000 (09:22 +0200)] 
clifuse: Use an empty array for holding the inode path

Cleaner these days.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoexamples: Slightly modernize printfs in teststat
Volker Lendecke [Mon, 14 Aug 2023 15:28:28 +0000 (17:28 +0200)] 
examples: Slightly modernize printfs in teststat

long long works, but it's a bit too specific now that we have intmax_t

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove two #defines just used once
Volker Lendecke [Wed, 23 Aug 2023 11:25:37 +0000 (13:25 +0200)] 
libsmb: Remove two #defines just used once

To me these two did not create clarity.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Modernize a few DBG statements
Volker Lendecke [Wed, 23 Aug 2023 14:36:06 +0000 (16:36 +0200)] 
smbd: Modernize a few DBG statements

Changes on level from 4 to 3 in store_file_unix_basic().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoexamples: Use explicit SMBCCTX
Volker Lendecke [Wed, 23 Aug 2023 14:46:56 +0000 (16:46 +0200)] 
examples: Use explicit SMBCCTX

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Avoid a tdb handle leak
Volker Lendecke [Sat, 23 Sep 2023 07:50:41 +0000 (00:50 -0700)] 
lib: Avoid a tdb handle leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Modernize tdb_fetch_lifetime()
Volker Lendecke [Sat, 23 Sep 2023 07:41:22 +0000 (00:41 -0700)] 
lib: Modernize tdb_fetch_lifetime()

Just came across this, avoid mallocs.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove unused cli_is_dos_error()
Volker Lendecke [Sat, 23 Sep 2023 02:05:38 +0000 (19:05 -0700)] 
libsmb: Remove unused cli_is_dos_error()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove unused cli_dos_error()
Volker Lendecke [Sat, 23 Sep 2023 01:56:58 +0000 (18:56 -0700)] 
libsmb: Remove unused cli_dos_error()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Eliminate a reader of cli->raw_status
Volker Lendecke [Sat, 23 Sep 2023 01:47:21 +0000 (18:47 -0700)] 
libsmb: Eliminate a reader of cli->raw_status

At some point we should get rid of cli->raw_status.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove SMBC_errno()
Volker Lendecke [Sat, 23 Sep 2023 01:44:14 +0000 (18:44 -0700)] 
libsmb: Remove SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove a call to SMBC_errno()
Volker Lendecke [Sat, 23 Sep 2023 01:42:24 +0000 (18:42 -0700)] 
libsmb: Remove a call to SMBC_errno()

This involves converting cli_printjob_del() to NTSTATUS and thus
touches a few callers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove a call to SMBC_errno()
Volker Lendecke [Sat, 23 Sep 2023 00:55:55 +0000 (17:55 -0700)] 
libsmb: Remove a call to SMBC_errno()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove a call to SMBC_errno()
Volker Lendecke [Sat, 23 Sep 2023 00:50:58 +0000 (17:50 -0700)] 
libsmb: Remove a call to SMBC_errno()

All returns from cacl_get() now explicitly set the errno.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove unused cli_is_nt_error()
Volker Lendecke [Sat, 23 Sep 2023 00:50:19 +0000 (17:50 -0700)] 
libsmb: Remove unused cli_is_nt_error()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbclient: Save lines with talloc_asprintf_addbuf()
Volker Lendecke [Tue, 19 Sep 2023 17:29:15 +0000 (10:29 -0700)] 
smbclient: Save lines with talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Extend cli_mknod to create NFS reparse points
Volker Lendecke [Thu, 21 Sep 2023 23:56:55 +0000 (16:56 -0700)] 
libsmb: Extend cli_mknod to create NFS reparse points

Tested smbclient mkfifo manually against W2k22, the Windows NFS server
reports this as FIFO.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Sep 25 18:08:01 UTC 2023 on atb-devel-224

2 years agolibsmb: Remove reparse_symlink.c
Volker Lendecke [Thu, 21 Sep 2023 14:40:43 +0000 (07:40 -0700)] 
libsmb: Remove reparse_symlink.c

Makes reparse_buffer_marshall static to reparse.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use reparse_data_buffer_marshall() in py_reparse_put()
Volker Lendecke [Thu, 21 Sep 2023 14:33:15 +0000 (07:33 -0700)] 
libsmb: Use reparse_data_buffer_marshall() in py_reparse_put()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use reparse_data_buffer_marshall() in cli_symlink_send()
Volker Lendecke [Thu, 21 Sep 2023 14:23:41 +0000 (07:23 -0700)] 
libsmb: Use reparse_data_buffer_marshall() in cli_symlink_send()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Factor out cli_create_reparse_point() from cli_symlink()
Volker Lendecke [Wed, 20 Sep 2023 23:54:40 +0000 (16:54 -0700)] 
libsmb: Factor out cli_create_reparse_point() from cli_symlink()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use reparse_data_buffer_marshall() in py_reparse_symlink_put()
Volker Lendecke [Thu, 21 Sep 2023 13:45:49 +0000 (06:45 -0700)] 
libsmb: Use reparse_data_buffer_marshall() in py_reparse_symlink_put()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Add reparse_data_buffer_marshall()
Volker Lendecke [Thu, 21 Sep 2023 11:27:34 +0000 (04:27 -0700)] 
libsmb: Add reparse_data_buffer_marshall()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbclient: Add mkfifo command
Volker Lendecke [Wed, 5 Jul 2023 07:25:14 +0000 (09:25 +0200)] 
smbclient: Add mkfifo command

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Add sync cli_mknod() for smbclient3's use
Volker Lendecke [Wed, 5 Jul 2023 07:06:58 +0000 (09:06 +0200)] 
libsmb: Add sync cli_mknod() for smbclient3's use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:tests: Check if test_smbclient_kerberos.sh was successful
Pavel Filipenský [Sat, 23 Sep 2023 15:13:27 +0000 (17:13 +0200)] 
s3:tests: Check if test_smbclient_kerberos.sh was successful

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Sep 25 00:14:47 UTC 2023 on atb-devel-224

2 years agos3:tests: Fix syntax error in test_smbclient_kerberos.sh
Pavel Filipenský [Sat, 23 Sep 2023 15:12:11 +0000 (17:12 +0200)] 
s3:tests: Fix syntax error in test_smbclient_kerberos.sh

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:tests: Fix init of samba_kdestroy in test_smbclient_kerberos.sh
Pavel Filipenský [Sat, 23 Sep 2023 15:10:54 +0000 (17:10 +0200)] 
s3:tests: Fix init of samba_kdestroy in test_smbclient_kerberos.sh

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:tests: test_smbspool.sh should be calling smbspool_argv_wrapper
Pavel Filipenský [Sun, 24 Sep 2023 19:07:04 +0000 (21:07 +0200)] 
s3:tests: test_smbspool.sh should be calling smbspool_argv_wrapper

There is no variable named 'smbspool_argv_wrapper', the correct name is
'samba_argv_wrapper'. The smbspool_argv_wrapper was not called from this
test till now.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Sun Sep 24 22:33:07 UTC 2023 on atb-devel-224

2 years agos3:tests: Fix smbspool_argv_wrapper.c
Pavel Filipenský [Sun, 24 Sep 2023 20:17:29 +0000 (22:17 +0200)] 
s3:tests: Fix smbspool_argv_wrapper.c

smbspool_argv_wrapper must copy also the last argument

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoconf: Remove "smb3 unix extensions" parameter
Volker Lendecke [Mon, 18 Sep 2023 23:54:05 +0000 (16:54 -0700)] 
conf: Remove "smb3 unix extensions" parameter

Always offer it, it's a client thing to ask for it or not.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 21 17:43:23 UTC 2023 on atb-devel-224

2 years agoctdb-daemon: Call setproctitle_init()
Martin Schwenke [Tue, 19 Sep 2023 07:47:36 +0000 (17:47 +1000)] 
ctdb-daemon: Call setproctitle_init()

Commit 19c82c19c009eefe975ae95c8b709fc93f5f4c39 changed the behaviour
of prctl_set_comment() so it now calls setproctitle(3bsd) by default.

In some Linux distributions (e.g. Rocky Linux 8.8), this results in
messages like this spamming the logs:

  ctdbd: setproctitle not initialized, please either call setproctitle_init() or link against libbsd-ctor.

Most Samba daemons seem to call setproctitle_init(), so do it here.

In the longer term CTDB should also switch to using lib/util's
process_set_title(), like the rest of Samba, for more flexible process
names.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Sep 21 00:46:50 UTC 2023 on atb-devel-224

2 years agosmbd: Fix BZ15481
Volker Lendecke [Wed, 20 Sep 2023 00:44:56 +0000 (17:44 -0700)] 
smbd: Fix BZ15481

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep 20 22:42:48 UTC 2023 on atb-devel-224

2 years agotests: Add reproducer for BZ15481
Volker Lendecke [Wed, 20 Sep 2023 17:53:52 +0000 (10:53 -0700)] 
tests: Add reproducer for BZ15481

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3: smbd: Ensure we remove any pending aio values for named pipes on forced shutdown.
Jeremy Allison [Tue, 19 Sep 2023 21:36:45 +0000 (14:36 -0700)] 
s3: smbd: Ensure we remove any pending aio values for named pipes on forced shutdown.

Matches file and directory closes.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep 20 02:43:18 UTC 2023 on atb-devel-224

2 years agos3: torture: Add a new SMB2 test: SMB2-PIPE-READ-ASYNC-DISCONNECT
Jeremy Allison [Tue, 19 Sep 2023 21:30:26 +0000 (14:30 -0700)] 
s3: torture: Add a new SMB2 test: SMB2-PIPE-READ-ASYNC-DISCONNECT

Shows the server crashes if we open a named pipe, do an async read
and then disconnect.

Adds knownfail:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: named pipe writes are async. Use the same logic as for named pipe transacts...
Jeremy Allison [Tue, 19 Sep 2023 00:37:44 +0000 (17:37 -0700)] 
s3: smbd: named pipe writes are async. Use the same logic as for named pipe transacts to avoid crashes on shutdown.

Noticed by Metze.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: named pipe reads are async. Use the same logic as for named pipe transacts...
Jeremy Allison [Tue, 19 Sep 2023 00:09:00 +0000 (17:09 -0700)] 
s3: smbd: named pipe reads are async. Use the same logic as for named pipe transacts to avoid crashes on shutdown.

Noticed by Metze.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Add some DEVELOPER-only code to panic if the destructor for an aio_lnk...
Jeremy Allison [Mon, 18 Sep 2023 21:43:23 +0000 (14:43 -0700)] 
s3: smbd: Add some DEVELOPER-only code to panic if the destructor for an aio_lnk is called and the associated fsp doesn't exist.

Make this DEVELOPER-only as it walks the entire open
file list on every file close (with associated aio).

This helps catch really subtle problems with orphaned
aio lnk structs.

Reproducer test case to follow.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Now we have proved hardlink_internals() doesn't use src_dirfsp and dst_dirf...
Jeremy Allison [Tue, 19 Sep 2023 17:32:59 +0000 (10:32 -0700)] 
s3: smbd: Now we have proved hardlink_internals() doesn't use src_dirfsp and dst_dirfsp, remove the parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Sep 19 19:51:47 UTC 2023 on atb-devel-224

2 years agos3: smbd: hardlink_internals() never looks at src_dirfsp or dst_dirfsp.
Jeremy Allison [Tue, 19 Sep 2023 17:30:01 +0000 (10:30 -0700)] 
s3: smbd: hardlink_internals() never looks at src_dirfsp or dst_dirfsp.

Show this by sending NULL in all cases.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Now we have shown dst_dirfsp is always NULL, remove the parameter from...
Jeremy Allison [Tue, 19 Sep 2023 17:03:05 +0000 (10:03 -0700)] 
s3: smbd: Now we have shown dst_dirfsp is always NULL, remove the parameter from rename_internals().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: As rename_internals() calls rename_internals_fsp(), show we can pass dst_di...
Jeremy Allison [Tue, 19 Sep 2023 16:55:12 +0000 (09:55 -0700)] 
s3: smbd: As rename_internals() calls rename_internals_fsp(), show we can pass dst_dirfsp as NULL here too.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Now we've proved dst_dirfsp parameter is always NULL, remove the parameter...
Jeremy Allison [Tue, 19 Sep 2023 16:52:16 +0000 (09:52 -0700)] 
s3: smbd: Now we've proved dst_dirfsp parameter is always NULL, remove the parameter from rename_internals_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: rename_internals_fsp() has to reopen the parent directory of the target...
Jeremy Allison [Tue, 19 Sep 2023 16:49:25 +0000 (09:49 -0700)] 
s3: smbd: rename_internals_fsp() has to reopen the parent directory of the target as a pathref to check permissions.

So it never looks at any passed in dst_dirfsp.

Prove this by passing NULL.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoselftest: add some basic testing for the io_uring vfs module
Stefan Metzmacher [Sat, 16 Sep 2023 18:00:33 +0000 (20:00 +0200)] 
selftest: add some basic testing for the io_uring vfs module

We're now able to build it on all linux systems and
the ci runners have at least a 5.4 kernel. That's
all the current vfs_io_uring requires.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Sep 17 18:04:18 UTC 2023 on atb-devel-224

2 years agos3:param: Remove unused lp_set_cmdline()
Andreas Schneider [Tue, 5 Sep 2023 08:06:24 +0000 (10:06 +0200)] 
s3:param: Remove unused lp_set_cmdline()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Sep 14 22:30:06 UTC 2023 on atb-devel-224

2 years agos3:client: Use lpcfg_set_cmdline()
Andreas Schneider [Wed, 2 Aug 2023 07:23:44 +0000 (09:23 +0200)] 
s3:client: Use lpcfg_set_cmdline()

This lp_set_cmdline() leaks memory and we want to get rid of it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libsmb: Use lpcfg_set_cmdline()
Pavel Kalugin [Sun, 3 Sep 2023 20:21:35 +0000 (23:21 +0300)] 
s3:libsmb: Use lpcfg_set_cmdline()

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:netapi: Fix a leak in libnetapi_net_init()
Pavel Kalugin [Sun, 20 Aug 2023 20:50:38 +0000 (23:50 +0300)] 
s3:netapi: Fix a leak in libnetapi_net_init()

Allow libnetapi_net_init() to be called more than once without
leaking libnetapi_ctx allocated on a previous call, which is
currently the case in the `net rpc` code.

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibnetapi: Use lpcfg_set_cmdline()
Pavel Kalugin [Sun, 20 Aug 2023 20:06:56 +0000 (23:06 +0300)] 
libnetapi: Use lpcfg_set_cmdline()

Replace lp_set_cmdline() with lpcfg_set_cmdline() in netapi.c.
For this purpose:
1. Add loadparm_context to the libnetapi_ctx because we need it
   in libnetapi_set_debuglevel() and libnetapi_set_logfile().
2. Move loadparm_context creation from libnetapi_net_init()
   to libnetapi_init() and add the lp_ctx parameter to the former.

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in smbpasswd
Pavel Kalugin [Mon, 14 Aug 2023 03:57:27 +0000 (06:57 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in smbpasswd

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:torture: Use lpcfg_set_cmdline()
Pavel Kalugin [Mon, 14 Aug 2023 03:01:28 +0000 (06:01 +0300)] 
s3:torture: Use lpcfg_set_cmdline()

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:notifyd: Use lpcfg_set_cmdline()
Pavel Kalugin [Mon, 14 Aug 2023 01:37:16 +0000 (04:37 +0300)] 
s3:notifyd: Use lpcfg_set_cmdline()

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agobuild: Reduce heimdal_no_error_flags to a more minimal set
Andrew Bartlett [Wed, 13 Sep 2023 20:14:55 +0000 (08:14 +1200)] 
build: Reduce heimdal_no_error_flags to a more minimal set

Heimdal does not seem to give as many errors as in the past, so we
can reduce the set of errors we ignore warnings for.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agobuild: Remove -Wno-error=missing-field-initializers from Heimdal build
Andrew Bartlett [Wed, 13 Sep 2023 20:02:50 +0000 (08:02 +1200)] 
build: Remove -Wno-error=missing-field-initializers from Heimdal build

This allows this warning (error) to be used in Samba for cases where a
non-designated initialiser is under-specified.  We can do this now as
the GCC versions we build on do not regard foo = {} as an error.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:dsdb: Fix comment
Joseph Sutton [Wed, 6 Sep 2023 04:35:03 +0000 (16:35 +1200)] 
s4:dsdb: Fix comment

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:winbindd: Add zero digit to literal
Joseph Sutton [Wed, 6 Sep 2023 04:34:00 +0000 (16:34 +1200)] 
s3:winbindd: Add zero digit to literal

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodsgetdcname: Remove excess zero digits from literals
Joseph Sutton [Wed, 6 Sep 2023 04:33:03 +0000 (16:33 +1200)] 
dsgetdcname: Remove excess zero digits from literals

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agofsrvp.idl: Remove excess zero digit from literal
Joseph Sutton [Wed, 6 Sep 2023 04:32:31 +0000 (16:32 +1200)] 
fsrvp.idl: Remove excess zero digit from literal

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Rename ‘client_claims’ to ‘claims_metadata’
Joseph Sutton [Wed, 6 Sep 2023 03:09:00 +0000 (15:09 +1200)] 
tests/krb5: Rename ‘client_claims’ to ‘claims_metadata’

This variable is used not only for client claims, but for device claims
as well.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:net: Check return value of data_blob_talloc()
Joseph Sutton [Wed, 6 Sep 2023 01:32:55 +0000 (13:32 +1200)] 
s3:net: Check return value of data_blob_talloc()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Don’t prepend useless colon to MIT KDC logging messages
Joseph Sutton [Wed, 6 Sep 2023 01:09:24 +0000 (13:09 +1200)] 
s4:kdc: Don’t prepend useless colon to MIT KDC logging messages

If we pass an empty string as the ‘whoami’ parameter, MIT’s logging
facilities will prepend a mysterious colon to the message. Printing
“mitkdc: ” ought at least to be more sensible, and perhaps more closely
to match our behaviour prior to commit
dd8138236bec3635c25e5b482b7a14faa0a9c36b.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:wrepl_server: Correctly read ‘type’ element
Joseph Sutton [Tue, 5 Sep 2023 23:03:02 +0000 (11:03 +1200)] 
s4:wrepl_server: Correctly read ‘type’ element

winsdb_message() stores this element as hexadecimal, which format
ldb_msg_find_attr_as_uint() cannot cope with. Permit this element to be
in either decimal or hexadecimal format.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoldb: Prefer explicit initialization to ZERO_STRUCT()
Joseph Sutton [Tue, 5 Sep 2023 22:54:25 +0000 (10:54 +1200)] 
ldb: Prefer explicit initialization to ZERO_STRUCT()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove ks_is_tgs_principal()
Joseph Sutton [Tue, 5 Sep 2023 05:06:00 +0000 (17:06 +1200)] 
s4:kdc: Remove ks_is_tgs_principal()

This function is a near‐duplicate of smb_krb5_principal_is_tgs().

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotestprogs: Fix script usage lines
Joseph Sutton [Tue, 5 Sep 2023 04:22:01 +0000 (16:22 +1200)] 
testprogs: Fix script usage lines

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:setup: Fix script usage line
Joseph Sutton [Tue, 5 Sep 2023 04:21:50 +0000 (16:21 +1200)] 
s4:setup: Fix script usage line

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:selftest: Fix script usage lines
Joseph Sutton [Tue, 5 Sep 2023 04:21:34 +0000 (16:21 +1200)] 
s4:selftest: Fix script usage lines

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:script: Fix script usage lines
Joseph Sutton [Tue, 5 Sep 2023 04:21:19 +0000 (16:21 +1200)] 
s3:script: Fix script usage lines

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonsswitch: Fix script usage
Joseph Sutton [Tue, 5 Sep 2023 04:20:53 +0000 (16:20 +1200)] 
nsswitch: Fix script usage

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Remove Heimdal‐only krb5_princ_component() implementation
Joseph Sutton [Tue, 5 Sep 2023 03:37:14 +0000 (15:37 +1200)] 
lib:krb5_wrap: Remove Heimdal‐only krb5_princ_component() implementation

This implementation is no longer called: using a variable of static
storage duration as a conduit for return values is only asking for
trouble.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:rpc_server: Switch to using smb_krb5_princ_component()
Joseph Sutton [Tue, 5 Sep 2023 04:46:17 +0000 (16:46 +1200)] 
s4:rpc_server: Switch to using smb_krb5_princ_component()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Switch to using smb_krb5_princ_component()
Joseph Sutton [Tue, 5 Sep 2023 04:46:08 +0000 (16:46 +1200)] 
s4:kdc: Switch to using smb_krb5_princ_component()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:dsdb: Switch to using smb_krb5_princ_component()
Joseph Sutton [Tue, 5 Sep 2023 04:38:23 +0000 (16:38 +1200)] 
s4:dsdb: Switch to using smb_krb5_princ_component()

This function has the handy feature of being able to be called twice in
succession without mysteriously breaking your code. Now, doesn’t that
sound useful?

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Add Heimdal‐specific smb_krb5_princ_component() implementation
Joseph Sutton [Tue, 5 Sep 2023 03:07:05 +0000 (15:07 +1200)] 
lib:krb5_wrap: Add Heimdal‐specific smb_krb5_princ_component() implementation

This implementation doesn’t rely on a variable of static storage
duration being used as a conduit for the return value.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Add smb_krb5_princ_component()
Joseph Sutton [Tue, 5 Sep 2023 02:52:02 +0000 (14:52 +1200)] 
lib:krb5_wrap: Add smb_krb5_princ_component()

For now this function is a mere wrapper round krb5_princ_component(),
but one whose interface allows for a more sensible implementation.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Have smb_krb5_principal_get_realm() check the return values of interme...
Joseph Sutton [Tue, 5 Sep 2023 03:47:06 +0000 (15:47 +1200)] 
lib:krb5_wrap: Have smb_krb5_principal_get_realm() check the return values of intermediate functions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Eliminate redundant code from smb_krb5_sockaddr_to_kaddr()
Joseph Sutton [Tue, 5 Sep 2023 03:27:29 +0000 (15:27 +1200)] 
lib:krb5_wrap: Eliminate redundant code from smb_krb5_sockaddr_to_kaddr()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Fix leaks
Joseph Sutton [Tue, 5 Sep 2023 02:23:10 +0000 (14:23 +1200)] 
s4:kdc: Fix leaks

Create a temporary memory context on which to allocate things.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Be sure not to pass a NULL pointer into strcmp()
Joseph Sutton [Tue, 5 Sep 2023 02:17:36 +0000 (14:17 +1200)] 
s4:kdc: Be sure not to pass a NULL pointer into strcmp()

To do so is to invoke undefined behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Prefer explicit initialization to ZERO_STRUCTP()
Joseph Sutton [Tue, 5 Sep 2023 02:17:14 +0000 (14:17 +1200)] 
s4:kdc: Prefer explicit initialization to ZERO_STRUCTP()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Make RODC ID checks easier to understand with more clearly‐named variables
Joseph Sutton [Tue, 5 Sep 2023 02:15:11 +0000 (14:15 +1200)] 
s4:kdc: Make RODC ID checks easier to understand with more clearly‐named variables

No change in behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Rename ‘status’ variables to ‘reply_status’
Joseph Sutton [Tue, 5 Sep 2023 02:08:25 +0000 (14:08 +1200)] 
s4:kdc: Rename ‘status’ variables to ‘reply_status’

This makes it clearer what these variables are used for, and avoids
confusion with the similarly‐named ‘nt_status’ variables — also used in
these functions.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Have samba_krbtgt_is_in_db() take a const KDC entry
Joseph Sutton [Tue, 5 Sep 2023 02:04:47 +0000 (14:04 +1200)] 
s4:kdc: Have samba_krbtgt_is_in_db() take a const KDC entry

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Have samba_krbtgt_is_in_db() return a krb5_error_code
Joseph Sutton [Tue, 5 Sep 2023 02:04:17 +0000 (14:04 +1200)] 
s4:kdc: Have samba_krbtgt_is_in_db() return a krb5_error_code

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Make pac_blobs_remove_blob() never fail
Joseph Sutton [Tue, 5 Sep 2023 00:55:04 +0000 (12:55 +1200)] 
s4:kdc: Make pac_blobs_remove_blob() never fail

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Make ‘struct pac_blobs’ memory handling safer and more consistent
Joseph Sutton [Tue, 5 Sep 2023 01:23:35 +0000 (13:23 +1200)] 
s4:kdc: Make ‘struct pac_blobs’ memory handling safer and more consistent

Having pac_blobs::type_blobs be managed both by talloc and by the
‘pac_blobs’ structure itself (with pac_blobs_destroy()) is very prone to
error. So is the current situation of having the other ‘pac_blobs’
functions each take in a memory context.

Improve these circumstances by requiring ‘pac_blobs’ to be managed by
talloc. Now the other functions can dispense with their ‘mem_ctx’
parameters, being instead able to allocate on to the ‘pac_blobs’
structure itself. pac_blobs_init() no longer must be a separate
function; inline it into pac_blobs_from_krb5_pac(). pac_blobs_destroy(),
being no longer of use, can go too.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Don’t corrupt pac_blobs structure if talloc_realloc() fails
Joseph Sutton [Tue, 5 Sep 2023 01:04:50 +0000 (13:04 +1200)] 
s4:kdc: Don’t corrupt pac_blobs structure if talloc_realloc() fails

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add common out path to pac_blobs_from_krb5_pac()
Joseph Sutton [Tue, 5 Sep 2023 01:02:59 +0000 (13:02 +1200)] 
s4:kdc: Add common out path to pac_blobs_from_krb5_pac()

This helps to make error‐checking and cleanup more systematic.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Introduce a temporary talloc context in samba_kdc_update_pac()
Joseph Sutton [Tue, 5 Sep 2023 00:44:54 +0000 (12:44 +1200)] 
s4:kdc: Introduce a temporary talloc context in samba_kdc_update_pac()

This avoids allocating working structures on to a potentially long‐lived
context.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Use temporary memory context in samba_kdc_verify_pac()
Joseph Sutton [Tue, 5 Sep 2023 00:35:27 +0000 (12:35 +1200)] 
s4:kdc: Use temporary memory context in samba_kdc_verify_pac()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Fix leak
Joseph Sutton [Tue, 5 Sep 2023 00:28:55 +0000 (12:28 +1200)] 
s4:kdc: Fix leak

Introduce a temporary memory context and allocate working structures on
to it.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Allocate variables on to more suitable memory context
Joseph Sutton [Tue, 5 Sep 2023 00:20:39 +0000 (12:20 +1200)] 
s4:kdc: Allocate variables on to more suitable memory context

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Increment PAC_DEVICE_INFO::domain_group_count only after SID has been success...
Joseph Sutton [Mon, 4 Sep 2023 23:06:50 +0000 (11:06 +1200)] 
s4:kdc: Increment PAC_DEVICE_INFO::domain_group_count only after SID has been successfully added

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Directly zero‐initialize PAC_DOMAIN_GROUP_MEMBERSHIP structure
Joseph Sutton [Mon, 4 Sep 2023 23:04:59 +0000 (11:04 +1200)] 
s4:kdc: Directly zero‐initialize PAC_DOMAIN_GROUP_MEMBERSHIP structure

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Assign RID and attribute together
Joseph Sutton [Mon, 4 Sep 2023 23:02:37 +0000 (11:02 +1200)] 
s4:kdc: Assign RID and attribute together

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Don’t corrupt domain groups structure if talloc_realloc() fails
Joseph Sutton [Mon, 4 Sep 2023 22:44:55 +0000 (10:44 +1200)] 
s4:kdc: Don’t corrupt domain groups structure if talloc_realloc() fails

Introduce a temporary variable instead of assigning the result of
talloc_realloc() directly to samr_RidWithAttributeArray::rids. In this
way we avoid having a structure with a non‐zero ‘count’ but with ‘rids’
set to the NULL pointer.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Check for overflow when adding a domain group SID
Joseph Sutton [Mon, 4 Sep 2023 22:32:26 +0000 (10:32 +1200)] 
s4:kdc: Check for overflow when adding a domain group SID

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>