]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agoexamples/winexe: fix fetching return code of the remote command
Yury Lunev [Wed, 27 Jul 2022 18:22:49 +0000 (21:22 +0300)] 
examples/winexe: fix fetching return code of the remote command

ctrl_inbuf field is used to parse remote-side information. A typo was
there that tried to parse return code as "version 0x%x" whereas the
correct way to do it (tested on Windows 10) is to scan for "return_code
%x".

Signed-off-by: Yury Lunev <yury.lunev@gmail.com>
Reviewed-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 Jul 28 18:01:16 UTC 2022 on sn-devel-184

3 years agos3: smbd: Convert reply_checkpath() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 23:21:52 +0000 (16:21 -0700)] 
s3: smbd: Convert reply_checkpath() to use filename_convert_dirfsp().

One less use of filename_convert().

This is the acid test of filename_convert_dirfsp() pathname error
handling.

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): Thu Jul 28 16:34:54 UTC 2022 on sn-devel-184

3 years agos3: smbd: Convert call_trans2mkdir() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:39:11 +0000 (12:39 -0700)] 
s3: smbd: Convert call_trans2mkdir() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert call_trans2open() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:36:23 +0000 (12:36 -0700)] 
s3: smbd: Convert call_trans2open() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert reply_rmdir() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:29:18 +0000 (12:29 -0700)] 
s3: smbd: Convert reply_rmdir() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert reply_ctemp() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:23:42 +0000 (12:23 -0700)] 
s3: smbd: Convert reply_ctemp() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert reply_mknew() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:09:48 +0000 (12:09 -0700)] 
s3: smbd: Convert reply_mknew() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert reply_open_and_X() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:00:32 +0000 (12:00 -0700)] 
s3: smbd: Convert reply_open_and_X() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Convert reply_open() to use filename_convert_dirfsp().
Jeremy Allison [Wed, 27 Jul 2022 19:05:17 +0000 (12:05 -0700)] 
s3: smbd: Convert reply_open() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Fix the error processing in filename_convert_dirfsp_nosymlink() to match...
Jeremy Allison [Wed, 27 Jul 2022 22:28:13 +0000 (15:28 -0700)] 
s3: smbd: Fix the error processing in filename_convert_dirfsp_nosymlink() to match unix_convert() 100%

We need this in order to pass:

samba3.raw.samba3badpath
raw.chkpath
samba3.base.chkpath

Now we can convert all the SMB1 reply_openXXX functions,
and reply_checkpath().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: In filename_split_lcomp() ensure we never return a streamname if posix...
Jeremy Allison [Wed, 27 Jul 2022 23:52:40 +0000 (16:52 -0700)] 
s3: smbd: In filename_split_lcomp() ensure we never return a streamname if posix is set.

POSIX has no streams, even on the root of a directory.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: Ensure we set fsp->file_id in openat_pathref_dirfsp_nosymlink().
Jeremy Allison [Wed, 27 Jul 2022 21:36:33 +0000 (14:36 -0700)] 
s3: smbd: Ensure we set fsp->file_id in openat_pathref_dirfsp_nosymlink().

This is a subtle one. The dirfsp returned by openat_pathref_dirfsp_nosymlink()
can be used inside open.c and passed to check_parent_access_fsp() to
check if a delete_on_close flag has been set on an existing "real"
open fsp. So the file_id must be correctly set in order for this
to work. Without it, samba3.base.delete fails in deltest20 when
we convert reply_open_and_X() to use filename_convert_dirfsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3:winbind: Implement dcerpc_samr_chgpasswd_user4 for PamAuthChangePassword
Andreas Schneider [Tue, 26 Jul 2022 14:54:36 +0000 (16:54 +0200)] 
s3:winbind: Implement dcerpc_samr_chgpasswd_user4 for PamAuthChangePassword

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): Thu Jul 28 12:47:31 UTC 2022 on sn-devel-184

3 years agos3:libsmb: Add dcerpc_samr_chgpasswd_user4 to remote_password_change()
Andreas Schneider [Tue, 26 Jul 2022 14:27:32 +0000 (16:27 +0200)] 
s3:libsmb: Add dcerpc_samr_chgpasswd_user4 to remote_password_change()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:test: Print the output to understand what was going wrong
Andreas Schneider [Tue, 26 Jul 2022 18:54:44 +0000 (20:54 +0200)] 
s3:test: Print the output to understand what was going wrong

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:libnet: Add support for samr_ChangePasswordUser4()
Andreas Schneider [Tue, 26 Jul 2022 13:43:31 +0000 (15:43 +0200)] 
s4:libnet: Add support for samr_ChangePasswordUser4()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:libnet: Move code using RC4 into its own function
Andreas Schneider [Tue, 26 Jul 2022 13:13:08 +0000 (15:13 +0200)] 
s4:libnet: Move code using RC4 into its own function

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:libnet: Remove unused code in libnet_ChangePassword_samr()
Andreas Schneider [Tue, 26 Jul 2022 12:47:53 +0000 (14:47 +0200)] 
s4:libnet: Remove unused code in libnet_ChangePassword_samr()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:torture: Add test for dcerpc_samr_ChangePasswordUser4
Andreas Schneider [Tue, 5 Jul 2022 11:26:37 +0000 (13:26 +0200)] 
s4:torture: Add test for dcerpc_samr_ChangePasswordUser4

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Implement dcesrv_samr_ChangePasswordUser4()
Andreas Schneider [Mon, 28 Feb 2022 12:51:40 +0000 (13:51 +0100)] 
s3:rpc_server: Implement dcesrv_samr_ChangePasswordUser4()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:passdb: Correctly burn the plaintext_pw with samu_destroy()
Andreas Schneider [Mon, 18 Jul 2022 12:38:38 +0000 (14:38 +0200)] 
s3:passdb: Correctly burn the plaintext_pw with samu_destroy()

memset() can be removed from the optimizer.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:passdb: Remove trailing whitespaces
Andreas Schneider [Mon, 18 Jul 2022 12:38:26 +0000 (14:38 +0200)] 
s3:passdb: Remove trailing whitespaces

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:rpc_server: Implement dcesrv_samr_ChangePasswordUser4()
Andreas Schneider [Mon, 30 Aug 2021 15:47:22 +0000 (17:47 +0200)] 
s4:rpc_server: Implement dcesrv_samr_ChangePasswordUser4()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:dsdb: Burn the memory of hashes returned by samdb_result_hashes()
Andreas Schneider [Tue, 26 Jul 2022 09:31:54 +0000 (11:31 +0200)] 
s4:dsdb: Burn the memory of hashes returned by samdb_result_hashes()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:dsdb: Remove trailing whitespaces from util.c
Andreas Schneider [Tue, 26 Jul 2022 09:31:35 +0000 (11:31 +0200)] 
s4:dsdb: Remove trailing whitespaces from util.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpcclient: Implement cmd chpasswd4
Andreas Schneider [Mon, 11 Jul 2022 13:24:59 +0000 (15:24 +0200)] 
s3:rpcclient: Implement cmd chpasswd4

Manually tested against Windows Server 2022.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agodocs-xml: Remove trailing whitespaces in rpcclient.1.xml
Andreas Schneider [Thu, 14 Jul 2022 08:05:53 +0000 (10:05 +0200)] 
docs-xml: Remove trailing whitespaces in rpcclient.1.xml

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_client: Implement dcerpc_samr_chgpasswd_user4()
Andreas Schneider [Tue, 5 Jul 2022 08:34:12 +0000 (10:34 +0200)] 
s3:rpc_client: Implement dcerpc_samr_chgpasswd_user4()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_client: Fix trailing whitespaces in cli_samr.c
Andreas Schneider [Tue, 5 Jul 2022 08:30:47 +0000 (10:30 +0200)] 
s3:rpc_client: Fix trailing whitespaces in cli_samr.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:util: Add generate_random_u64_range()
Andreas Schneider [Thu, 14 Jul 2022 05:56:39 +0000 (07:56 +0200)] 
lib:util: Add generate_random_u64_range()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:util: Remove trailing whitespaces in samba_util.h
Andreas Schneider [Thu, 14 Jul 2022 06:05:07 +0000 (08:05 +0200)] 
lib:util: Remove trailing whitespaces in samba_util.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Add test for pbkdf2
Andreas Schneider [Fri, 15 Jul 2022 07:06:04 +0000 (09:06 +0200)] 
lib:crypto: Add test for pbkdf2

This is just that we use the right parameters for gnutls_pbkdf2() and
reach the values from Windows.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agowaf: Check for gnutls_pbkdf2()
Andreas Schneider [Mon, 30 Aug 2021 15:06:10 +0000 (17:06 +0200)] 
waf: Check for gnutls_pbkdf2()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:torture: Implement test for SAMR SetUserInfo(2) level 32
Andreas Schneider [Tue, 24 Aug 2021 09:39:19 +0000 (11:39 +0200)] 
s4:torture: Implement test for SAMR SetUserInfo(2) level 32

make test TESTS="samba4.rpc.samr.passwords"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Implement SAMR SetUserInfo(2) level 32
Andreas Schneider [Tue, 24 Aug 2021 13:00:37 +0000 (15:00 +0200)] 
s3:rpc_server: Implement SAMR SetUserInfo(2) level 32

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:rpc_server: Implement support for SetUserInfo(2) level 32
Andreas Schneider [Tue, 24 Aug 2021 12:23:53 +0000 (14:23 +0200)] 
s4:rpc_server: Implement support for SetUserInfo(2) level 32

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:torture: Implement test for SAMR SetUserInfo(2) level 31
Andreas Schneider [Thu, 19 Aug 2021 07:44:10 +0000 (09:44 +0200)] 
s4:torture: Implement test for SAMR SetUserInfo(2) level 31

We can't apply this patch earlier as there are no individual tests we could
mark as knownfail. Reorganizing the whole test is a too big task for now.
However this test is working and also found some bugs.

make test TESTS="samba4.rpc.samr.passwords"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Implement support for SAMR SetUserInfo level 31
Andreas Schneider [Sun, 22 Aug 2021 16:38:52 +0000 (18:38 +0200)] 
s3:rpc_server: Implement support for SAMR SetUserInfo level 31

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Remove obosolete copy_id26_to_sam_passwd()
Andreas Schneider [Mon, 23 Aug 2021 09:31:32 +0000 (11:31 +0200)] 
s3:rpc_server: Remove obosolete copy_id26_to_sam_passwd()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Use copy_pwd_expired_to_sam_passwd() in set_user_info_26()
Andreas Schneider [Mon, 23 Aug 2021 09:30:40 +0000 (11:30 +0200)] 
s3:rpc_server: Use copy_pwd_expired_to_sam_passwd() in set_user_info_26()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Add copy_pwd_expired_to_sam_passwd() for SAMR
Andreas Schneider [Sun, 22 Aug 2021 16:37:28 +0000 (18:37 +0200)] 
s3:rpc_server: Add copy_pwd_expired_to_sam_passwd() for SAMR

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Set missing debug class for srv_samr_chgpasswd
Andreas Schneider [Fri, 15 Jul 2022 09:10:47 +0000 (11:10 +0200)] 
s3:rpc_server: Set missing debug class for srv_samr_chgpasswd

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Add test for decode_pwd_string_from_buffer514()
Andreas Schneider [Mon, 25 Jul 2022 10:12:52 +0000 (12:12 +0200)] 
libcli:auth: Add test for decode_pwd_string_from_buffer514()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Add decode_pwd_string_from_buffer514()
Andreas Schneider [Mon, 23 Aug 2021 13:03:19 +0000 (15:03 +0200)] 
libcli:auth: Add decode_pwd_string_from_buffer514()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:rpc_server: Implement support for SAMR SetUserInfo(2) level 31
Andreas Schneider [Wed, 18 Aug 2021 14:22:19 +0000 (16:22 +0200)] 
s4:rpc_server: Implement support for SAMR SetUserInfo(2) level 31

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:rpc_server: Add samr_set_password_aes()
Andreas Schneider [Wed, 18 Aug 2021 14:21:59 +0000 (16:21 +0200)] 
s4:rpc_server: Add samr_set_password_aes()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:rpc_server: Add transaction for dcesrv_samr_SetUserInfo()
Andreas Schneider [Tue, 26 Jul 2022 09:04:29 +0000 (11:04 +0200)] 
s4:rpc_server: Add transaction for dcesrv_samr_SetUserInfo()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4:rpc_server: Use sam_ctx consistently in dcesrv_samr_SetUserInfo()
Andreas Schneider [Tue, 26 Jul 2022 08:59:13 +0000 (10:59 +0200)] 
s4:rpc_server: Use sam_ctx consistently in dcesrv_samr_SetUserInfo()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_server: Use a done goto label for dcesrv_samr_SetUserInfo()
Andreas Schneider [Tue, 26 Jul 2022 08:57:19 +0000 (10:57 +0200)] 
s3:rpc_server: Use a done goto label for dcesrv_samr_SetUserInfo()

This will be used in the following commits.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Add test for extract_pwd_blob_from_buffer514()
Andreas Schneider [Mon, 25 Jul 2022 10:06:05 +0000 (12:06 +0200)] 
libcli:auth: Add test for extract_pwd_blob_from_buffer514()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Add extract_pwd_blob_from_buffer514()
Andreas Schneider [Fri, 20 Aug 2021 07:45:27 +0000 (09:45 +0200)] 
libcli:auth: Add extract_pwd_blob_from_buffer514()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Implment a common create_pw_buffer_from_blob()
Andreas Schneider [Mon, 25 Jul 2022 08:29:01 +0000 (10:29 +0200)] 
libcli:auth: Implment a common create_pw_buffer_from_blob()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Use extract_pw_from_buffer() in decode_pw_buffer()
Andreas Schneider [Mon, 25 Jul 2022 08:14:12 +0000 (10:14 +0200)] 
libcli:auth: Use extract_pw_from_buffer() in decode_pw_buffer()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Keep data of extract_pw_from_buffer() secret
Andreas Schneider [Mon, 25 Jul 2022 06:42:39 +0000 (08:42 +0200)] 
libcli:auth: Keep data of extract_pw_from_buffer() secret

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpcclient: Implement setuserinfo2 level 31
Andreas Schneider [Mon, 2 Aug 2021 13:41:23 +0000 (15:41 +0200)] 
s3:rpcclient: Implement setuserinfo2 level 31

Manually tested against Windows Server 2022.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpcclient: Encrypt the password buffers only if really needed
Andreas Schneider [Mon, 18 Jul 2022 13:48:36 +0000 (15:48 +0200)] 
s3:rpcclient: Encrypt the password buffers only if really needed

If we are in FIPS mode certain ciphers like RC4 are not available, so
we should make sure we do not call them. We will add AES support in the
next patch.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:rpc_client: Implement init_samr_CryptPasswordAES()
Andreas Schneider [Fri, 30 Jul 2021 14:24:37 +0000 (16:24 +0200)] 
s3:rpc_client: Implement init_samr_CryptPasswordAES()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agosamr.idl: Add samr_ChangePasswordUser4()
Andreas Schneider [Thu, 26 Aug 2021 15:37:59 +0000 (17:37 +0200)] 
samr.idl: Add samr_ChangePasswordUser4()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agosamr:idl: add samr_SupportedFeatures for samr_Connect5()
Andreas Schneider [Wed, 25 Aug 2021 12:11:28 +0000 (14:11 +0200)] 
samr:idl: add samr_SupportedFeatures for samr_Connect5()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agosamr.idl: Add support for new AES encrypted password buffer
Andreas Schneider [Fri, 30 Jul 2021 09:12:07 +0000 (11:12 +0200)] 
samr.idl: Add support for new AES encrypted password buffer

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Add test for encode_pwd_buffer514_from_str()
Andreas Schneider [Mon, 25 Jul 2022 09:25:09 +0000 (11:25 +0200)] 
libcli:auth: Add test for encode_pwd_buffer514_from_str()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Add encode_pw_buffer_from_str()
Andreas Schneider [Thu, 19 Aug 2021 09:29:04 +0000 (11:29 +0200)] 
libcli:auth: Add encode_pw_buffer_from_str()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Implement a generic encode_pwd_buffer_from_str()
Andreas Schneider [Fri, 22 Jul 2022 12:26:43 +0000 (14:26 +0200)] 
libcli:auth: Implement a generic encode_pwd_buffer_from_str()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibcli:auth: Remove trailing spaces from proto.h
Andreas Schneider [Thu, 19 Aug 2021 09:28:37 +0000 (11:28 +0200)] 
libcli:auth: Remove trailing spaces from proto.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Add test for samba_gnutls_aead_aes_256_cbc_hmac_sha512_decrypt()
Andreas Schneider [Tue, 17 Aug 2021 09:19:01 +0000 (11:19 +0200)] 
lib:crypto: Add test for samba_gnutls_aead_aes_256_cbc_hmac_sha512_decrypt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Add samba_gnutls_aead_aes_256_cbc_hmac_sha512_decrypt()
Andreas Schneider [Mon, 16 Aug 2021 15:14:19 +0000 (17:14 +0200)] 
lib:crypto: Add samba_gnutls_aead_aes_256_cbc_hmac_sha512_decrypt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Add test for samba_gnutls_aead_aes_256_cbc_hmac_sha512_encrypt()
Andreas Schneider [Tue, 3 Aug 2021 12:14:07 +0000 (14:14 +0200)] 
lib:crypto: Add test for samba_gnutls_aead_aes_256_cbc_hmac_sha512_encrypt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolibrpc:rpc: Add SAMR encryption and mac key salt definitions
Andreas Schneider [Mon, 18 Jul 2022 11:42:07 +0000 (13:42 +0200)] 
librpc:rpc: Add SAMR encryption and mac key salt definitions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Implement samba_gnutls_aead_aes_256_cbc_hmac_sha512_encrypt()
Andreas Schneider [Mon, 2 Aug 2021 14:21:19 +0000 (16:21 +0200)] 
lib:crypto: Implement samba_gnutls_aead_aes_256_cbc_hmac_sha512_encrypt()

This is for [MS-SAMR] 3.2.2.4 AES Cipher Usage

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:replace: Add macros to burn data from memory
Andreas Schneider [Tue, 19 Jul 2022 11:36:57 +0000 (13:36 +0200)] 
lib:replace: Add macros to burn data from memory

This will explicitly zero data from memory. This is guaranteed to be not
optimized away.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Merge wscript_build into wscript
Andreas Schneider [Mon, 2 Aug 2021 14:34:05 +0000 (16:34 +0200)] 
lib:crypto: Merge wscript_build into wscript

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Merge wscript_configure into wscript
Andreas Schneider [Mon, 2 Aug 2021 14:28:53 +0000 (16:28 +0200)] 
lib:crypto: Merge wscript_configure into wscript

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib:crypto: Reformat wscript
Andreas Schneider [Mon, 2 Aug 2021 14:27:04 +0000 (16:27 +0200)] 
lib:crypto: Reformat wscript

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoctdb-tests: Add tests for cluster mutex I/O timeout
Martin Schwenke [Fri, 25 Feb 2022 08:44:52 +0000 (19:44 +1100)] 
ctdb-tests: Add tests for cluster mutex I/O timeout

Block the locker helper child by taking a lock on the 2nd byte of the
lock file.  This will cause a ping timeout if the process is blocked
for long enough.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jul 28 11:10:54 UTC 2022 on sn-devel-184

3 years agoctdb-tests: Terminate event loop if lock is no longer held
Martin Schwenke [Mon, 28 Feb 2022 05:11:18 +0000 (16:11 +1100)] 
ctdb-tests: Terminate event loop if lock is no longer held

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Test the lock by locking a 2nd byte range
Martin Schwenke [Tue, 8 Feb 2022 01:23:42 +0000 (12:23 +1100)] 
ctdb-mutex: Test the lock by locking a 2nd byte range

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: open() and fstat() when testing lock file
Martin Schwenke [Tue, 8 Feb 2022 01:15:26 +0000 (12:15 +1100)] 
ctdb-mutex: open() and fstat() when testing lock file

This makes a file descriptor available for other I/O.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Factor out function fcntl_lock_fd()
Martin Schwenke [Tue, 8 Feb 2022 00:56:46 +0000 (11:56 +1100)] 
ctdb-mutex: Factor out function fcntl_lock_fd()

Allows blocking mode and start offset to be specified.  Always locks a
1-byte range.

Make the lock structure static to avoid initialising the whole
structure each time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Handle pings from lock checking child to parent
Martin Schwenke [Fri, 28 Jan 2022 02:49:48 +0000 (13:49 +1100)] 
ctdb-mutex: Handle pings from lock checking child to parent

The ping timeout is specified by passing an extra argument to the
mutex helper, representing the ping timeout in seconds.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Do inode checks in a child process
Martin Schwenke [Fri, 21 Jan 2022 02:37:17 +0000 (13:37 +1100)] 
ctdb-mutex: Do inode checks in a child process

In future this will allow extra I/O tests and a timeout in the parent
to (hopefully) release the lock if the child gets wedged.  For
simplicity, use tmon only to detect when either parent or child goes
away.  Plumbing a timeout for pings from child to parent will be done
later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Rename wait_for_lost to lock_io_check
Martin Schwenke [Mon, 7 Feb 2022 22:35:17 +0000 (09:35 +1100)] 
ctdb-mutex: Rename wait_for_lost to lock_io_check

This will be generalised to do more I/O-based checks.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Rename recheck_time to recheck_interval
Martin Schwenke [Wed, 19 Jan 2022 01:09:07 +0000 (12:09 +1100)] 
ctdb-mutex: Rename recheck_time to recheck_interval

There will be more timeouts so clarify the intent of this one.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-mutex: Consistently use progname in error messages
Martin Schwenke [Mon, 28 Feb 2022 22:58:22 +0000 (09:58 +1100)] 
ctdb-mutex: Consistently use progname in error messages

To avoid error messages having ridiculously long paths, set progname
to basename(argv[0]).

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Add tests for trivial FD monitoring
Martin Schwenke [Wed, 2 Feb 2022 10:47:59 +0000 (21:47 +1100)] 
ctdb-tests: Add tests for trivial FD monitoring

tmon_ping_test covers complex 2-way interaction between processes
using tmon_ping_send(), including via a socketpair().  tmon_test
covers the more general functionality of tmon_send() but uses a
simpler 1-way harness with wide coverage.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-common: Add trivial FD monitoring abstraction
Martin Schwenke [Tue, 1 Feb 2022 00:44:48 +0000 (11:44 +1100)] 
ctdb-common: Add trivial FD monitoring abstraction

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-build: Link in backtrace support for ctdb_util_tests
Martin Schwenke [Tue, 3 May 2022 23:21:38 +0000 (09:21 +1000)] 
ctdb-build: Link in backtrace support for ctdb_util_tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-build: Separate test backtrace support into separate subsystem
Martin Schwenke [Tue, 3 May 2022 23:02:12 +0000 (09:02 +1000)] 
ctdb-build: Separate test backtrace support into separate subsystem

A convention when testing members of ctdb-util is to include the .c
file so that static functions can potentially be tested.  This means
that such tests can't be linked against ctdb-util or duplicate symbols
will be encountered.

ctdb-tests-common depends on ctdb-client, which depends in turn on
ctdb-util, so this can't be used to pull in backtrace support.
Instead, make ctdb-tests-backtrace its own subsystem.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-build: Sort sources in ctdb-util and ctdb_unit_tests
Martin Schwenke [Tue, 3 May 2022 23:17:40 +0000 (09:17 +1000)] 
ctdb-build: Sort sources in ctdb-util and ctdb_unit_tests

Also, rename ctdb_unit_tests to ctdb_util_tests.  The sorting makes
it clear that only items from ctdb-util are tested here.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-daemon: Fix printing of tickle ACKs
Martin Schwenke [Tue, 5 Jul 2022 09:33:15 +0000 (19:33 +1000)] 
ctdb-daemon: Fix printing of tickle ACKs

Commit f5a20377347aba18700d010d4201775fc83a0b1b arguably got this
back-to-front:

  2022-07-27T09:50:01.985857+10:00 testn1 ctdbd[17820]: ../../ctdb/server/ctdb_takeover.c:514 sending TAKE_IP for '10.0.1.173'
  2022-07-27T09:50:01.990601+10:00 testn1 ctdbd[17820]: Send TCP tickle ACK: 10.0.1.77:33004 -> 10.0.1.173:2049
  2022-07-27T09:50:01.991323+10:00 testn1 ctdb-takeover[19758]: TAKEOVER_IP 10.0.1.173 succeeded on node 0

Unfortunately there is an inconsistency somewhere in the connection
tracking code used for tickle ACKs, making this less than obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Jul 28 09:02:08 UTC 2022 on sn-devel-184

3 years agopy/uptodateness: more details in missing dn report
Douglas Bagnall [Mon, 11 Jul 2022 00:06:54 +0000 (12:06 +1200)] 
py/uptodateness: more details in missing dn report

This does not fix bug 15127, but it improves reporting.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jul 28 06:18:43 UTC 2022 on sn-devel-184

3 years agoutil/genrand: don't ignore errors in random number generation
Douglas Bagnall [Sun, 4 Aug 2019 12:10:53 +0000 (00:10 +1200)] 
util/genrand: don't ignore errors in random number generation

In this case it is probably better to crash out.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: smbd: Convert call_nt_transact_create() to use filename_convert_dirfsp().
Jeremy Allison [Mon, 25 Jul 2022 23:30:06 +0000 (16:30 -0700)] 
s3: smbd: Convert call_nt_transact_create() to use filename_convert_dirfsp().

One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul 27 17:49:51 UTC 2022 on sn-devel-184

3 years agos3: smbd: Inside filename_convert_dirfsp_nosymlink() ensure the returned smb_fname...
Jeremy Allison [Tue, 26 Jul 2022 21:34:27 +0000 (14:34 -0700)] 
s3: smbd: Inside filename_convert_dirfsp_nosymlink() ensure the returned smb_fname is always allocated off mem_ctx.

Without this, if we just return smb_fname_rel->fsp->fsp_name as the smb_fname
then we return something allocated off fsp (which itself is allocated off
the conn struct), not the passed in talloc_ctx.

Do this for both non-stream and stream returns.

This matters for two reasons.

1). If we error out after calling filename_convert_dirfsp()
but before getting to the code inside create_file_unixpath()
that takes ownership of the passed in smb_fname->fsp we will
leak the fsp as the destructor for smb_fname that closes the
fsp will never fire on return to the client, as smb_fname is
owned by smb_fname->fsp, not the talloc_tos() context.

2). Some uses of filename_convert() expect to be able
to TALLOC_FREE the returned smb_fname once they've successfully
called SMB_VFS_CREATE_FILE() as they consider the passed in smb_fname
no longer used. It would be nice to be able to just change
filename_convert() -> filename_convert_dirfsp() without
having to change the lifetime handling of smb_fname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: smbd: In openat_pathref_dirfsp_nosymlink() ensure we call fsp_smb_fname_link...
Jeremy Allison [Tue, 26 Jul 2022 21:29:21 +0000 (14:29 -0700)] 
s3: smbd: In openat_pathref_dirfsp_nosymlink() ensure we call fsp_smb_fname_link() to set smb_fname->fsp in the returned smb_fname.

Instead of just assigning smb_fname->fsp = fsp.

This makes the logic match that of openat_pathref_fullname() and parent_pathref()
when returning smb_fnames with associated pathref fsp's.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agoCVE-2022-32742: s3: smbd: Harden the smbreq_bufrem() macro.
Jeremy Allison [Tue, 7 Jun 2022 16:53:08 +0000 (09:53 -0700)] 
CVE-2022-32742: s3: smbd: Harden the smbreq_bufrem() macro.

Fixes the raw.write.bad-write test.

NB. We need the two (==0) changes in source3/smbd/smb2_reply.c
as the gcc optimizer now knows that the return from
smbreq_bufrem() can never be less than zero.

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

Remove knownfail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Wed Jul 27 11:46:46 UTC 2022 on sn-devel-184

3 years agoCVE-2022-32742: s4: torture: Add raw.write.bad-write test.
Jeremy Allison [Tue, 7 Jun 2022 16:40:45 +0000 (09:40 -0700)] 
CVE-2022-32742: s4: torture: Add raw.write.bad-write test.

Reproduces the test code in:

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

Add knownfail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
3 years agoCVE-2022-2031 testprogs: Add test for short-lived ticket across an incoming trust
Joseph Sutton [Thu, 23 Jun 2022 01:59:11 +0000 (13:59 +1200)] 
CVE-2022-2031 testprogs: Add test for short-lived ticket across an incoming trust

We ensure that the KDC does not reject a TGS-REQ with our short-lived
TGT over an incoming trust.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
3 years agoCVE-2022-2031 s4:kpasswd: Do not accept TGTs as kpasswd tickets
Joseph Sutton [Fri, 10 Jun 2022 07:18:53 +0000 (19:18 +1200)] 
CVE-2022-2031 s4:kpasswd: Do not accept TGTs as kpasswd tickets

If TGTs can be used as kpasswd tickets, the two-minute lifetime of a
authentic kpasswd ticket may be bypassed. Furthermore, kpasswd tickets
are not supposed to be cached, but using this flaw, a stolen credentials
cache containing a TGT may be used to change that account's password,
and thus is made more valuable to an attacker.

Since all TGTs should be issued with a REQUESTER_SID PAC buffer, and
service tickets without it, we assert the absence of this buffer to
ensure we're not accepting a TGT.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoCVE-2022-2031 s4:auth: Use PAC to determine whether ticket is a TGT
Joseph Sutton [Fri, 10 Jun 2022 07:18:35 +0000 (19:18 +1200)] 
CVE-2022-2031 s4:auth: Use PAC to determine whether ticket is a TGT

We use the presence or absence of a REQUESTER_SID PAC buffer to
determine whether the ticket is a TGT. We will later use this to reject
TGTs where a service ticket is expected.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoCVE-2022-2031 auth: Add ticket type field to auth_user_info_dc and auth_session_info
Joseph Sutton [Fri, 10 Jun 2022 07:18:07 +0000 (19:18 +1200)] 
CVE-2022-2031 auth: Add ticket type field to auth_user_info_dc and auth_session_info

This field may be used to convey whether we were provided with a TGT or
a non-TGT. We ensure both structures are zeroed out to avoid incorrect
results being produced by an uninitialised field.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>