samba.git
2 years agos4:kdc: rename free_sdb_key() as public sdb_key_free() function
Stefan Metzmacher [Fri, 11 Feb 2022 20:04:44 +0000 (21:04 +0100)]
s4:kdc: rename free_sdb_key() as public sdb_key_free() function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: make free_sdb_entry() static
Stefan Metzmacher [Fri, 11 Feb 2022 19:58:03 +0000 (20:58 +0100)]
s4:kdc: make free_sdb_entry() static

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: let samba_kdc_entry_destructor() call sdb_free_entry()
Stefan Metzmacher [Fri, 11 Feb 2022 19:55:25 +0000 (20:55 +0100)]
s4:kdc: let samba_kdc_entry_destructor() call sdb_free_entry()

It's basically the same as free_sdb_entry(), but the next
step will make free_sdb_entry() private.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: don't leak salt in free_sdb_key()
Stefan Metzmacher [Fri, 11 Feb 2022 20:13:24 +0000 (21:13 +0100)]
s4:kdc: don't leak salt in free_sdb_key()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: call krb5_free_keyblock_contents() in free_sdb_key()
Stefan Metzmacher [Fri, 11 Feb 2022 19:56:17 +0000 (20:56 +0100)]
s4:kdc: call krb5_free_keyblock_contents() in free_sdb_key()

This is much clearer than doing it in sdb_free_entry() already.
It also simplifies the next cleanups.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: remove unused sdb_entry_ex->free_entry()
Stefan Metzmacher [Tue, 22 Mar 2022 12:59:58 +0000 (13:59 +0100)]
s4:kdc: remove unused sdb_entry_ex->free_entry()

It seems we need to take a closer look at the
memory hierachy of the sdb_entry related code.

I'll check that during the next commits,
but for now just remove use the unused hook.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:libnet: ask for SDB_F_ADMIN_DATA in order to create a keytab entry
Stefan Metzmacher [Wed, 23 Mar 2022 01:14:46 +0000 (02:14 +0100)]
s4:libnet: ask for SDB_F_ADMIN_DATA in order to create a keytab entry

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:libnet: sdb_free_entry() already clears everything
Stefan Metzmacher [Mon, 21 Feb 2022 22:39:14 +0000 (23:39 +0100)]
s4:libnet: sdb_free_entry() already clears everything

There's no need to know about '.free_entry'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: let sdb_free_entry clear sdb_entry_ex at the end
Stefan Metzmacher [Tue, 22 Mar 2022 12:31:31 +0000 (13:31 +0100)]
s4:kdc: let sdb_free_entry clear sdb_entry_ex at the end

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: let sdb_entry_ex_to_krb5_db_entry() initialize 'k' at the beginning
Stefan Metzmacher [Thu, 17 Feb 2022 09:59:45 +0000 (10:59 +0100)]
s4:kdc: let sdb_entry_ex_to_krb5_db_entry() initialize 'k' at the beginning

This is clearer and make further changes easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: let sdb_entry_to_hdb_entry() initialize *h at the beginning
Stefan Metzmacher [Thu, 17 Feb 2022 09:59:45 +0000 (10:59 +0100)]
s4:kdc: let sdb_entry_to_hdb_entry() initialize *h at the beginning

This is clearer and make further changes easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: remove unused mkvno from sdb_key
Stefan Metzmacher [Fri, 11 Feb 2022 20:04:57 +0000 (21:04 +0100)]
s4:kdc: remove unused mkvno from sdb_key

This is not related to the kvno of the key,
the mkvno tells the HDB layer that the keys need to
be decrypted with a master key (with the given [m]kvno).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: strictly have 2 16-bit parts in krbtgt kvnos
Stefan Metzmacher [Wed, 16 Feb 2022 13:11:10 +0000 (14:11 +0100)]
s4:kdc: strictly have 2 16-bit parts in krbtgt kvnos

Even if the msDS-KeyVersionNumber of the main krbtgt
account if larger than 65535, we need to have
the 16 upper bits all zero in order to avoid
mixing the keys with an RODC.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosmbd: Make an if-statement in ReadDirName() a bit more readable
Volker Lendecke [Sat, 12 Mar 2022 11:47:03 +0000 (12:47 +0100)]
smbd: Make an if-statement in ReadDirName() a bit more readable

Align to make the () structure more obvious

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

2 years agosmbclient: strequal() -> ISDOT/ISDOTDOT
Volker Lendecke [Sat, 12 Mar 2022 11:40:29 +0000 (12:40 +0100)]
smbclient: strequal() -> ISDOT/ISDOTDOT

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use ISDOT/ISDOTDOT in ReadDirName()
Volker Lendecke [Sat, 12 Mar 2022 11:47:54 +0000 (12:47 +0100)]
smbd: Use ISDOT/ISDOTDOT in ReadDirName()

With those macros, we check n[0] twice now, but I think the compiler
should either optimize that out or if it can't this will be in the CPU
cache, so the second check should be practially free. I can't imagine
this makes any difference but the better readability.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Fix a misleading comment
Volker Lendecke [Sun, 13 Mar 2022 14:22:50 +0000 (15:22 +0100)]
smbd: Fix a misleading comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Avoid an "else"
Volker Lendecke [Sun, 13 Mar 2022 14:58:03 +0000 (15:58 +0100)]
smbd: Avoid an "else"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Use talloc_zero, save a ZERO_STRUCT
Volker Lendecke [Mon, 21 Mar 2022 08:13:09 +0000 (09:13 +0100)]
lib: Use talloc_zero, save a ZERO_STRUCT

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Add a pair of {}
Volker Lendecke [Mon, 21 Mar 2022 08:12:44 +0000 (09:12 +0100)]
lib: Add a pair of {}

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Slightly simplify add_interface()
Volker Lendecke [Mon, 21 Mar 2022 08:12:02 +0000 (09:12 +0100)]
lib: Slightly simplify add_interface()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Make non_widelink_open() robust for non-cwd dirfsp
Volker Lendecke [Wed, 9 Mar 2022 11:58:40 +0000 (12:58 +0100)]
smbd: Make non_widelink_open() robust for non-cwd dirfsp

If you pass in dirfsp!=conn->cwd_fsp and a stream fsp, we don't chdir
to the parent pathname, and thus we also don't overwrite
fsp->base_fsp.

fsp->base_fsp!=NULL is thus the wrong condition to restore the
original base fsp name: If we open a stream with a non-cwd_fsp dirfsp,
we would overwrite fsp->base_fsp->fsp_name with NULL.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoreplace: add explicit function pointer casting from dlsym() to avoid warnings
Stefan Metzmacher [Tue, 15 Feb 2022 14:09:08 +0000 (15:09 +0100)]
replace: add explicit function pointer casting from dlsym() to avoid warnings

This avoids a lot of warnings on AIX.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Mar 23 13:27:45 UTC 2022 on sn-devel-184

2 years agolib/replace: Do not typedef int bool
Andrew Bartlett [Tue, 22 Mar 2022 03:12:00 +0000 (16:12 +1300)]
lib/replace: Do not typedef int bool

We need a genuine boolean type, as otherwise expressions like

bool foo = (4 & 4);
if (foo == true) {
exit(1);
} else {
exit(2);
}

could evaluate differently on non-modern platforms, and
that would be a real pain to debug.

_Bool and bool are in C99

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Mar 23 12:31:47 UTC 2022 on sn-devel-184

2 years agogitlab-ci: Drop Debian 10
Andreas Schneider [Fri, 18 Mar 2022 15:31:54 +0000 (16:31 +0100)]
gitlab-ci: Drop Debian 10

It should be enough to build on the latest Debian version. We have older
Ubuntu versions already.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agogitlab-ci: Update to openSUSE 15.3
Andreas Schneider [Fri, 18 Mar 2022 15:29:43 +0000 (16:29 +0100)]
gitlab-ci: Update to openSUSE 15.3

This drops openSUSE 15.1 and 15.2 to save some CI resources.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agogitlab-ci: Drop Fedora 34
Andreas Schneider [Fri, 18 Mar 2022 15:24:01 +0000 (16:24 +0100)]
gitlab-ci: Drop Fedora 34

It should be enough to run on the latest Fedora version. This should save us
some CI minutes. We have CentOS runners and I would prefer to add CentOS9
Stream.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agogitlab-ci: Use Ubuntu 20.04 for Coverity
Andreas Schneider [Fri, 18 Mar 2022 15:22:39 +0000 (16:22 +0100)]
gitlab-ci: Use Ubuntu 20.04 for Coverity

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agogitlab-ci: Remove unused variable for ubuntu1604
Andreas Schneider [Fri, 18 Mar 2022 15:33:00 +0000 (16:33 +0100)]
gitlab-ci: Remove unused variable for ubuntu1604

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3: smbd: Don't allow setting the delete on close bit on a directory if it contains...
Jeremy Allison [Mon, 21 Mar 2022 20:50:56 +0000 (13:50 -0700)]
s3: smbd: Don't allow setting the delete on close bit on a directory if it contains non-visible files and "delete veto files = no".

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 22 17:48:25 UTC 2022 on sn-devel-184

2 years agos3: torture: Add 2 new tests SMB2-DEL-ON-CLOSE-NONWRITE-DELETE-NO, SMB2-DEL-ON-CLOSE...
Jeremy Allison [Mon, 21 Mar 2022 20:45:25 +0000 (13:45 -0700)]
s3: torture: Add 2 new tests SMB2-DEL-ON-CLOSE-NONWRITE-DELETE-NO, SMB2-DEL-ON-CLOSE-NONWRITE-DELETE-YES.

We currently allow setting the delete on close bit for
a directory containing only explicitly hidden/vetoed files
in the case where "delete veto files = yes" *and*
"delete veto files = no". For the "delete veto files = no"
case we should be denying setting the delete on close bit
when the client tries to set it (that's the only time Windows
looks at the bit and returns an error to the user). We
already do the in the dangling symlink case, we just
missed it in the !is_visible_fsp() case.

Mark SMB2-DEL-ON-CLOSE-NONWRITE-DELETE-NO as knownfail
for now.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agoWHATSNEW: Mention our matrix room as well
Andrew Bartlett [Thu, 17 Mar 2022 05:47:48 +0000 (18:47 +1300)]
WHATSNEW: Mention our matrix room as well

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Mon Mar 21 13:52:06 UTC 2022 on sn-devel-184

2 years agoWHATSNEW: IRC is irc.libera.chat according to https://www.samba.org/samba/irc.html
Thomas Debesse [Tue, 15 Feb 2022 13:11:45 +0000 (14:11 +0100)]
WHATSNEW: IRC is irc.libera.chat according to https://samba.org/samba/irc.html

Signed-off-by: Thomas Debesse <dev@illwieckz.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:rpc_server/samr: Use extended DN when searching for user
Joseph Sutton [Thu, 3 Mar 2022 01:54:00 +0000 (14:54 +1300)]
s4:rpc_server/samr: Use extended DN when searching for user

Switch to dsdb_search() for looking up the user for changing the
password, and specify that we want extended DNs. Using the SID or GUID
avoids a race condition if the DN of the user changes.

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): Fri Mar 18 12:45:17 UTC 2022 on sn-devel-184

2 years agosamba-tool group: Add --special parameter to add predefined special group
Joseph Sutton [Thu, 10 Feb 2022 04:14:56 +0000 (17:14 +1300)]
samba-tool group: Add --special parameter to add predefined special group

This allows default security groups that have been added since Windows
Server 2008 R2, such as Protected Users, to be created in pre-existing
domains. An error message is generated if a group already exists with
the same name, DN, or SID.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agofunctionalprep.sh: Add test for samba-tool add group --special
Joseph Sutton [Thu, 3 Mar 2022 07:59:48 +0000 (20:59 +1300)]
functionalprep.sh: Add test for samba-tool add group --special

Test that we can add the special Protected Users group, and that we get
an appropriate error message when attempting to add it a second time.

We add these tests here so that we can make use of an old provision that
does not already have the Protected Users group added.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/sam: Ensure that Protected Users group cannot be deleted
Joseph Sutton [Wed, 2 Feb 2022 02:47:05 +0000 (15:47 +1300)]
tests/sam: Ensure that Protected Users group cannot be deleted

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:rpc_server/samr: Simplify lp_ctx expression
Joseph Sutton [Thu, 3 Feb 2022 02:17:40 +0000 (15:17 +1300)]
s4:rpc_server/samr: Simplify lp_ctx expression

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:auth: Disable NTLM authentication for Protected Users
Joseph Sutton [Tue, 1 Feb 2022 08:08:44 +0000 (21:08 +1300)]
s4:auth: Disable NTLM authentication for Protected Users

We also move the authentication to after checking whether the user is
protected, so that if a user in the Protected Users group tries to
authenticate with a wrong password, the bag password count is not
incremented and the account is not locked out. This does not match
MS-APDS, but matches the behaviour of Windows.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:kdc: Add KDC support for Protected Users group
Joseph Sutton [Wed, 2 Feb 2022 04:08:41 +0000 (17:08 +1300)]
s4:kdc: Add KDC support for Protected Users group

Accounts in the Protected Users group acting as clients lack support for
the RC4 encryption type. TGTs issued to such accounts have a lifetime
restricted to four hours, and are unable to be proxied or forwarded.

To determine at lookup time whether a client account is a member of
Protected Users, we now also create an auth_user_info_dc structure when
creating the database entry for an AS-REQ, rather than only when
creating a PAC for a TGT, or when recreating the PAC from an RODC-issued
TGT.

This means that the user's groups are now expanded even for AS-REQs that
result in an error (such as a PREAUTH_REQUIRED error), but this is
required to be able to correctly determine the account's available
encryption types, which are needed soon after fetching the user account.

Currently, the TGT lifetime may exceed four hours (for Heimdal
specifically). This may happen if PKINIT is used, and either the
pkinit_max_life_from_cert_extension option is TRUE and
pkinit_max_life_bound is greater than four hours, or
pkinit_max_life_from_cert is greater than four hours.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:kdc: Add function to get user_info_dc from database
Joseph Sutton [Thu, 17 Mar 2022 22:13:40 +0000 (11:13 +1300)]
s4:kdc: Add function to get user_info_dc from database

The resulting user_info_dc is kept in the 'samba_kdc_entry' structure,
so it can be reused between calls.

This allows us to simplify samba_kdc_get_pac_blobs(), as it no longer
need to return a user_info_dc structure.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:kdc: simplify samba_kdc_message2entry by using data_blob_string_const("computer")
Stefan Metzmacher [Tue, 8 Feb 2022 15:49:35 +0000 (16:49 +0100)]
s4:kdc: simplify samba_kdc_message2entry by using data_blob_string_const("computer")

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2 years agodsdb/common: Add helper function for determining if account is in Protected Users...
Joseph Sutton [Wed, 2 Feb 2022 22:11:56 +0000 (11:11 +1300)]
dsdb/common: Add helper function for determining if account is in Protected Users group

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:provision_users.ldif: Add Protected Users group
Joseph Sutton [Tue, 1 Feb 2022 08:04:40 +0000 (21:04 +1300)]
s4:provision_users.ldif: Add Protected Users group

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/passwords: Test that LDAP password changes work for Protected Users
Joseph Sutton [Wed, 9 Feb 2022 00:57:47 +0000 (13:57 +1300)]
tests/passwords: Test that LDAP password changes work for Protected Users

We want to disable SAMR password changes for Protected Users, but need
to ensure that other methods of changing the password still work.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/password_lockout: Test NTLM and SAMR password changes with Protected Users
Joseph Sutton [Wed, 9 Feb 2022 00:50:10 +0000 (13:50 +1300)]
tests/password_lockout: Test NTLM and SAMR password changes with Protected Users

Test that NTLM and SAMR password changes cannot be used for Protected
Users, and that lockouts are not triggered for attempting to use them.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Add tests for the Protected Users group
Joseph Sutton [Tue, 1 Feb 2022 08:00:16 +0000 (21:00 +1300)]
tests/krb5: Add tests for the Protected Users group

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth/credentials: Add encrypt_samr_password()
Joseph Sutton [Wed, 23 Feb 2022 07:57:44 +0000 (20:57 +1300)]
auth/credentials: Add encrypt_samr_password()

This method encrypts a samr_Password structure with the current session
key, which allows for interactive SamLogon from Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest/dbcheck: Fix up msDS-RevealedUsers links with deleted target DN
Joseph Sutton [Fri, 11 Feb 2022 03:30:13 +0000 (16:30 +1300)]
selftest/dbcheck: Fix up msDS-RevealedUsers links with deleted target DN

Replicating test accounts to the RODC and then deleting them caused
stale msDS-RevealedUsers links to remain in the database.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Add helper function to modify ticket flags
Joseph Sutton [Mon, 7 Feb 2022 23:15:36 +0000 (12:15 +1300)]
tests/krb5: Add helper function to modify ticket flags

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Remove unused import
Joseph Sutton [Tue, 1 Feb 2022 07:59:15 +0000 (20:59 +1300)]
tests/krb5: Remove unused import

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Add account to cleanup list before adding it to database
Joseph Sutton [Tue, 1 Feb 2022 07:57:22 +0000 (20:57 +1300)]
tests/krb5: Add account to cleanup list before adding it to database

This ensures accounts are still cleaned up if a test fails before adding
it to the cleanup list.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Add more encryption type constants
Joseph Sutton [Tue, 1 Feb 2022 07:55:56 +0000 (20:55 +1300)]
tests/krb5: Add more encryption type constants

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Remove accounts in reverse order of addition
Joseph Sutton [Tue, 1 Feb 2022 07:54:39 +0000 (20:54 +1300)]
tests/krb5: Remove accounts in reverse order of addition

This prevents problems if accounts are added as children of other
accounts.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:kdc: Fix copy-paste typo
Joseph Sutton [Tue, 1 Feb 2022 07:52:16 +0000 (20:52 +1300)]
s4:kdc: Fix copy-paste typo

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotests/krb5: Simplify logic
Joseph Sutton [Mon, 7 Mar 2022 04:07:48 +0000 (17:07 +1300)]
tests/krb5: Simplify logic

This code can be made part of the previous 'else' branch.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Joseph Sutton <jsutton@samba.org>
Autobuild-Date(master): Fri Mar 18 00:11:25 UTC 2022 on sn-devel-184

2 years agotests/krb5: Improve mock RODC creation
Joseph Sutton [Mon, 7 Mar 2022 04:01:40 +0000 (17:01 +1300)]
tests/krb5: Improve mock RODC creation

Use a unique name for the mock RODC. Don't assign to _rodc_ctx until the
RODC has been created, so we don't try to use a mock RODC that failed to
create.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoselftest: Simplify krb5 test environments
Joseph Sutton [Fri, 4 Mar 2022 03:57:27 +0000 (16:57 +1300)]
selftest: Simplify krb5 test environments

It's not necessary to repeat the required environment variables for
every test.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agopython: Restore SDDL abbreviations for SIDs
Joseph Sutton [Mon, 14 Mar 2022 21:20:59 +0000 (10:20 +1300)]
python: Restore SDDL abbreviations for SIDs

This time we use the correct values.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agosddl: Remove SDDL SID strings unsupported by Windows
Joseph Sutton [Mon, 14 Mar 2022 05:18:39 +0000 (18:18 +1300)]
sddl: Remove SDDL SID strings unsupported by Windows

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agosddl: Add new SDDL SID strings
Joseph Sutton [Mon, 14 Mar 2022 05:18:09 +0000 (18:18 +1300)]
sddl: Add new SDDL SID strings

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agosddl: Fix incorrect SDDL SID strings
Joseph Sutton [Mon, 14 Mar 2022 05:14:15 +0000 (18:14 +1300)]
sddl: Fix incorrect SDDL SID strings

Change the values to match those used by Windows.

Verified with PowerShell commands of the form:
New-Object Security.Principal.SecurityIdentifier ER

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:rpc_server/lsa: Use explicit SID instead of SDDL abbreviation
Joseph Sutton [Mon, 14 Mar 2022 06:40:45 +0000 (19:40 +1300)]
s4:rpc_server/lsa: Use explicit SID instead of SDDL abbreviation

This is to prepare for the SDDL string being removed.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agopython: Use explicit SIDs instead of SDDL abbreviations
Joseph Sutton [Mon, 14 Mar 2022 06:40:16 +0000 (19:40 +1300)]
python: Use explicit SIDs instead of SDDL abbreviations

This is to prepare for changing the SDDL string values.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agopython:tests: Add tests for SDDL SID strings
Joseph Sutton [Tue, 15 Mar 2022 06:24:38 +0000 (19:24 +1300)]
python:tests: Add tests for SDDL SID strings

We get the server to decode the SDDL by putting the SID strings in the
defaultSecurityDescriptor of a new class and making an object of that
class. We then check that the resulting SID is what we expect.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotorture: Allow Samba as an AD DC to use zeros for LM key
Andrew Bartlett [Mon, 28 Feb 2022 00:24:31 +0000 (13:24 +1300)]
torture: Allow Samba as an AD DC to use zeros for LM key

This is simple, explainable and secure.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar 17 02:47:13 UTC 2022 on sn-devel-184

2 years agotorture: Do not expect LM passwords to be accepted except by samba3
Andrew Bartlett [Mon, 28 Feb 2022 00:19:58 +0000 (13:19 +1300)]
torture: Do not expect LM passwords to be accepted except by samba3

This allows Samba as an AD DC (compared with the fileserver/NT4-like DC mode) to match
windows and refuse all LM passwords, no matter what.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agotorture: Update rpc.samlogon to match Win19 and newer Samba behaviour for LM key
Andrew Bartlett [Sun, 27 Feb 2022 21:07:35 +0000 (10:07 +1300)]
torture: Update rpc.samlogon to match Win19 and newer Samba behaviour for LM key

Not all cases are covered, but this much covers the areas that Samba and Win19
will agree on.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Remove auth_log test for RAP password change
Andrew Bartlett [Thu, 17 Feb 2022 23:55:57 +0000 (12:55 +1300)]
selftest: Remove auth_log test for RAP password change

RAP is SMB1, the password change routine requires LM hashes and so everything
here is going away or has now gone, so remove the test.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agontlm_auth: Adapt --diagnostics mode to expect that the DC does not support LANMAN...
Andrew Bartlett [Thu, 17 Feb 2022 04:50:43 +0000 (17:50 +1300)]
ntlm_auth: Adapt --diagnostics mode to expect that the DC does not support LANMAN by default

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3-ntlm_auth: Convert table of tests in --diagnostics to designated initialisers
Andrew Bartlett [Wed, 16 Feb 2022 21:48:54 +0000 (10:48 +1300)]
s3-ntlm_auth: Convert table of tests in --diagnostics to designated initialisers

This makes it easeir to set some as "LM auth".

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Remove LM hash parameter from samdb_set_password() and callers
Andrew Bartlett [Wed, 16 Feb 2022 18:35:54 +0000 (07:35 +1300)]
dsdb: Remove LM hash parameter from samdb_set_password() and callers

This fixes the rpc.samr test because we no longer specify an LM hash
to the DSDB layer only to have it rejected by password_hash.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Allow RPC-SAMR to cope with OemChangePasswordUser2 being un-implemented
Andrew Bartlett [Wed, 16 Feb 2022 04:24:19 +0000 (17:24 +1300)]
selftest: Allow RPC-SAMR to cope with OemChangePasswordUser2 being un-implemented

This is important to allow, after other changes, for the Samba AD DC to again
pass rpc.samr after the removal of LM hash support from the DC.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Cope with LM hash not being stored in the tombstone_reanimation test
Andrew Bartlett [Tue, 15 Feb 2022 23:56:41 +0000 (12:56 +1300)]
selftest: Cope with LM hash not being stored in the tombstone_reanimation test

The removal of LM hash storage changes the expected metadata.

We do not need to track these values exactly to prove the
behaviour here.

This is not due to the changes in password_hash directly, which in
update_final_msg() sets DSDB_FLAG_INTERNAL_FORCE_META_DATA to force
a push out of the removed attribute to the replication state.

However at the stage of a subsequent LDAP Delete there is no longer
a lmPwdHistory nor dBCSPwd attribute, in the directory, so there is
no subsequent version bump to remove them when building a tombstone.

Samba's behaviour is different to that seen by Metze on windows 2022,
where he sees dBCSPwd removed (for the no LM store case) but
lmPwdHistory kept.  We in Samba choose to differ, not storing an
ambiguous LM hsitory (of "" values likely), so allowing any version
for these two attributes is the sensible choice.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Remove parsing of LM password hash from "dBCSPwd" attribute
Andrew Bartlett [Thu, 10 Feb 2022 05:58:52 +0000 (18:58 +1300)]
dsdb: Remove parsing of LM password hash from "dBCSPwd" attribute

This means Samba will essentially ignore this attribute, not even attempting
to read it from the AD DC sam.ldb

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-rpc_server: Do not use LM hash in password changes
Andrew Bartlett [Thu, 10 Feb 2022 05:40:31 +0000 (18:40 +1300)]
s4-rpc_server: Do not use LM hash in password changes

We now only change passwords based on the NT hash.

This means we no longer support samr_OemChangePasswordUser2()
and we do not check the LM verifier din samr_ChangePasswordUser3()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-auth: Do not supply the LM hash to the AD DC authentication code
Andrew Bartlett [Thu, 10 Feb 2022 05:19:50 +0000 (18:19 +1300)]
s4-auth: Do not supply the LM hash to the AD DC authentication code

This still passes in the value in the LM field for checking
in case it is an NT response or LMv2.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-auth: Disable LM authenticaton in the AD DC despite "lanman auth = yes"
Andrew Bartlett [Thu, 10 Feb 2022 05:15:58 +0000 (18:15 +1300)]
s4-auth: Disable LM authenticaton in the AD DC despite "lanman auth = yes"

LM authentication is very weak and a very bad idea, so has been deprecated since
Samba 4.11.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4/dsdb: Remove LM password generation and storage from password_hash
Andrew Bartlett [Thu, 10 Feb 2022 04:40:29 +0000 (17:40 +1300)]
s4/dsdb: Remove LM password generation and storage from password_hash

We no longer generate nor store the LM hash in the Samba AD DC.

This adds much to the knownfail, some future commits will trim this
back down by making the tests understand that the server will not
support or store the LM hash.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-rpc_server: Remove pre-check for existing NT and LM hash from netlogon
Andrew Bartlett [Mon, 14 Mar 2022 03:06:36 +0000 (16:06 +1300)]
s4-rpc_server: Remove pre-check for existing NT and LM hash from netlogon

We no longer use the old NT and LM hash as proof of performing a
password change, and this removes the privileged status of these
attributes.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agokdc: Remove pre-check for existing NT and LM hash from kpasswd
Andrew Bartlett [Thu, 10 Feb 2022 01:11:03 +0000 (14:11 +1300)]
kdc: Remove pre-check for existing NT and LM hash from kpasswd

We no longer use the old NT and LM hash as proof of performing a
password change, and this removes the privileged status of these
attributes.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Return dsdb_password_change control name to DSDB_CONTROL_PASSWORD_CHANGE_OLD_PW...
Andrew Bartlett [Wed, 9 Feb 2022 03:53:08 +0000 (16:53 +1300)]
dsdb: Return dsdb_password_change control name to DSDB_CONTROL_PASSWORD_CHANGE_OLD_PW_CHECKED_OID

This makes it clearer that the purpose of this control is to indicate that the password
was already checked (by an out-of-band mechanism, eg kpasswd) and so can safely be changed
subject to ACLs etc.

This essentially reverts bbb9dc806e4399c65dee9b5dc2cde0bfaa9609bd

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: No longer supply exact password hashes in a control to indicate password changes
Andrew Bartlett [Wed, 9 Feb 2022 03:33:23 +0000 (16:33 +1300)]
dsdb: No longer supply exact password hashes in a control to indicate password changes

This returns the API for password changes via (eg) kpasswd to the
previous design as at 7eebcebbab8f62935bd1d5460e58b0a8f2cc30e8
where a control but no partiuclar values were specified.

This avoids the issues that were attempted to be addressed between
7eebcebbab8f62935bd1d5460e58b0a8f2cc30e8 and 786c41b0954b541518d1096019e1ce7ca11e5e98
by still keeping the ACL check from 23bd3a74176be4a1f8d6d70b148ababee397cf8c.

The purpose of this change is to move away from the NT hash (unicodePwd) being
the primary password in Samba, to allow installations to operate without this
unsalted hash.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: run s4member tests less
Andrew Bartlett [Fri, 11 Feb 2022 22:26:37 +0000 (11:26 +1300)]
selftest: run s4member tests less

The s4member test environment is a historical artifact, provisioned like an
AD DC using sam.ldb and joined using the historical S4 join code.

Once running however it is nothing particualr special in winbindd, so
there is no need to run the tests against ad_member and s4member.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Remove duplicate run of rpc.lsa tests against ad_dc as "samba3"
Andrew Bartlett [Sat, 12 Feb 2022 01:09:34 +0000 (14:09 +1300)]
selftest: Remove duplicate run of rpc.lsa tests against ad_dc as "samba3"

Running these tests twice is a waste (sorry, thas was my choice when
merging s3 and s4 to just run all the tests against the AD DC) and
more importantly means that tests are run in "samba3" mode against
the AD DC, making it difficult to change the tests to expect a different
behaivour against the AD DC compared to the NT4 DC.

To assure that we have not lost tests, I ran:
grep command st/subunit | grep ad_dc| cut -f 2 -d\" | cut -f 2- -d. | sort | uniq -c

The two blocks (for rpc.lsa and rpc.lsa.*) are because the rpc.lsa.*
subtests were not previously run under ncacn_ip_tcp: and this is the
minimal change.

The output is:
--- /tmp/3 2022-02-12 14:01:50.435761067 +1300
+++ /tmp/now 2022-02-12 14:01:37.427595351 +1300
@@ -13,9 +13,8 @@
       2 rpc.lsa-getuser on ncalrpc with validate.
       2 rpc.lsa-getuser with bigendian.
       2 rpc.lsa-getuser with seal,padcheck.
       2 rpc.lsa-getuser with validate.
-      2 rpc.lsa.lookupnames.
       2 rpc.lsa.lookupnames with .
       2 rpc.lsa.lookupnames with bigendian.
       2 rpc.lsa.lookupnames with validate.
       2 rpc.lsalookup on ncacn_ip_tcp with bigendian.
@@ -26,9 +25,8 @@
       2 rpc.lsalookup on ncacn_np with validate.
       2 rpc.lsalookup on ncalrpc with bigendian.
       2 rpc.lsalookup on ncalrpc with seal,padcheck.
       2 rpc.lsalookup on ncalrpc with validate.
-      2 rpc.lsa.lookupsids.
       2 rpc.lsa.lookupsids with .
       2 rpc.lsa.lookupsids with bigendian.
       2 rpc.lsa.lookupsids with validate.
       2 rpc.lsalookup with bigendian.
@@ -42,15 +40,11 @@
       2 rpc.lsa on ncacn_np with validate.
       2 rpc.lsa on ncalrpc with bigendian.
       2 rpc.lsa on ncalrpc with seal,padcheck.
       2 rpc.lsa on ncalrpc with validate.
-      2 rpc.lsa over ncacn_ip_tcp .
-      2 rpc.lsa over ncacn_np .
-      2 rpc.lsa.privileges.
       2 rpc.lsa.privileges with .
       2 rpc.lsa.privileges with bigendian.
       2 rpc.lsa.privileges with validate.
-      2 rpc.lsa.secrets.
       2 rpc.lsa.secrets on ncacn_np with with -k no --option=clientusespnego=no.
       2 rpc.lsa.secrets on ncacn_np with with -k no --option=clientusespnego=no --option=clientntlmv2auth=yes.
       2 rpc.lsa.secrets on ncacn_np with with -k no --option=clientusespnego=yes.
       2 rpc.lsa.secrets on ncacn_np with with -k no --option=clientusespnego=yes --option=clientntlmv2auth=yes.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Remove duplicate run of rpc.samr tests against ad_dc as "samba3"
Andrew Bartlett [Fri, 11 Feb 2022 08:05:38 +0000 (21:05 +1300)]
selftest: Remove duplicate run of rpc.samr tests against ad_dc as "samba3"

Running these tests twice is a waste (sorry, thas was my choice when
merging s3 and s4 to just run all the tests against the AD DC) and
more importantly means that tests are run in "samba3" mode against
the AD DC, making it difficult to change the tests to expect a different
behaivour against the AD DC compared to the NT4 DC.

To assure that we have not lost tests, I ran:
grep command st/subunit | grep ad_dc| cut -f 2 -d\" | cut -f 2- -d. | sort | uniq -c

The output is:
--- /tmp/2 2022-02-11 21:00:54.033610748 +1300
+++ /tmp/now 2022-02-11 21:01:13.849823721 +1300
@@ -1,32 +1,21 @@
-      2 rpc.samr.
-      2 rpc.samr.handletype.
       2 rpc.samr.handletype with .
       2 rpc.samr.handletype with bigendian.
       2 rpc.samr.handletype with validate.
-      2 rpc.samr.large-dc.
       2 rpc.samr.large-dc on ncacn_np with .
-      2 rpc.samr.machine.auth.
       2 rpc.samr.machine.auth with .
       2 rpc.samr.machine.auth with bigendian.
       2 rpc.samr.machine.auth with validate.
       2 rpc.samr on ncacn_np with .
-      2 rpc.samr.passwords.
-      2 rpc.samr.passwords.badpwdcount.
       2 rpc.samr.passwords.badpwdcount on ncacn_np with .
       2 rpc.samr.passwords.lockout on ncacn_np with .
       2 rpc.samr.passwords on ncacn_np with .
-      2 rpc.samr.passwords.pwdlastset.
       2 rpc.samr.passwords.pwdlastset on ncacn_np with .
       2 rpc.samr.passwords.validate on ncacn_ip_tcp with bigendian.
       2 rpc.samr.passwords.validate on ncacn_ip_tcp with seal,padcheck.
       2 rpc.samr.passwords.validate on ncacn_ip_tcp with validate.
-      2 rpc.samr.passwords.validate over ncacn_ip_tcp .
-      2 rpc.samr.priv.
       2 rpc.samr.priv with .
       2 rpc.samr.priv with bigendian.
       2 rpc.samr.priv with validate.
-      2 rpc.samr.users.
       2 rpc.samr.users on ncacn_np with .
-      2 rpc.samr.users.privileges.
       2 rpc.samr.users.privileges on ncacn_np with .
       4 tests.dcerpc.samr_change_password.

It is clear that the tests are all still being run at least once against the AD DC.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Allow samba.tests.ntlm_auth to fail rather than error checking --diagnostics
Andrew Bartlett [Sat, 12 Feb 2022 01:52:44 +0000 (14:52 +1300)]
selftest: Allow samba.tests.ntlm_auth to fail rather than error checking --diagnostics

This allows a knownfail entry to be written for this test.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Use more torture_assert_goto() et al in rpc.samlogon test
Andrew Bartlett [Tue, 15 Feb 2022 07:21:00 +0000 (20:21 +1300)]
selftest: Use more torture_assert_goto() et al in rpc.samlogon test

This testsuite can otherwise fail with an error, which cannot be covered with
a knownfail.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agowafsamba: Fix call to sorted()
Joseph Sutton [Tue, 15 Feb 2022 07:05:55 +0000 (20:05 +1300)]
wafsamba: Fix call to sorted()

In Python 3, sorted() does not take a 'cmp' parameter, so we need to use
the 'key' parameter instead.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar 17 01:36:59 UTC 2022 on sn-devel-184

2 years agos4-smbtorture: Fix typo in assertion message
Joseph Sutton [Mon, 14 Feb 2022 20:25:38 +0000 (09:25 +1300)]
s4-smbtorture: Fix typo in assertion message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython/ntacls.py: Fix ACE type comparison
Joseph Sutton [Fri, 4 Mar 2022 03:11:42 +0000 (16:11 +1300)]
python/ntacls.py: Fix ACE type comparison

SEC_ACE_TYPE_ values are not flags, so this comparison does not behave
as intended. Modify the check to more closely match the one in
gp_create_gpt_security_descriptor().

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:policy: Fix ACE type comparison
Joseph Sutton [Wed, 2 Mar 2022 04:14:42 +0000 (17:14 +1300)]
s4:policy: Fix ACE type comparison

SEC_ACE_TYPE_ values are not flags, so this comparison does not behave
as intended. Modify the check to more closely match the comment.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodsdb audit tests: Use assert_in_range() for comparing timestamps
Joseph Sutton [Wed, 16 Mar 2022 22:20:45 +0000 (11:20 +1300)]
dsdb audit tests: Use assert_in_range() for comparing timestamps

This can make the code clearer. assert_in_range() takes only integer
parameters, but POSIX allows us to assume that time_t is an integer.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodsdb audit tests: Fix flapping test
Joseph Sutton [Tue, 28 Sep 2021 07:42:36 +0000 (20:42 +1300)]
dsdb audit tests: Fix flapping test

Use gettimeofday() to obtain the current time for comparison, to be
consistent with audit_logging.c. On Linux, time() may occasionally
return a smaller value than gettimeofday(), despite being called later.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: Fix typo
Joseph Sutton [Thu, 18 Mar 2021 06:22:52 +0000 (19:22 +1300)]
samba-tool: Fix typo

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Use samba_kdc_update_pac() in Heimdal DB plugin
Andreas Schneider [Mon, 7 Mar 2022 09:41:41 +0000 (10:41 +0100)]
s4:kdc: Use samba_kdc_update_pac() in Heimdal DB plugin

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2 years agos4:kdc: Remove trailing whitespace in wdc-samba4.c
Andreas Schneider [Mon, 7 Mar 2022 12:15:08 +0000 (13:15 +0100)]
s4:kdc: Remove trailing whitespace in wdc-samba4.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2 years agos4:kdc: Remove ks_is_tgs_principal()
Andreas Schneider [Tue, 15 Mar 2022 06:33:57 +0000 (07:33 +0100)]
s4:kdc: Remove ks_is_tgs_principal()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2 years agos4:kdc: Use samba_kdc_update_pac() in mit_samba_update_pac()
Andreas Schneider [Tue, 8 Mar 2022 06:34:16 +0000 (07:34 +0100)]
s4:kdc: Use samba_kdc_update_pac() in mit_samba_update_pac()

This is for MIT Kerberos >= 1.20.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2 years agos4:kdc: Use samba_kdc_update_pac() in mit_samba_reget_pac()
Andreas Schneider [Thu, 10 Mar 2022 16:20:46 +0000 (17:20 +0100)]
s4:kdc: Use samba_kdc_update_pac() in mit_samba_reget_pac()

This is for MIT Kerberos <= 1.19

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