asn/samba.git
3 years agoWIP master-samr-allow-rc4
Andreas Schneider [Wed, 8 Apr 2020 08:31:43 +0000 (10:31 +0200)]
WIP

3 years agoDEBUG
Andreas Schneider [Tue, 10 Mar 2020 16:47:08 +0000 (17:47 +0100)]
DEBUG

3 years agos4:rpc_server: Allow to use RC4 for setting passwords
Andreas Schneider [Fri, 15 Nov 2019 12:49:40 +0000 (13:49 +0100)]
s4:rpc_server: Allow to use RC4 for setting passwords

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agos3:rpc_server: Allow RC4 encrypted buffers in samr_SetUserInfo()
Andreas Schneider [Tue, 12 Nov 2019 15:56:45 +0000 (16:56 +0100)]
s3:rpc_server: Allow RC4 encrypted buffers in samr_SetUserInfo()

This is only allowed if we have an encrypted SMB3 connections!

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agolibrpc: Add dcerpc helper for checking named pipe connections
Andreas Schneider [Thu, 12 Mar 2020 13:11:56 +0000 (14:11 +0100)]
librpc: Add dcerpc helper for checking named pipe connections

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agos3:smbd: Add SMB3 connection information to session info
Andreas Schneider [Fri, 7 Feb 2020 15:48:29 +0000 (16:48 +0100)]
s3:smbd: Add SMB3 connection information to session info

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agoidl: Add SID_SAMBA_SMB3
Andreas Schneider [Fri, 7 Feb 2020 15:48:16 +0000 (16:48 +0100)]
idl: Add SID_SAMBA_SMB3

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agos3:smbd: Enforce encryption in smb2_create if the request was encrypted
Andreas Schneider [Tue, 10 Mar 2020 14:54:44 +0000 (15:54 +0100)]
s3:smbd: Enforce encryption in smb2_create if the request was encrypted

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agogitlab-ci: Add target for fips compliance testing
Andreas Schneider [Fri, 3 Apr 2020 09:19:17 +0000 (11:19 +0200)]
gitlab-ci: Add target for fips compliance testing

Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agos3:smbcacls: Add support for DFS path
Anubhav Rakshit [Sun, 7 Jun 2020 19:09:59 +0000 (00:39 +0530)]
s3:smbcacls: Add support for DFS path

smbcacls does not handle DFS paths correctly. This is beacuse once the
command encounters a path which returns STATUS_PATH_NOT_COVERED, it does
not attempt a GET REFERRAL.

We use cli_resolve_path API to perform a DFS path resolution to solve
the above problem.

Additionally this removes the known fail against smbcacls tests
Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul  7 23:03:00 UTC 2020 on sn-devel-184

3 years agoselftest: run smbcacls test against a share with a DFS link
Noel Power [Thu, 2 Jul 2020 10:44:36 +0000 (11:44 +0100)]
selftest: run smbcacls test against a share with a DFS link

The commit creates a dfs link in existing 'fileserver' env
share msdfs_share. Additionally we create a new dfs target in
a new share (with associated directory)

Additionally add a known fail as smbcacls doesn't not yet navigate DFS links.
A subsequent commit will fix smcacls to handle DFS (and remove the
knownfail)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: Add basic smbcacls test(s)
Noel Power [Tue, 30 Jun 2020 17:03:42 +0000 (18:03 +0100)]
selftest: Add basic smbcacls test(s)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4:rpc_server: Implement epmapper LookupHandleFree
Samuel Cabrero [Mon, 29 Jun 2020 10:49:33 +0000 (12:49 +0200)]
s4:rpc_server: Implement epmapper LookupHandleFree

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Tue Jul  7 13:43:14 UTC 2020 on sn-devel-184

3 years agos4:torture: Do not skip epmapper lookup terminate test in samba4
Samuel Cabrero [Mon, 29 Jun 2020 10:46:50 +0000 (12:46 +0200)]
s4:torture: Do not skip epmapper lookup terminate test in samba4

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoselftest: Split samba4 epmapper expected failures into individual tests
Samuel Cabrero [Mon, 29 Jun 2020 10:45:33 +0000 (12:45 +0200)]
selftest: Split samba4 epmapper expected failures into individual tests

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos4:selftest: test for smbtorture subunit names with and without --fullname
Sachin Prabhu [Fri, 26 Jun 2020 16:35:38 +0000 (16:35 +0000)]
s4:selftest: test for smbtorture subunit names with and without --fullname

We check the output with both --fullname and with the default shortname
to ensure it works as expected.

We also do tests for each level and test relative names are used.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User((no branch)): Stefan Metzmacher <metze@samba.org>
Autobuild-Date((no branch)): Tue Jul  7 12:16:34 UTC 2020 on sn-devel-184

3 years agos4:torture/local: Add new test to check smbtorture --fullname
Sachin Prabhu [Thu, 25 Jun 2020 17:02:28 +0000 (18:02 +0100)]
s4:torture/local: Add new test to check smbtorture --fullname

Add new always pass test to test smbtorture --fullname.

Since we test the printing of the fullname of the test, the test is
placed at the bottom of several levels of test suites.

test : local.smbtorture.level1.level2.level3.always_pass

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos4:torture: Add command line parameter --fullname
Sachin Prabhu [Fri, 3 Jul 2020 12:17:43 +0000 (14:17 +0200)]
s4:torture: Add command line parameter --fullname

This argument is used to print out the the full name which includes the
name of the test suite.

For example, the name in the output for the test smb2.read.dir is "dir".
By using the --fullname parameter, the name used will be
"smb2.read.dir".

The default continues to be to use the shortname.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos4:torture: avoid multiple recursions into the test lists
Stefan Metzmacher [Fri, 3 Jul 2020 13:58:38 +0000 (15:58 +0200)]
s4:torture: avoid multiple recursions into the test lists

torture_run_suite_restricted() and torture_run_tcase_restricted()
already handle recursion. If we call them from smbtorture
we should avoid our own recursion.

Without this passing 'smb2.multichannel.*' results in running
tests more than once.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos4:torture: use prefix_name() for all names in run_matching()
Stefan Metzmacher [Fri, 3 Jul 2020 13:53:18 +0000 (15:53 +0200)]
s4:torture: use prefix_name() for all names in run_matching()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib/torture: fix subunit names of nested suites
Stefan Metzmacher [Fri, 3 Jul 2020 13:40:31 +0000 (15:40 +0200)]
lib/torture: fix subunit names of nested suites

E.g. passing 'smb2.multichannel.generic' to smbtorture results in

- interface_info
- num_channels

While passing 'smb2.multichannel' to smbtorture results in:

- generic.interface_info
- genetic.num_channels
- oplocks.test1
...
- leases.test1
...

Before we got this:

- interface_info
- num_channels
- test1
...
- test1

That made it impossible to add knownfail entries for

leases.test1 vs. oplocks.test1

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib/torture: add back links to the parent objects
Stefan Metzmacher [Fri, 3 Jul 2020 13:37:25 +0000 (15:37 +0200)]
lib/torture: add back links to the parent objects

This makes would allow the full name of a test to be constructed
if needed in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib/torture: make torture_subunit_test_name() public
Stefan Metzmacher [Fri, 3 Jul 2020 12:41:16 +0000 (14:41 +0200)]
lib/torture: make torture_subunit_test_name() public

This makes it easier to modify.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoselftest/Samba4: split out _setup_ad_dc()
Stefan Metzmacher [Fri, 3 Jul 2020 20:23:20 +0000 (22:23 +0200)]
selftest/Samba4: split out _setup_ad_dc()

setup_ad_dc() was used for more than 'ad_dc'.
Setting up 'ad_dc' means not all missing arguments are
passed as undef.

The following had no effect

        if (!defined($conf_opts)) {
                $conf_opts = "";
        }

and $conf_opts results in a string of 'HASH(....)'

So we better pass explicit undef arguments from setup_ad_dc() to
_setup_ad_dc() now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:wscript: vfs_gpfs needs kernel oplock support
Stefan Metzmacher [Fri, 29 May 2020 08:39:00 +0000 (01:39 -0700)]
s3:wscript: vfs_gpfs needs kernel oplock support

It uses symbols, which are only available if we have
HAVE_KERNEL_OPLOCKS_LINUX defined.

This is not the case when building withing the
Windows Subsystem for Liux (WSL). So we better don't try to
build the vfs_gpfs module there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul  7 09:37:37 UTC 2020 on sn-devel-184

3 years agos3:smbd: check for stale pid in delay_for_oplock_fn() when leases_db_get() fails
Stefan Metzmacher [Mon, 6 Jul 2020 06:58:22 +0000 (08:58 +0200)]
s3:smbd: check for stale pid in delay_for_oplock_fn() when leases_db_get() fails

If leases_db_get() failed the leases_db record might have been cleaned up for
stale processes. Check if the share-mode-entry owner is stale in this case and
return ignore the entry. In any other case, log a debug messages and panic.

Commit 05d4466a6d1ad048fa86aea09ec0a56a7b961369
"smbd: check for stale pid in get_lease_type()" fixed only one half of
this.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul  7 02:47:46 UTC 2020 on sn-devel-184

3 years agos3:leases: log errors with level 0 in leases_db_do_locked_fn()
Stefan Metzmacher [Mon, 6 Jul 2020 12:03:39 +0000 (14:03 +0200)]
s3:leases: log errors with level 0 in leases_db_do_locked_fn()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodsdb/password_hash: don't double assign variables (CID 1363048, 1034720)
Douglas Bagnall [Wed, 22 May 2019 21:59:51 +0000 (09:59 +1200)]
dsdb/password_hash: don't double assign variables (CID 13630481034720)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jul  6 13:56:17 UTC 2020 on sn-devel-184

3 years agopypidl: check the result of py_dcerpc_ndr_pointer_deref()
Douglas Bagnall [Tue, 14 May 2019 23:53:07 +0000 (11:53 +1200)]
pypidl: check the result of py_dcerpc_ndr_pointer_deref()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agopolicy/gp: always close a file (CID 1445119)
Douglas Bagnall [Tue, 14 May 2019 22:54:33 +0000 (10:54 +1200)]
policy/gp: always close a file (CID 1445119)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos4/winbind/idmap: check the right variable (CID 1272950)
Douglas Bagnall [Thu, 9 May 2019 22:26:54 +0000 (10:26 +1200)]
s4/winbind/idmap: check the right variable (CID 1272950)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: check for stale pid in get_lease_type()
Ralph Boehme [Thu, 2 Jul 2020 12:47:12 +0000 (14:47 +0200)]
smbd: check for stale pid in get_lease_type()

If leases_db_get() failed the leases_db record might have been cleaned up for
stale processes. Check if the share-mode-entry owner is stale in this case and
return a 0 lease state. In any other case, log a debug messages and panic.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul  2 16:45:42 UTC 2020 on sn-devel-184

3 years agosmbd: let get_lease_type() take a non-const share_mode_entry
Ralph Boehme [Thu, 2 Jul 2020 12:45:59 +0000 (14:45 +0200)]
smbd: let get_lease_type() take a non-const share_mode_entry

We're going to add a call to share_entry_stale_pid(share_mode_entry) which takes
a non-const pointer (in order to eventually set e->state = true).

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agosmbd: inverse if/else logic in get_lease_type()
Ralph Boehme [Thu, 2 Jul 2020 12:08:44 +0000 (14:08 +0200)]
smbd: inverse if/else logic in get_lease_type()

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3/leases: log NDR decoding failure with level 0 in leases_db_get_fn()
Ralph Boehme [Thu, 2 Jul 2020 12:10:05 +0000 (14:10 +0200)]
s3/leases: log NDR decoding failure with level 0 in leases_db_get_fn()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: increase loglevel when leases_db_del() with anything then NT_STATUS_NOT_FOUND
Ralph Boehme [Thu, 2 Jul 2020 12:09:15 +0000 (14:09 +0200)]
smbd: increase loglevel when leases_db_del() with anything then NT_STATUS_NOT_FOUND

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:smbd: make sure vfs_ChDir() always sets conn->cwd_fsp->fh->fd = AT_FDCWD
Stefan Metzmacher [Wed, 1 Jul 2020 07:38:58 +0000 (09:38 +0200)]
s3:smbd: make sure vfs_ChDir() always sets conn->cwd_fsp->fh->fd = AT_FDCWD

This is what all consumers of conn->cwd_fsp->fh->fd expect!

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3:smbd: reformat if statement for caching in vfs_ChDir()
Stefan Metzmacher [Thu, 2 Jul 2020 10:06:28 +0000 (12:06 +0200)]
s3:smbd: reformat if statement for caching in vfs_ChDir()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos4:torture/smb2: add smb2.delete-on-close-perms.BUG14427
Stefan Metzmacher [Thu, 2 Jul 2020 12:32:34 +0000 (14:32 +0200)]
s4:torture/smb2: add smb2.delete-on-close-perms.BUG14427

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3:winbind:idmap_ad - make failure to get attrnames for schema mode fatal
Andrew [Tue, 30 Jun 2020 10:54:06 +0000 (06:54 -0400)]
s3:winbind:idmap_ad - make failure to get attrnames for schema mode fatal

Add check for failure to resolve the OID array for the schema mode into
names.

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

Signed-off-by: Andrew <awalker@ixsystems.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agolib/debug: set the correct default backend loglevel to MAX_DEBUG_LEVEL
Ralph Boehme [Tue, 30 Jun 2020 15:03:05 +0000 (17:03 +0200)]
lib/debug: set the correct default backend loglevel to MAX_DEBUG_LEVEL

This fixed a regression introduced by commit
c83ce5f4f99aef94530411ec82cc03e9935b352d for bug #14345.

The backend loglevel globally restricts logging of a particular backend. If this
value is smaller then any explicitly configured logging class, logging for this
class is skipped.

Eg, given the following logging config in smb.conf:

  log level = 1 auth_json_audit:3@/var/log/samba/samba_auth_audit.log

the default class loglevel of 1 (dbgc_config[DBGC_ALL].loglevel) will be
assigned to the backend loglevel.

So even though the logging class auth_json_audit is configured at level 3, this
doesn't become effective as the file backend drops all log messages with a level
below 1.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jul  2 13:25:29 UTC 2020 on sn-devel-184

3 years agolib/debug: assert file backend
Ralph Boehme [Tue, 30 Jun 2020 15:02:07 +0000 (17:02 +0200)]
lib/debug: assert file backend

The debug file backend is a built-in default, if it's missing we're totally
screwed.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoldap_client: Make ldap_parse_basic_url() IPv6-address aware
Volker Lendecke [Wed, 1 Jul 2020 14:10:17 +0000 (16:10 +0200)]
ldap_client: Make ldap_parse_basic_url() IPv6-address aware

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jul  2 12:01:06 UTC 2020 on sn-devel-184

3 years agoldap_client: Align integer types
Volker Lendecke [Fri, 26 Jun 2020 06:31:30 +0000 (08:31 +0200)]
ldap_client: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoldap_client: Make ldap_parse_basic_url take care of ldapi as well
Volker Lendecke [Thu, 25 Jun 2020 19:20:04 +0000 (21:20 +0200)]
ldap_client: Make ldap_parse_basic_url take care of ldapi as well

SUSV4's sscanf has the %m modifier, which allocates the right
amount. Remove those SMB_ASSERTS for string buffers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agopdb_dsdb: Fix typos
Volker Lendecke [Thu, 25 Jun 2020 13:59:48 +0000 (15:59 +0200)]
pdb_dsdb: Fix typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoldb_ldap: Fix a memleak
Volker Lendecke [Wed, 24 Jun 2020 14:50:34 +0000 (16:50 +0200)]
ldb_ldap: Fix a memleak

Don't allocate a temporary value on a long-term context

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
3 years agoCVE-2020-14303: s4 nbt: fix busy loop on empty UDP packet
Gary Lockyer [Wed, 24 Jun 2020 02:27:08 +0000 (14:27 +1200)]
CVE-2020-14303: s4 nbt: fix busy loop on empty UDP packet

An empty UDP packet put the nbt server into a busy loop that consumes
100% of a cpu.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Thu Jul  2 10:26:24 UTC 2020 on sn-devel-184

3 years agoCVE-2020-14303 Ensure an empty packet will not DoS the NBT server
Andrew Bartlett [Wed, 24 Jun 2020 23:59:54 +0000 (11:59 +1200)]
CVE-2020-14303 Ensure an empty packet will not DoS the NBT server

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-10760 dsdb: Add tests for paged_results and VLV over the Global Catalog...
Andrew Bartlett [Mon, 8 Jun 2020 04:32:14 +0000 (16:32 +1200)]
CVE-2020-10760 dsdb: Add tests for paged_results and VLV over the Global Catalog port

This should avoid a regression.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-10760 dsdb: Ensure a proper talloc tree for saved controls
Andrew Bartlett [Fri, 5 Jun 2020 10:14:48 +0000 (22:14 +1200)]
CVE-2020-10760 dsdb: Ensure a proper talloc tree for saved controls

Otherwise a paged search on the GC port will fail as the ->data was
not kept around for the second page of searches.

An example command to produce this is
 bin/ldbsearch --paged -H ldap://$SERVER:3268 -U$USERNAME%$PASSWORD

This shows up later in the partition module as:

ERROR: AddressSanitizer: heap-use-after-free on address 0x60b00151ef20 at pc 0x7fec3f801aac bp 0x7ffe8472c270 sp 0x7ffe8472c260
READ of size 4 at 0x60b00151ef20 thread T0 (ldap(0))
    #0 0x7fec3f801aab in talloc_chunk_from_ptr ../../lib/talloc/talloc.c:526
    #1 0x7fec3f801aab in __talloc_get_name ../../lib/talloc/talloc.c:1559
    #2 0x7fec3f801aab in talloc_check_name ../../lib/talloc/talloc.c:1582
    #3 0x7fec1b86b2e1 in partition_search ../../source4/dsdb/samdb/ldb_modules/partition.c:780

or

smb_panic_default: PANIC (pid 13287): Bad talloc magic value - unknown value
(from source4/dsdb/samdb/ldb_modules/partition.c:780)

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-10745: ndr/dns-utils: prepare for NBT compatibility
Douglas Bagnall [Thu, 14 May 2020 22:52:45 +0000 (10:52 +1200)]
CVE-2020-10745: ndr/dns-utils: prepare for NBT compatibility

NBT has a funny thing where it sometimes needs to send a trailing dot as
part of the last component, because the string representation is a user
name. In DNS, "example.com", and "example.com." are the same, both
having three components ("example", "com", ""); in NBT, we want to treat
them differently, with the second form having the three components
("example", "com.", "").

This retains the logic of e6e2ec0001fe3c010445e26cc0efddbc1f73416b.

Also DNS compression cannot be turned off for NBT.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10745: dns_util/push: forbid names longer than 255 bytes
Douglas Bagnall [Thu, 14 May 2020 12:06:08 +0000 (00:06 +1200)]
CVE-2020-10745: dns_util/push: forbid names longer than 255 bytes

As per RFC 1035.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10745: ndr_dns: do not allow consecutive dots
Douglas Bagnall [Fri, 24 Apr 2020 23:10:18 +0000 (11:10 +1200)]
CVE-2020-10745: ndr_dns: do not allow consecutive dots

The empty subdomain component is reserved for the root domain, which we
should only (and always) see at the end of the list. That is, we expect
"example.com.", but never "example..com".

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10745: ndr/dns_utils: correct a comment
Douglas Bagnall [Fri, 24 Apr 2020 23:03:30 +0000 (11:03 +1200)]
CVE-2020-10745: ndr/dns_utils: correct a comment

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10745: ndr_dns: move ndr_push_dns_string core into sharable function
Douglas Bagnall [Fri, 24 Apr 2020 23:02:08 +0000 (11:02 +1200)]
CVE-2020-10745: ndr_dns: move ndr_push_dns_string core into sharable function

This is because ndr_nbt.c does almost exactly the same thing with
almost exactly the same code, and they both do it wrong. Soon they
will both be using the better version that this will become. Though in
this patch we just move the code, not fix it.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10745: librpc/tests: cmocka tests of dns and ndr strings
Douglas Bagnall [Fri, 12 Jun 2020 02:26:38 +0000 (14:26 +1200)]
CVE-2020-10745: librpc/tests: cmocka tests of dns and ndr strings

These time the push and pull function in isolation.

Timing should be under 0.0001 seconds on even quite old hardware; we
assert it must be under 0.2 seconds.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10745: pytests: hand-rolled invalid dns/nbt packet tests
Douglas Bagnall [Thu, 11 Jun 2020 05:38:51 +0000 (17:38 +1200)]
CVE-2020-10745: pytests: hand-rolled invalid dns/nbt packet tests

The client libraries don't allow us to make packets that are broken in
certain ways, so we need to construct them as byte strings.

These tests all fail at present, proving the server is rendered
unresponsive, which is the crux of CVE-2020-10745.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agoCVE-2020-10730: lib ldb: Check if ldb_lock_backend_callback called twice
Gary Lockyer [Tue, 12 May 2020 22:56:56 +0000 (10:56 +1200)]
CVE-2020-10730: lib ldb: Check if ldb_lock_backend_callback called twice

Prevent use after free issues if ldb_lock_backend_callback is called
twice, usually due to ldb_module_done being called twice. This can happen if a
module ignores the return value from function a function that calls
ldb_module_done as part of it's error handling.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-10730: s4 dsdb vlv_pagination: Prevent repeat call of ldb_module_done
Gary Lockyer [Mon, 18 May 2020 00:37:39 +0000 (12:37 +1200)]
CVE-2020-10730: s4 dsdb vlv_pagination: Prevent repeat call of ldb_module_done

Check the return code from vlv_results, if it is not LDB_SUCCESS
ldb_module_done has already been called, and SHOULD NOT be called again.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-10730: s4 dsdb paged_results: Prevent repeat call of ldb_module_done
Gary Lockyer [Mon, 18 May 2020 00:36:57 +0000 (12:36 +1200)]
CVE-2020-10730: s4 dsdb paged_results: Prevent repeat call of ldb_module_done

Check the return code from paged_results, if it is not LDB_SUCCESS
ldb_module_done has already been called, and SHOULD NOT be called again.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoCVE-2020-10730: dsdb: Ban the combination of paged_results and VLV
Andrew Bartlett [Wed, 6 May 2020 04:18:19 +0000 (16:18 +1200)]
CVE-2020-10730: dsdb: Ban the combination of paged_results and VLV

This (two different paging controls) makes no sense and fails against
Windows Server 1709.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agoCVE-2020-10730: dsdb: Fix crash when vlv and paged_results are combined
Andrew Bartlett [Wed, 6 May 2020 05:05:30 +0000 (17:05 +1200)]
CVE-2020-10730: dsdb: Fix crash when vlv and paged_results are combined

The GUID is not returned in the DN for some reason in this (to be banned)
combination.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agoCVE-2020-10730: selftest: Add test to show that VLV and paged_results are incompatible
Andrew Bartlett [Wed, 6 May 2020 04:19:01 +0000 (16:19 +1200)]
CVE-2020-10730: selftest: Add test to show that VLV and paged_results are incompatible

As tested against Windows Server 1709

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agoCVE-2020-10730: vlv: Another workaround for mixing ASQ and VLV
Andrew Bartlett [Tue, 5 May 2020 04:34:11 +0000 (16:34 +1200)]
CVE-2020-10730: vlv: Another workaround for mixing ASQ and VLV

This is essentially an alternative patch, but without the correct
behaviour.  Instead this just avoids a segfault.

Included in case we have something simialr again in
another module.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agoCVE-2020-10730: selftest: Add test to confirm VLV interaction with ASQ
Andrew Bartlett [Tue, 5 May 2020 01:16:48 +0000 (13:16 +1200)]
CVE-2020-10730: selftest: Add test to confirm VLV interaction with ASQ

Tested against Windows 1709.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agoCVE-2020-10730: vlv: Do not re-ASQ search the results of an ASQ search with VLV
Andrew Bartlett [Tue, 5 May 2020 00:55:57 +0000 (12:55 +1200)]
CVE-2020-10730: vlv: Do not re-ASQ search the results of an ASQ search with VLV

This is a silly combination, but at least try and keep the results sensible
and avoid a double-dereference.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agoCVE-2020-10730: vlv: Use strcmp(), not strncmp() checking the NULL terminated control...
Andrew Bartlett [Tue, 5 May 2020 00:54:59 +0000 (12:54 +1200)]
CVE-2020-10730: vlv: Use strcmp(), not strncmp() checking the NULL terminated control OIDs

The end result is the same, as sizeof() includes the trailing NUL, but this
avoids having to think about that.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agos3: libsmb: Fix SMB2 client rename bug to a Windows server.
Jeremy Allison [Tue, 30 Jun 2020 21:00:41 +0000 (14:00 -0700)]
s3: libsmb: Fix SMB2 client rename bug to a Windows server.

Fix bug where renaming to a target name of one
UCS2 character (name length 2 bytes) fails to
a Windows 10 SMB2 server.

The Windows 10 SMB2 server has a minimum length
for a SMB2_FILE_RENAME_INFORMATION buffer of
24 bytes. It returns NT_STATUS_INFO_LENGTH_MISMATCH
if the length is less. This isn't an alignment
issue as Windows client happily 2-byte align
for larget target name sizes. Also the Windows 10
SMB1 server doesn't have this restriction.

If the name length is too short, pad out with
zeros to 24 bytes.

Hard to add a test for this as we don't want to
add this silly restriction to the Samba server
as it would break all non-Windows clients.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul  1 18:59:53 UTC 2020 on sn-devel-184

3 years agotls: Use NORMAL:-VERS-SSL3.0 as the default configuration
Andreas Schneider [Tue, 30 Jun 2020 15:12:17 +0000 (17:12 +0200)]
tls: Use NORMAL:-VERS-SSL3.0 as the default configuration

This seems to be really broken in GnuTLS and the documentation is also
not correct.

This partially reverts 53e3a959b958a3b099df6ecc5f6e294e96bd948e

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jul  1 14:56:33 UTC 2020 on sn-devel-184

3 years agoselftest: Run test of how userPassword / crypt() style passwords are stored in quicktest
Andrew Bartlett [Wed, 1 Jul 2020 02:31:54 +0000 (14:31 +1200)]
selftest: Run test of how userPassword / crypt() style passwords are stored in quicktest

This ensures that the crypt_r()/crypt_rn()/crypt() behaviour is tested in all
the samba-o3 builds and so is checked on RHEL7 in GitLab CI.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoselftest: Split samba.tests.samba_tool.user_virtualCryptSHA into GPG and not GPG...
Andrew Bartlett [Wed, 1 Jul 2020 02:30:24 +0000 (14:30 +1200)]
selftest: Split samba.tests.samba_tool.user_virtualCryptSHA into GPG and not GPG parts

This allows the userPassword (not GPG) part of the test to run on hosts without
python3-gpg (eg RHEL7) while still testing the userPassword handling.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agodsdb: Allow "password hash userPassword schemes = CryptSHA256" to work on RHEL7
Andrew Bartlett [Wed, 1 Jul 2020 02:35:39 +0000 (14:35 +1200)]
dsdb: Allow "password hash userPassword schemes = CryptSHA256" to work on RHEL7

On RHEL7 crypt_r() will set errno.  This is a problem because the implementation of crypt_r()
in RHEL8 and elsewhere in libcrypt will return non-NULL but set errno on failure.

The workaround is to use crypt_rn(), provided only by libcrypt, which will return NULL
on failure, and so avoid checking errno in the non-failure case.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoshare_mode_lock.c: initialize out param
Isaac Boukris [Mon, 29 Jun 2020 08:42:09 +0000 (10:42 +0200)]
share_mode_lock.c: initialize out param

detected by covscan:
source3/locking/share_mode_lock.c:1563:6: warning: Branch condition evaluates to a garbage value

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Tue Jun 30 09:42:33 UTC 2020 on sn-devel-184

3 years agolibgpo: only install group policy admx files when building as DC
Günther Deschner [Fri, 26 Jun 2020 08:35:13 +0000 (10:35 +0200)]
libgpo: only install group policy admx files when building as DC

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Jun 30 07:51:48 UTC 2020 on sn-devel-184

3 years agoutil: fix build on AIX by fixing the order of replace.h include
Bjoern Jacke [Mon, 29 Jun 2020 12:00:46 +0000 (12:00 +0000)]
util: fix build on AIX by fixing the order of replace.h include

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Mon Jun 29 18:19:04 UTC 2020 on sn-devel-184

3 years agos3:smbd: fix the handling of the durable_v2_timeout
Stefan Metzmacher [Wed, 24 Jun 2020 16:01:46 +0000 (18:01 +0200)]
s3:smbd: fix the handling of the durable_v2_timeout

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jun 27 05:42:05 UTC 2020 on sn-devel-184

3 years agos4:torture/smb2: adjust durable v2 tests to pass against Windows Server 2019
Stefan Metzmacher [Wed, 24 Jun 2020 15:48:24 +0000 (17:48 +0200)]
s4:torture/smb2: adjust durable v2 tests to pass against Windows Server 2019

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4:torture/smb2: remove MULTI_CHANNEL checking from smb2.replay.channel-sequence
Stefan Metzmacher [Wed, 24 Jun 2020 15:41:15 +0000 (17:41 +0200)]
s4:torture/smb2: remove MULTI_CHANNEL checking from smb2.replay.channel-sequence

This test doesn't need multi-channel. But we need to
force using the channel_sequence, as our client libraries
only use them for multi-channel connections or persistent handles.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest/Samba3: support durable handles on the 'aio' share
Stefan Metzmacher [Wed, 24 Oct 2012 13:55:20 +0000 (15:55 +0200)]
selftest/Samba3: support durable handles on the 'aio' share

This means we can test the lock sequence checking via the
'samba3.smb2.lock aio(nt4_dc)' test.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:smb2_lock: implement lock_sequence replay detection
Stefan Metzmacher [Wed, 24 Oct 2012 13:55:20 +0000 (15:55 +0200)]
s3:smb2_lock: implement lock_sequence replay detection

While windows enables it only for resilient and persistent handles a SMB server
SHOULD (according to MS-SMB2 section 3.3.5.14 ) activate processing of lock
sequence numbers:

... if Open.IsResilient or Open.IsDurable or Open.IsPersistent is TRUE or if
Connection.Dialect belongs to the SMB 3.x dialect family and
Connection.ServerCapabilities includes SMB2_GLOBAL_CAP_MULTI_CHANNEL ...

We only support durable handles or multichannel, so we only implement
these according to the specification.

But we have 'smb2 disable lock sequence checking = yes' to force
to match the Windows Server bahavior, which only supports this
for resilient and persistent handles.

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Pair-Programmed-With: Guenther Deschner <gd@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodocs-xml/smbdotconf: add "smb2 disable lock sequence checking"
Stefan Metzmacher [Tue, 23 Jun 2020 16:30:15 +0000 (18:30 +0200)]
docs-xml/smbdotconf: add "smb2 disable lock sequence checking"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:smb2_lock: pass in_lock_sequence to smbd_smb2_lock_send()
Stefan Metzmacher [Wed, 24 Oct 2012 12:53:05 +0000 (14:53 +0200)]
s3:smb2_lock: pass in_lock_sequence to smbd_smb2_lock_send()

Take the value from the client if the dialect is SMB2_10 or higher,
otherwise default to 0.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:smbXsrv_open: initialize smbXsrv_open_global->lock_sequence_array with 0xFF
Stefan Metzmacher [Wed, 24 Oct 2012 13:17:56 +0000 (15:17 +0200)]
s3:smbXsrv_open: initialize smbXsrv_open_global->lock_sequence_array with 0xFF

This is way to mark an entry as invalid (.valid = false).

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:smbXsrv.idl: add lock_sequence_array to smbXsrv_open_global0
Stefan Metzmacher [Wed, 24 Oct 2012 13:06:54 +0000 (15:06 +0200)]
s3:smbXsrv.idl: add lock_sequence_array to smbXsrv_open_global0

This is needed for lock replay detection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4:torture/smb2: add smb2.lock.replay_smb3_specification test
Stefan Metzmacher [Wed, 2 Oct 2019 13:30:53 +0000 (15:30 +0200)]
s4:torture/smb2: add smb2.lock.replay_smb3_specification test

This implements a test that checks for the specified behaviour.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4:torture/smb2: make smb2.lock.replay_broken_windows more obvious
Stefan Metzmacher [Wed, 2 Oct 2019 12:51:26 +0000 (14:51 +0200)]
s4:torture/smb2: make smb2.lock.replay_broken_windows more obvious

This test checks the SMB 2.1.0 behaviour of lock sequence checking,
which is only turned on for resilient handles.

Even Windows Server 2019 only implements lock sequence checking only
for resilient and persistent handles as a server.
While its client side uses lock sequence checking if it negotiated
multichannel with the server.

Hopefully this will be fixed in future Windows versions.

Make it clear that this test is supposed to pass against the legacy
Windows servers which violate the specification:

  [MS-SMB2] 3.3.5.14 Receiving an SMB2 LOCK Request

  ...

  ... if Open.IsResilient or Open.IsDurable or Open.IsPersistent is
  TRUE or if Connection.Dialect belongs to the SMB 3.x dialect family
  and Connection.ServerCapabilities includes
  SMB2_GLOBAL_CAP_MULTI_CHANNEL bit, the server SHOULD<314>
  perform lock sequence verification ...

  ...

  <314> Section 3.3.5.14: Windows 7 and Windows Server 2008 R2 perform
  lock sequence verification only when Open.IsResilient is TRUE.
  Windows 8 through Windows 10 v1909 and Windows Server 2012 through
  Windows Server v1909 perform lock sequence verification only when
  Open.IsResilient or Open.IsPersistent is TRUE.

Note <314> also applies to all versions (at least) up to Windows Server v2004.

Hopefully this will be fixed in future Windows versions and they
will avoid Note <314>.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4:torture/smb2: fix and improve the smb2.lock.replay test
Michael Adam [Thu, 20 Sep 2018 10:45:17 +0000 (12:45 +0200)]
s4:torture/smb2: fix and improve the smb2.lock.replay test

The test was wrong in that it used an invalid
lock sequence bucket (65) where it actually wanted
to use a valid on (64), and hence the test results
(which were adapted to the real responses) were not
quite logical.

This patch fixes this and also improves some of
the comments so that the flow of the patch becomes
a little more obvious.

Pair-Programmed-With: Günther Deschner <gd@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agotorture4: openattr always succeeds
David Mulder [Fri, 13 Dec 2019 20:08:28 +0000 (13:08 -0700)]
torture4: openattr always succeeds

Because this test returned true, it would always
succeed, despite failures in the test. Make it
return false if there are failures. Also, removed
a stray CHECK_MAX_FAILURES introduced by commit
8773e743 that caused the test to *always* fail
(but always be ignored).

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Wed Jun 24 22:13:11 UTC 2020 on sn-devel-184

3 years agoConvert samba4.base.deny* tests to smb2
David Mulder [Tue, 17 Dec 2019 21:03:19 +0000 (14:03 -0700)]
Convert samba4.base.deny* tests to smb2

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Noel Power <noel.power@suse.com>
3 years agos4:torture: Convert samba4.base.vuid test to smb2
David Mulder [Thu, 16 Jan 2020 17:26:25 +0000 (10:26 -0700)]
s4:torture: Convert samba4.base.vuid test to smb2

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Noel Power <noel.power@suse.com>
3 years agos4:torture: Convert samba4.base.secleak test to smb2
David Mulder [Fri, 17 Jan 2020 16:07:00 +0000 (09:07 -0700)]
s4:torture: Convert samba4.base.secleak test to smb2

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Noel Power <noel.power@suse.com>
3 years agos3: smbd: Allow a SHUTDOWN_CLOSE on a file with outstanding aio if there are no clien...
Jeremy Allison [Tue, 16 Jun 2020 22:01:49 +0000 (15:01 -0700)]
s3: smbd: Allow a SHUTDOWN_CLOSE on a file with outstanding aio if there are no client connections alive.

The process is exiting now so pthreads will never complete to cause
problems.

Remove the knownfail.d/aio_outstanding entry.

Followup-bugfix for:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 24 20:14:15 UTC 2020 on sn-devel-184

3 years agos3: smbd: Make smbXsrv_client_valid_connections() external.
Jeremy Allison [Tue, 16 Jun 2020 21:58:54 +0000 (14:58 -0700)]
s3: smbd: Make smbXsrv_client_valid_connections() external.

We will need to this ensure our client connections are
terminated in close_file before exiting with outstanding
aio.

Followup-bugfix for:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: selftest: Add samba3.blackbox.aio-outstanding test.
Jeremy Allison [Mon, 22 Jun 2020 20:44:12 +0000 (13:44 -0700)]
s3: selftest: Add samba3.blackbox.aio-outstanding test.

Shows smbd panics if connection is terminated (torn down)
by killing the client with outstanding aio requests in the
queue. As we're closing smbd we should cope with this.

Followup-bugfix for:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agogpo: Test samba-tool gpo admxload
David Mulder [Thu, 18 Jun 2020 18:06:28 +0000 (12:06 -0600)]
gpo: Test samba-tool gpo admxload

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Tue Jun 23 17:53:22 UTC 2020 on sn-devel-184

3 years agosamba-tool: add command for installing gpo samba admx
David Mulder [Tue, 16 Oct 2018 09:36:09 +0000 (03:36 -0600)]
samba-tool: add command for installing gpo samba admx

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agoAdd python binding for DATADIR build path
David Mulder [Tue, 16 Oct 2018 09:23:34 +0000 (03:23 -0600)]
Add python binding for DATADIR build path

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agogpo: Test gpo scripts apply
David Mulder [Tue, 16 Jun 2020 21:29:40 +0000 (15:29 -0600)]
gpo: Test gpo scripts apply

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agogpo: Run Group Policy Scripts
David Mulder [Mon, 27 Apr 2020 22:02:55 +0000 (16:02 -0600)]
gpo: Run Group Policy Scripts

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>