]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agoCVE-2020-25721 krb5pac: Add new buffers for samAccountName and objectSID
Andrew Bartlett [Sun, 26 Sep 2021 22:20:19 +0000 (11:20 +1300)] 
CVE-2020-25721 krb5pac: Add new buffers for samAccountName and objectSID

These appear when PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID is set.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest/user_account_control: more work to cope with UAC/objectclass...
Andrew Bartlett [Fri, 22 Oct 2021 10:41:23 +0000 (23:41 +1300)] 
CVE-2020-25722 selftest/user_account_control: more work to cope with UAC/objectclass defaults and lock

This new restriction breaks a large number of assumptions in the tests, like
that you can remove some UF_ flags, because it turns out doing so will
make the 'computer' a 'user' again, and this will fail.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest/user_account_control: Allow a broader set of possible errors
Andrew Bartlett [Fri, 22 Oct 2021 09:54:52 +0000 (22:54 +1300)] 
CVE-2020-25722 selftest/user_account_control: Allow a broader set of possible errors

This favors a test that confirms we got an error over getting exactly
the right error, at least for now.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Allow self.assertRaisesLdbError() to take a list of errors...
Andrew Bartlett [Fri, 22 Oct 2021 09:40:06 +0000 (22:40 +1300)] 
CVE-2020-25722 selftest: Allow self.assertRaisesLdbError() to take a list of errors to match with

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: adapt ldap.py/sam.py test_all tests to new default computer...
Andrew Bartlett [Thu, 21 Oct 2021 02:42:46 +0000 (15:42 +1300)] 
CVE-2020-25722 selftest: adapt ldap.py/sam.py test_all tests to new default computer behaviour

Objects of objectclass computer are computers by default now and this changes
the sAMAccountType and primaryGroupID as well as userAccountControl

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Adapt sam.py test to userAccountControl/objectclass restrictions
Andrew Bartlett [Thu, 21 Oct 2021 02:19:19 +0000 (15:19 +1300)] 
CVE-2020-25722 selftest: Adapt sam.py test to userAccountControl/objectclass restrictions

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: New objects of objectclass=computer are workstations by...
Andrew Bartlett [Thu, 21 Oct 2021 02:14:28 +0000 (15:14 +1300)] 
CVE-2020-25722 selftest: New objects of objectclass=computer are workstations by default now

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Adjust sam.py test_userAccountControl_computer_add_trust...
Andrew Bartlett [Thu, 21 Oct 2021 02:06:14 +0000 (15:06 +1300)] 
CVE-2020-25722 selftest: Adjust sam.py test_userAccountControl_computer_add_trust to new reality

We now enforce that a trust account must be a user.

These can not be added over LDAP anyway, and our C
code in the RPC server gets this right in any case.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Split test_userAccountControl into unit tests
Andrew Bartlett [Thu, 21 Oct 2021 01:03:05 +0000 (14:03 +1300)] 
CVE-2020-25722 selftest: Split test_userAccountControl into unit tests

The parts that create and delete a single object can be
safely split out into an individual test.

At this point the parts that fail against Windows 2019 are:

error: __main__.SamTests.test_userAccountControl_computer_add_normal [
_ldb.LdbError: (53, 'LDAP error 53 LDAP_UNWILLING_TO_PERFORM -  <0000052D: SvcErr: DSID-031A1236, problem 5003 (WILL_NOT_PERFORM), data 0\n> <>')
error: __main__.SamTests.test_userAccountControl_computer_modify [
_ldb.LdbError: (53, 'LDAP error 53 LDAP_UNWILLING_TO_PERFORM -  <0000052D: SvcErr: DSID-031A1236, problem 5003 (WILL_NOT_PERFORM), data 0\n> <>')
error: __main__.SamTests.test_userAccountControl_user_add_0_uac [
_ldb.LdbError: (53, 'LDAP error 53 LDAP_UNWILLING_TO_PERFORM -  <0000052D: SvcErr: DSID-031A1236, problem 5003 (WILL_NOT_PERFORM), data 0\n> <>')
error: __main__.SamTests.test_userAccountControl_user_add_normal [
_ldb.LdbError: (53, 'LDAP error 53 LDAP_UNWILLING_TO_PERFORM -  <0000052D: SvcErr: DSID-031A1236, problem 5003 (WILL_NOT_PERFORM), data 0\n> <>')
error: __main__.SamTests.test_userAccountControl_user_modify [
_ldb.LdbError: (53, 'LDAP error 53 LDAP_UNWILLING_TO_PERFORM -  <0000052D: SvcErr: DSID-031A1236, problem 5003 (WILL_NOT_PERFORM), data 0\n> <>')

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 samdb: Fill in isCriticalSystemObject on any account type change
Andrew Bartlett [Thu, 21 Oct 2021 00:02:42 +0000 (13:02 +1300)] 
CVE-2020-25722 samdb: Fill in isCriticalSystemObject on any account type change

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Adapt sam.py test_isCriticalSystemObject to new UF_WORKSTATI...
Andrew Bartlett [Wed, 20 Oct 2021 22:57:22 +0000 (11:57 +1300)] 
CVE-2020-25722 selftest: Adapt sam.py test_isCriticalSystemObject to new UF_WORKSTATION_TRUST_ACCOUNT default

Objects with objectclass computer now have UF_WORKSTATION_TRUST_ACCOUNT
by default and so this test must adapt.

The changes to this test passes against Windows 2019 except for
the new behaviour around the UF_WORKSTATION_TRUST_ACCOUNT default.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: Add restrictions on computer accounts without a trailing $
Andrew Bartlett [Tue, 21 Sep 2021 23:29:02 +0000 (11:29 +1200)] 
CVE-2020-25722 dsdb: Add restrictions on computer accounts without a trailing $

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: samldb_objectclass_trigger() is only called on ADD, so remove...
Andrew Bartlett [Tue, 21 Sep 2021 23:28:05 +0000 (11:28 +1200)] 
CVE-2020-25722 dsdb: samldb_objectclass_trigger() is only called on ADD, so remove indentation

This makes the code less indented and simpler to understand.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Adapt selftest to restriction on swapping account types
Andrew Bartlett [Fri, 22 Oct 2021 03:18:51 +0000 (16:18 +1300)] 
CVE-2020-25722 selftest: Adapt selftest to restriction on swapping account types

This makes many of our tests pass again.  We do not pass against Windows 2019 on all
as this does not have this restriction at this time.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest/priv_attrs: Mention that these knownfails are OK (for now)
Andrew Bartlett [Thu, 28 Oct 2021 01:47:30 +0000 (14:47 +1300)] 
CVE-2020-25722 selftest/priv_attrs: Mention that these knownfails are OK (for now)

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: Prohibit mismatch between UF_ account types and objectclass.
Andrew Bartlett [Fri, 22 Oct 2021 03:07:46 +0000 (16:07 +1300)] 
CVE-2020-25722 dsdb: Prohibit mismatch between UF_ account types and objectclass.

There are a lot of knownfail entries added with this commit.  These
all need to be addressed and removed in subsequent commits which
will restructure the tests to pass within this new reality.

The restriction is not applied to users with administrator rights,
as this breaks a lot of tests and provides no security benefit.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: Add tests for modifying objectClass, userAccountControl and...
Joseph Sutton [Fri, 29 Oct 2021 10:33:32 +0000 (23:33 +1300)] 
CVE-2020-25722 dsdb: Add tests for modifying objectClass, userAccountControl and sAMAccountName

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-25722 dsdb: Improve privileged and unprivileged tests for objectclass/doller/UAC
Andrew Bartlett [Fri, 22 Oct 2021 02:42:08 +0000 (15:42 +1300)] 
CVE-2020-25722 dsdb: Improve privileged and unprivileged tests for objectclass/doller/UAC

This helps ensure we cover off all the cases that matter
for objectclass/trailing-doller/userAccountControl

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: objectclass computer becomes UF_WORKSTATION_TRUST by default
Andrew Bartlett [Wed, 15 Sep 2021 20:46:42 +0000 (08:46 +1200)] 
CVE-2020-25722 dsdb: objectclass computer becomes UF_WORKSTATION_TRUST by default

There are a lot of knownfail entries added with this commit.  These
all need to be addressed and removed in subsequent commits which
will restructure the tests to pass within this new reality.

This default applies even to users with administrator rights,
as changing the default based on permissions would break
to many assumptions.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Catch errors from samdb.modify() in user_account_control...
Andrew Bartlett [Fri, 17 Sep 2021 01:41:40 +0000 (13:41 +1200)] 
CVE-2020-25722 selftest: Catch errors from samdb.modify() in user_account_control tests

This will allow these to be listed in a knownfail shortly.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Catch possible errors in PasswordSettingsTestCase.test_pso_n...
Andrew Bartlett [Mon, 20 Sep 2021 02:54:03 +0000 (14:54 +1200)] 
CVE-2020-25722 selftest: Catch possible errors in PasswordSettingsTestCase.test_pso_none_applied()

This allows future patches to restrict changing the account type
without triggering an error.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: allow for future failures in BindTests.test_virtual_email_ac...
Andrew Bartlett [Mon, 20 Sep 2021 00:35:51 +0000 (12:35 +1200)] 
CVE-2020-25722 selftest: allow for future failures in BindTests.test_virtual_email_account_style_bind

This allows for any failures here to be handled via the knownfail system.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Test combinations of account type and objectclass for creati...
Andrew Bartlett [Sun, 12 Sep 2021 22:21:03 +0000 (10:21 +1200)] 
CVE-2020-25722 selftest: Test combinations of account type and objectclass for creating a user

The idea here is to split out the restrictions seen on Windows 2019
at the schema level, as seen when acting as an administrator.

These pass against Windows 2019 except for the account type swapping
which is not wanted.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 selftest: Extend priv_attrs test - work around UF_NORMAL_ACCOUNT rules...
Andrew Bartlett [Mon, 13 Sep 2021 08:34:54 +0000 (20:34 +1200)] 
CVE-2020-25722 selftest: Extend priv_attrs test - work around UF_NORMAL_ACCOUNT rules on Windows 2019 (requires |UF_PASSWD_NOTREQD or a password) - extend to also cover the sensitive UF_TRUSTED_FOR_DELEGATION

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14703
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14778
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14775

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: Restrict the setting of privileged attributes during LDAP add...
Andrew Bartlett [Fri, 13 Aug 2021 05:42:23 +0000 (17:42 +1200)] 
CVE-2020-25722 dsdb: Restrict the setting of privileged attributes during LDAP add/modify

The remaining failures in the priv_attrs (not the strict one) test are
due to missing objectclass constraints on the administrator which should
be addressed, but are not a security issue.

A better test for confirming constraints between objectclass and
userAccountControl UF_NORMAL_ACCONT/UF_WORKSTATION_TRUST values would
be user_account_control.py.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14703
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14778
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14775

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: Move krbtgt password setup after the point of checking if any...
Andrew Bartlett [Wed, 11 Aug 2021 23:10:09 +0000 (11:10 +1200)] 
CVE-2020-25722 dsdb: Move krbtgt password setup after the point of checking if any passwords are changed

This allows the add of an RODC, before setting the password, to avoid
this module, which helps isolate testing of security around the
msDS-SecondaryKrbTgtNumber attribute.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-25722 dsdb: Tests for our known set of privileged attributes
Andrew Bartlett [Tue, 10 Aug 2021 10:31:02 +0000 (22:31 +1200)] 
CVE-2020-25722 dsdb: Tests for our known set of privileged attributes

This, except for where we choose to disagree, does pass
against Windows 2019.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14703
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14778
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14775

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agosmbd: check lp_load_printers before reload via NetShareEnum
David Disseldorp [Mon, 8 Nov 2021 11:11:17 +0000 (12:11 +0100)] 
smbd: check lp_load_printers before reload via NetShareEnum

api_RNetShareEnum() unconditionally attempts to reload printers via
delete_and_reload_printers(). Add a lp_load_printers() check to
obey smb.conf "load printers = off" settings.

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

Reported-by: Nate Stuyvesant <nstuyvesant@gmail.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Nov  8 13:27:40 UTC 2021 on sn-devel-184

3 years agogitlab-ci: Add Fedora 35 and drop Fedora 33
Andreas Schneider [Thu, 4 Nov 2021 08:31:08 +0000 (09:31 +0100)] 
gitlab-ci: Add Fedora 35 and drop Fedora 33

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov  5 12:36:55 UTC 2021 on sn-devel-184

3 years agowaf: Fix resolv_wrapper with glibc 2.34
Andreas Schneider [Thu, 7 Oct 2021 13:55:37 +0000 (15:55 +0200)] 
waf: Fix resolv_wrapper with glibc 2.34

With glibc 2.34 we are not able to talk to the DNS server via socket_wrapper
anymore. The res_* symbols have been moved from libresolv to libc. We are not
able to intercept any traffic inside of libc.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agos3-winexe: Fix winexe core dump (use-after-free)
Günther Deschner [Thu, 4 Nov 2021 21:22:44 +0000 (22:22 +0100)] 
s3-winexe: Fix winexe core dump (use-after-free)

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Nov  5 11:43:57 UTC 2021 on sn-devel-184

3 years agosamba-tool: Add domain member leave
David Mulder [Thu, 4 Nov 2021 14:42:06 +0000 (08:42 -0600)] 
samba-tool: Add domain member leave

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Rowland Penny <rpenny@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Thu Nov  4 20:43:32 UTC 2021 on sn-devel-184

3 years agolib/dbwrap: reset deleted record to tdb_null
Ralph Boehme [Fri, 29 Oct 2021 20:03:42 +0000 (22:03 +0200)] 
lib/dbwrap: reset deleted record to tdb_null

This allows the calling the following sequence of dbwrap functions:

  dbwrap_delete_record(rec);
  data = dbwrap_record_get_value(rec);

without triggering the assert rec->value_valid inside dbwrap_record_get_value().

Note that dbwrap_record_storev() continues to invalidate the record, so this
change somewhat blurs our semantics.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov  4 19:49:47 UTC 2021 on sn-devel-184

3 years agoCI: add a test for bug 14882
Ralph Boehme [Fri, 29 Oct 2021 04:27:38 +0000 (06:27 +0200)] 
CI: add a test for bug 14882

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/libsmb: check for global parametric option "libsmb:client_guid"
Stefan Metzmacher [Mon, 5 Oct 2020 06:52:32 +0000 (08:52 +0200)] 
s3/libsmb: check for global parametric option "libsmb:client_guid"

Useful in test.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don...
Jeremy Allison [Thu, 4 Nov 2021 02:02:36 +0000 (19:02 -0700)] 
s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don't overwrite the 'ret' variable.

If we overwrite with ret=0, we return NT_STATUS_OK even when we goto err.

This function should be restructured to use NT_STATUS internally,
and make 'int ret' transitory, but that's a patch for another
time.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Nov  4 09:10:27 UTC 2021 on sn-devel-184

3 years agos3: smbtorture3: Add test for setting delete on close on a directory, then creating...
Jeremy Allison [Wed, 3 Nov 2021 23:50:10 +0000 (16:50 -0700)] 
s3: smbtorture3: Add test for setting delete on close on a directory, then creating a file within to see if delete succeeds.

Exposes an existing problem where "ret" is overwritten
in the directory scan.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: early out in is_visible_fsp()
Ralph Boehme [Wed, 3 Nov 2021 13:40:01 +0000 (14:40 +0100)] 
smbd: early out in is_visible_fsp()

This is used in a hot codepath (directory enumeration) so we should avoiding the
string comparisions by adding an early exit.

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 Nov  3 17:33:00 UTC 2021 on sn-devel-184

3 years agovfs_fruit: remove a fsp check from ad_fset()
Ralph Boehme [Tue, 2 Nov 2021 04:34:59 +0000 (05:34 +0100)] 
vfs_fruit: remove a fsp check from ad_fset()

This comes from times before we had pathref fsps. Back then if you wanted to
check if fsp->fh->fd contained a valid value != -1, you'd also first check that
the passed in fsp and fsp->fh are non NULL. With pathref fsps we don't need this
anymore.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14890
RN: Crash in vfs_fruit asking for fsp_get_io_fd() for an XATTR call

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: smbd: dirfsp is being used uninitialized inside rmdir_internals().
Jeremy Allison [Tue, 2 Nov 2021 17:44:44 +0000 (10:44 -0700)] 
s3: smbd: dirfsp is being used uninitialized inside rmdir_internals().

Not caught be the tests in bugs 14878, 14879 as can_delete_directory_fsp()
doesn't have the same bug.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Nov  3 14:33:49 UTC 2021 on sn-devel-184

3 years agos3:librpc: Improve calling of krb5_kt_end_seq_get()
Pavel Filipenský [Thu, 21 Oct 2021 13:01:48 +0000 (15:01 +0200)] 
s3:librpc: Improve calling of krb5_kt_end_seq_get()

Remove indentation with early return, best reviewed with
git show -b

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov  3 08:36:00 UTC 2021 on sn-devel-184

3 years agogp: Apply Firewalld Policy
David Mulder [Thu, 14 Oct 2021 21:36:52 +0000 (15:36 -0600)] 
gp: Apply Firewalld Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov  1 21:16:43 UTC 2021 on sn-devel-184

3 years agogp: Test Firewalld Group Policy Apply
David Mulder [Tue, 12 Oct 2021 18:54:09 +0000 (12:54 -0600)] 
gp: Test Firewalld Group Policy Apply

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogp: Add Firewalld ADMX templates
David Mulder [Wed, 6 Oct 2021 18:46:26 +0000 (12:46 -0600)] 
gp: Add Firewalld ADMX templates

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodebug: Add new smb.conf option "debug syslog format"
Martin Schwenke [Sun, 31 Oct 2021 00:59:30 +0000 (11:59 +1100)] 
debug: Add new smb.conf option "debug syslog format"

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Nov  1 07:29:47 UTC 2021 on sn-devel-184

3 years agodebug: Add debug_syslog_format setting
Martin Schwenke [Thu, 28 Oct 2021 08:05:19 +0000 (19:05 +1100)] 
debug: Add debug_syslog_format setting

Without debug_hires_timestamp this produces a syslog style header
containing:

  "MON DD HH:MM:SS HOSTNAME PROGNAME[PID] "

With debug_hires_timestamp this produces a syslog style header
containing:

  "RFC5424-TIMESTAMP HOSTNAME PROGNAME[PID] "

All other settings are ignored.

This will be made visible via smb.conf in a subsequent commit.

This commit adds some simple hostname handling.  It avoids using
get_myname() from util.c because using that potentially pulls in all
manner of dependencies.  No real error handling is done.  In the worst
case debug_set_hostname() sets the hostname to a truncated version of
the given string.  Similarly, in an even weirder world,
ensure_hostname() sets the hostname to a truncation of "unknown".
Both of these are unlikely in all reasonable cases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3:modules:recycle - fix crash in recycle_unlink_internal
Andrew Walker [Thu, 28 Oct 2021 20:01:42 +0000 (16:01 -0400)] 
s3:modules:recycle - fix crash in recycle_unlink_internal

Original logic for separating path from base name assumed
that we were using same string to determine offset when
getting the parent dir name (smb_fname->base_name).

Simplify by using parent_dirname() to split the path
from base name.

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

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Oct 30 04:34:53 UTC 2021 on sn-devel-184

3 years agofix undefined-shift in put_res_rec fuzz error: ../../source3/libsmb/nmblib.c:451...
eaglegai [Thu, 28 Oct 2021 13:51:13 +0000 (21:51 +0800)] 
fix undefined-shift in put_res_rec fuzz error: ../../source3/libsmb/nmblib.c:451:4: runtime error: left shift of 65312 by 16 places cannot be represented in type 'int'

Author:    eaglegai <eaglegai@163.com>

Signed-off-by: eaglegai <eaglegai@163.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 29 20:29:26 UTC 2021 on sn-devel-184

3 years agos3: docs-xml: Clarify the "delete veto files" paramter.
Jeremy Allison [Mon, 25 Oct 2021 19:42:02 +0000 (12:42 -0700)] 
s3: docs-xml: Clarify the "delete veto files" paramter.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Oct 29 14:57:14 UTC 2021 on sn-devel-184

3 years agos3: smbd: Fix logic in can_delete_directory_fsp() to cope with dangling symlinks.
Jeremy Allison [Mon, 25 Oct 2021 19:36:57 +0000 (12:36 -0700)] 
s3: smbd: Fix logic in can_delete_directory_fsp() to cope with dangling symlinks.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Fix logic in rmdir_internals() to cope with dangling symlinks.
Jeremy Allison [Mon, 25 Oct 2021 19:32:29 +0000 (12:32 -0700)] 
s3: smbd: Fix logic in rmdir_internals() to cope with dangling symlinks.

Still need to add the same logic in can_delete_directory_fsp()
before we can delete the knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Fix rmdir_internals() to do an early return if lp_delete_veto_files() is...
Jeremy Allison [Mon, 25 Oct 2021 19:21:37 +0000 (12:21 -0700)] 
s3: smbd: Fix rmdir_internals() to do an early return if lp_delete_veto_files() is not set.

Fix the comments to match what the code actually does. The
exit at the end of the scan directory loop if we find a client
visible filename is a change in behavior, but the previous
behavior (not exist on visible filename, but delete it) was
a bug and in non-tested code. Now it's testd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: VFS: xattr_tdb. Allow unlinkat to cope with dangling symlinks.
Jeremy Allison [Mon, 25 Oct 2021 19:02:43 +0000 (12:02 -0700)] 
s3: VFS: xattr_tdb. Allow unlinkat to cope with dangling symlinks.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: VFS: streams_depot. Allow unlinkat to cope with dangling symlinks.
Jeremy Allison [Mon, 25 Oct 2021 19:01:58 +0000 (12:01 -0700)] 
s3: VFS: streams_depot. Allow unlinkat to cope with dangling symlinks.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add two tests showing the ability to delete a directory containing a dangli...
Jeremy Allison [Thu, 21 Oct 2021 23:37:27 +0000 (16:37 -0700)] 
s3: smbd: Add two tests showing the ability to delete a directory containing a dangling symlink over SMB2 depends on "delete veto files" setting.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Fix recursive directory delete of a directory containing veto file and...
Jeremy Allison [Thu, 21 Oct 2021 23:18:24 +0000 (16:18 -0700)] 
s3: smbd: Fix recursive directory delete of a directory containing veto file and msdfs links.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add two tests showing recursive directory delete of a directory containing...
Jeremy Allison [Thu, 21 Oct 2021 22:06:20 +0000 (15:06 -0700)] 
s3: smbd: Add two tests showing recursive directory delete of a directory containing veto file and msdfs links over SMB2.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoeditorconfig: Heimdal has mixed spaces and tabs with different width
Andreas Schneider [Tue, 26 Oct 2021 07:20:32 +0000 (09:20 +0200)] 
editorconfig: Heimdal has mixed spaces and tabs with different width

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 29 10:16:15 UTC 2021 on sn-devel-184

3 years agothird_party: Update pam_wrapper to version 1.1.4
Andreas Schneider [Thu, 28 Oct 2021 08:50:30 +0000 (10:50 +0200)] 
third_party: Update pam_wrapper to version 1.1.4

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 28 19:03:04 UTC 2021 on sn-devel-184

3 years agolib: handle NTTIME_THAW in nt_time_to_full_timespec()
Ralph Boehme [Tue, 5 Oct 2021 13:10:33 +0000 (15:10 +0200)] 
lib: handle NTTIME_THAW in nt_time_to_full_timespec()

Preliminary handling of NTTIME_THAW to avoid NTTIME_THAW is passed as some
mangled value down to the VFS set timestamps function.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14127
RN: Avoid storing NTTIME_THAW (-2) as value on disk

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture: add a test for NTTIME_FREEZE and NTTIME_THAW
Ralph Boehme [Thu, 28 Oct 2021 10:55:39 +0000 (12:55 +0200)] 
torture: add a test for NTTIME_FREEZE and NTTIME_THAW

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: add a test for null_nttime(NTTIME_THAW)
Ralph Boehme [Thu, 28 Oct 2021 08:18:54 +0000 (10:18 +0200)] 
lib: add a test for null_nttime(NTTIME_THAW)

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: update null_nttime() of -1: -1 is NTTIME_FREEZE
Ralph Boehme [Thu, 28 Oct 2021 08:18:17 +0000 (10:18 +0200)] 
lib: update null_nttime() of -1: -1 is NTTIME_FREEZE

NTTIME_FREEZE is not a nil sentinel value, instead it implies special, yet
unimplemented semantics. Callers must deal with those values specifically and
null_nttime() must not lie about their nature.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: use NTTIME_FREEZE in a null_nttime() test
Ralph Boehme [Thu, 28 Oct 2021 08:17:01 +0000 (10:17 +0200)] 
lib: use NTTIME_FREEZE in a null_nttime() test

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: fix null_nttime() tests
Ralph Boehme [Wed, 27 Oct 2021 15:02:48 +0000 (17:02 +0200)] 
lib: fix null_nttime() tests

The test was checking -1 twice:

torture_assert(tctx, null_nttime(-1), "-1");
torture_assert(tctx, null_nttime(-1), "-1");

The first line was likely supposed to test the value "0".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: add NTTIME_THAW
Ralph Boehme [Tue, 5 Oct 2021 13:10:10 +0000 (15:10 +0200)] 
lib: add NTTIME_THAW

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib:cmdline: Fix -k option which doesn't expect anything
Andreas Schneider [Wed, 27 Oct 2021 11:45:15 +0000 (13:45 +0200)] 
lib:cmdline: Fix -k option which doesn't expect anything

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Oct 28 13:23:34 UTC 2021 on sn-devel-184

3 years agotestprogs: Use new cmdline option for kerberos
Andreas Schneider [Wed, 27 Oct 2021 13:30:20 +0000 (15:30 +0200)] 
testprogs: Use new cmdline option for kerberos

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoRevert "samba-tool: Pick local host if calling samba-tool from DC"
David Mulder [Tue, 26 Oct 2021 14:46:24 +0000 (08:46 -0600)] 
Revert "samba-tool: Pick local host if calling samba-tool from DC"

This reverts commit 7c9195e28bc51ac375d609f8306db2456f348167.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Tue Oct 26 16:00:28 UTC 2021 on sn-devel-184

3 years agosamba-tool: Pick local host if calling samba-tool from DC
David Mulder [Mon, 25 Oct 2021 14:49:35 +0000 (08:49 -0600)] 
samba-tool: Pick local host if calling samba-tool from DC

It is reasonable to assume, that if we are running a command from a DC,
that a user expects that the command will run against this DC.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Rowland Penny <rpenny@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Tue Oct 26 14:23:42 UTC 2021 on sn-devel-184

3 years agoRevert "gp: Add Firewalld ADMX templates"
Andreas Schneider [Mon, 25 Oct 2021 12:29:56 +0000 (14:29 +0200)] 
Revert "gp: Add Firewalld ADMX templates"

This reverts commit 7253405c35247dff192e86598b18d524e1602818.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Mon Oct 25 15:04:18 UTC 2021 on sn-devel-184

3 years agoRevert "gp: Test Firewalld Group Policy Apply"
Andreas Schneider [Mon, 25 Oct 2021 12:29:41 +0000 (14:29 +0200)] 
Revert "gp: Test Firewalld Group Policy Apply"

This reverts commit 8f347449190c698ec4d2720bbf6ffced853ef797.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: David Mulder <dmulder@suse.com>
3 years agoRevert "gp: Apply Firewalld Policy"
Andreas Schneider [Mon, 25 Oct 2021 12:29:20 +0000 (14:29 +0200)] 
Revert "gp: Apply Firewalld Policy"

This reverts commit 9ac2d5d991d16d1957c720fcda3ff6a9ac78dc13.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: David Mulder <dmulder@suse.com>
3 years agotests/krb5: Check account name and SID in PAC for S4U tests
Joseph Sutton [Thu, 21 Oct 2021 03:46:56 +0000 (16:46 +1300)] 
tests/krb5: Check account name and SID in PAC for S4U tests

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Oct 25 09:23:35 UTC 2021 on sn-devel-184

3 years agogp: Apply Firewalld Policy
David Mulder [Thu, 14 Oct 2021 21:36:52 +0000 (15:36 -0600)] 
gp: Apply Firewalld Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
3 years agogp: Test Firewalld Group Policy Apply
David Mulder [Tue, 12 Oct 2021 18:54:09 +0000 (12:54 -0600)] 
gp: Test Firewalld Group Policy Apply

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
3 years agogp: Add Firewalld ADMX templates
David Mulder [Wed, 6 Oct 2021 18:46:26 +0000 (12:46 -0600)] 
gp: Add Firewalld ADMX templates

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
3 years agolib/krb5_wrap: Fix missing error check in new salt code
Andrew Bartlett [Thu, 21 Oct 2021 21:50:36 +0000 (10:50 +1300)] 
lib/krb5_wrap: Fix missing error check in new salt code

CID 1492905: Control flow issues  (DEADCODE)

This was a regression in 5eeb441b771a1ffe1ba1c69b72e8795f525a58ed.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Oct 23 08:07:13 UTC 2021 on sn-devel-184

3 years agodsdb: Allow special chars like "@" in samAccountName when generating the salt
Andrew Bartlett [Tue, 19 Oct 2021 03:01:36 +0000 (16:01 +1300)] 
dsdb: Allow special chars like "@" in samAccountName when generating the salt

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 20 12:54:54 UTC 2021 on sn-devel-184

3 years agotests/krb5: Add tests for account salt calculation
Joseph Sutton [Tue, 19 Oct 2021 23:46:36 +0000 (12:46 +1300)] 
tests/krb5: Add tests for account salt calculation

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotests/krb5: Fix account salt calculation to match Windows
Joseph Sutton [Tue, 19 Oct 2021 23:45:47 +0000 (12:45 +1300)] 
tests/krb5: Fix account salt calculation to match Windows

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotests/krb5: Allow specifying the UPN for test accounts
Joseph Sutton [Tue, 19 Oct 2021 23:45:08 +0000 (12:45 +1300)] 
tests/krb5: Allow specifying the UPN for test accounts

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotests/krb5: Allow creating machine accounts without a trailing dollar
Joseph Sutton [Tue, 19 Oct 2021 23:44:19 +0000 (12:44 +1300)] 
tests/krb5: Allow creating machine accounts without a trailing dollar

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotests/krb5: Allow specifying prefix or suffix for test account names
Joseph Sutton [Tue, 19 Oct 2021 23:41:39 +0000 (12:41 +1300)] 
tests/krb5: Allow specifying prefix or suffix for test account names

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agotests/krb5: Decrease length of test account prefix
Joseph Sutton [Tue, 19 Oct 2021 23:39:05 +0000 (12:39 +1300)] 
tests/krb5: Decrease length of test account prefix

This allows us more room to test with different account names.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest/Samba3: replace (winbindd => "yes", skip_wait => 1) with (winbindd => "offline")
Stefan Metzmacher [Tue, 5 Oct 2021 14:42:00 +0000 (16:42 +0200)] 
selftest/Samba3: replace (winbindd => "yes", skip_wait => 1) with (winbindd => "offline")

This is much more flexible and concentrates the logic in a single place.

We'll use winbindd => "offline" in other places soon.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoselftest/Samba3: remove unused close(USERMAP); calls
Stefan Metzmacher [Fri, 8 Oct 2021 16:04:55 +0000 (18:04 +0200)] 
selftest/Samba3: remove unused close(USERMAP); calls

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agowaf: Allow building with MIT KRB5 >= 1.20
Andreas Schneider [Mon, 4 Oct 2021 11:02:35 +0000 (13:02 +0200)] 
waf: Allow building with MIT KRB5 >= 1.20

gssrpc/xdr.h:105:1: error: function declaration isn’t a prototype
[-Werror=strict-prototypes]
  105 | typedef bool_t (*xdrproc_t)();
      | ^~~~~~~

This can't be fixed, as the protoype is variadic. It can take up to three
arguments.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest: Improve error handling and perl style when setting up users in Samba4.pm
Andrew Bartlett [Sun, 17 Oct 2021 22:55:14 +0000 (11:55 +1300)] 
selftest: Improve error handling and perl style when setting up users in Samba4.pm

This catches errors and avoids using global varibles (the old
style file handles are global).

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest: Remove duplicate setup of $base_dn and $ldbmodify
Andrew Bartlett [Mon, 18 Oct 2021 07:44:54 +0000 (20:44 +1300)] 
selftest: Remove duplicate setup of $base_dn and $ldbmodify

These are already set up to the same values above for the full
DC and correct values for the (strange) s4member environment.

By not setting $base_dn again we avoid an error once we start
checking for them.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agopytest: s3_net_join: avoid name clash
Douglas Bagnall [Thu, 19 Aug 2021 23:26:02 +0000 (11:26 +1200)] 
pytest: s3_net_join: avoid name clash

The net_join test uses "NetJoinTest" (and doesn't properly clean up),
we must use a unique name for this test in s3_net_join.py.

[abartlet@samba.org The hilarious naming conventions come from a time when samba-tool
was known as "net" in the s4 branch]

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest: krb5 account creation: clarify account type as an enum
Joseph Sutton [Fri, 8 Oct 2021 02:40:09 +0000 (15:40 +1300)] 
selftest: krb5 account creation: clarify account type as an enum

This makes the code clearer with a symbolic constant rather
than a True/False boolean.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agopytest: dynamic tests optionally add __doc__
Douglas Bagnall [Thu, 5 Aug 2021 23:08:10 +0000 (11:08 +1200)] 
pytest: dynamic tests optionally add __doc__

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoselftest: Increase account lockout windows to make test more realiable
Joseph Sutton [Mon, 20 Sep 2021 04:27:40 +0000 (16:27 +1200)] 
selftest: Increase account lockout windows to make test more realiable

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agopytest/rodc_rwdc: try to avoid race.
Douglas Bagnall [Wed, 8 Sep 2021 05:01:26 +0000 (17:01 +1200)] 
pytest/rodc_rwdc: try to avoid race.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agoHEIMDAL:kdc: Fix transit path validation CVE-2017-6594
Viktor Dukhovni [Wed, 10 Aug 2016 23:31:14 +0000 (23:31 +0000)] 
HEIMDAL:kdc: Fix transit path validation CVE-2017-6594

Commit f469fc6 (2010-10-02) inadvertently caused the previous hop realm
to not be added to the transit path of issued tickets.  This may, in
some cases, enable bypass of capath policy in Heimdal versions 1.5
through 7.2.

Note, this may break sites that rely on the bug.  With the bug some
incomplete [capaths] worked, that should not have.  These may now break
authentication in some cross-realm configurations.

(similar to heimdal commit b1e699103f08d6a0ca46a122193c9da65f6cf837)

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

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 20 10:58:37 UTC 2021 on sn-devel-184

3 years agotests/krb5: Add tests for constrained delegation to NO_AUTH_DATA_REQUIRED service
Joseph Sutton [Mon, 18 Oct 2021 03:07:11 +0000 (16:07 +1300)] 
tests/krb5: Add tests for constrained delegation to NO_AUTH_DATA_REQUIRED service

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 20 09:22:43 UTC 2021 on sn-devel-184

3 years agotests/krb5: Ensure PAC is not present if expect_pac is false
Joseph Sutton [Mon, 18 Oct 2021 03:05:19 +0000 (16:05 +1300)] 
tests/krb5: Ensure PAC is not present if expect_pac is false

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agokdc: Correctly strip PAC, rather than error on UF_NO_AUTH_DATA_REQUIRED for servers
Andrew Bartlett [Mon, 18 Oct 2021 03:00:45 +0000 (16:00 +1300)] 
kdc: Correctly strip PAC, rather than error on UF_NO_AUTH_DATA_REQUIRED for servers

UF_NO_AUTH_DATA_REQUIRED on a server/service account should cause
the PAC to be stripped not to given an error if the PAC was still
present.

Tested against Windows 2019

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agokdc: Remove UF_NO_AUTH_DATA_REQUIRED from client principals
Andrew Bartlett [Mon, 18 Oct 2021 02:21:50 +0000 (15:21 +1300)] 
kdc: Remove UF_NO_AUTH_DATA_REQUIRED from client principals

Tests against Windows 2019 show that UF_NO_AUTH_DATA_REQUIRED
applies to services only, not to clients.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>