]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
13 months agoselftest: Add a python blackbox test for some misc (widelink) DFS tests
Noel Power [Tue, 11 Jun 2024 10:19:50 +0000 (11:19 +0100)] 
selftest: Add a python blackbox test for some misc (widelink) DFS tests

On master attempting to chdir into a nested dfs link

e.g. cd dfslink (works)
     cd dfslink/another_dfslink (fails)

[1] Add a test for this scenario (nested chdir)
[2] Add test for enumerating a dfs link in root of dfs share
[3] Add a test to check case insensitive chdir into dfs link on widelink
  enabled share

Add knownfails for tests 1 and 3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435

13 months agos3: vfs_widelinks: Allow case insensitivity to work on DFS widelinks shares.
Jeremy Allison [Tue, 11 Jun 2024 00:25:32 +0000 (17:25 -0700)] 
s3: vfs_widelinks: Allow case insensitivity to work on DFS widelinks shares.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 11 17:00:38 UTC 2024 on atb-devel-224

13 months agos3/torture: Add test for widelink case insensitivity on a MSDFS share.
Jeremy Allison [Mon, 10 Jun 2024 22:14:19 +0000 (15:14 -0700)] 
s3/torture: Add test for widelink case insensitivity on a MSDFS share.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
13 months agosamba-tool user readpasswords: avoid `assert` for validation
Douglas Bagnall [Fri, 2 Feb 2024 02:01:21 +0000 (15:01 +1300)] 
samba-tool user readpasswords: avoid `assert` for validation

`assert` can be optimised away if python is run with `-O`.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jun 11 05:32:28 UTC 2024 on atb-devel-224

13 months agos4:auth: Handle expired accounts in authsam_account_ok() (CID 1603594)
Jo Sutton [Tue, 11 Jun 2024 02:58:11 +0000 (14:58 +1200)] 
s4:auth: Handle expired accounts in authsam_account_ok() (CID 1603594)

We check the ACB_PW_EXPIRED bit to determine whether the account is
expired. Since ACB_PW_EXPIRED can’t be represented in a 16‐bit integer,
we must increase the width of acct_flags so as not to lose that bit.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4:dsdb: Remove trailing whitespace
Jo Sutton [Fri, 24 May 2024 01:05:58 +0000 (13:05 +1200)] 
s4:dsdb: Remove trailing whitespace

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4:auth: Add temporary memory context to authsam_reread_user_logon_data()
Jo Sutton [Mon, 29 Apr 2024 05:07:43 +0000 (17:07 +1200)] 
s4:auth: Add temporary memory context to authsam_reread_user_logon_data()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4:auth: Add common out path to authsam_reread_user_logon_data()
Jo Sutton [Mon, 29 Apr 2024 05:09:12 +0000 (17:09 +1200)] 
s4:auth: Add common out path to authsam_reread_user_logon_data()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoldb: Attach appropriate ldb context to returned result
Jo Sutton [Wed, 1 May 2024 04:54:01 +0000 (16:54 +1200)] 
ldb: Attach appropriate ldb context to returned result

This is done by adding a new API that avoids the problems of
ldb_dn_copy() and makes it clear that a struct ldb_context *
pointer will be stored in the new copy.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4/torture: Remove already existing test_dir
Anoop C S [Wed, 29 May 2024 13:22:10 +0000 (18:52 +0530)] 
s4/torture: Remove already existing test_dir

In configurations where vfs_acl_xattr is used with 'ignore system acls'
option we encounter NT_STATUS_ACCESS_DENIED while trying to open an
already existing test_dir in smb2.delete-on-close-perms.READONLY. Due
to missing SEC_STD_DELETE permission from the list of allowed ACEs it
couldn't be removed via previous call to smb2_deltree(). Thus as seen
with other tests we now call set_dir_delete_perms() so that subsequent
attempt to remove it can succeed.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jun 10 13:17:58 UTC 2024 on atb-devel-224

14 months agos4/torture: Create test_dir with SEC_RIGHTS_DIR_ALL
Anoop C S [Wed, 29 May 2024 13:11:32 +0000 (18:41 +0530)] 
s4/torture: Create test_dir with SEC_RIGHTS_DIR_ALL

In shares where acl_xattr vfs module is loaded with 'ignore system acls'
set, smb2.delete-on-close-perms.FIND_and_set_DOC fails to open test_dir
due to NT_STATUS_ACCESS_DENIED as it lacks few permissions for owner
when created using create_dir(). Test case aims to set delete-on-close
for which delete permission is necessary in first place. Therefore we
now perform the creation and subsequent opening of directory using
torture_smb2_testdir() so that the open handle comes with SEC_STD_DELETE
permission.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopython/samba/tests/krb5: Allow PkInitTests.test_pkinit_ntlm_from_pac_must_change_now...
Andrew Bartlett [Tue, 4 Jun 2024 01:26:18 +0000 (13:26 +1200)] 
python/samba/tests/krb5: Allow PkInitTests.test_pkinit_ntlm_from_pac_must_change_now to pass on Samba/Heimdal

This flexiblity in the tests avoids requiring Samba/Heimdal to omit an NTSTATUS error
return and just be consistent between the different authentication paths.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jun 10 05:32:54 UTC 2024 on atb-devel-224

14 months agopython/samba/tests/krb5: Expand test without UF_SMARTCARD_REQUIRED to show rotation...
Andrew Bartlett [Mon, 3 Jun 2024 23:36:53 +0000 (11:36 +1200)] 
python/samba/tests/krb5: Expand test without UF_SMARTCARD_REQUIRED to show rotation is not done

This makes sense as otherwise the user would suddenly not know their password
for use when they do not use their smartcard.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agoWHATSNEW: Mention msDS-ExpirePasswordsOnSmartCardOnlyAccounts behaviour
Andrew Bartlett [Sun, 26 May 2024 23:51:59 +0000 (11:51 +1200)] 
WHATSNEW: Mention msDS-ExpirePasswordsOnSmartCardOnlyAccounts behaviour

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agoprovision: Match Windows 2022 and set msDS-ExpirePasswordsOnSmartCardOnlyAccounts...
Andrew Bartlett [Sun, 26 May 2024 23:30:29 +0000 (11:30 +1200)] 
provision: Match Windows 2022 and set msDS-ExpirePasswordsOnSmartCardOnlyAccounts by default

We do this by telling the Domain Functional Level upgrade code that
this is a new install.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agoselftest: Add test that msDS-ExpirePasswordsOnSmartCardOnlyAccounts=TRUE is set
Andrew Bartlett [Sun, 26 May 2024 23:53:15 +0000 (11:53 +1200)] 
selftest: Add test that msDS-ExpirePasswordsOnSmartCardOnlyAccounts=TRUE is set

This assures us that the new provision sets the value by default.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agokdc: Rotate smart-card only underlying password in 2nd half of lifetime
Andrew Bartlett [Fri, 17 May 2024 05:34:36 +0000 (17:34 +1200)] 
kdc: Rotate smart-card only underlying password in 2nd half of lifetime

This is a measure to avoid multiple servers rotating the password
but means that the maximum password age really must be set to
twice the TGT lifetime, eg a default of 20 hours.  The internet
suggestions of 1 day for this feature should work fine.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agokdc: Track the pwdLastSet of expired UF_SMARTCARD_REQUIRED accounts
Andrew Bartlett [Thu, 9 May 2024 04:24:31 +0000 (16:24 +1200)] 
kdc: Track the pwdLastSet of expired UF_SMARTCARD_REQUIRED accounts

This is to gracefully deal with races and to avoid additional password
rollover in situations where the TGT lifetime is longer than the
maximum password lifetime.  This is not a sensible combination, so
we just avoid the extra DB write, and update it only once per AS-REQ
in this case.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agokdc: Detect (about to) expire UF_SMARTCARD_REQUIRED accounts and rotate passwords
Andrew Bartlett [Mon, 20 May 2024 23:14:50 +0000 (11:14 +1200)] 
kdc: Detect (about to) expire UF_SMARTCARD_REQUIRED accounts and rotate passwords

This ensures that before the KDC starts to process the entry
we check if it is expired and rotate it.  As an account with
UF_SMARTCARD_REQUIRED simply can not expire unless
msDS-ExpirePasswordsOnSmartCardOnlyAccounts is set and
the Domain Functional Level is >= 2016 we do not need
to do configuration checks here.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Pair-programmed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agos4-auth: Use consistant externally-supplied time in auth stack
Andrew Bartlett [Wed, 29 May 2024 02:51:01 +0000 (14:51 +1200)] 
s4-auth: Use consistant externally-supplied time in auth stack

This makes the time during authentication stay consistent in the KDC
and follows the fake time when we are testing gMSA accounts.  By having
the account expiry follow exactly the same clock as the password expiry
we can hope for less supprises.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agokdc: Use a consistent, stable time throughout the Heimdal KDC
Andrew Bartlett [Tue, 28 May 2024 00:53:19 +0000 (12:53 +1200)] 
kdc: Use a consistent, stable time throughout the Heimdal KDC

The MIT KDC has a fallback to a consistent time per fetch call, and
both implementations then follow the time in each 'struct
samba_kdc_entry'.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agokdc: Mark KDC sam.ldb as not to use ldb_wrap cache
Andrew Bartlett [Wed, 29 May 2024 23:43:04 +0000 (11:43 +1200)] 
kdc: Mark KDC sam.ldb as not to use ldb_wrap cache

This will ensure that the time which will be is passed in an opaque is
not used by other parts of Samba

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agoldb_wrap: Provide a way to avoid Samba using ldb_wrap()
Andrew Bartlett [Wed, 29 May 2024 23:23:01 +0000 (11:23 +1200)] 
ldb_wrap: Provide a way to avoid Samba using ldb_wrap()

ldb_wrap is a caching mechansim, and it should probably be removed
but for now provide a way to avoid it in specific cases where we
know it is harmful.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agokdc: Remove confusing duplicate open of sam.ldb to find RODC status
Andrew Bartlett [Wed, 29 May 2024 23:40:16 +0000 (11:40 +1200)] 
kdc: Remove confusing duplicate open of sam.ldb to find RODC status

Instead, make this query after we open the DB in common with the MIT code.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agodsdb: Prepare to handle smartcard password rollover
Andrew Bartlett [Mon, 20 May 2024 01:51:23 +0000 (13:51 +1200)] 
dsdb: Prepare to handle smartcard password rollover

We do this by allowing the password change control to indicate
that the password is to be randomised, bypassing the quality
checks (as true random passwords often fail these) and
re-randomising with the same code as is used for the KDC.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agodsdb: Use dsdb_gmsa_current_time() in construct_msds_user_account_control_computed
Andrew Bartlett [Fri, 17 May 2024 03:10:18 +0000 (15:10 +1200)] 
dsdb: Use dsdb_gmsa_current_time() in construct_msds_user_account_control_computed

This both allows the time to be overriden in some future unit tests
(which is incredibly helpful in testing) and gets a full NTTIME
rather than just a time_t based time, so we do not need to wait
an extra second for the NTTIME to change.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agodsdb: UF_SMARTCARD_REQUIRED can have a password expiry, if configured!
Andrew Bartlett [Tue, 2 Apr 2024 22:54:00 +0000 (11:54 +1300)] 
dsdb: UF_SMARTCARD_REQUIRED can have a password expiry, if configured!

While the passwords are random and rolled on the server, we can tell
about the expiry by setting pwdLastSet to 0.

Samba now honours the password expiry.

This is only enabled for domain functional level 2016 and when
msDS-ExpirePasswordsOnSmartCardOnlyAccounts is set to TRUE.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agodsdb: Reduce minimum maxPwdAge from 1 day to nil
Andrew Bartlett [Fri, 17 May 2024 02:19:31 +0000 (14:19 +1200)] 
dsdb: Reduce minimum maxPwdAge from 1 day to nil

This allows us to have tests, which pass on Windows, that
use a very short maxPwdAge.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agodsdb: Change the magic smartcard_reset to set AES keys like the krbtgt mode
Andrew Bartlett [Mon, 20 May 2024 05:13:53 +0000 (17:13 +1200)] 
dsdb: Change the magic smartcard_reset to set AES keys like the krbtgt mode

This is because the smartcard reset now generates all the keys
on Windows, so we want to match Windows 2022 as at April 2024
behaviour.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/samba/tests/krb5: PKINIT tests of passwords that are naturally expired
Andrew Bartlett [Fri, 10 May 2024 04:51:27 +0000 (16:51 +1200)] 
python/samba/tests/krb5: PKINIT tests of passwords that are naturally expired

The tests of passwords that will expire in the TGT lifetime fail against
windows, we do not see the rotation in that case.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/test/krb5: Use assertAlmostEqual in check_ticket_times()
Andrew Bartlett [Fri, 17 May 2024 00:17:40 +0000 (12:17 +1200)] 
python/test/krb5: Use assertAlmostEqual in check_ticket_times()

This allows Windows behaviour with clock skew to be allowed for.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/tests/krb5: Move check_ticket_times() to kdc_base_test.py
Andrew Bartlett [Fri, 17 May 2024 00:25:17 +0000 (12:25 +1200)] 
python/tests/krb5: Move check_ticket_times() to kdc_base_test.py

This will allow other parts of the testsuite to use this helpful function.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/samba/krb5: Add test for password rotation on UF_SMARCARD_REQUIRED accounts
Andrew Bartlett [Tue, 2 Apr 2024 21:53:11 +0000 (10:53 +1300)] 
python/samba/krb5: Add test for password rotation on UF_SMARCARD_REQUIRED accounts

This demonstrates behaviour against a server presumed to be in FL 2016
what the impact of the msDS-ExpirePasswordsOnSmartCardOnlyAccounts
attribute is.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/tests/krb5: Remove unused utf16pw variable
Andrew Bartlett [Tue, 2 Apr 2024 19:26:04 +0000 (08:26 +1300)] 
python/tests/krb5: Remove unused utf16pw variable

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/tests/krb5: Expect AES keys for UF_SMARTCARD_REQUIRED
Andrew Bartlett [Thu, 2 May 2024 04:02:58 +0000 (16:02 +1200)] 
python/tests/krb5: Expect AES keys for UF_SMARTCARD_REQUIRED

Windows 2022 at April 2024 has change and now includes the
AES keys for accounts with UF_SMARTCARD_REQUIRED, so revert
part of the change in b2fe1ea1c6aba116b31a1c803b4e0d36ac1a32ee.

(This is an improvement to Windows security).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/samba/tests/krb5: Extend PKINIT tests to show kpasswd still works
Andrew Bartlett [Mon, 27 May 2024 06:53:42 +0000 (18:53 +1200)] 
python/samba/tests/krb5: Extend PKINIT tests to show kpasswd still works

We have had confirmed from MS that this behaviour is both deliberate
and required.  Possession of the credential is (by the returned PAC
containing the NT hash) possession of the password, and it must be
possible to change the password to a known value otherwise DPAPI
(local keychain) secured by this value can fail on the client.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agopython/samba/tests/krb5: Move get_kpasswd_sname() into raw_testcase() to allow broade...
Andrew Bartlett [Mon, 27 May 2024 06:46:49 +0000 (18:46 +1200)] 
python/samba/tests/krb5: Move get_kpasswd_sname() into raw_testcase() to allow broader use

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agos4-auth: Use msDS-User-Account-Control-Computed for PW expiry check
Andrew Bartlett [Mon, 20 May 2024 02:07:46 +0000 (14:07 +1200)] 
s4-auth: Use msDS-User-Account-Control-Computed for PW expiry check

This centralises the check rather than checking the time in
multiple spots.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agos4-auth: Update comment to mention 60mins in the NTLM grace period
Andrew Bartlett [Tue, 2 Apr 2024 22:52:28 +0000 (11:52 +1300)] 
s4-auth: Update comment to mention 60mins in the NTLM grace period

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agodsdb: Make argument order of dsdb_update_gmsa_{entry_,}keys() consistant with other...
Andrew Bartlett [Tue, 23 Apr 2024 04:17:04 +0000 (16:17 +1200)] 
dsdb: Make argument order of dsdb_update_gmsa_{entry_,}keys() consistant with other uses

Other functions in this file are TALLOC_CTX, struct ldb_context *, not
the other way around.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agosmbd: Ensure we grant owner sid in check_parent_access_fsp()
MikeLiu [Fri, 31 May 2024 07:31:46 +0000 (15:31 +0800)] 
smbd: Ensure we grant owner sid in check_parent_access_fsp()

Grant owner sid to check for owner rights.

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

Signed-off-by: MikeLiu <mikeliu@qnap.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun  7 18:30:34 UTC 2024 on atb-devel-224

14 months agos3:utils: Use talloc instead of malloc functions
Andreas Schneider [Thu, 6 Jun 2024 15:37:32 +0000 (17:37 +0200)] 
s3:utils: Use talloc instead of malloc functions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  6 21:32:53 UTC 2024 on atb-devel-224

14 months agos3:util: Use a talloc stackframe in rpc_trustdom_establish()
Andreas Schneider [Tue, 30 Apr 2024 07:55:15 +0000 (09:55 +0200)] 
s3:util: Use a talloc stackframe in rpc_trustdom_establish()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:utils: Use a destructor in rpc_trustdom_establish()
Andreas Schneider [Thu, 6 Jun 2024 15:31:10 +0000 (17:31 +0200)] 
s3:utils: Use a destructor in rpc_trustdom_establish()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:utils: Remove overwrite of opt_workgroup in rpc_trustdom_establish()
Andreas Schneider [Tue, 30 Apr 2024 07:46:33 +0000 (09:46 +0200)] 
s3:utils: Remove overwrite of opt_workgroup in  rpc_trustdom_establish()

This is not used anywhere in that functions or the functions we are
calling. It was replaced by command line cli credentials stored in
c->creds. This fixes a memory leak.

Direct leak of 12 byte(s) in 1 object(s) allocated from:
    #0 0x7f17fdaf5830 in strdup ../../../../libsanitizer/asan/asan_interceptors.cpp:578
    #1 0x7f17fc7e7339 in smb_xstrdup ../../lib/util/util.c:752
    #2 0x55f079bf0723 in rpc_trustdom_establish ../../source3/utils/net_rpc.c:6591
    #3 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464
    #4 0x55f079bdbecf in rpc_trustdom ../../source3/utils/net_rpc.c:7483
    #5 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464
    #6 0x55f079bfe7de in net_rpc ../../source3/utils/net_rpc.c:8413
    #7 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464
    #8 0x55f079baa0a8 in main ../../source3/utils/net.c:1436
    #9 0x7f17f8a2a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython: Add test for checking the SHA256SUM
Andreas Schneider [Thu, 6 Jun 2024 08:12:08 +0000 (10:12 +0200)] 
python: Add test for checking the SHA256SUM

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:netcmd: Create a SHA256SUM file with checksums
Andreas Schneider [Wed, 15 Feb 2023 07:10:03 +0000 (08:10 +0100)] 
python:netcmd: Create a SHA256SUM file with checksums

This allows to verify the backup tarball contents with:

  sha256sum -c SHA256SUM

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:netcmd: Only put regular files into the tarball
Andreas Schneider [Wed, 15 Feb 2023 07:05:42 +0000 (08:05 +0100)] 
python:netcmd: Only put regular files into the tarball

We also have ldapi, other sockets or pipes around, we don't want to
add. This will be relevant for adding checksums later.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:utils: DNS_UTIL depends on libads headers so we need to depend on 'ads'
Stefan Metzmacher [Thu, 6 Jun 2024 08:39:33 +0000 (10:39 +0200)] 
s3:utils: DNS_UTIL depends on libads headers so we need to depend on 'ads'

Otherwise we don't get the correct header include paths and krb5.h in
a non default location won't be found.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:libsmb: we no longer need libads/kerberos_proto.h in namequery.c
Stefan Metzmacher [Thu, 6 Jun 2024 08:38:48 +0000 (10:38 +0200)] 
s3:libsmb: we no longer need libads/kerberos_proto.h in namequery.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: no-op dns updates with ACCESS_DENIED should be ignored
Stefan Metzmacher [Thu, 30 May 2024 12:52:22 +0000 (14:52 +0200)] 
s4:dns_server: no-op dns updates with ACCESS_DENIED should be ignored

If the client does not have permissions to update the record,
but the record already has the data the update tries to apply,
it's a no-op that should result in success instead of failing.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  6 03:18:16 UTC 2024 on atb-devel-224

14 months agos4:dns_server: correctly sign dns update responses with gss-tsig like Windows
Stefan Metzmacher [Thu, 30 May 2024 12:39:28 +0000 (14:39 +0200)] 
s4:dns_server: correctly sign dns update responses with gss-tsig like Windows

This means we no longer generate strange errors/warnings
in the Windows event log nor in the nsupdate -g output.

Note: this is a only difference between gss-tsig and
the legacy gss.microsoft.com algorithms.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: dns_verify_tsig should return REFUSED on error
Stefan Metzmacher [Thu, 30 May 2024 12:42:53 +0000 (14:42 +0200)] 
s4:dns_server: dns_verify_tsig should return REFUSED on error

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: also search DNS_QTYPE_TKEY in the answers section if it's the last...
Stefan Metzmacher [Thu, 30 May 2024 12:41:21 +0000 (14:41 +0200)] 
s4:dns_server: also search DNS_QTYPE_TKEY in the answers section if it's the last section

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: use tkey->algorithm if available in dns_sign_tsig()
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: use tkey->algorithm if available in dns_sign_tsig()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: use the client provided algorithm for the fake TSIG structure
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: use the client provided algorithm for the fake TSIG structure

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: only allow gss-tsig and gss.microsoft.com for TSIG
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: only allow gss-tsig and gss.microsoft.com for TSIG

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: only allow gss-tsig and gss.microsoft.com for TKEY
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: only allow gss-tsig and gss.microsoft.com for TKEY

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: failed dns updates should result in REFUSED for ACCESS_DENIED
Stefan Metzmacher [Fri, 31 May 2024 06:36:40 +0000 (08:36 +0200)] 
s4:dns_server: failed dns updates should result in REFUSED for ACCESS_DENIED

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: add test_update_tsig_record_access_denied()
Stefan Metzmacher [Wed, 29 May 2024 09:40:51 +0000 (11:40 +0200)] 
python:tests/dns_tkey: add test_update_tsig_record_access_denied()

This demonstrates that access_denied is only generated if the client
really generates a change in the database.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:selftest/tests: pass USERNAME_UNPRIV=$DOMAIN_USER to samba.tests.dns_tkey
Stefan Metzmacher [Wed, 29 May 2024 09:39:56 +0000 (11:39 +0200)] 
s4:selftest/tests: pass USERNAME_UNPRIV=$DOMAIN_USER to samba.tests.dns_tkey

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: add get_unpriv_creds() helper
Stefan Metzmacher [Wed, 29 May 2024 09:39:56 +0000 (11:39 +0200)] 
python:tests/dns_base: add get_unpriv_creds() helper

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: let test_update_tsig_windows() actually pass against windows...
Stefan Metzmacher [Wed, 29 May 2024 11:17:54 +0000 (13:17 +0200)] 
python:tests/dns_tkey: let test_update_tsig_windows() actually pass against windows 2022

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let verify_packet() work against Windows
Stefan Metzmacher [Wed, 29 May 2024 11:17:54 +0000 (13:17 +0200)] 
python:tests/dns_base: let verify_packet() work against Windows

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: test bad and changing tsig algorithms
Stefan Metzmacher [Wed, 29 May 2024 15:26:39 +0000 (17:26 +0200)] 
python:tests/dns_tkey: test bad and changing tsig algorithms

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: add gss.microsoft.com tsig updates
Stefan Metzmacher [Wed, 29 May 2024 15:18:34 +0000 (17:18 +0200)] 
python:tests/dns_tkey: add gss.microsoft.com tsig updates

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: let us have test_update_gss_tsig_tkey_req_{additional,answers}()
Stefan Metzmacher [Wed, 29 May 2024 12:15:45 +0000 (14:15 +0200)] 
python:tests/dns_tkey: let us have test_update_gss_tsig_tkey_req_{additional,answers}()

Also test using the additional record in the answers section.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: test TKEY with gss-tsig, gss.microsoft.com and invalid algorithms
Stefan Metzmacher [Wed, 29 May 2024 14:41:12 +0000 (16:41 +0200)] 
python:tests/dns_tkey: test TKEY with gss-tsig, gss.microsoft.com and invalid algorithms

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: maintain a dict with tkey related state
Stefan Metzmacher [Wed, 29 May 2024 12:10:52 +0000 (14:10 +0200)] 
python:tests/dns_base: maintain a dict with tkey related state

This will allow tests to backup the whole state
and mix them.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let dns_transaction_udp() take allow_{remaining,truncated...
Stefan Metzmacher [Wed, 29 May 2024 12:14:11 +0000 (14:14 +0200)] 
python:tests/dns_base: let dns_transaction_udp() take allow_{remaining,truncated}=True

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: pass tkey_trans(expected_rcode)
Stefan Metzmacher [Wed, 29 May 2024 14:07:53 +0000 (16:07 +0200)] 
python:tests/dns_base: pass tkey_trans(expected_rcode)

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let tkey_trans() take tkey_req_in_answers
Stefan Metzmacher [Wed, 29 May 2024 12:08:13 +0000 (14:08 +0200)] 
python:tests/dns_base: let tkey_trans() take tkey_req_in_answers

It's possible to put the additional into the answers section,
so we should be able to test that.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let tkey_trans() and sign_packet() take algorithm_name as...
Stefan Metzmacher [Wed, 29 May 2024 11:17:54 +0000 (13:17 +0200)] 
python:tests/dns_base: let tkey_trans() and sign_packet() take algorithm_name as argument

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: make use of self.assert_echoed_dns_error()
Stefan Metzmacher [Wed, 29 May 2024 11:35:58 +0000 (13:35 +0200)] 
python:tests/dns_tkey: make use of self.assert_echoed_dns_error()

Failed DNS updates just echo the request flaged as response,
all other elements are unchanged.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: add self.assert_echoed_dns_error()
Stefan Metzmacher [Wed, 29 May 2024 11:35:58 +0000 (13:35 +0200)] 
python:tests/dns_base: add self.assert_echoed_dns_error()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let dns_transaction_tcp() handle short receives
Stefan Metzmacher [Fri, 31 May 2024 06:07:24 +0000 (08:07 +0200)] 
python:tests/dns_base: let dns_transaction_tcp() handle short receives

With socket_wrapper we only get 1500 byte chunks...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: use ndr_deepcopy() and ndr_pack() in verify_packet()
Stefan Metzmacher [Wed, 29 May 2024 11:16:40 +0000 (13:16 +0200)] 
python:tests/dns_base: use ndr_deepcopy() and ndr_pack() in verify_packet()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: generate a real signature in bad_sign_packet()
Stefan Metzmacher [Wed, 29 May 2024 11:11:24 +0000 (13:11 +0200)] 
python:tests/dns_base: generate a real signature in bad_sign_packet()

We just destroy the signature bytes but keep the header unchanged.

This makes it easier to look at it in wireshark.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib/addns: remove unused kerberos/gssapi includes in dns.h
Stefan Metzmacher [Wed, 5 Jun 2024 15:46:53 +0000 (17:46 +0200)] 
lib/addns: remove unused kerberos/gssapi includes in dns.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agobuild: Make "samba4" public libraries provided (mostly) for OpenChange private
Andrew Bartlett [Sun, 26 May 2024 21:24:13 +0000 (09:24 +1200)] 
build: Make "samba4" public libraries provided (mostly) for OpenChange private

These libraries, mostly with ABI versions of 0.0.1 were made public in
the early development of Samba4 and have not been seriously considered
since.  Most are to allow OpenChange to build.

While the OpenChange server is no longer actively used, the MAPI
client is used and we need to allow packages to be built that will
allow the Evolution MAPI client to still work.

Some appear to be mistakes (dcerpc-samr), historical abberations
(tevent-util) or ideas that did not go very far (the samba-policy
library for example).

To allow any remaining users to access them, they are not made private
in the build system but are instead listed so that they can be made
public again via ./configure with the same --private-libraries='!LIB'
syntax introduced to make ldb private by default.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun  5 21:47:24 UTC 2024 on atb-devel-224

14 months agobuild: Remove incorrect pyembed=True from samba-policy
Andrew Bartlett [Sun, 26 May 2024 19:28:33 +0000 (07:28 +1200)] 
build: Remove incorrect pyembed=True from samba-policy

This is a normal C library, used by python but does not use
any python itself (nor by dependencies any longer).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
14 months agos4-libnet: Split up samba-net into samba-net and samba-net-join
Andrew Bartlett [Mon, 27 May 2024 07:44:38 +0000 (19:44 +1200)] 
s4-libnet: Split up samba-net into samba-net and samba-net-join

samba-net-join links to python and so needs the variable name
with the python ABI tag, while samba-net is a normal C library
and can be included in a package without python dependencies.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
14 months agotests/krb5: Calculate correct gMSA password to fix flapping test
Jo Sutton [Tue, 28 May 2024 04:59:30 +0000 (16:59 +1200)] 
tests/krb5: Calculate correct gMSA password to fix flapping test

If this test happens to be run in the five minute window prior to the
next ten‐hour GKDI interval — about once every one hundred and twenty
runs — the ‘current’ password requested from LDAP will actually be the
future password, which won’t match what’s in the database.

Instead of taking the password from LDAP, calculate it ourselves with
expected_gmsa_password_blob().

[330(7038)/334 at 43m51s] samba.tests.krb5.gmsa_tests(ad_dc:local)
UNEXPECTED(failure): samba.tests.krb5.gmsa_tests.samba.tests.krb5.gmsa_tests.GmsaTests.test_retrieving_managed_password_triggers_keys_update(ad_dc:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "/builds/samba-testbase/samba-def-build/bin/python/samba/tests/krb5/gmsa_tests.py", line 1091, in test_retrieving_managed_password_triggers_keys_update
    self.assertEqual(creds.get_nt_hash(), nt_hash)
AssertionError: b'\xcf[\xe8:\xc7-\xd4V\xce\t\xfc\xcd\x06.T\x8a' != b'c\xc5\x97k\x17"G\x1e\x81>\xacV\x9d.*\x14'

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jun  4 20:52:09 UTC 2024 on atb-devel-224

14 months agotests/krb5: Reset local database time in a cleaner (and nearly equivalent) fashion
Jo Sutton [Tue, 28 May 2024 04:53:22 +0000 (16:53 +1200)] 
tests/krb5: Reset local database time in a cleaner (and nearly equivalent) fashion

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dsdb: Use talloc_get_type_abort()
Jo Sutton [Tue, 28 May 2024 02:24:51 +0000 (14:24 +1200)] 
s4:dsdb: Use talloc_get_type_abort()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotests/krb5: Make use of update_password() method
Jo Sutton [Mon, 27 May 2024 05:53:17 +0000 (17:53 +1200)] 
tests/krb5: Make use of update_password() method

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoldb: Fix typo
Jo Sutton [Fri, 12 Apr 2024 03:10:33 +0000 (15:10 +1200)] 
ldb: Fix typo

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:winbind: Fix idmap_ad creating an invalid local krb5.conf
Andreas Schneider [Tue, 28 May 2024 11:54:24 +0000 (13:54 +0200)] 
s3:winbind: Fix idmap_ad creating an invalid local krb5.conf

In case of a trusted domain, we are providing the realm of the primary
trust but specify the KDC IP of the trusted domain. This leads to
Kerberos ticket requests to the trusted domain KDC which doesn't know
about the machine account. However we need a ticket from our primary
trust KDC.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:libads: Do not fail if we don't get an IP passed down
Andreas Schneider [Tue, 28 May 2024 11:53:51 +0000 (13:53 +0200)] 
s3:libads: Do not fail if we don't get an IP passed down

The IP should be optional and we should look it up if not provided.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:libads: Allow get_kdc_ip_string() to lookup the KDCs IP
Andreas Schneider [Tue, 28 May 2024 11:51:53 +0000 (13:51 +0200)] 
s3:libads: Allow get_kdc_ip_string() to lookup the KDCs IP

Remove the requirement to provide an IP address. We should look up the
IP of the KDC and use it for the specified realm/workgroup.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agosmbd: list reparse tag in QUERY_DIRECTORY
Volker Lendecke [Mon, 2 Jan 2023 15:35:16 +0000 (16:35 +0100)] 
smbd: list reparse tag in QUERY_DIRECTORY

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun  4 17:39:21 UTC 2024 on atb-devel-224

14 months agotests: Check that query_directory lists the reparse tag
Volker Lendecke [Mon, 2 Jan 2023 15:01:28 +0000 (16:01 +0100)] 
tests: Check that query_directory lists the reparse tag

With the source3/ based clilist.c, we can't test all infolevels where
this matters (see callers of get_dirent_ea_size()). But porting the
source4 based all-infolevel search code into source3/libsmb or doing
this one the reparse point test in the source4 infrastructure to me
seems like a lot of effort for moderate gain.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
14 months agos3:rpc_server: Check query level according to MS-NRPC
Jo Sutton [Tue, 28 May 2024 03:12:36 +0000 (15:12 +1200)] 
s3:rpc_server: Check query level according to MS-NRPC

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Jun  4 09:39:42 UTC 2024 on atb-devel-224

14 months agos3:rpc_server: Check function code according to MS-NRPC
Jo Sutton [Tue, 28 May 2024 03:10:51 +0000 (15:10 +1200)] 
s3:rpc_server: Check function code according to MS-NRPC

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
14 months agos3/rpc_server: Fix dereference of client pointer
Noel Power [Mon, 25 Sep 2023 08:58:33 +0000 (09:58 +0100)] 
s3/rpc_server: Fix dereference of client pointer

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agos4/torture: Test with level 4 with NETLOGON_CONTROL_SET_DBFLAG function
Noel Power [Sun, 24 Sep 2023 00:03:37 +0000 (01:03 +0100)] 
s4/torture: Test with level 4 with NETLOGON_CONTROL_SET_DBFLAG function

Change levels tested from 1 - 3 to 1 - 4 for NETLOGON_CONTROL_SET_DBFLAG

This change triggers a core dump in the server and so we add a knownfail
here. Following commit will fix (and remove known fail)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agos4/torture: Prepare to handle Level 4 check with unknown func code
Noel Power [Mon, 25 Sep 2023 09:30:30 +0000 (10:30 +0100)] 
s4/torture: Prepare to handle Level 4 check with unknown func code

A future (next) commit will change the NETLOGON_CONTROL_SET_DBFLAG test
to use levels 1 - 4 (current test just tests 1 - 3). A side affect of
this test is that the following test will now test passing an unknown
function code against against Level 4 (previously level 3).

Unfortunately s4 and s3 netlogon server results differ when handling
a level 4 request with an unknown function code.
  s3 server returns WERR_NOT_SUPPORTED and
  s4 server returns WERR_INVALID_PARAMETER.

For level 3 both return WERR_NOT_SUPPORTED.

MS-NRPC doesn't seem to specifically indicate the required response in
this case.

this commit modifies the test to cater for either response (for either
level) A future commit could explore the test response combinations more
thorougly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agolib: Align an integer type
Volker Lendecke [Thu, 23 May 2024 14:13:58 +0000 (16:13 +0200)] 
lib: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jun  4 08:16:58 UTC 2024 on atb-devel-224

14 months agolib: Fix an error path memleak
Volker Lendecke [Thu, 23 May 2024 14:12:53 +0000 (16:12 +0200)] 
lib: Fix an error path memleak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib: Use talloc_asprintf_addbufin _ber_read_OID_String_impl
Volker Lendecke [Thu, 23 May 2024 14:06:37 +0000 (16:06 +0200)] 
lib: Use talloc_asprintf_addbufin _ber_read_OID_String_impl

Just one NULL check required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>