metze/samba-autobuild-v4-19-test/.git
9 months agotdb: release 1.4.9 tdb-1.4.9
Stefan Metzmacher [Tue, 18 Jul 2023 09:39:38 +0000 (11:39 +0200)]
tdb: release 1.4.9

* Remove remaining, but broken python2 support
* Spelling fixes
* python: Safely clear structure members

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 months agotalloc: release 2.4.1 talloc-2.4.1
Stefan Metzmacher [Tue, 18 Jul 2023 09:39:38 +0000 (11:39 +0200)]
talloc: release 2.4.1

* Remove remaining, but broken python2 support
* Spelling fixes
* Remove unneeded va_copy()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 months agonetcmd: sites: add sites and subnet list and view commands to manpage
Rob van der Linde [Wed, 12 Jul 2023 12:42:56 +0000 (00:42 +1200)]
netcmd: sites: add sites and subnet list and view commands to manpage

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jul 19 04:29:15 UTC 2023 on atb-devel-224

9 months agonetcmd: sites: add missing subnet commands to samba-tool manpage
Rob van der Linde [Wed, 12 Jul 2023 12:42:03 +0000 (00:42 +1200)]
netcmd: sites: add missing subnet commands to samba-tool manpage

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
9 months agonetcmd: sites: tests for list and view sites and subnet
Rob van der Linde [Wed, 5 Jul 2023 05:40:48 +0000 (17:40 +1200)]
netcmd: sites: tests for list and view sites and subnet

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
9 months agonetcmd: sites: make use of ldb_connect from base class
Rob van der Linde [Tue, 4 Jul 2023 10:02:01 +0000 (22:02 +1200)]
netcmd: sites: make use of ldb_connect from base class

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
9 months agonetcmd: add list and view commands for sites and subnets
Rob van der Linde [Tue, 4 Jul 2023 09:47:46 +0000 (21:47 +1200)]
netcmd: add list and view commands for sites and subnets

* samba-tool sites list
* samba-tool sites view
* samba-tool sites subnet list
* samba-tool sites subnet view

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
9 months agonetcmd: add Subnet and Site models
Rob van der Linde [Tue, 4 Jul 2023 09:34:38 +0000 (21:34 +1200)]
netcmd: add Subnet and Site models

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
9 months agoWHATSNEW: Update minimum GnuTLS version
Andrew Bartlett [Mon, 17 Jul 2023 22:29:50 +0000 (10:29 +1200)]
WHATSNEW: Update minimum GnuTLS version

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
9 months agolib/fuzzing: patch for collecting fuzz_security_token_vs_descriptor seeds
Douglas Bagnall [Tue, 18 Jul 2023 00:54:40 +0000 (12:54 +1200)]
lib/fuzzing: patch for collecting fuzz_security_token_vs_descriptor seeds

If this patch is applied, and an environment variable is set, all
access_check calls will be recorded as seeds for
fuzz_security_token_vs_descriptor. See the patch for details.

You probably will never want to apply this patch, but it is here just
in case.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agolib/fuzzing: adapt fuzz_sddl_access_check for AD variant
Douglas Bagnall [Mon, 17 Jul 2023 20:56:40 +0000 (08:56 +1200)]
lib/fuzzing: adapt fuzz_sddl_access_check for AD variant

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agolib/fuzzing: adapt fuzz_security_token_vs_descriptor for AD variant
Douglas Bagnall [Mon, 17 Jul 2023 04:20:58 +0000 (16:20 +1200)]
lib/fuzzing: adapt fuzz_security_token_vs_descriptor for AD variant

This of course doesn't exercise the object tree or default SID code,
but it still covers a lot to the *_ds access_check functions.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agolib/fuzzing: add fuzzer for arbitrary token/sd access checks
Douglas Bagnall [Sat, 15 Jul 2023 10:49:22 +0000 (22:49 +1200)]
lib/fuzzing: add fuzzer for arbitrary token/sd access checks

The token and descriptor are stored in NDR format; for this purpose we
add a new IDL struct containing this pair (along with a desired access
mask).

An upcoming commit will show how to collect seeds for this fuzzer.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agolib/fuzzing: add fuzz_sddl_access_check
Douglas Bagnall [Wed, 12 Jul 2023 01:03:53 +0000 (13:03 +1200)]
lib/fuzzing: add fuzz_sddl_access_check

This fuzzer parses SDDL into a security descriptor and runs an access
check on it using a known security token. This is purely for crash
detection -- we don't know enough to assert whether the check should
succeed or not.

The seed strings used are compatible with those of fuzz_sddl_parse --
anything found by fuzz_sddl_parse is worth trying as a seed here, and
vice versa.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agos4:provision: use better values for operatingSystem[Version]
Stefan Metzmacher [Wed, 22 Jul 2015 10:44:32 +0000 (12:44 +0200)]
s4:provision: use better values for operatingSystem[Version]

Some clients (e.g. an exchange server) check operatingSystemVersion
in order to check if a domain controller is new enough.

So we better use a value matching the dc functional level.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agos4:pydsdb: add dc_operatingSystemVersion() helper
Stefan Metzmacher [Tue, 18 Jul 2023 15:17:21 +0000 (17:17 +0200)]
s4:pydsdb: add dc_operatingSystemVersion() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agos4:dsdb: let dsdb_check_and_update_fl() also operatingSystem[Version]
Stefan Metzmacher [Fri, 7 Jul 2023 12:18:14 +0000 (14:18 +0200)]
s4:dsdb: let dsdb_check_and_update_fl() also operatingSystem[Version]

Some clients (e.g. an exchange server) check operatingSystemVersion
in order to check if a domain controller is new enough.

So we better use a value matching the dc functional level.

While we also fixed operatingSystem[Version] at provision time,
we do it also in dsdb_check_and_update_fl() in order to
handle old provisions and systems joined to an existing domain.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agoupgradeprovision: handle operatingSystem similar to operatingSystemVersion
Stefan Metzmacher [Tue, 18 Jul 2023 09:01:31 +0000 (11:01 +0200)]
upgradeprovision: handle operatingSystem similar to operatingSystemVersion

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agoldapcmp: also ignore operatingSystem similar to operatingSystemVersion
Stefan Metzmacher [Tue, 18 Jul 2023 09:00:56 +0000 (11:00 +0200)]
ldapcmp: also ignore operatingSystem similar to operatingSystemVersion

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agonetlogon.idl: add some comments to netr_OsVersionInfoEx
Stefan Metzmacher [Mon, 20 Dec 2021 19:53:35 +0000 (20:53 +0100)]
netlogon.idl: add some comments to netr_OsVersionInfoEx

[MS-RPRN] 7 Appendix B: Product Behavior contains information
about the products and their announced versions.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agothird_party/heimdal: Import lorikeet-heimdal-202307050413 (commit e0597fe1d01b109e64d...
Joseph Sutton [Wed, 5 Jul 2023 04:21:07 +0000 (16:21 +1200)]
third_party/heimdal: Import lorikeet-heimdal-202307050413 (commit e0597fe1d01b109e64d9c2a5bcada664ac199498)

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

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): Wed Jul 19 02:41:25 UTC 2023 on atb-devel-224

9 months agotests/krb5: Add a test for PK-INIT with a revoked certificate
Joseph Sutton [Mon, 3 Jul 2023 02:31:03 +0000 (14:31 +1200)]
tests/krb5: Add a test for PK-INIT with a revoked certificate

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Allow passing a pre-created certificate into _pkinit_req()
Joseph Sutton [Wed, 5 Jul 2023 04:12:42 +0000 (16:12 +1200)]
tests/krb5: Allow passing a pre-created certificate into _pkinit_req()

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Have the caller of create_certificate() fetch the CA certificate and...
Joseph Sutton [Wed, 5 Jul 2023 00:55:41 +0000 (12:55 +1200)]
tests/krb5: Have the caller of create_certificate() fetch the CA certificate and private key

These are useful to keep around for other purposes.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Factor out a method to fetch the CA certificate and private key
Joseph Sutton [Wed, 5 Jul 2023 00:53:45 +0000 (12:53 +1200)]
tests/krb5: Factor out a method to fetch the CA certificate and private key

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Factor out a method to create a certificate
Joseph Sutton [Wed, 5 Jul 2023 00:43:52 +0000 (12:43 +1200)]
tests/krb5: Factor out a method to create a certificate

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agos4:kdc: Add auth_data_reqd flag to SDBFlags
Joseph Sutton [Mon, 26 Jun 2023 01:07:44 +0000 (13:07 +1200)]
s4:kdc: Add auth_data_reqd flag to SDBFlags

This is to adapt to Heimdal:

commit 3c4548025c0a239ff580e7974939185eadf1856b
Author: Nicolas Williams <nico@twosigma.com>
Date:   Sun Jun 4 22:54:03 2023 -0500

    hdb: Add auth-data-reqd flag

NOTE: This commit finally works again!

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agothird_party/heimdal_build: Make Heimdal version strings const
Joseph Sutton [Thu, 22 Jun 2023 04:46:09 +0000 (16:46 +1200)]
third_party/heimdal_build: Make Heimdal version strings const

This is to adapt to Heimdal:

commit 997916e3f67d70bb52674829615c50455918fbb3
Author: Taylor R Campbell <campbell+heimdal@mumble.net>
Date:   Sun May 28 20:34:34 2023 +0000

    krb5: Make heimdal_version and heimdal_long_version const.

NOTE: THIS COMMIT WON’T COMPILE/WORK ON ITS OWN!

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agothird_party/heimdal: Import lorikeet-heimdal-202307040259 (commit 33d117b8a9c11714ef7...
Joseph Sutton [Tue, 4 Jul 2023 03:16:27 +0000 (15:16 +1200)]
third_party/heimdal: Import lorikeet-heimdal-202307040259 (commit 33d117b8a9c11714ef709e63a005d87e34b9bfde)

NOTE: THIS COMMIT WON’T COMPILE/WORK ON ITS OWN!

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Test Windows 2000 variant of PK-INIT
Joseph Sutton [Tue, 4 Jul 2023 03:28:04 +0000 (15:28 +1200)]
tests/krb5: Test Windows 2000 variant of PK-INIT

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add ASN.1 definitions for Windows 2000 PK-INIT
Joseph Sutton [Tue, 4 Jul 2023 03:40:31 +0000 (15:40 +1200)]
tests/krb5: Add ASN.1 definitions for Windows 2000 PK-INIT

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add tests for PK-INIT Freshness Extension (RFC 8070)
Joseph Sutton [Mon, 3 Jul 2023 04:34:11 +0000 (16:34 +1200)]
tests/krb5: Add tests for PK-INIT Freshness Extension (RFC 8070)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Remove unused methods
Joseph Sutton [Mon, 3 Jul 2023 04:43:37 +0000 (16:43 +1200)]
tests/krb5: Remove unused methods

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Check PAC_TYPE_CREDENTIAL_INFO PAC buffer
Joseph Sutton [Mon, 3 Jul 2023 02:46:23 +0000 (14:46 +1200)]
tests/krb5: Check PAC_TYPE_CREDENTIAL_INFO PAC buffer

When PK-INIT is performed, check that the buffer is as expected and
contains the correct NT hash.

The PK-INIT tests now pass against Windows Server 2019.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add PK-INIT testing framework
Joseph Sutton [Mon, 3 Jul 2023 02:43:10 +0000 (14:43 +1200)]
tests/krb5: Add PK-INIT testing framework

To run these tests standalone, you will need the certificate and private
key of the Certificate Authority. These can be specified together in the
same file with the environment variable CA_CERT, or the private key may
be specified in its own file with CA_PRIVATE_KEY.

If either of these files are encrypted, you can specify the password in
the environment variable CA_PASS.

These tests create a new certificate for the user account, signed with
the private key of the Certificate Authority. We negotiate the reply key
with either of the public-key and Diffie-Hellman PK-INIT variants, and
use the reply key to decrypt the enc-part in the response. We also check
that the KDC’s signatures are valid.

Most of the failures with the Heimdal KDC are due to the wrong nonce
being returned in the reply compared to Windows, which issue is simple
enough to correct.

An example command line for manual testing against Windows:
SMB_CONF_PATH=ad_dc.conf KRB5_CONFIG=krb5.conf SERVICE_USERNAME=win2k19-dc.example.com ADMIN_USERNAME=Administrator ADMIN_PASSWORD=locDCpass ADMIN_KVNO=1 FOR_USER=Administrator USERNAME=Administrator PASSWORD=locDCpass DC_SERVER=win2k19-dc.example.com SERVER=win2k19-dc.example.com DOMAIN=example REALM=example.com PYTHONPATH=bin/python STRICT_CHECKING=1 FAST_SUPPORT=1 CLAIMS_SUPPORT=1 COMPOUND_ID_SUPPORT=1 TKT_SIG_SUPPORT=1 FULL_SIG_SUPPORT=1 GNUTLS_PBKDF2_SUPPORT=1 EXPECT_PAC=1 EXPECT_EXTRA_PAC_BUFFERS=1 CHECK_CNAME=1 CHECK_PADATA=1 KADMIN_IS_TGS=0 FORCED_RC4=1 DEFAULT_ETYPES=36 CA_CERT=./win2k19-ca.pfx CA_PASS=1234 python3 python/samba/tests/krb5/pkinit_tests.py

To set up windows for this I first installed an Certificate Authority with an Enterprise CA.
Then I exported the private key and certificate of the CA:

1. go into the Certification Authority snap-in for the relevant computer,
2. right-clicking the CA
3. clicking ‘All Tasks’ → ‘Back up CA...’
4. and exporting the private key and CA certificate.

(I downloaded the resulting file via smbclient).

After setting up an Enterprise CA, I also needed to edit the domain
controller GPO to enable auto-enrollment, otherwise Windows would
refuse to accept as legitimate any certificates provided by the client.

That can be done by first enabling the policy:
 ‘Computer Configuration/Policies/Windows Settings/Security Settings/Public Key Policies/Certificate Services Client — Auto-Enrollment’,
and then ticking both ‘Renew expired certificates…’ and ‘Update certificates…’)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Allow KerberosCredentials to have associated RSA private key
Joseph Sutton [Mon, 3 Jul 2023 02:49:03 +0000 (14:49 +1200)]
tests/krb5: Allow KerberosCredentials to have associated RSA private key

This is needed for PK-INIT testing.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add helper methods for PK-INIT testing
Joseph Sutton [Mon, 3 Jul 2023 02:49:43 +0000 (14:49 +1200)]
tests/krb5: Add helper methods for PK-INIT testing

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Refactor encryption type selection
Joseph Sutton [Mon, 3 Jul 2023 02:41:55 +0000 (14:41 +1200)]
tests/krb5: Refactor encryption type selection

Add and use some methods to calculate the highest supported AES and RC4
encryption types, respectively.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add PK-INIT ASN1 definitions and include licence
Joseph Sutton [Wed, 21 Jun 2023 00:16:53 +0000 (12:16 +1200)]
tests/krb5: Add PK-INIT ASN1 definitions and include licence

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
9 months agotests/krb5: Add PKINIT pre-authentication types
Joseph Sutton [Tue, 20 Jun 2023 23:16:32 +0000 (11:16 +1200)]
tests/krb5: Add PKINIT pre-authentication types

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add PKINIT typed data errors
Joseph Sutton [Tue, 20 Jun 2023 23:13:46 +0000 (11:13 +1200)]
tests/krb5: Add PKINIT typed data errors

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Add PKINIT error codes
Joseph Sutton [Tue, 20 Jun 2023 23:11:12 +0000 (11:11 +1200)]
tests/krb5: Add PKINIT error codes

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agos4:kdc: Fix wrong debug message
Joseph Sutton [Thu, 22 Jun 2023 04:21:17 +0000 (16:21 +1200)]
s4:kdc: Fix wrong debug message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 months agotests/krb5: Remove unused variables
Joseph Sutton [Wed, 21 Jun 2023 04:42:29 +0000 (16:42 +1200)]
tests/krb5: Remove unused variables

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:nmbd: Fix code spelling
Andreas Schneider [Thu, 13 Jul 2023 07:09:48 +0000 (09:09 +0200)]
s3:nmbd: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jul 17 12:41:21 UTC 2023 on atb-devel-224

10 months agos3:nmbd: Fix trailing white spaces in nmbd_incomingrequests.c
Andreas Schneider [Thu, 13 Jul 2023 07:10:07 +0000 (09:10 +0200)]
s3:nmbd: Fix trailing white spaces in nmbd_incomingrequests.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:nmbd: Fix trailing white spaces in nmbd_incomingdgrams.c
Andreas Schneider [Thu, 13 Jul 2023 07:08:32 +0000 (09:08 +0200)]
s3:nmbd: Fix trailing white spaces in nmbd_incomingdgrams.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:nmbd: Fix trailing white spaces in nmbd.c
Andreas Schneider [Thu, 13 Jul 2023 07:08:01 +0000 (09:08 +0200)]
s3:nmbd: Fix trailing white spaces in nmbd.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:modules: Fix code spelling
Andreas Schneider [Thu, 13 Jul 2023 06:52:45 +0000 (08:52 +0200)]
s3:modules: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:modules: Remove fruit:ressource option with incorrect spelling
Andreas Schneider [Thu, 13 Jul 2023 07:03:18 +0000 (09:03 +0200)]
s3:modules: Remove fruit:ressource option with incorrect spelling

The plan was to remove it in 4.7. I think it is safe to remove it with
4.19.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:modules: Remove trailing white spaces of README.nfs4acls.txt
Andreas Schneider [Thu, 13 Jul 2023 06:55:31 +0000 (08:55 +0200)]
s3:modules: Remove trailing white spaces of README.nfs4acls.txt

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:modules: Remove trailing white spaces of vfs_hpuxacl.c
Andreas Schneider [Thu, 13 Jul 2023 06:53:26 +0000 (08:53 +0200)]
s3:modules: Remove trailing white spaces of vfs_hpuxacl.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:locking: Fix code spelling
Andreas Schneider [Thu, 13 Jul 2023 06:50:21 +0000 (08:50 +0200)]
s3:locking: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:librpc: Fix code spelling
Andreas Schneider [Thu, 13 Jul 2023 06:47:11 +0000 (08:47 +0200)]
s3:librpc: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agowscript: Fix code spelling
Andreas Schneider [Thu, 13 Jul 2023 06:46:20 +0000 (08:46 +0200)]
wscript: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agoexamples: Remove outdated validchars
Andreas Schneider [Thu, 13 Jul 2023 05:52:02 +0000 (07:52 +0200)]
examples: Remove outdated validchars

I don't think we even look into this anymore and have other tests in
place.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agoexample: Remove outdated config files from tridge
Andreas Schneider [Thu, 13 Jul 2023 05:44:44 +0000 (07:44 +0200)]
example: Remove outdated config files from tridge

I don't think he still runs Windows 95 ...

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:rpc_server:netlogon: generate FAULT_INVALID_TAG for invalid netr_LogonGetCapabilit...
Stefan Metzmacher [Sat, 15 Jul 2023 14:11:48 +0000 (16:11 +0200)]
s3:rpc_server:netlogon: generate FAULT_INVALID_TAG for invalid netr_LogonGetCapabilities levels

This is important as Windows clients with KB5028166 seem to
call netr_LogonGetCapabilities with query_level=2 after
a call with query_level=1.

An unpatched Windows Server returns DCERPC_NCA_S_FAULT_INVALID_TAG
for query_level values other than 1.
While Samba tries to return NT_STATUS_NOT_SUPPORTED, but
later fails to marshall the response, which results
in DCERPC_FAULT_BAD_STUB_DATA instead.

Because we don't have any documentation for level 2 yet,
we just try to behave like an unpatched server and
generate DCERPC_NCA_S_FAULT_INVALID_TAG instead of
DCERPC_FAULT_BAD_STUB_DATA.
Which allows patched Windows clients to keep working
against a Samba DC.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jul 17 07:35:09 UTC 2023 on atb-devel-224

10 months agos4:rpc_server:netlogon: generate FAULT_INVALID_TAG for invalid netr_LogonGetCapabilit...
Stefan Metzmacher [Sat, 15 Jul 2023 14:11:48 +0000 (16:11 +0200)]
s4:rpc_server:netlogon: generate FAULT_INVALID_TAG for invalid netr_LogonGetCapabilities levels

This is important as Windows clients with KB5028166 seem to
call netr_LogonGetCapabilities with query_level=2 after
a call with query_level=1.

An unpatched Windows Server returns DCERPC_NCA_S_FAULT_INVALID_TAG
for query_level values other than 1.
While Samba tries to return NT_STATUS_NOT_SUPPORTED, but
later fails to marshall the response, which results
in DCERPC_FAULT_BAD_STUB_DATA instead.

Because we don't have any documentation for level 2 yet,
we just try to behave like an unpatched server and
generate DCERPC_NCA_S_FAULT_INVALID_TAG instead of
DCERPC_FAULT_BAD_STUB_DATA.
Which allows patched Windows clients to keep working
against a Samba DC.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos4:torture/rpc: let rpc.schannel also check netr_LogonGetCapabilities with different...
Stefan Metzmacher [Sat, 15 Jul 2023 15:25:05 +0000 (17:25 +0200)]
s4:torture/rpc: let rpc.schannel also check netr_LogonGetCapabilities with different levels

The important change it that we expect DCERPC_NCA_S_FAULT_INVALID_TAG
for unsupported query_levels, we allow it to work with servers
with or without support for query_level=2.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agonetlogon.idl: add support for netr_LogonGetCapabilities response level 2
Stefan Metzmacher [Sat, 15 Jul 2023 15:20:32 +0000 (17:20 +0200)]
netlogon.idl: add support for netr_LogonGetCapabilities response level 2

We don't have any documentation about this yet, but tests against
a Windows Server 2022 patched with KB5028166 revealed that
the response for query_level=2 is exactly the same as
for querey_level=1.

Until we know the reason for query_level=2 we won't
use it as client nor support it in the server, but
we want ndrdump to work.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 months agos3:libsmb: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:26:30 +0000 (11:26 +0200)]
s3:libsmb: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jul 13 06:34:01 UTC 2023 on atb-devel-224

10 months agos3:libads: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:21:39 +0000 (11:21 +0200)]
s3:libads: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agos3:lib: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:16:18 +0000 (11:16 +0200)]
s3:lib: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agos3:include: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:10:23 +0000 (11:10 +0200)]
s3:include: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agos3:include: Remove trailing whitepaces in MacExtensions.h
Andreas Schneider [Wed, 5 Jul 2023 09:11:20 +0000 (11:11 +0200)]
s3:include: Remove trailing whitepaces in MacExtensions.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agopython:tests: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:07:52 +0000 (11:07 +0200)]
python:tests: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agopython: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:05:09 +0000 (11:05 +0200)]
python: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agoexamples: Fix code spelling
Andreas Schneider [Wed, 5 Jul 2023 09:02:04 +0000 (11:02 +0200)]
examples: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agoexamples: Make codespell happy
Andreas Schneider [Wed, 5 Jul 2023 09:01:25 +0000 (11:01 +0200)]
examples: Make codespell happy

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
10 months agoconfigure: ensure sizeof(int) >= 4
Douglas Bagnall [Fri, 7 Jul 2023 00:50:13 +0000 (12:50 +1200)]
configure: ensure sizeof(int) >= 4

There are multiple places we make this assumption. For example, in
source3/lib/tldap.c, we have this line

      if (ld->msgid == 2147483647) {

where ld->msgid is an int. And in librpc/idl/security.idl we have
several lines like:

      const int SEC_MASK_GENERIC        = 0xF0000000;

In lib/replace/inet_pton.c and inet_ntop.c we have

  /*
   * WARNING: Don't even consider trying to compile this on a system where
   * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
   */

but no attempt to enforce that as far as I can see, until now.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 11 22:44:15 UTC 2023 on atb-devel-224

10 months agodocs-xml: Fix script idmap backend documentation
Martin Schwenke [Tue, 4 Jul 2023 00:49:39 +0000 (10:49 +1000)]
docs-xml: Fix script idmap backend documentation

This was clearly copied from the tdb2 backend and incompletely edited.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Jul 10 23:47:12 UTC 2023 on atb-devel-224

10 months agodocs-xml: Tweak autorid idmap backend documentation
Martin Schwenke [Tue, 4 Jul 2023 00:51:59 +0000 (10:51 +1000)]
docs-xml: Tweak autorid idmap backend documentation

The name of the placeholder is misleading.  It certainly isn't per
domain, so we might as well indicate that it is per range.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agodocs-xml: Fix rid idmap backend documentation
Martin Schwenke [Tue, 4 Jul 2023 00:55:19 +0000 (10:55 +1000)]
docs-xml: Fix rid idmap backend documentation

The statement just above the example says the example demonstrates the
use of the base_rid parameter.  It doesn't, so fix this.

Also fix a typo.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agosmbd: don't leak the fsp if close_file_smb() fails
Ralph Boehme [Mon, 10 Jul 2023 14:34:23 +0000 (16:34 +0200)]
smbd: don't leak the fsp if close_file_smb() fails

This can happen if DELETE-ON-CLOSE is set, but the deletion fails for some
reason.

The bug was introduced by 1808e5c133474eabc9d3cf91c2a92ec4d92d9fdd.

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

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): Mon Jul 10 21:32:32 UTC 2023 on atb-devel-224

10 months agoctdb-server: Avoid logging a count of 0 resent calls
Martin Schwenke [Thu, 15 Jun 2023 00:31:07 +0000 (10:31 +1000)]
ctdb-server: Avoid logging a count of 0 resent calls

This fixes a little thinko in commit
80de84d36e9c29d9506976f991560fb5dde99471, where this was overlooked.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Jul 10 15:15:06 UTC 2023 on atb-devel-224

10 months agoctdb-tools: Switch tickle ACK sending message to INFO level
Martin Schwenke [Tue, 28 Feb 2023 21:51:08 +0000 (08:51 +1100)]
ctdb-tools: Switch tickle ACK sending message to INFO level

DEBUG level logging in ctdb_killtcp is very noisy.  The most important
messages when debugging are those for tickle ACKs and TCP RSTs.  TCP
RSTs are already logged at INFO level, so promote tickle ACKs to INFO
level too.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 months agoctdb-tools: Fix a typo in a log message
Martin Schwenke [Tue, 28 Feb 2023 21:43:30 +0000 (08:43 +1100)]
ctdb-tools: Fix a typo in a log message

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reported-by: Ulrich Sibiller <ulrich.sibiller@atos.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 months agoctdb-logging: Really make NOTICE the default debug level
Martin Schwenke [Fri, 10 Feb 2023 06:57:13 +0000 (17:57 +1100)]
ctdb-logging: Really make NOTICE the default debug level

NOTICE level debug messages in common/run_event.c are not logged by
default.

Currently eventd ends up using ERROR, since this is specified as
LOGGING_LOG_LEVEL_DEFAULT.  It doesn't inherit the debug level from
ctdbd and only uses NOTICE level when interactive.

Change the real logging default to NOTICE and use it everywhere.

Followups might be:

* Remove the default_log_level argument to logging_conf_init()
* Kick eventd to update debug level when "ctdb setdebug" is used

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 months agolibrpc/nbt: Avoid reading invalid member of union
Joseph Sutton [Wed, 5 Jul 2023 22:57:59 +0000 (10:57 +1200)]
librpc/nbt: Avoid reading invalid member of union

WACK packets use the ‘data’ member of the ‘nbt_rdata’ union, but they
claim to be a different type — NBT_QTYPE_NETBIOS — than would normally
be used with that union member. This means that if rr_type is equal to
NBT_QTYPE_NETBIOS, ndr_push_nbt_res_rec() has to guess which type the
structure really is by examining the data member. However, if the
structure is actually of a different type, that union member will not be
valid and accessing it will invoke undefined behaviour.

To fix this, eliminate all the guesswork and introduce a new type,
NBT_QTYPE_WACK, which can never appear on the wire, and which indicates
that although the ‘data’ union member should be used, the wire type is
actually NBT_QTYPE_NETBIOS.

This means that as far as NDR is concerned, the ‘netbios’ member of the
‘nbt_rdata’ union will consistently be used for all NBT_QTYPE_NETBIOS
structures; we shall no longer access the wrong member of the union.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38480

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Jul  7 01:14:06 UTC 2023 on atb-devel-224

10 months agolibrpc:ndr: Fix overflow in ndr_push_expand
Joseph Sutton [Wed, 5 Jul 2023 22:50:05 +0000 (10:50 +1200)]
librpc:ndr: Fix overflow in ndr_push_expand

If ‘size’ was equal to UINT32_MAX, the expression ‘size+1’ could
overflow to zero.

This could result in inadequate memory being allocated, which could
cause ndr_pull_compression_xpress_huff_raw_chunk() to overflow memory
with zero bytes.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57728

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
10 months agos3:rpc_server: Fix double blackslash issue in dfs path
Pavel Filipenský [Tue, 20 Jun 2023 14:24:55 +0000 (16:24 +0200)]
s3:rpc_server: Fix double blackslash issue in dfs path

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul  5 20:24:35 UTC 2023 on atb-devel-224

10 months agos3:rpc_server: Initialize consumedcnt to 0 in _dfs_GetInfo()
Pavel Filipenský [Fri, 23 Jun 2023 08:08:39 +0000 (10:08 +0200)]
s3:rpc_server: Initialize consumedcnt to 0 in _dfs_GetInfo()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agos3:tests: Add rpcclient 'dfsgetinfo' test
Pavel Filipenský [Fri, 23 Jun 2023 10:03:30 +0000 (12:03 +0200)]
s3:tests: Add rpcclient 'dfsgetinfo' test

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agosmbd: call exit_server_cleanly() to avoid panicking
Ralph Boehme [Wed, 5 Jul 2023 09:33:58 +0000 (11:33 +0200)]
smbd: call exit_server_cleanly() to avoid panicking

The parent smdb forwards SIGTERM to its process group in order to kill all
children like the scavenger. This happens from a function registered via
atexit() which means the signal forwarding is happening very briefly before the
main smbd process exits. When exiting the pipe between smbd and scavenger is
closed which triggers a file event in the scavenger.

However, due to kernel sheduling it is possible that the file descriptor event
is received before the signal, where we call exit_server() which call
smb_panic() at the end.

Change the exit to exit_server_cleanly() and just log this event at level 2
which we already do.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jul  5 13:14:08 UTC 2023 on atb-devel-224

10 months agos3:winbindd: let winbind_samlogon_retry_loop() fallback to NT_STATUS_NO_LOGON_SERVERS
Stefan Metzmacher [Tue, 4 Jul 2023 12:12:03 +0000 (14:12 +0200)]
s3:winbindd: let winbind_samlogon_retry_loop() fallback to NT_STATUS_NO_LOGON_SERVERS

When we were not able to get a valid response from any DC we should
report NT_STATUS_NO_LOGON_SERVERS with authoritative = 1.

This matches what windows does. In a chain of transitive
trusts the ACCESS_DENIED/authoritative=0 is not propagated,
instead NT_STATUS_NO_LOGON_SERVERS/authoritative=1 is
passed along the chain if there's no other DC is available.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 months agos3:winbindd: make use of reset_cm_connection_on_error() in winbind_samlogon_retry_loop()
Stefan Metzmacher [Tue, 4 Jul 2023 11:01:24 +0000 (13:01 +0200)]
s3:winbindd: make use of reset_cm_connection_on_error() in winbind_samlogon_retry_loop()

Note this is more than a simple invalidate_cm_connection() as it may set
domain->conn.netlogon_force_reauth = true, which is important in order
to recover from NT_STATUS_RPC_SEC_PKG_ERROR errors.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 months agos3:winbindd: let winbind_samlogon_retry_loop() always start with authoritative = 1
Stefan Metzmacher [Wed, 16 Feb 2022 13:19:16 +0000 (14:19 +0100)]
s3:winbindd: let winbind_samlogon_retry_loop() always start with authoritative = 1

Otherwise we could treat a local problem as non-authoritative.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 months agos3:winbindd: make use of reset_cm_connection_on_error() for winbindd_lookup_{names...
Stefan Metzmacher [Tue, 4 Jul 2023 10:32:34 +0000 (12:32 +0200)]
s3:winbindd: make use of reset_cm_connection_on_error() for winbindd_lookup_{names,sids}()

Note this is more than a simple invalidate_cm_connection() as it may set
domain->conn.netlogon_force_reauth = true.

This is not strictly needed as the callers call
reset_cm_connection_on_error() via reconnect_need_retry().
But it might avoid one roundtrip.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 months agos3:winbindd: call reset_cm_connection_on_error() in wb_cache_query_user_list()
Stefan Metzmacher [Tue, 4 Jul 2023 10:32:34 +0000 (12:32 +0200)]
s3:winbindd: call reset_cm_connection_on_error() in wb_cache_query_user_list()

This is mostly for consistency, every remote call should call
reset_cm_connection_on_error(). Note this is more than
a simple invalidate_cm_connection() as it may set
domain->conn.netlogon_force_reauth = true.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 months agoctdb-tests: Run ShellCheck on event-script unit test support scripts
Martin Schwenke [Mon, 3 Jul 2023 02:02:36 +0000 (12:02 +1000)]
ctdb-tests: Run ShellCheck on event-script unit test support scripts

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Jul  5 12:16:57 UTC 2023 on atb-devel-224

10 months agoctdb-tests: Avoid ShellCheck warnings
Martin Schwenke [Sun, 2 Jul 2023 23:32:26 +0000 (09:32 +1000)]
ctdb-tests: Avoid ShellCheck warnings

These are all trivial, so handle them in bulk.

* Change code to avoid (approximately sorted by frequency):

  SC2004 $/${} is unnecessary on arithmetic variables.
  SC2086 Double quote to prevent globbing and word splitting.
  SC2162 read without -r will mangle backslashes.
  SC2254 Quote expansions in case patterns to match literally rather than as a glob.
  SC2154 (warning): <variable> is referenced but not assigned.
  SC3037 (warning): In POSIX sh, echo flags are undefined.
  SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.
  SC2069 (warning): To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).
  SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
  SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
  SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.

* Locally disable checks:

  SC2034 (warning): <variable> appears unused. Verify use (or export if used externally).
  SC2086 (info): Double quote to prevent globbing and word splitting. [once]
  SC2120 (warning): <function> references arguments, but none are ever passed.
  SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

While touching reads for SC2162, switch unused variables to "_"
instead of "_x", which seems to be preferred by ShellCheck.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tests: Avoid ShellCheck warning SC2059
Martin Schwenke [Tue, 4 Jul 2023 00:30:05 +0000 (10:30 +1000)]
ctdb-tests: Avoid ShellCheck warning SC2059

  SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".

Move the format string to the function and just parameterise the share
type.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tests: Avoid ShellCheck warnings SC2046, SC2005
Martin Schwenke [Mon, 3 Jul 2023 01:54:15 +0000 (11:54 +1000)]
ctdb-tests: Avoid ShellCheck warnings SC2046, SC2005

In ./tests/UNIT/eventscripts/scripts/local.sh line 328:
echo $(ctdb ifaces -X | awk -F'|' 'FNR > 1 {print $2}')
             ^-- SC2046 (warning): Quote this to prevent word splitting.
             ^-- SC2005 (style): Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

Use xargs to get output on 1 line.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tests: Drop unreachable code
Martin Schwenke [Mon, 3 Jul 2023 01:42:56 +0000 (11:42 +1000)]
ctdb-tests: Drop unreachable code

This generates ShellCheck warnings:

In ./tests/UNIT/eventscripts/scripts/60.nfs.sh line 412:
if [ -n "$service_check_cmd" ]; then
                                 ^----------------^ SC2031 (info): service_check_cmd was modified in a subshell. That change might be lost.

In ./tests/UNIT/eventscripts/scripts/60.nfs.sh line 413:
if eval "$service_check_cmd"; then
                                         ^----------------^ SC2031 (info): service_check_cmd was modified in a subshell. That change might be lost.

service_check_cmd will never be set here because it is only set in a
sub-shell in rpc_set_service_failure_response().

This reverts some of commit 713ec217507d2f0d5f516efc45c8cd8773fccc14.

If testcases requiring use of service_check_cmd are later added then
this will need to be redone properly.  This would probably start by
renaming this function nfs_iterate_rpc_test().

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tests: Reformat with "shfmt -w -p -i 0 -fn"
Martin Schwenke [Sun, 2 Jul 2023 23:26:34 +0000 (09:26 +1000)]
ctdb-tests: Reformat with "shfmt -w -p -i 0 -fn"

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tests: Drop unused test code for tunables
Martin Schwenke [Fri, 16 Jun 2023 03:28:40 +0000 (13:28 +1000)]
ctdb-tests: Drop unused test code for tunables

This is unused since loading tunables was moved to ctdbd.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tests: Avoid ShellCheck warning SC2086
Martin Schwenke [Mon, 3 Jul 2023 02:10:28 +0000 (12:10 +1000)]
ctdb-tests: Avoid ShellCheck warning SC2086

  SC2086 Double quote to prevent globbing and word splitting.

Apparently ShellCheck is more picky about some of these than it used
to be.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-scripts: Avoid ShellCheck warnings SC2317, SC2086
Martin Schwenke [Mon, 3 Jul 2023 03:34:58 +0000 (13:34 +1000)]
ctdb-scripts: Avoid ShellCheck warnings SC2317, SC2086

New in ShellCheck 0.9.0:

  SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Also:

  SC2086 (info): Double quote to prevent globbing and word splitting.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb-tools: Avoid ShellCheck warning SC2317
Martin Schwenke [Mon, 3 Jul 2023 03:26:20 +0000 (13:26 +1000)]
ctdb-tools: Avoid ShellCheck warning SC2317

New in ShellCheck 0.9.0:

  SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>