]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agosmbd: Remove duplicate/unused #defines
Volker Lendecke [Fri, 23 Dec 2022 08:21:25 +0000 (09:21 +0100)] 
smbd: Remove duplicate/unused #defines

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agotorture: Fix whitespace
Volker Lendecke [Sat, 24 Dec 2022 13:08:40 +0000 (14:08 +0100)] 
torture: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move SMB_QUERY_FILE_UNIX_LINK to smb1_trans2.c
Volker Lendecke [Mon, 2 Jan 2023 08:47:05 +0000 (09:47 +0100)] 
smbd: Move SMB_QUERY_FILE_UNIX_LINK to smb1_trans2.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move get_posix_fsp() to smb1_trans2.c
Volker Lendecke [Sat, 31 Dec 2022 16:41:16 +0000 (17:41 +0100)] 
smbd: Move get_posix_fsp() to smb1_trans2.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move SMB_QUERY_POSIX_ACL to smb1_trans2.c
Volker Lendecke [Sat, 31 Dec 2022 16:39:09 +0000 (17:39 +0100)] 
smbd: Move SMB_QUERY_POSIX_ACL to smb1_trans2.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move SMB_QUERY_FILE_UNIX_[BASIC|INFO2] to smb1_trans2.c
Volker Lendecke [Fri, 30 Dec 2022 15:26:38 +0000 (16:26 +0100)] 
smbd: Move SMB_QUERY_FILE_UNIX_[BASIC|INFO2] to smb1_trans2.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Remove an unnecessary if-statement
Volker Lendecke [Fri, 30 Dec 2022 21:22:31 +0000 (22:22 +0100)] 
smbd: Remove an unnecessary if-statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Remove an unnecessary if-statement
Volker Lendecke [Fri, 30 Dec 2022 21:21:48 +0000 (22:21 +0100)] 
smbd: Remove an unnecessary if-statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move smb_set_posix_acl() to smb1_trans2.c
Volker Lendecke [Fri, 30 Dec 2022 19:49:11 +0000 (20:49 +0100)] 
smbd: Move smb_set_posix_acl() to smb1_trans2.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Make get_posix_fsp() public
Volker Lendecke [Fri, 30 Dec 2022 19:39:54 +0000 (20:39 +0100)] 
smbd: Make get_posix_fsp() public

This will go static again soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: smbd_do_qfilepathinfo() does not need lock_data anymore
Volker Lendecke [Fri, 30 Dec 2022 21:15:50 +0000 (22:15 +0100)] 
smbd: smbd_do_qfilepathinfo() does not need lock_data anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Handle SMB_QUERY_POSIX_LOCK() in call_trans2qfileinfo()
Volker Lendecke [Fri, 30 Dec 2022 21:12:23 +0000 (22:12 +0100)] 
smbd: Handle SMB_QUERY_POSIX_LOCK() in call_trans2qfileinfo()

smbd_do_qfilepathinfo() does not use the lock data anymore, we can
pass NULL/0 now.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Remove two variables never set after initialization
Volker Lendecke [Fri, 30 Dec 2022 20:43:06 +0000 (21:43 +0100)] 
smbd: Remove two variables never set after initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move SMB_SET_FILE_UNIX_[BASIC|INFO2] to smb1_trans2.c
Volker Lendecke [Fri, 30 Dec 2022 15:26:38 +0000 (16:26 +0100)] 
smbd: Move SMB_SET_FILE_UNIX_[BASIC|INFO2] to smb1_trans2.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Make map_info2_flags_to_sbuf() public
Volker Lendecke [Fri, 30 Dec 2022 15:23:52 +0000 (16:23 +0100)] 
smbd: Make map_info2_flags_to_sbuf() public

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Make smb_set_file_size() public
Volker Lendecke [Fri, 30 Dec 2022 15:23:27 +0000 (16:23 +0100)] 
smbd: Make smb_set_file_size() public

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move handling smb_set_posix_lock() to smb1_trans2.c
Volker Lendecke [Thu, 29 Dec 2022 09:59:45 +0000 (10:59 +0100)] 
smbd: Move handling smb_set_posix_lock() to smb1_trans2.c

Most of this is direct cut&paste without reformatting.

Don't pass SMB_SET_POSIX_LOCK through smbd_do_setfilepathinfo(),
directly handle it in call_trans2setfileinfo() where we know we have a
fsp.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move smb_set_file_unix_hlink() to smb1_trans2.c
Volker Lendecke [Thu, 29 Dec 2022 09:47:12 +0000 (10:47 +0100)] 
smbd: Move smb_set_file_unix_hlink() to smb1_trans2.c

Most of this is direct cut&paste without reformatting.

Don't pass SMB_SET_FILE_UNIX_HLINK through smbd_do_setfilepathinfo(),
directly handle it in call_trans2setpathinfo() where we know we have a
path.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move smb_set_file_unix_link() to smb1_trans2.c
Volker Lendecke [Thu, 29 Dec 2022 09:44:33 +0000 (10:44 +0100)] 
smbd: Move smb_set_file_unix_link() to smb1_trans2.c

Most of this is direct cut&paste without reformatting.

Don't pass SMB_SET_FILE_UNIX_LINK through smbd_do_setfilepathinfo(),
directly handle it in call_trans2setpathinfo() where we know we have a
path.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move smb_posix_unlink() to smb1_trans2.c
Volker Lendecke [Wed, 28 Dec 2022 23:07:21 +0000 (00:07 +0100)] 
smbd: Move smb_posix_unlink() to smb1_trans2.c

Most of this is direct cut&paste without reformatting.

Don't pass SMB_POSIX_PATH_UNLINK through smbd_do_setfilepathinfo(),
directly handle it in call_trans2setpathinfo() where we know we have a
path.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Make smb_set_file_disposition_info() public
Volker Lendecke [Wed, 28 Dec 2022 23:06:58 +0000 (00:06 +0100)] 
smbd: Make smb_set_file_disposition_info() public

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Move smb_posix_open() to smb1_trans2.c
Volker Lendecke [Wed, 28 Dec 2022 22:50:53 +0000 (23:50 +0100)] 
smbd: Move smb_posix_open() to smb1_trans2.c

Most of this is direct cut&paste without reformatting.

Don't pass SMB_POSIX_PATH_OPEN through smbd_do_setfilepathinfo(),
directly handle it in call_trans2setpathinfo() where we know we have a
path.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Make store_file_unix_basic[_info2] public
Volker Lendecke [Wed, 28 Dec 2022 22:47:42 +0000 (23:47 +0100)] 
smbd: Make store_file_unix_basic[_info2] public

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Factor out handle_trans2qfilepathinfo_result()
Volker Lendecke [Fri, 30 Dec 2022 11:23:58 +0000 (12:23 +0100)] 
smbd: Factor out handle_trans2qfilepathinfo_result()

The error handling will be used in other places.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Simplify call_trans2qfilepathinfo()
Volker Lendecke [Fri, 23 Dec 2022 17:20:15 +0000 (18:20 +0100)] 
smbd: Simplify call_trans2qfilepathinfo()

Move the file/path specific preparations to the respective callers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Fix qfileinfo profiling
Volker Lendecke [Fri, 23 Dec 2022 16:23:36 +0000 (17:23 +0100)] 
smbd: Fix qfileinfo profiling

This ran under qpathinfo profiling

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Remove call_trans2setfilepathinfo()
Volker Lendecke [Fri, 30 Dec 2022 09:27:11 +0000 (10:27 +0100)] 
smbd: Remove call_trans2setfilepathinfo()

What's left was just a simple wrapper around smbd_do_setfilepathinfo()
and handle_trans2setfilepathinfo_result()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Factor out handle_trans2setfilepathinfo_result()
Volker Lendecke [Fri, 30 Dec 2022 09:13:08 +0000 (10:13 +0100)] 
smbd: Factor out handle_trans2setfilepathinfo_result()

This will be lifted up in the next patches. We can also remove the
REALLOC of *pparams, for this we only ever send 2 NULL bytes that we
stack-allocate now.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Simplify call_trans2setfilepathinfo()
Volker Lendecke [Fri, 23 Dec 2022 16:29:45 +0000 (17:29 +0100)] 
smbd: Simplify call_trans2setfilepathinfo()

Move the file/path specific preparations to the respective callers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: Fix setfileinfo profiling
Volker Lendecke [Fri, 23 Dec 2022 16:18:30 +0000 (17:18 +0100)] 
smbd: Fix setfileinfo profiling

This ran under setpathinfo profiling

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Strip any leading '\\' characters if the SMB2 DFS flag is set.
Jeremy Allison [Wed, 4 Jan 2023 02:28:54 +0000 (18:28 -0800)] 
s3: smbd: Strip any leading '\\' characters if the SMB2 DFS flag is set.

MacOS clients send SMB2 DFS pathnames as \server\share\file\name.

Ensure smbd can cope with this by stipping any leading '\\'
characters from an SMB2 packet with the DFS flag set.

Remove knownfail.

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

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  4 07:46:06 UTC 2023 on sn-devel-184

3 years agos3: smbtorture: Add SMB2-DFS-FILENAME-LEADING-BACKSLASH test.
Jeremy Allison [Wed, 4 Jan 2023 01:53:17 +0000 (17:53 -0800)] 
s3: smbtorture: Add SMB2-DFS-FILENAME-LEADING-BACKSLASH test.

Shows that we fail to cope with MacOSX clients that send a
(or more than one) leading '\\' character for an SMB2 DFS pathname.

I missed this in earlier tests as Windows, Linux, and
libsmbclient clients do NOT send a leading backslash
for SMB2 DFS paths. Only MacOSX (sigh:-).

Passes against Windows. Adds a knownfail for smbd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agolib/replace - add extra check to bsd_attr_list
Andrew Walker [Tue, 27 Dec 2022 15:59:14 +0000 (10:59 -0500)] 
lib/replace - add extra check to bsd_attr_list

The FreeBSD extattr API may return success and truncated
namelist. We need to check for this in bsd_attr_list to
ensure that we don't accidentally read off the end of the
buffer. In the case of a truncated value, the pascal
strings for attr names will reflect the lengths as if
the value were not truncated. For example:
`58DosStrea`

In case of short read we now set error to ERANGE and
fail.

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

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jan  2 14:27:23 UTC 2023 on sn-devel-184

3 years agoHappy New Year 2023!
Stefan Metzmacher [Sat, 31 Dec 2022 23:24:28 +0000 (23:24 +0000)] 
Happy New Year 2023!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Jan  1 00:24:02 UTC 2023 on sn-devel-184

3 years agos3:rpc_server/srvsvc: make sure we (re-)load all shares as root.
Stefan Metzmacher [Wed, 28 Dec 2022 12:50:45 +0000 (13:50 +0100)] 
s3:rpc_server/srvsvc: make sure we (re-)load all shares as root.

This fixes a regression in commit f03665bb7e8ea97699062630f2aa1bac4c5dfc7f

The use of reload_services() has a lot of side effects, e.g. reopen of
log files and other things, which are only useful in smbd, but not in rpcd_classic.
It was also unloading the user and registry shares we loaded a few lines
above.

We need to do all (re-)loading as root, otherwise we won't be able
to read root only smb.conf files, access registry shares, ...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Walker <awalker@ixsystems.com>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Dec 29 21:14:02 UTC 2022 on sn-devel-184

3 years agoselftest: add samba3.blackbox.registry_share
Stefan Metzmacher [Wed, 28 Dec 2022 15:18:40 +0000 (16:18 +0100)] 
selftest: add samba3.blackbox.registry_share

This demonstrates the regression introduced by
f03665bb7e8ea97699062630f2aa1bac4c5dfc7f, where
registry shares are no longer listed.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Walker <awalker@ixsystems.com>
3 years agos4:setup:tests: Use system ldbdump if we build with system ldb
Andreas Schneider [Thu, 22 Dec 2022 14:25:49 +0000 (15:25 +0100)] 
s4:setup:tests: Use system ldbdump if we build with system ldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Dec 23 15:31:31 UTC 2022 on sn-devel-184

3 years agopython:tests: Use system ldbsearch if we built against system libldb
Andreas Schneider [Thu, 22 Dec 2022 14:29:56 +0000 (15:29 +0100)] 
python:tests: Use system ldbsearch if we built against system libldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agopython:tests: Use system ldbdump if we build with system ldb
Andreas Schneider [Thu, 22 Dec 2022 14:16:04 +0000 (15:16 +0100)] 
python:tests: Use system ldbdump if we build with system ldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agopython:tests: Use system ldbsearch if we build with system libldb
Andreas Schneider [Thu, 22 Dec 2022 13:47:25 +0000 (14:47 +0100)] 
python:tests: Use system ldbsearch if we build with system libldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agonsswitch:tests: Use system_or_builddir_binary() for test_rfc2307_mapping
Andreas Schneider [Thu, 22 Dec 2022 15:54:30 +0000 (16:54 +0100)] 
nsswitch:tests: Use system_or_builddir_binary() for test_rfc2307_mapping

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for upgradeprovision-oldrelease
Andreas Schneider [Thu, 22 Dec 2022 13:43:45 +0000 (14:43 +0100)] 
testprogs: Use system_or_builddir_binary() for upgradeprovision-oldrelease

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for tombstones-expunge
Andreas Schneider [Thu, 22 Dec 2022 13:42:12 +0000 (14:42 +0100)] 
testprogs: Use system_or_builddir_binary() for tombstones-expunge

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_trust_token
Andreas Schneider [Thu, 22 Dec 2022 13:37:21 +0000 (14:37 +0100)] 
testprogs: Use system_or_builddir_binary() for test_trust_token

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_special_group
Andreas Schneider [Thu, 22 Dec 2022 13:36:29 +0000 (14:36 +0100)] 
testprogs: Use system_or_builddir_binary() for test_special_group

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_primary_group
Andreas Schneider [Thu, 22 Dec 2022 13:34:00 +0000 (14:34 +0100)] 
testprogs: Use system_or_builddir_binary() for test_primary_group

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_pkinit_simple
Andreas Schneider [Thu, 22 Dec 2022 13:32:59 +0000 (14:32 +0100)] 
testprogs: Use system_or_builddir_binary() for test_pkinit_simple

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_pkinit_pac
Andreas Schneider [Thu, 22 Dec 2022 13:31:54 +0000 (14:31 +0100)] 
testprogs: Use system_or_builddir_binary() for test_pkinit_pac

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_old_enctypes
Andreas Schneider [Thu, 22 Dec 2022 13:03:29 +0000 (14:03 +0100)] 
testprogs: Use system_or_builddir_binary() for test_old_enctypes

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_net_ads_dns
Andreas Schneider [Thu, 22 Dec 2022 13:02:04 +0000 (14:02 +0100)] 
testprogs: Use system_or_builddir_binary() for test_net_ads_dns

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_net_ads
Andreas Schneider [Thu, 22 Dec 2022 12:45:17 +0000 (13:45 +0100)] 
testprogs: Use system_or_builddir_binary() for test_net_ads

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_ldb_simple
Andreas Schneider [Thu, 22 Dec 2022 12:38:27 +0000 (13:38 +0100)] 
testprogs: Use system_or_builddir_binary() for test_ldb_simple

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_ldb
Andreas Schneider [Thu, 22 Dec 2022 12:34:39 +0000 (13:34 +0100)] 
testprogs: Use system_or_builddir_binary() for test_ldb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_ktpass
Andreas Schneider [Thu, 22 Dec 2022 12:24:21 +0000 (13:24 +0100)] 
testprogs: Use system_or_builddir_binary() for test_ktpass

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_kinit_mit
Andreas Schneider [Thu, 22 Dec 2022 12:22:36 +0000 (13:22 +0100)] 
testprogs: Use system_or_builddir_binary() for test_kinit_mit

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_kinit_heimdal
Andreas Schneider [Thu, 22 Dec 2022 12:21:18 +0000 (13:21 +0100)] 
testprogs: Use system_or_builddir_binary() for test_kinit_heimdal

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for test_client_kerberos
Andreas Schneider [Thu, 22 Dec 2022 12:19:27 +0000 (13:19 +0100)] 
testprogs: Use system_or_builddir_binary() for test_client_kerberos

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for renamedc
Andreas Schneider [Thu, 22 Dec 2022 12:10:34 +0000 (13:10 +0100)] 
testprogs: Use system_or_builddir_binary() for renamedc

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for ldapcmp_restoredc
Andreas Schneider [Thu, 22 Dec 2022 12:06:55 +0000 (13:06 +0100)] 
testprogs: Use system_or_builddir_binary() for ldapcmp_restoredc

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for functionalprep
Andreas Schneider [Thu, 22 Dec 2022 12:05:05 +0000 (13:05 +0100)] 
testprogs: Use system_or_builddir_binary() for functionalprep

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for demote-saveddb
Andreas Schneider [Thu, 22 Dec 2022 12:04:25 +0000 (13:04 +0100)] 
testprogs: Use system_or_builddir_binary() for demote-saveddb

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for dbcheck-oldrelease
Andreas Schneider [Thu, 22 Dec 2022 12:03:13 +0000 (13:03 +0100)] 
testprogs: Use system_or_builddir_binary() for dbcheck-oldrelease

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Use system_or_builddir_binary() for dbcheck and runtime tests
Andreas Schneider [Thu, 22 Dec 2022 11:57:39 +0000 (12:57 +0100)] 
testprogs: Use system_or_builddir_binary() for dbcheck and runtime tests

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Add system_or_builddir_binary()
Andreas Schneider [Thu, 22 Dec 2022 07:36:26 +0000 (08:36 +0100)] 
testprogs: Add system_or_builddir_binary()

This should be used if we use a system or builddir binary.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotestprogs: Fix remove_directory()
Andreas Schneider [Thu, 22 Dec 2022 12:13:54 +0000 (13:13 +0100)] 
testprogs: Fix remove_directory()

common_test_fns.inc: line 121: [: too many arguments

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agowaf: Run python tests also with tr_TR locale
Andreas Schneider [Fri, 18 Nov 2022 07:49:29 +0000 (08:49 +0100)] 
waf: Run python tests also with tr_TR locale

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Dec 23 14:17:31 UTC 2022 on sn-devel-184

3 years agolib:ldb: Use ldb_ascii_toupper() for case folding
Andreas Schneider [Thu, 10 Nov 2022 13:44:59 +0000 (14:44 +0100)] 
lib:ldb: Use ldb_ascii_toupper() for case folding

For example there are at least two locales (tr_TR and az_AZ) in glibc
having dotless i transformation different from Latin scripts and GUID
versus Guid comparison would be different there (attribute name would
not match in the test).

See also
https://en.wikipedia.org/wiki/Dotted_and_dotless_I
https://lists.samba.org/archive/samba-technical/2019-December/134659.html

This fixes: LC_ALL=tr_TR.UTF-8 make test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:ldb: Add ldb_ascii_toupper()
Andreas Schneider [Wed, 23 Mar 2022 11:45:37 +0000 (12:45 +0100)] 
lib:ldb: Add ldb_ascii_toupper()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:ldb: Remove trailing white spaces in ldb_private.h
Andreas Schneider [Thu, 10 Nov 2022 13:46:47 +0000 (14:46 +0100)] 
lib:ldb: Remove trailing white spaces in ldb_private.h

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:ldb: Fix trailing whitespaces in common/ldb_utf8.c
Andreas Schneider [Wed, 23 Mar 2022 11:44:07 +0000 (12:44 +0100)] 
lib:ldb: Fix trailing whitespaces in common/ldb_utf8.c

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:ldb: Fix trailing whitespaces in common/attrib_handlers.c
Andreas Schneider [Wed, 23 Mar 2022 11:43:36 +0000 (12:43 +0100)] 
lib:ldb: Fix trailing whitespaces in common/attrib_handlers.c

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agosmbd: Make send_trans2_replies() static
Volker Lendecke [Mon, 19 Dec 2022 09:16:51 +0000 (10:16 +0100)] 
smbd: Make send_trans2_replies() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Dec 22 20:46:53 UTC 2022 on sn-devel-184

3 years agosmbd: Hide the SMB1 posix symlink behaviour behind UCF_LCOMP_LNK_OK
Volker Lendecke [Tue, 20 Dec 2022 20:26:10 +0000 (21:26 +0100)] 
smbd: Hide the SMB1 posix symlink behaviour behind UCF_LCOMP_LNK_OK

This will be used in the future to also open symlinks as reparse
points, so this won't be specific to only SMB1 posix extensions.

I have tried to avoid additional flags for several weeks by making
openat_pathref_fsp or other flavors of this to always open fsp's with
symlink O_PATH opens, because I think NT_STATUS_OBJECT_NAME_NOT_FOUND
with a valid stat is a really bad and racy way to express that we just
hit a symlink, but I miserably failed. Adding additional flags (another one
will follow) is wrong, but I don't see another way right now.

Signed-off-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: Simplify filename_convert_dirfsp_nosymlink()
Volker Lendecke [Tue, 20 Dec 2022 13:40:26 +0000 (14:40 +0100)] 
smbd: Simplify filename_convert_dirfsp_nosymlink()

Avoid a nested if, the "&&" is easier to understand for me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Simplify filename_convert_dirfsp_nosymlink()
Volker Lendecke [Tue, 20 Dec 2022 13:38:02 +0000 (14:38 +0100)] 
smbd: Simplify filename_convert_dirfsp_nosymlink()

Factor out the symlink-case into a more obvious if-statement with less
indentation.

Review with git show -b

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Reduce indentation in ucf_flags_from_smb_request()
Volker Lendecke [Tue, 20 Dec 2022 13:14:45 +0000 (14:14 +0100)] 
smbd: Reduce indentation in ucf_flags_from_smb_request()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Implement SET_REPARSE_POINT buffer size checks
Volker Lendecke [Fri, 2 Dec 2022 10:06:38 +0000 (11:06 +0100)] 
smbd: Implement SET_REPARSE_POINT buffer size checks

Partially survives

samba.tests.reparsepoints.ReparsePoints.test_create_reparse

NTTRANS-FSCTL needs changing: Windows 2016 returns INVALID_BUFFER_SIZE
instead of our NOT_A_REPARSE_POINT. This is not the whole story, but
this smbtorture3 change makes autobuild survive.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Rename "ctx" to the more common "mem_ctx" in reparse functions
Volker Lendecke [Wed, 21 Dec 2022 13:39:00 +0000 (14:39 +0100)] 
smbd: Rename "ctx" to the more common "mem_ctx" in reparse functions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Print the file name in reparse point functions
Volker Lendecke [Fri, 2 Dec 2022 10:55:31 +0000 (11:55 +0100)] 
smbd: Print the file name in reparse point functions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib/compression: add simple python bindings
Douglas Bagnall [Fri, 25 Nov 2022 03:43:52 +0000 (16:43 +1300)] 
lib/compression: add simple python bindings

There are four functions, allowing compression and decompression in
the two formats we support so far. The functions will accept bytes or
unicode strings which are treated as utf-8.

The LZ77+Huffman decompression algorithm requires an exact target
length to decompress, so this is mandatory.

The plain decompression algorithm does not need an exact length, but
you can provide one to help it know how much space to allocate. As
currently written, you can provide a short length and it will often
succeed in decompressing to a different shorter string.

These bindings are intended to make ad-hoc investigation easier, not
for production use. This is reflected in the guesses about output size
that plain_decompress() makes if you don't supply one -- either they
are stupidly wasteful or ridiculously insufficient, depending on
whether or not you were trying to decompress a 20MB string.

>>> a = '12345678'
>>> import compression
>>> b = compression.huffman_compress(a)
>>> b
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00  #....
>>> len(b)
262
>>> c = compression.huffman_decompress(b, len(a))
>>> c
b'12345678'                                   # note, c is bytes, a is str
>>> a
'12345678'
>>> d = compression.plain_compress(a)
>>> d
b'\xff\xff\xff\x0012345678'
>>> compression.plain_decompress(d)           # no size specified, guesses
b'12345678'
>>> compression.plain_decompress(d,5)
b'12345'
>>> compression.plain_decompress(d,0)         # 0 for auto
b'12345678'
>>> compression.plain_decompress(d,1)
b'1'
>>> compression.plain_decompress(a,444)
Traceback (most recent call last):
   compression.CompressionError: unable to decompress data into a buffer of 444 bytes.
>>> compression.plain_decompress(b,444)
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 #...

That last one decompresses the Huffman compressed file with the plain
compressor; pretty much any string is valid for plain decompression.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:client: Fix a use-after-free issue in smbclient
Andreas Schneider [Thu, 22 Dec 2022 09:31:11 +0000 (10:31 +0100)] 
s3:client: Fix a use-after-free issue in smbclient

Detected by

    make test TESTS="samba3.blackbox.chdir-cache"

with an optimized build or with AddressSanitizer.

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

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 Dec 22 10:52:31 UTC 2022 on sn-devel-184

3 years agos3:script: Improve test_chdir_cache.sh
Andreas Schneider [Thu, 22 Dec 2022 09:36:02 +0000 (10:36 +0100)] 
s3:script: Improve test_chdir_cache.sh

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoautobuild: Don't use deprecated distutils
Andreas Schneider [Wed, 21 Dec 2022 15:02:18 +0000 (16:02 +0100)] 
autobuild: Don't use deprecated distutils

The distutils package was deprecated in Python 3.10 by PEP 632.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agothird_party: Update resolv_wrapper to version 1.1.8
Andreas Schneider [Wed, 21 Dec 2022 07:42:49 +0000 (08:42 +0100)] 
third_party: Update resolv_wrapper to version 1.1.8

res_randomid() is marked as deprecated in newer glibc.

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): Wed Dec 21 21:28:42 UTC 2022 on sn-devel-184

3 years agoCI: add a test for wbinfo --change-secret-at=DC
Ralph Boehme [Wed, 23 Nov 2022 13:14:45 +0000 (14:14 +0100)] 
CI: add a test for wbinfo --change-secret-at=DC

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): Wed Dec 21 20:05:59 UTC 2022 on sn-devel-184

3 years agoCI: join ad_member_s3_join to vampire_dc
Ralph Boehme [Wed, 23 Nov 2022 13:10:36 +0000 (14:10 +0100)] 
CI: join ad_member_s3_join to vampire_dc

Currently ad_member_s3_join is only used for testing samba-tool join and that'll
work just fine being joined to vampire_dc instead of ad_dc.

vampire_dc is an additional DC in the SAMBADOMAIN "started" by ad_dc_ntvfs, so
by joining ad_member_s3_join to the SAMBADOMAIN, it is member of a domain with
more then one DC.

Subsequently I'll add a test that needs such an environment.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowbinfo: Add --change-secret-at=dcname
Ralph Boehme [Tue, 22 Nov 2022 13:40:07 +0000 (14:40 +0100)] 
wbinfo: Add --change-secret-at=dcname

Add WHATSNEW.txt entry and update wbinfo man page.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibwbclient: add wbc[Ctx]ChangeTrustCredentialsAt()
Ralph Boehme [Tue, 22 Nov 2022 11:00:14 +0000 (12:00 +0100)] 
libwbclient: add wbc[Ctx]ChangeTrustCredentialsAt()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbindd: add dcname arg to ChangeMachineAccount request
Ralph Boehme [Tue, 22 Nov 2022 15:09:34 +0000 (16:09 +0100)] 
winbindd: add dcname arg to ChangeMachineAccount request

Existing callers will pass an empty string, later a new caller will pass an
explicit DC name taken from the wbinfo command line.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbindd: Add force_dc to bypass cached connection and DC lookup
Ralph Boehme [Tue, 22 Nov 2022 13:23:21 +0000 (14:23 +0100)] 
winbindd: Add force_dc to bypass cached connection and DC lookup

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbindd: More simplification of cm_open_connection()
Ralph Boehme [Thu, 24 Nov 2022 11:17:32 +0000 (12:17 +0100)] 
winbindd: More simplification of cm_open_connection()

This basically moves the functionality to connect the socket to the currently
preferred DC to a new helper function connect_preferred_dc() that is called from
the renamed function find_new_dc().

find_dc() now either returns a connected to the preferred DC or a new DC until
all possible DCs are exhausted and cm_open_connection() can just call find_dc()
to get a connected socket and pass it to cm_prepare_connection().

While at it reorder the args of find_dc() and make the only real out arg "fd"
the last one.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbindd: simplify cm_open_connection()
Ralph Boehme [Thu, 24 Nov 2022 14:18:23 +0000 (15:18 +0100)] 
winbindd: simplify cm_open_connection()

Simplify to retry logic: if cm_prepare_connection() succeeded just exit the
retry loop, only if it failed check the "retry" variable.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbindd: simplify find_new_dc()
Ralph Boehme [Thu, 24 Nov 2022 11:15:13 +0000 (12:15 +0100)] 
winbindd: simplify find_new_dc()

Remove the dcname and pss args from find_new_dc(). The caller passes in the
domain anyway, so let's fill in domain->dcname and domain->dcaddr directly.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbindd: do an early exit in cm_open_connection()
Ralph Boehme [Thu, 24 Nov 2022 10:54:14 +0000 (11:54 +0100)] 
winbindd: do an early exit in cm_open_connection()

Best viewed with git show -w. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogp: Don't hide managed/recommended directories
David Mulder [Mon, 12 Dec 2022 17:05:16 +0000 (10:05 -0700)] 
gp: Don't hide managed/recommended directories

Making these variables hidden prevents the parent
class gp_chromium_ext from reading them when
subclassed in gp_chrome_ext. This caused the
chrome policies to be installed in the chromium
directories.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Dec 21 03:05:46 UTC 2022 on sn-devel-184

3 years agogp: Ensure rsop is tested for every CSE
David Mulder [Fri, 9 Dec 2022 17:31:49 +0000 (10:31 -0700)] 
gp: Ensure rsop is tested for every CSE

A bug cropped up in the rsop that was causing a
crash because this wasn't being tested.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogp: Fix rsop when final value isn't a str
David Mulder [Fri, 9 Dec 2022 16:40:34 +0000 (09:40 -0700)] 
gp: Fix rsop when final value isn't a str

The output must be a string value, or it will
crash. Chromium policies output integers, which
was causing the parser to crash.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogp: Enable gpupdate output when testing
David Mulder [Thu, 8 Dec 2022 22:15:15 +0000 (15:15 -0700)] 
gp: Enable gpupdate output when testing

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogp: Ensure policy changes don't leave files behind
David Mulder [Wed, 7 Dec 2022 17:17:38 +0000 (10:17 -0700)] 
gp: Ensure policy changes don't leave files behind

This test exercises the gp_file_applier and
ensures that when a policy is modified, no old
policy is left behind.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogp: Re-create files if manually removed
David Mulder [Wed, 7 Dec 2022 16:51:12 +0000 (09:51 -0700)] 
gp: Re-create files if manually removed

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>