asn/samba.git
4 years agos3:rpc_server: Shutdown registered enpoint servers on server exit
Samuel Cabrero [Thu, 19 Mar 2020 12:00:52 +0000 (13:00 +0100)]
s3:rpc_server: Shutdown registered enpoint servers on server exit

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Initialize global dcesrv_context for embedded services
Samuel Cabrero [Tue, 26 Feb 2019 12:58:43 +0000 (13:58 +0100)]
s3:rpc_server: Initialize global dcesrv_context for embedded services

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Add global dcesrv_context init and shutdown functions
Samuel Cabrero [Wed, 30 Oct 2019 16:00:05 +0000 (17:00 +0100)]
s3:rpc_server: Add global dcesrv_context init and shutdown functions

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:winbindd: Register endpoint servers in winbindd daemon
Samuel Cabrero [Thu, 28 Feb 2019 12:32:53 +0000 (13:32 +0100)]
s3:winbindd: Register endpoint servers in winbindd daemon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Register endpoint servers in external mdssd daemon
Samuel Cabrero [Tue, 26 Feb 2019 12:52:39 +0000 (13:52 +0100)]
s3:rpc_server: Register endpoint servers in external mdssd daemon

The parent calls the setup function to register the endpoint server, as
it has to be registered to initialize the endpoints (create the sockets).

Delete the setup call from forker childs as it is already registered by
the parent.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Register endpoint servers in external spoolssd daemon
Samuel Cabrero [Tue, 26 Feb 2019 12:51:23 +0000 (13:51 +0100)]
s3:rpc_server: Register endpoint servers in external spoolssd daemon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Register endpoint servers in external fssd daemon
Samuel Cabrero [Tue, 26 Feb 2019 12:50:37 +0000 (13:50 +0100)]
s3:rpc_server: Register endpoint servers in external fssd daemon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Register endpoint servers in external lsasd daemon
Samuel Cabrero [Tue, 26 Feb 2019 12:48:33 +0000 (13:48 +0100)]
s3:rpc_server: Register endpoint servers in external lsasd daemon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Register endpoint servers in external epmd daemon
Samuel Cabrero [Tue, 26 Feb 2019 12:40:44 +0000 (13:40 +0100)]
s3:rpc_server: Register endpoint servers in external epmd daemon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Register endpoint servers for embedded services
Samuel Cabrero [Fri, 15 Nov 2019 13:26:28 +0000 (14:26 +0100)]
s3:rpc_server: Register endpoint servers for embedded services

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Provide LSA ncacn_np secondary endpoint and LSA over Netlogon
Samuel Cabrero [Thu, 14 Feb 2019 13:21:25 +0000 (14:21 +0100)]
s3:rpc_server: Provide LSA ncacn_np secondary endpoint and LSA over Netlogon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftests: Tests only appropiate RPC interfaces are available in smb pipes
Samuel Cabrero [Tue, 26 Nov 2019 13:16:14 +0000 (14:16 +0100)]
selftests: Tests only appropiate RPC interfaces are available in smb pipes

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftests: Test lsa over netlogon in nt4 dc environment
Samuel Cabrero [Fri, 15 Nov 2019 13:24:31 +0000 (14:24 +0100)]
selftests: Test lsa over netlogon in nt4 dc environment

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:rpc_server: Include generated boilerplate code
Samuel Cabrero [Fri, 22 Feb 2019 17:30:45 +0000 (18:30 +0100)]
s3:rpc_server: Include generated boilerplate code

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopidl:NDR/ServerCompat: Compat server PIDL parser
Samuel Cabrero [Tue, 15 Jan 2019 16:55:07 +0000 (17:55 +0100)]
pidl:NDR/ServerCompat: Compat server PIDL parser

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: Run python.samba.tests.dcerpc.raw_protocol against S3 ad_member
Samuel Cabrero [Thu, 3 Oct 2019 12:18:17 +0000 (14:18 +0200)]
selftest: Run python.samba.tests.dcerpc.raw_protocol against S3 ad_member

The goal is to pass the raw protocol testsuite against s3 RPC server.
To do so we need to enable epmd and lsasd daemons, as the testsuite
connects to the endpoint mapper and lsa endpoints using NCACN_IP_TCP
and NCACN_NP transports.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agogitlab-ci: Add Fedora 32 (Beta)
Andreas Schneider [Thu, 19 Mar 2020 09:32:17 +0000 (10:32 +0100)]
gitlab-ci: Add Fedora 32 (Beta)

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): Fri Mar 20 15:19:50 UTC 2020 on sn-devel-184

4 years agogitlab-ci: Remove Fedora 30
Andreas Schneider [Thu, 19 Mar 2020 09:28:23 +0000 (10:28 +0100)]
gitlab-ci: Remove Fedora 30

It is pretty similar to Fedora 31, so remove it safe some CI resources.
We will add Fedora 32 next.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agogitlab-ci: Remove Fedora 29 which is already EOL
Andreas Schneider [Thu, 19 Mar 2020 09:23:02 +0000 (10:23 +0100)]
gitlab-ci: Remove Fedora 29 which is already EOL

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agothird_party: Update nss_wrapper to version 1.1.10
Andreas Schneider [Mon, 16 Mar 2020 16:00:16 +0000 (17:00 +0100)]
third_party: Update nss_wrapper to version 1.1.10

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

4 years agobootstrap: Add podman command to readme
Andreas Schneider [Tue, 17 Mar 2020 16:39:48 +0000 (17:39 +0100)]
bootstrap: Add podman command to readme

Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agolibsmb: Don't try to find posix stat info in SMBC_getatr()
Volker Lendecke [Thu, 19 Mar 2020 10:01:41 +0000 (11:01 +0100)]
libsmb: Don't try to find posix stat info in SMBC_getatr()

This wrongly used "frame" instead of "fname", which can never have
worked. A first attempt to fix in 51551e0d53fa6 caused a few followup
patches in an attempt to clean up the test failures 51551e0d53fa6
introduced. They were reverted after a few discussions. So rather than
changing behaviour, just remove the code that introduced the valgrind
error again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 20 05:06:07 UTC 2020 on sn-devel-184

4 years agos4/param: py_sid shouldn't be decref'ed after insertion into dict
Noel Power [Mon, 16 Mar 2020 16:00:24 +0000 (16:00 +0000)]
s4/param: py_sid shouldn't be decref'ed after insertion into dict

This was causing samba.tests.net_join_no_spnego(ad_dc) to
core dumps sometimes on tumbleweed with python3.8

with...

===============================================================
INTERNAL ERROR: Signal 11 in pid 1781 (4.12.0)
If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
===============================================================
smb_panic_default: PANIC (pid 1781): internal error
BACKTRACE: 64 stack frames:

7128  #0 bin/shared/libsamba-util.so.0(log_stack_trace+0x1f) [0x7fa541c5b220]
7129  #1 bin/shared/libsamba-util.so.0(+0x1efc8) [0x7fa541c5afc8]
7130  #2 bin/shared/libsamba-util.so.0(log_stack_trace+0) [0x7fa541c5b201]
7131  #3 bin/shared/libsamba-util.so.0(+0x1eed9) [0x7fa541c5aed9]
7132  #4 bin/shared/libsamba-util.so.0(+0x1eeee) [0x7fa541c5aeee]
7133  #5 /lib64/libc.so.6(+0x3bf20) [0x7fa542631f20]
7134  #6 /usr/lib64/libpython3.8.so.1.0(PyObject_GC_UnTrack+0xd) [0x7fa542386c1d]
7135  #7 /usr/lib64/libpython3.8.so.1.0(+0x12d599) [0x7fa542387599]
7136  #8 /usr/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x4d6d) [0x7fa5424269ed]
7137  #9 /usr/lib64/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x30c) [0x7fa5423eaf5c]
7138  #10 /usr/lib64/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x18e) [0x7fa5423ebcbe]
7139  #11 /usr/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x4a3a) [0x7fa5424266ba]
etc....

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar 19 22:23:52 UTC 2020 on sn-devel-184

4 years agos4/param: treat NULL value passed to dict_insert as error
Noel Power [Mon, 16 Mar 2020 15:54:00 +0000 (15:54 +0000)]
s4/param: treat NULL value passed to dict_insert as error

insert_dict is used as a convenience to decrement the values to
prevent leaks with orpahaned PyObjects and avoid excessive creation of
temp variables.

        if (!dict_insert(parameters,
                         "rootdn",
                         PyUnicode_FromString(settings->root_dn_str))) {
                status = NT_STATUS_UNSUCCESSFUL;
                goto out;
        }

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4/param: don't decref object we don't own
Noel Power [Mon, 16 Mar 2020 15:27:15 +0000 (15:27 +0000)]
s4/param: don't decref object we don't own

provision_fn is a borrowed reference we should not
call Py_CLEAR on it

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agobootstrap: Bring back a Ubuntu 16.04 build but just for the samba-fuzz task
Andrew Bartlett [Tue, 17 Mar 2020 03:49:02 +0000 (16:49 +1300)]
bootstrap: Bring back a Ubuntu 16.04 build but just for the samba-fuzz task

This is needed to restore oss-fuzz support, as this uses the Ubuntu 16.04 package list
because all the docker images provided start with a Ubuntu 16.04 base.

REF: https://github.com/google/oss-fuzz/issues/3505
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21189

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agobuild: Allow a fuzzing build with Python 3.5
Andrew Bartlett [Tue, 17 Mar 2020 04:07:02 +0000 (17:07 +1300)]
build: Allow a fuzzing build with Python 3.5

The Python 3.6 changes are only in actual .py files, not in the build system
nor the C side of things, so relax this so we can still build on oss-fuzz
which is based on Ubuntu 16.04 for now.

REF: https://github.com/google/oss-fuzz/issues/3505
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21189

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agopython/samba/gp_parse: Fix test errors with python3.8
Noel Power [Fri, 13 Mar 2020 17:32:20 +0000 (17:32 +0000)]
python/samba/gp_parse: Fix test errors with python3.8

UNEXPECTED(failure): samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.test_backup_restore_generalize(ad_dc:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "/tmp/samba-testbase/b28/samba-ad-dc-1/bin/python/samba/tests/samba_tool/gpo.py", line 434, in test_backup_restore_generalize
    self.assertIsNone(has_difference(os.path.join(new_path, 'policy',

This caused because prior to 3.8 minodom.toprettyxml() was sorting the
attribute order, now it preserves the attribute order specified by the user
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests: Add test for weak crypto
Andreas Schneider [Wed, 11 Mar 2020 17:35:57 +0000 (18:35 +0100)]
tests: Add test for weak crypto

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agowaf: Check if GnuTLS has support for crypto policies
Andreas Schneider [Thu, 12 Mar 2020 06:13:00 +0000 (07:13 +0100)]
waf: Check if GnuTLS has support for crypto policies

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:ntlmssp: Mark as weak_crypto
Andreas Schneider [Mon, 11 Nov 2019 15:39:24 +0000 (16:39 +0100)]
auth:ntlmssp: Mark as weak_crypto

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agogensec: Add a check if a gensec module implements weak crypto
Andreas Schneider [Wed, 11 Dec 2019 16:45:39 +0000 (17:45 +0100)]
gensec: Add a check if a gensec module implements weak crypto

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:param: Add lp(cfg)_weak_crypto()
Andreas Schneider [Mon, 4 Nov 2019 16:15:14 +0000 (17:15 +0100)]
lib:param: Add lp(cfg)_weak_crypto()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:utils: Add weak crypto information to testparm
Andreas Schneider [Mon, 4 Nov 2019 16:26:48 +0000 (17:26 +0100)]
s3:utils: Add weak crypto information to testparm

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib:crypto: Add samba_gnutls_weak_crypto()
Andreas Schneider [Mon, 4 Nov 2019 16:01:50 +0000 (17:01 +0100)]
lib:crypto: Add samba_gnutls_weak_crypto()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosmbd: let delayed update handler also update on-disk timestamps
Ralph Boehme [Sun, 15 Mar 2020 07:30:21 +0000 (08:30 +0100)]
smbd: let delayed update handler also update on-disk timestamps

Let delayed update handler also update on-disk timestamps by calling
trigger_write_time_update_immediate().

trigger_write_time_update_immediate() sets fsp->update_write_time_on_close to
false which prevents updating the write-time on close if there was ever only one
write to the file.

Besides resetting fsp->update_write_time_on_close and setting the on-disk timestamps
trigger_write_time_update_immediate() takes the same steps as the removed code.

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

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): Thu Mar 19 03:05:40 UTC 2020 on sn-devel-184

4 years agosmbd: let mark_file_modified() always call trigger_write_time_update()
Ralph Boehme [Sun, 15 Mar 2020 07:30:21 +0000 (08:30 +0100)]
smbd: let mark_file_modified() always call trigger_write_time_update()

Preperatory change: the next commit will reset fsp->update_write_time_on_close
in the event handler, so this change ensures it gets set again for any
subsequent write.

This will NOT always result in a write-time update because
trigger_write_time_update() has its own only-once logic using the internal
variable fsp->update_write_time_triggered.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture/smb2: delayed timestamp updates test: more then one write
Ralph Boehme [Sun, 15 Mar 2020 15:46:16 +0000 (16:46 +0100)]
torture/smb2: delayed timestamp updates test: more then one write

Verify a close updates the write-time for subsequent writes after an initial
write started the delayed update logic.

This covers a scenario that will become relevant with the two subsequent
commits. The next commit:

  smbd: let mark_file_modified() always call trigger_write_time_update()

ensures that trigger_write_time_update() is not only called for the first write
on a file. Without that preaparatory change, the second commit:

  smbd: let delayed update handler also update on-disk timestamps

alone would cause this test to fail.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture/smb2: delayed timestamp update test: single write
Ralph Boehme [Sat, 14 Mar 2020 15:43:48 +0000 (16:43 +0100)]
torture/smb2: delayed timestamp update test: single write

Verify close only updates write-time when a delayed update is actually pending.

This scenario is not covered by basic.delaywrite.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove stat call from mark_file_modified()
Ralph Boehme [Sun, 15 Mar 2020 14:51:18 +0000 (15:51 +0100)]
smbd: remove stat call from mark_file_modified()

This stat dates back to d03453864ab1bc5fd3b4a3abaf96176a006c102b where the call
to trigger_write_time_update() had been to the file IO codepath. It was present
there for other reasons: to setup the write-cache based on the file's size.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture/smb2: Windows 2019 15 ms timestamp resolution
Ralph Boehme [Fri, 6 Mar 2020 15:21:47 +0000 (16:21 +0100)]
torture/smb2: Windows 2019 15 ms timestamp resolution

This test demonstrates that Windows has a timestamp resolution of ~15ms.

When a smaller amount of time than that has passed between modifying operations
on a file, it's not necessarily detectable on a Windows 2019 server that
implements immediate timestamp updates (no delayed magic).

Note that this test relies on a low latency SMB connection. Even with a low
latency connection of eg 1m there's a chance of 1/15 that the first part of the
test expecting no timestamp change fails as the writetime is updated.

Due to this timing dependency this test is skipped in Samba CI, but it is
preserved here for future SMB2 timestamps behaviour archealogists.

See also: https://lists.samba.org/archive/cifs-protocol/2019-December/003358.html

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: flush pending writetime update when setting timestamps file
Ralph Boehme [Thu, 12 Mar 2020 18:23:40 +0000 (19:23 +0100)]
smbd: flush pending writetime update when setting timestamps file

Cf the explanations in the previous commits.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: flush pending writetime update when flushing file
Ralph Boehme [Thu, 12 Mar 2020 18:23:40 +0000 (19:23 +0100)]
smbd: flush pending writetime update when flushing file

Cf the explanations in the previous commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: always flush pending write time update when setting filesize
Ralph Boehme [Thu, 12 Mar 2020 15:52:34 +0000 (16:52 +0100)]
smbd: always flush pending write time update when setting filesize

We need to flush a pending write time update even when we're setting the
filesize to current filesize.

Note that we're already doing it this way in the relevant places listed my
dochelp@MS in

https://lists.samba.org/archive/cifs-protocol/2019-December/003364.html

  Cleanup (= Close)
  SetBasicInfo
  SetAllocationInfo
  SetEndOfFileInfo
  SetValidDataLengthInfo
  Flush
  FSCTL_SET_ENCRYPTION
  FSCTL_OFFLOAD_WRITE

Cleanup (= Close):

  Already implemented by update_write_time_on_close() and friends.

SetBasicInfo:

  Currently doesn't flush pending updates. Fixed by a subsequent commit.

SetAllocationInfo:

  smb_set_file_allocation_info() when setting a file's allocation size.

SetEndOfFileInfo:

  Currently doesn't flush pending updates. Fixed by a subsequent commit.

SetValidDataLengthInfo:

  Not implemented, returns NT_STATUS_NOT_SUPPORTED which seems wrong btw, as
  SetValidDataLengthInfo IS listed in MS-SMB2 2.2.39.

Flush:

  Currently doesn't flush pending updates. Fixed by subsequent commit.

FSCTL_SET_ENCRYPTION:

  Windows 2016 doesn't flush a pending writetime update, verified with a
  smbtorture test.

FSCTL_OFFLOAD_WRITE:

  NT_STATUS_NOT_IMPLEMENTED

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture/smb2: add a test verifying a setinfo(basicinfo) flushes a pending writetime...
Ralph Boehme [Thu, 12 Mar 2020 15:48:09 +0000 (16:48 +0100)]
torture/smb2: add a test verifying a setinfo(basicinfo) flushes a pending writetime update

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture/smb2: add a test verifying a flush flushes a pending writetime update
Ralph Boehme [Thu, 12 Mar 2020 15:48:09 +0000 (16:48 +0100)]
torture/smb2: add a test verifying a flush flushes a pending writetime update

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture/smb2: mtime update logic with 2 handles: write io on handle 1, then set mtime...
Ralph Boehme [Fri, 6 Mar 2020 10:50:57 +0000 (11:50 +0100)]
torture/smb2: mtime update logic with 2 handles: write io on handle 1, then set mtime on handle 2

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4/torture: fix a timestamps test to work on ext filesystem
Ralph Boehme [Tue, 10 Mar 2020 17:26:49 +0000 (18:26 +0100)]
s4/torture: fix a timestamps test to work on ext filesystem

ext filesystem has a time_t limit of 15032385535 (0x0x37fffffff). From
Documentation/filesystems/ext4/inodes.rst:

  If the inode structure size ``sb->s_inode_size`` is larger than 128 bytes and
  the ``i_inode_extra`` field is large enough to encompass the respective
  ``i_[cma]time_extra`` field, the ctime, atime, and mtime inode fields are
  widened to 64 bits. Within this “extra” 32-bit field, the lower two bits are
  used to extend the 32-bit seconds field to be 34 bit wide; the upper 30 bits
  are used to provide nanosecond timestamp accuracy. Therefore, timestamps
  should not overflow until May 2446. ...

Changing the test to use the value 0x37fffffff instead of 100000000000 allows
running the test locally on ext filesytems.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: enforce AIO requests draining
Ralph Boehme [Tue, 17 Mar 2020 10:17:46 +0000 (11:17 +0100)]
smbd: enforce AIO requests draining

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 18 19:40:00 UTC 2020 on sn-devel-184

4 years agoRevert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pread...
Jeremy Allison [Fri, 13 Mar 2020 17:40:50 +0000 (10:40 -0700)]
Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pread_state."

This reverts commit 594a435b33e8447625ca83b50daec2d08cf66d64.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default. Pass in struct vfswrap_pread_state as the callback...
Jeremy Allison [Fri, 13 Mar 2020 17:40:33 +0000 (10:40 -0700)]
Revert "s3: VFS: vfs_default. Pass in struct vfswrap_pread_state as the callback data to the subreq."

This reverts commit e102908f112866d657b8c0cd6a5b217d070210c8.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default. Protect vfs_pread_done() from accessing a freed req...
Jeremy Allison [Fri, 13 Mar 2020 17:40:19 +0000 (10:40 -0700)]
Revert "s3: VFS: vfs_default. Protect vfs_pread_done() from accessing a freed req pointer."

This reverts commit b9ad06079fe362385cc4c77f8e8d54f5f74d6db6.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pwrit...
Jeremy Allison [Fri, 13 Mar 2020 17:40:02 +0000 (10:40 -0700)]
Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pwrite_state."

This reverts commit 86cc7439501ab9b9eb018a18dbbef9567eb9b6f9.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default. Pass in struct vfswrap_pwrite_state as the callback...
Jeremy Allison [Fri, 13 Mar 2020 17:39:46 +0000 (10:39 -0700)]
Revert "s3: VFS: vfs_default. Pass in struct vfswrap_pwrite_state as the callback data to the subreq."

This reverts commit 13e25d68385aa951115e0e063ec6a9a281fea4a4.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req...
Jeremy Allison [Fri, 13 Mar 2020 17:39:31 +0000 (10:39 -0700)]
Revert "s3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req pointer."

This reverts commit c8cd93dd54cb9f78665928d4bc8fcc3baf084b6f.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_fsync...
Jeremy Allison [Fri, 13 Mar 2020 17:39:07 +0000 (10:39 -0700)]
Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_fsync_state."

This reverts commit 4adde71b99d4ab09914072458329d5f1008b77e3.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default. Pass in struct vfswrap_fsync_state as the callback...
Jeremy Allison [Fri, 13 Mar 2020 17:38:18 +0000 (10:38 -0700)]
Revert "s3: VFS: vfs_default. Pass in struct vfswrap_fsync_state as the callback data to the subreq."

This reverts commit d623779913e0d4a46d7e299dc41b5c83cb127872.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_default. Protect vfs_fsync_done() from accessing a freed req...
Jeremy Allison [Fri, 13 Mar 2020 17:38:03 +0000 (10:38 -0700)]
Revert "s3: VFS: vfs_default. Protect vfs_fsync_done() from accessing a freed req pointer."

This reverts commit 18671534e42f66b904e51c3fbe887e998ff79493.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster...
Jeremy Allison [Fri, 13 Mar 2020 17:37:48 +0000 (10:37 -0700)]
Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pread_state."

This reverts commit 0e3dc0078ebd6aa79553bf2afa8e72945e23dfb0.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pread_state as the callbac...
Jeremy Allison [Fri, 13 Mar 2020 17:37:30 +0000 (10:37 -0700)]
Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pread_state as the callback data to the subreq."

This reverts commit c6c4e2de22cd3d84f45f5c21e6b09b09274f7f7b.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pread_done() from accessing a...
Jeremy Allison [Fri, 13 Mar 2020 17:37:16 +0000 (10:37 -0700)]
Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pread_done() from accessing a freed req pointer."

This reverts commit 99283871c5230e640a8102943ebed685459ed9af.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster...
Jeremy Allison [Fri, 13 Mar 2020 17:36:59 +0000 (10:36 -0700)]
Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pwrite_state."

This reverts commit 058a7effd00b47e4778f7d680cc9c2a7d40d5fa8.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callba...
Jeremy Allison [Fri, 13 Mar 2020 17:36:39 +0000 (10:36 -0700)]
Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data to the subreq."

This reverts commit 3357a77d0823eddc1b0db68cfa251a0d54058c88.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pwrite_done() from accessing...
Jeremy Allison [Fri, 13 Mar 2020 17:36:19 +0000 (10:36 -0700)]
Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pwrite_done() from accessing a freed req pointer."

This reverts commit 67910c751c9f5ce8cdd1e57b34e51e5b7163838b.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster...
Jeremy Allison [Fri, 13 Mar 2020 17:36:03 +0000 (10:36 -0700)]
Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_fsync_state."

This reverts commit c0c088b1b786f0ba248960114191277e91bbba2f.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_fsync_state as the callbac...
Jeremy Allison [Fri, 13 Mar 2020 17:35:44 +0000 (10:35 -0700)]
Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_fsync_state as the callback data to the subreq."

This reverts commit cdde55a69d0dacd2f9939c2f00cd356c0186f791.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_fsync_done() from accessing a...
Jeremy Allison [Fri, 13 Mar 2020 17:35:21 +0000 (10:35 -0700)]
Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_fsync_done() from accessing a freed req pointer."

This reverts commit 9ecbda263f102a24257fd47142b7c24d1f429d8d.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "vfs_default: pass in state as the callback data to the subreq"
Jeremy Allison [Fri, 13 Mar 2020 17:35:04 +0000 (10:35 -0700)]
Revert "vfs_default: pass in state as the callback data to the subreq"

This reverts commit 0e894f3e48285415f72cf7a68e26f1802fe8045d.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "vfs_default: Protect vfs_getxattrat_done() from accessing a freed req pointer"
Jeremy Allison [Fri, 13 Mar 2020 17:34:46 +0000 (10:34 -0700)]
Revert "vfs_default: Protect vfs_getxattrat_done() from accessing a freed req pointer"

This reverts commit 95cfcda13fe9a70b9955a7c44173d619eacb34c1.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove file_close_pid().
Jeremy Allison [Thu, 12 Mar 2020 18:02:19 +0000 (11:02 -0700)]
s3: smbd: Remove file_close_pid().

The old synchronous reply_exit() was the only user.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove old synchronous SMB1 reply_exit().
Jeremy Allison [Thu, 12 Mar 2020 18:01:05 +0000 (11:01 -0700)]
s3: smbd: Remove old synchronous SMB1 reply_exit().

SMB1 exit is now fully async.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add async internals of reply_exit().
Jeremy Allison [Thu, 12 Mar 2020 17:59:16 +0000 (10:59 -0700)]
s3: smbd: Add async internals of reply_exit().

Waits until all aio requests on all fsp's owned by this
vuid are finished before returning to the client.

Charges the profile time in the done function. Not strictly
correct but better than the other SMB1 async code that
double-charges profiling in both send and done at the
moment.

Done this way (commented out) so it is a clean
diff and it's clear what is being added.

A later commit will remove the old synchronous version.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove old synchronous SMB1 reply_ulogoffX().
Jeremy Allison [Thu, 12 Mar 2020 17:19:31 +0000 (10:19 -0700)]
s3: smbd: Remove old synchronous SMB1 reply_ulogoffX().

SMB1 user logoff is now fully async.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: reply_ulogoffX() Update to modern coding standards.
Jeremy Allison [Thu, 12 Mar 2020 17:16:42 +0000 (10:16 -0700)]
s3: smbd: reply_ulogoffX() Update to modern coding standards.

Minimizes the diff in the later commits.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In reply_ulogoffX(), replace req -> smb1req.
Jeremy Allison [Thu, 12 Mar 2020 17:15:10 +0000 (10:15 -0700)]
s3: smbd: In reply_ulogoffX(), replace req -> smb1req.

Minimises the diff in later commits.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add async internals of reply_ulogoffX.
Jeremy Allison [Thu, 12 Mar 2020 17:11:14 +0000 (10:11 -0700)]
s3: smbd: Add async internals of reply_ulogoffX.

Waits until all aio requests on all fsp's owned by this
vuid are finished before returning to the client.

Charges the profile time in the done function. Not strictly
correct but better than the other SMB1 async code that
double-charges profiling in both send and done at the
moment.

Done this way (commented out) so it is a clean
diff and it's clear what is being added.

A later commit will remove the old synchronous version.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove old synchronous SMB1 reply_tdis().
Jeremy Allison [Thu, 12 Mar 2020 17:03:27 +0000 (10:03 -0700)]
s3: smbd: Remove old synchronous SMB1 reply_tdis().

SMB1 tree disconnect is now fully async.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: reply_tdis() Update to modern coding standards.
Jeremy Allison [Thu, 12 Mar 2020 16:59:47 +0000 (09:59 -0700)]
s3: smbd: reply_tdis() Update to modern coding standards.

Minimizes the diff in the next commit.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In reply_tdis(), replace req -> smb1req.
Jeremy Allison [Thu, 12 Mar 2020 16:55:30 +0000 (09:55 -0700)]
s3: smbd: In reply_tdis(), replace req -> smb1req.

Minimises the diff in the next commit.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add async internals of reply_tdis().
Jeremy Allison [Thu, 12 Mar 2020 16:51:53 +0000 (09:51 -0700)]
s3: smbd: Add async internals of reply_tdis().

Waits until all aio requests on all fsp's under this
conn struct are finished before returning to the client.

Charges the profile time in the done function. Not strictly
correct but better than the other SMB1 async code that
double-charges profiling in both send and done at the
moment.

Done this way (commented out) so it is a clean
diff and it's clear what is being added.

A later commit will remove the old synchronous version.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Replace synchronous conn_force_tdis() with the async version.
Jeremy Allison [Thu, 12 Mar 2020 16:47:26 +0000 (09:47 -0700)]
s3: smbd: Replace synchronous conn_force_tdis() with the async version.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add async internals of conn_force_tdis().
Jeremy Allison [Thu, 12 Mar 2020 16:28:21 +0000 (09:28 -0700)]
s3: smbd: Add async internals of conn_force_tdis().

Commented out so it can be seen complete as
a diff. The next commit will replace the old
synchronous conn_force_tdis() code with the
new async code.

Uses a wait_queue to cause the force close
requests to stay pending until all outstanding
aio is finished on all file handles opened
on the connection.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Don't allow force disconnect of a connection already being disconnected.
Jeremy Allison [Tue, 10 Mar 2020 19:25:58 +0000 (12:25 -0700)]
s3: smbd: Don't allow force disconnect of a connection already being disconnected.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.
Jeremy Allison [Wed, 11 Mar 2020 22:16:35 +0000 (15:16 -0700)]
s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.

Eventually this will allow us to remove fsp->deferred_close
from the fsp struct (and also source3/lib/tevent_wait.[ch]).

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already do in...
Jeremy Allison [Thu, 12 Mar 2020 00:25:59 +0000 (17:25 -0700)]
s3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already do in SMB2 async close.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in chunks...
Jeremy Allison [Wed, 11 Mar 2020 21:47:50 +0000 (14:47 -0700)]
s3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in chunks of 10 instead of 1.

Prevents incremental +1 tallocs, and the original
idea of this array was that it wasn't freed for
io efficiency reasons. Add paranoia integer wrap
protection also.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when fsp->num_ai...
Jeremy Allison [Tue, 10 Mar 2020 17:55:22 +0000 (10:55 -0700)]
s3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when fsp->num_aio_requests reaches zero.

The add code in aio_add_req_to_fsp() re-tallocs
this array on demand, and talloc freeing it here
allows it to be used as the parent for a tevent
wait queue, so callers can get notified when
all outstanding aio on an fsp is finished.

We'll deal with any performance issues in
the next commit.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: tests: Slight tweak to the force-close share test.
Jeremy Allison [Fri, 13 Mar 2020 22:45:16 +0000 (15:45 -0700)]
s3: tests: Slight tweak to the force-close share test.

Turns out on a fast desktop machine 10MB is too small,
and by the time we've done the 'sleep 1' to make sure
the smbclient got scheduled and started processing
the 'put' command, it's already done.

Tweak the file size to be 20MB from 10MB. 10MB
seems to work reliably on gitlab-ci and on
sn-devel, but making the put size 20MB makes
sure it's still in flight when we force-close
the share, even on a fast desktop box. 20MB
shouldn't be too burdonsome even on ci VM's.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()
Martin Schwenke [Fri, 6 Mar 2020 05:11:23 +0000 (16:11 +1100)]
ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()

The only place the outgoing connection needs to be stopped is when
there is a timeout when waiting for the connection to become writable.
Add a new function ctdb_tcp_node_connect_timeout() to handle this
case.

All of the other cases are attempts to establish a new outgoing
connection (initial attempt, retry after an error or disconnect, ...)
so drop stopping the connection in those cases.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Mar 12 05:29:20 UTC 2020 on sn-devel-184

4 years agoctdb-tcp: Factor out function ctdb_tcp_start_outgoing()
Martin Schwenke [Fri, 6 Mar 2020 04:59:32 +0000 (15:59 +1100)]
ctdb-tcp: Factor out function ctdb_tcp_start_outgoing()

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-tcp: add ctdb_tcp_stop_incoming()
Ralph Boehme [Sat, 29 Feb 2020 10:54:51 +0000 (11:54 +0100)]
ctdb-tcp: add ctdb_tcp_stop_incoming()

No change in behaviour.  This makes the code self-documenting.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()
Ralph Boehme [Fri, 28 Feb 2020 10:36:00 +0000 (11:36 +0100)]
ctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()

No change in behaviour.  This makes the code self-documenting.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()
Ralph Boehme [Sat, 29 Feb 2020 11:28:20 +0000 (12:28 +0100)]
ctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()

The node dead upcall has already restarted the outgoing connection.
There's no need to repeat it.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()
Ralph Boehme [Sat, 29 Feb 2020 11:13:12 +0000 (12:13 +0100)]
ctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()

ctdb_tcp_tnode_cb() is called when we receive data on the outgoing connection.

This can happen when we get an EOF on the connection because the other side as
closed. In this case data will be NULL.

It would also be called if we received data from the peer. In this case data
will not be NULL.

The latter case is a fatal error though and we already call
ctdb_tcp_stop_connection() for this case as well, which means even though the
node is not fully connected anymore, by not calling the node_dead() upcall
NODE_FLAGS_DISCONNECTED will not be set.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-tcp: move free of inbound queue to TCP restart
Noel Power [Sat, 29 Feb 2020 15:49:28 +0000 (15:49 +0000)]
ctdb-tcp: move free of inbound queue to TCP restart

Since commit 77deaadca8e8dbc3c92ea16893099c72f6dc874e, a nodeA which
had previously accepted a connection from nodeB (where nodeB dies
e.g. as as result of fencing) when nodeB attempts to connect again
after restarting is always rejected with

 ctdb_listen_event: Incoming queue active, rejecting connection from w.x.y.z

messages.

Consolidate dead node handling in the TCP restart handling.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-daemon: more logical whitespace, debug modernisation
Martin Schwenke [Sun, 1 Mar 2020 05:40:41 +0000 (16:40 +1100)]
ctdb-daemon: more logical whitespace, debug modernisation

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoctdb-daemon: ensure restart() callback is called in half-connected state
Ralph Boehme [Sat, 29 Feb 2020 11:26:19 +0000 (12:26 +0100)]
ctdb-daemon: ensure restart() callback is called in half-connected state

If NODE_FLAGS_DISCONNECTED is set the node can be in half-connected state. With
this change we ensure to restart the transport for this case.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoselftest: Add test for rpcclient LSA lookup calls
Christof Schmitt [Mon, 9 Mar 2020 23:25:00 +0000 (16:25 -0700)]
selftest: Add test for rpcclient LSA lookup calls

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 11 09:52:44 UTC 2020 on sn-devel-184

4 years agorpcclient: Ask for minimal permissions for SID and name lookups
Christof Schmitt [Mon, 9 Mar 2020 21:21:41 +0000 (14:21 -0700)]
rpcclient: Ask for minimal permissions for SID and name lookups

The RPC calls to lookup SIDS and names only require the
POLICY_LOOKUP_NAMES permission. Only ask for that instead of the
MAXIMUM_ALLOWED flag. This allows these calls to work against a NetApp
that does not accept MAXIMUM_ALLOWED (see bugzilla 11105).

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli: Align integer types
Volker Lendecke [Sun, 8 Mar 2020 15:50:59 +0000 (16:50 +0100)]
libcli: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 10 23:08:20 UTC 2020 on sn-devel-184