iboukris/samba-autobuild/.git
4 years agoVERSION: Bump version up to 4.11.0... samba-4.11.0
Karolin Seeger [Tue, 17 Sep 2019 08:02:02 +0000 (10:02 +0200)]
VERSION: Bump version up to 4.11.0...

and disable GIT_SNAPSHOT for the 4.11.0 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Add release notes for Samba 4.11.0.
Karolin Seeger [Tue, 17 Sep 2019 08:00:54 +0000 (10:00 +0200)]
WHATSNEW: Add release notes for Samba 4.11.0.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoVERSION: Bump version up to 4.11.0rc5...
Karolin Seeger [Tue, 10 Sep 2019 11:19:03 +0000 (13:19 +0200)]
VERSION: Bump version up to 4.11.0rc5...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoVERSION: Disable GIT_SNAPSHOT for the 4.11.0rc4 release. samba-4.11.0rc4
Karolin Seeger [Tue, 10 Sep 2019 11:00:53 +0000 (13:00 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.11.0rc4 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Add release notes for Samba 4.11.0rc4.
Karolin Seeger [Tue, 10 Sep 2019 07:19:32 +0000 (09:19 +0200)]
WHATSNEW: Add release notes for Samba 4.11.0rc4.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Remove paragraph about rejoining DCs.
Karolin Seeger [Tue, 10 Sep 2019 11:02:12 +0000 (13:02 +0200)]
WHATSNEW: Remove paragraph about rejoining DCs.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agovfs: restore stat fields in vfs_stat_fsp()
Ralph Boehme [Mon, 9 Sep 2019 06:08:06 +0000 (08:08 +0200)]
vfs: restore stat fields in vfs_stat_fsp()

This ensures we preserve btime, itime and File-ID.

As the Durable Handles code calls vfs_stat_fsp() in the DH disconnect function,
previously the btime was lost and NOT stored in the cookie. With this change the
cookie will store the correct btime (and iflags), which requires us to call
dos_mode() in the reconnect function to ensure we pass
vfs_default_durable_reconnect_check_stat().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Sep 10 20:22:21 UTC 2019 on sn-devel-184

(cherry picked from commit 95655fe683d499d93f3844ed72ad332ef64adb96)

Autobuild-User(v4-11-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-11-test): Tue Sep 10 22:29:08 UTC 2019 on sn-devel-184

4 years agos3:vfs: streamline vfs_stat_fsp()
Ralph Boehme [Mon, 9 Sep 2019 06:03:53 +0000 (08:03 +0200)]
s3:vfs: streamline vfs_stat_fsp()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit e00e78cfeda99bd5374eff8fb4ba84873e4e46b7)

4 years agos3: replace fsp_stat() with vfs_stat_fsp()
Ralph Boehme [Mon, 9 Sep 2019 05:57:34 +0000 (07:57 +0200)]
s3: replace fsp_stat() with vfs_stat_fsp()

Both functions do the same, they differ just in the type of the returned result.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit ab03394969f8a4c748aea7d0d8ed37f9ced6cc30)

4 years agos3:lib: add update_stat_ex_from_saved_stat()
Ralph Boehme [Fri, 30 Aug 2019 12:49:47 +0000 (14:49 +0200)]
s3:lib: add update_stat_ex_from_saved_stat()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit ac18730f10ce96a607a3a07e1360b522ebf72f38)

4 years agovfs_catia: stat info may have been updated, make sure to return changes
Ralph Boehme [Fri, 30 Aug 2019 12:48:57 +0000 (14:48 +0200)]
vfs_catia: stat info may have been updated, make sure to return changes

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4e49999c97f53acc7006f1dc6b6812bb0e156db5)

4 years agos3:smbd: ensure to update the File-ID in struct smb_filename
Ralph Boehme [Fri, 30 Aug 2019 12:48:40 +0000 (14:48 +0200)]
s3:smbd: ensure to update the File-ID in struct smb_filename

Initialize the File-ID in fsp->fsp_name->st, any subsequent metadata fetch on
this file-handle needs this, eg QFID SMB2 Create-Context or GETINFO SMB
requests.

It would be nice if SMB_VFS_SET_DOS_ATTRIBUTE() would do this, unfortunately it
gets a const struct smb_filename.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 3483b75fed8985bd2968bbf8c85985107115fba8)

4 years agos3:lib: round itime to NTTIME resolution in make_file_id_from_itime()
Ralph Boehme [Mon, 9 Sep 2019 09:12:08 +0000 (11:12 +0200)]
s3:lib: round itime to NTTIME resolution in make_file_id_from_itime()

The rounding is needed because when a file is created via eg an SMB2 CREATE
request, we need to calculate the correct File-ID for the QFID Create-Context or
for a subsequent GETINFO SMB request on the same file-handle.

Any later metadata request that received the File-ID will do so by going through
dos_mode() -> ... -> parse_dos_attribute_blob(), where the File-ID will be
calculated from the on-disk itime which has NTTIME resolution.

As long as that is the only available itime backend, I'm rounding itime inside
make_file_id_from_itime(), not in the callers.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 84abeaa60ffced276da2b28b8add6efaa6da5ca6)

4 years agolib: add round_timespec_to_nttime()
Ralph Boehme [Tue, 3 Sep 2019 15:50:54 +0000 (17:50 +0200)]
lib: add round_timespec_to_nttime()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5403bb22e6cb39baf6dc1b91558744d41e9f6f64)

4 years agos4:torture: add a file-id related test
Ralph Boehme [Fri, 30 Aug 2019 12:49:24 +0000 (14:49 +0200)]
s4:torture: add a file-id related test

Note I'm using the share vfs_fruit_xattr because I need a share with both a
streams and a acl_* VFS object.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 2ecab3c60abf9baa16a6a5e3eba0fc4720def840)

4 years agos3:ldap: Fix join with don't exists machine account
Evgeny Sinelnikov [Wed, 31 Jul 2019 19:17:20 +0000 (23:17 +0400)]
s3:ldap: Fix join with don't exists machine account

Add check for requested replies of existing machine object during join
machine to domain. This solves regression fail during join with error:
"None of the information to be translated has been translated."

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

Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Sep  4 17:02:37 UTC 2019 on sn-devel-184

(cherry picked from commit ad4ef1657e9b2a088a3bfadcce196cfcceead1dc)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Tue Sep 10 09:13:15 UTC 2019 on sn-devel-184

4 years agos3:selftest: add delay_inject:brl_lock_windows testing
Stefan Metzmacher [Tue, 20 Aug 2019 13:53:59 +0000 (15:53 +0200)]
s3:selftest: add delay_inject:brl_lock_windows testing

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

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): Mon Sep  9 15:42:45 UTC 2019 on sn-devel-184

(cherry picked from commit 2b43ce6704ecf035e6734337a2dea3458153a4b2)

Autobuild-User(v4-11-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-11-test): Mon Sep  9 17:19:11 UTC 2019 on sn-devel-184

4 years agovfs_delay_inject: add support for brl_[un]lock_windows()
Stefan Metzmacher [Mon, 19 Aug 2019 16:22:38 +0000 (18:22 +0200)]
vfs_delay_inject: add support for brl_[un]lock_windows()

This demonstrates the two ways to handle the retry:
- smb layer retry => plock->context.smblctx = UINT64_MAX
- vfs backend retry => plock->context.smblctx = 0

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit c2503a5c68e967054ab84ca0d8ce693200c2e002)

4 years agos3:locking: add brl_req_guid() and brl_req_mem_ctx() helper functions
Stefan Metzmacher [Thu, 8 Aug 2019 17:26:28 +0000 (19:26 +0200)]
s3:locking: add brl_req_guid() and brl_req_mem_ctx() helper functions

This allows the vfs backend to detect a retry and keep state between
the retries.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 66d92f37c3a643d97489a59bb6d1e75e91528c20)

4 years agos3:smb2_lock: handle NT_STATUS_RETRY from the VFS backend
Stefan Metzmacher [Mon, 19 Aug 2019 14:25:59 +0000 (16:25 +0200)]
s3:smb2_lock: handle NT_STATUS_RETRY from the VFS backend

This allows the VFS backends to implement async byte
range locking.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 7471b0f63276e707784c98b832992ff08b1898ef)

4 years agos3:blocking: handle NT_STATUS_RETRY from the VFS backend
Stefan Metzmacher [Mon, 19 Aug 2019 13:29:32 +0000 (15:29 +0200)]
s3:blocking: handle NT_STATUS_RETRY from the VFS backend

This allows the VFS backends to implement async byte
range locking.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 7d1cd6f22e7e3d95aba04c45776057945c2a5e30)

4 years agos3:blocking: make use of smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send()
Stefan Metzmacher [Thu, 15 Aug 2019 18:09:55 +0000 (20:09 +0200)]
s3:blocking: make use of smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send()

We only need the logic to call smbd_smb1_do_locks_check() and a possible
retry once in smbd_smb1_do_locks_try().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8975673e3c3f9f7dbdb7ba7562bb81a62cd24e2e)

4 years agos3:blocking: call smbd_smb1_do_locks_setup_timeout() also in smbd_smb1_do_locks_try()
Stefan Metzmacher [Thu, 15 Aug 2019 16:18:50 +0000 (18:18 +0200)]
s3:blocking: call smbd_smb1_do_locks_setup_timeout() also in smbd_smb1_do_locks_try()

This is a noop if smbd_smb1_do_locks_setup_timeout() was called before.

But it allows us to use smbd_smb1_do_locks_try() in
smbd_smb1_do_locks_send() in a following commit.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 6e30a89b3f00ad55391454fbaa1272074e1962f0)

4 years agos3:blocking: fix the fsp->blocked_smb1_lock_reqs handling
Stefan Metzmacher [Fri, 16 Aug 2019 12:55:13 +0000 (14:55 +0200)]
s3:blocking: fix the fsp->blocked_smb1_lock_reqs handling

A new request is first checks against all pending
requests before checking the already granted locks.

Before we retried the lock array of another request
(the first in the list), but then finished current request,
which is wrong.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 312327106271abafeb53e62dfb71a38bf93e2d41)

4 years agos3:blocking: do the timeout calculation before calling dbwrap_watched_watch_send()
Stefan Metzmacher [Mon, 19 Aug 2019 13:21:50 +0000 (15:21 +0200)]
s3:blocking: do the timeout calculation before calling dbwrap_watched_watch_send()

This makes the next commits easier to understand.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 997548a5f1a14d82f1e80cce6d9ee55e85b5107c)

4 years agos3:blocking: split out smbd_smb1_do_locks_setup_timeout()
Stefan Metzmacher [Thu, 15 Aug 2019 16:02:57 +0000 (18:02 +0200)]
s3:blocking: split out smbd_smb1_do_locks_setup_timeout()

This function can be called multiple times, but only
the first time will setup the endtime. And the
endtime is relative to the request time and not
the current time.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8da7c10a58292022ee57406db9a365de9ffaf5cf)

4 years agos3:blocking: use timeval_expired(&state->endtime) to stop processing
Stefan Metzmacher [Thu, 15 Aug 2019 16:17:47 +0000 (18:17 +0200)]
s3:blocking: use timeval_expired(&state->endtime) to stop processing

This is less racy than timeval_elapsed() > 0
as the current time is already expired and timeout = 0
will always work correct.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 5a841a43f9c4f862e2d7235429363b3066cf5850)

4 years agos4:torture/raw: add multilock6 test
Stefan Metzmacher [Fri, 16 Aug 2019 14:24:34 +0000 (16:24 +0200)]
s4:torture/raw: add multilock6 test

This is similar to multilock3, but uses a read-only
(LOCKING_ANDX_SHARED_LOCK) locks for the 2nd lock
request.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit d3bc0199697fd7d6e04479321ca644a227bc4ede)

4 years agos4:torture/raw: add multilock5 test
Stefan Metzmacher [Fri, 16 Aug 2019 13:12:01 +0000 (15:12 +0200)]
s4:torture/raw: add multilock5 test

This is similar to multilock3, but uses a read-only
(LOCKING_ANDX_SHARED_LOCK) locks for the first lock
request.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 6d4296aca0c9a9287c0c78c8f8847a560bd2ea24)

4 years agos4:torture/raw: add multilock4 test
Stefan Metzmacher [Fri, 16 Aug 2019 12:49:29 +0000 (14:49 +0200)]
s4:torture/raw: add multilock4 test

This is similar to multilock3, but uses read-only
(LOCKING_ANDX_SHARED_LOCK) locks for the blocked
requests.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit d3e65ceb1ec25c7b62a7e908506126269011f30d)

4 years agos4:torture/raw: add multilock3 test
Stefan Metzmacher [Fri, 16 Aug 2019 10:13:15 +0000 (12:13 +0200)]
s4:torture/raw: add multilock3 test

This demonstrates that unrelated lock ranges
are not blocked by other blocked requests on the same
fsp.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 297763c6b618c07148d788b46218a0798225bf79)

4 years agos4:torture/raw: improvements for multilock2
Stefan Metzmacher [Fri, 16 Aug 2019 10:28:39 +0000 (12:28 +0200)]
s4:torture/raw: improvements for multilock2

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8a7039be530adcdda9e7e7621bdcf902f5ca1721)

4 years agos3:smb2_lock: add retry for POSIX locks
Stefan Metzmacher [Fri, 2 Aug 2019 12:50:27 +0000 (14:50 +0200)]
s3:smb2_lock: add retry for POSIX locks

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8decf41bbb8be2b4ac463eb6ace16a8628276ab5)

4 years agos4:torture/smb2: add smb2.samba3misc.localposixlock1
Stefan Metzmacher [Mon, 19 Aug 2019 15:38:30 +0000 (17:38 +0200)]
s4:torture/smb2: add smb2.samba3misc.localposixlock1

This demonstrates that the SMB2 code path doesn't do
any retry for local posix locks.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 7155d3a2c5d7237f00cccb1802c1341cf295864e)

4 years agos3:smb2_lock: make use of smbd_smb2_lock_try() in smbd_smb2_lock_send()
Stefan Metzmacher [Tue, 13 Aug 2019 14:39:41 +0000 (16:39 +0200)]
s3:smb2_lock: make use of smbd_smb2_lock_try() in smbd_smb2_lock_send()

We only need the logic to call smbd_do_locks_try() and a possible
retry once in smbd_smb2_lock_try().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 359e9992be713bbecfdb19998d69e1d3f020c5e9)

4 years agos3:smb2_lock: let smbd_smb2_lock_try() explicitly check for the retry condition
Stefan Metzmacher [Tue, 13 Aug 2019 14:39:41 +0000 (16:39 +0200)]
s3:smb2_lock: let smbd_smb2_lock_try() explicitly check for the retry condition

This makes it possible to reuse _try() in the _send() function in the
next commit.

We should not retry forever on a hard error.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 7f77e0b4e9878f1f3515206d052adc012e26aafb)

4 years agos3:smb2_lock: error out early in smbd_smb2_lock_send()
Stefan Metzmacher [Tue, 13 Aug 2019 14:39:41 +0000 (16:39 +0200)]
s3:smb2_lock: error out early in smbd_smb2_lock_send()

We no longer expect NT_STATUS_FILE_LOCK_CONFLICT from
the VFS layer and assert that in a future version.

This makes it easier to port the same logic to smbd_smb2_lock_try().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 39d514cdc358f175d0968f4a78f8f2f05a6c1707)

4 years agos3:smb2_lock: split smbd_smb2_lock_retry() into _try() and _retry()
Stefan Metzmacher [Tue, 13 Aug 2019 14:39:41 +0000 (16:39 +0200)]
s3:smb2_lock: split smbd_smb2_lock_retry() into _try() and _retry()

This makes it possible to reuse _try() in the _send() function in the
next commits.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit d096742da1a045357f52ccd5b28d499c30e96152)

4 years agos3:smb2_lock: move from 'blocking' to 'state->blocking'
Stefan Metzmacher [Tue, 13 Aug 2019 14:14:23 +0000 (16:14 +0200)]
s3:smb2_lock: move from 'blocking' to 'state->blocking'

This will simplify the next commits.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit f13d13ae9da3072862a781bc926e7a06e8384337)

4 years agos3:brlock: always return LOCK_NOT_GRANTED instead of FILE_LOCK_CONFLICT
Stefan Metzmacher [Mon, 19 Aug 2019 10:33:28 +0000 (12:33 +0200)]
s3:brlock: always return LOCK_NOT_GRANTED instead of FILE_LOCK_CONFLICT

Returning NT_STATUS_FILE_LOCK_CONFLICT is a SMB1 only detail
for delayed brlock requests, which is handled in
smbd_smb1_do_locks*().

The brlock layer should be consistent even for posix locks.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit ad98eec6090430ba5296a5111dde2e53b9cd217a)

4 years agos3:blocking: maintain state->deny_status
Stefan Metzmacher [Mon, 19 Aug 2019 10:04:43 +0000 (12:04 +0200)]
s3:blocking: maintain state->deny_status

For Windows locks we start with LOCK_NOT_GRANTED and use
FILE_LOCK_CONFLICT if we retried after a timeout.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit aba0ee46258f3dd910421facb742fce3318a6946)

4 years agos4:torture/raw: assert to get LOCK_NOT_GRANTED in torture_samba3_posixtimedlock()
Stefan Metzmacher [Mon, 19 Aug 2019 14:30:16 +0000 (16:30 +0200)]
s4:torture/raw: assert to get LOCK_NOT_GRANTED in torture_samba3_posixtimedlock()

There should not be a different if the blocker is a posix process
instead of another smbd.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 2a77025a1e16d897281e5840192c93fa03328681)

4 years agos3:blocking: use dynamic posix lock wait intervals
Stefan Metzmacher [Thu, 15 Aug 2019 15:26:43 +0000 (17:26 +0200)]
s3:blocking: use dynamic posix lock wait intervals

We want to start with a short timeout (200ms) and
slow down to larger timeouts up to 2s for the default
value of "lock spin time".

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 15765644d2590d6549f8fcc01c39c56387eed654)

4 years agos3:blocking: Remove bug reproducer from a few commits ago
Stefan Metzmacher [Thu, 15 Aug 2019 14:44:11 +0000 (16:44 +0200)]
s3:blocking: Remove bug reproducer from a few commits ago

The problem is fixed, now we can revert the change that made it
easier to trigger.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 62ec58b06c38ee82bb3147c4d325413fd3a76499)

4 years agos3:blocking: fix posix lock retry
Stefan Metzmacher [Thu, 15 Aug 2019 12:21:38 +0000 (14:21 +0200)]
s3:blocking: fix posix lock retry

We should evaluate the timeout condition after the very last
retry and not before.

Otherwise we'd fail to retry when waiting for posix locks.
The problem happens if the client provided timeout is smaller
than the 1 sec (for testing temporary 15 secs) retry.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit e8d719d31f885d7b6d5b317165f90ec40df169c9)

4 years agos3:blocking: move from 'timeout' to 'smbd_smb1_do_locks_state->timeout'
Stefan Metzmacher [Tue, 13 Aug 2019 16:34:36 +0000 (18:34 +0200)]
s3:blocking: move from 'timeout' to 'smbd_smb1_do_locks_state->timeout'

This will make it possible to just use smbd_smb1_do_locks_try()
in a later commit.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8fe708acb43ea36d0cbf398713b125daba180a2d)

4 years agos3:blocking: split smbd_smb1_do_locks_retry() into _try() and _retry()
Stefan Metzmacher [Tue, 13 Aug 2019 16:34:36 +0000 (18:34 +0200)]
s3:blocking: split smbd_smb1_do_locks_retry() into _try() and _retry()

This will make it possible to have just one caller to
smbd_do_locks_try() later and use smbd_smb1_do_locks_try()
from within smbd_smb1_do_locks_send().

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

Reviewed-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit e79fcfaaf2ecfca6c3747f6fe4be51f332ebf10d)

4 years agos3:blocking: demonstrate the posix lock retry fails
Stefan Metzmacher [Thu, 15 Aug 2019 09:09:47 +0000 (11:09 +0200)]
s3:blocking: demonstrate the posix lock retry fails

This is just a temporary commit that shows the bug and its
fix. It will be reverted once the problem is fixed.

The posix lock retry fails if the client specified timeout
is smaller than the hardcoded 1 second retry.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 2ec9e93a7aac2706b4a5931495d56a7b64f8d894)

4 years agos3:torture: convert LOCK9 into LOCK9A and LOCK9B
Stefan Metzmacher [Thu, 15 Aug 2019 12:31:54 +0000 (14:31 +0200)]
s3:torture: convert LOCK9 into LOCK9A and LOCK9B

LOCK9A is the original test (with a timeout of -1)
and LOCK9B is the same but with timeout of 10 seconds.

LOCK9B is needed to demonstrate a server bug in the next
commits.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit ac28eec3e4af710feab3be3d4b25bfbe38294431)

4 years agos3:torture: fix the timeout alarm handling on LOCK9
Stefan Metzmacher [Thu, 15 Aug 2019 14:10:58 +0000 (16:10 +0200)]
s3:torture: fix the timeout alarm handling on LOCK9

smbXcli_conn_disconnect(alarm_cli->conn, NT_STATUS_OK)
means existing requests are not finished with an error,
but instead just keep dangling arround.

Pass NT_STATUS_LOCAL_DISCONNECT in order to fail the
cli_lock32() call after getting SIGALARM.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit e18c8ced8e7a872deb118191595425ef6b826bfa)

4 years agos3:blocking: remove unused timeval_brl_min()
Stefan Metzmacher [Tue, 13 Aug 2019 17:19:07 +0000 (19:19 +0200)]
s3:blocking: remove unused timeval_brl_min()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 3b788d97f9995e24e4005567f90a925957fb1e00)

4 years agos3:locking: add share_mode_wakeup_waiters() helper function
Stefan Metzmacher [Thu, 8 Aug 2019 22:47:39 +0000 (00:47 +0200)]
s3:locking: add share_mode_wakeup_waiters() helper function

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit bd8884e5722cbbb7783fb4ae53e4f35b31031b01)

4 years agos3:locking: add/split out byte_range_{valid,overlap}() helper functions
Stefan Metzmacher [Thu, 5 Sep 2019 06:43:32 +0000 (08:43 +0200)]
s3:locking: add/split out byte_range_{valid,overlap}() helper functions

They implement the logic from [MS-FSA].

The following commits will use these functions in other locations.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 0e5613e39d6c6bb892fed939c63b4f14b878803b)

4 years agos3:smb2_lock: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
Stefan Metzmacher [Wed, 4 Sep 2019 10:47:07 +0000 (12:47 +0200)]
s3:smb2_lock: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes

This is not strictly required as fd-based calls are used,
but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
in the same environment on retry.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8b565de1acb0fda121cb0bd4cff42d66ee027529)

4 years agos3:blocking: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
Stefan Metzmacher [Wed, 4 Sep 2019 10:50:06 +0000 (12:50 +0200)]
s3:blocking: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes

This is not strictly required as fd-based calls are used,
but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
in the same environment on retry.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 28ac2cbaf92a8619f0380f024c5a220d9fdc4622)

4 years agolibcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID
Stefan Metzmacher [Thu, 25 Jul 2019 12:38:26 +0000 (14:38 +0200)]
libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID

Note: Unlike the current documentation, the utf16 string
is not null-terminated, that matches Windows Server 1903
as a client.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055
RN: Add the target server name of SMB 3.1.1 connections
as a hint to load balancers or servers with "multi-tenancy"
support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
(cherry picked from commit 21f6cece543dd791e0f4636458bfe9819823420c)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Mon Sep  9 12:03:55 UTC 2019 on sn-devel-184

4 years agolibcli/smb: add new COMPRESSION and NETNAME negotiate context ids
Stefan Metzmacher [Thu, 25 Jul 2019 12:37:31 +0000 (14:37 +0200)]
libcli/smb: add new COMPRESSION and NETNAME negotiate context ids

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
(cherry picked from commit e10b90f33bb812600886656a1124e2d434416563)

4 years agoctdb: fix compilation on systems with glibc robust mutexes
Ralph Boehme [Fri, 12 Jul 2019 08:49:13 +0000 (10:49 +0200)]
ctdb: fix compilation on systems with glibc robust mutexes

On older systems like SLES 11 without POSIX robust mutexes, but with glib robust
mutexes where all the functions are available but have a "_np" suffix,
compilation fails in:

ctdb/tests/src/test_mutex_raw.c.239.o: In function `worker':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:129: undefined reference to `pthread_mutex_consistent'
ctdb/tests/src/test_mutex_raw.c.239.o: In function `main':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:285: undefined reference to `pthread_mutex_consistent'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:332: undefined reference to `pthread_mutexattr_setrobust'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:363: undefined reference to `pthread_mutex_consistent'
collect2: ld returned 1 exit status

This could be fixed by using libreplace system/threads.h instead of pthreads.h
directly, but as there has been a desire to keep test_mutex_raw.c standalone and
compilable without other external depenencies then libc and libpthread, make the
tool developer build only. This should get the average user over the cliff.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14038
RN: Fix compiling ctdb on older systems lacking POSIX robust mutexes

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit f5388f97792ac2d7962950dad91aaf8ad49bceaa)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Fri Sep  6 08:19:44 UTC 2019 on sn-devel-184

4 years agoWHATSNEW: Add entry for deprecation of "lanman auth" and "encrypt passwords = no"
Andrew Bartlett [Thu, 5 Sep 2019 04:12:10 +0000 (16:12 +1200)]
WHATSNEW: Add entry for deprecation of "lanman auth" and "encrypt passwords = no"

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs: Deprecate "encrypt passwords = no"
Andrew Bartlett [Wed, 4 Sep 2019 23:19:10 +0000 (11:19 +1200)]
docs: Deprecate "encrypt passwords = no"

This feature is only available for SMB1 and we need to warn users that this
is going away soon, and allow the removal in a future release under our rules
for parameter deprecation.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 8d0d99a4d78ba408bb45e2d693049025e60e277a)

4 years agodocs: Deprecate "lanman auth = yes"
Andrew Bartlett [Wed, 4 Sep 2019 23:23:22 +0000 (11:23 +1200)]
docs: Deprecate "lanman auth = yes"

This feature is only available for SMB1 and we need to warn users that this
is going away soon, and allow the removal in a future release under our rules
for parameter deprecation.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Sep  5 04:04:18 UTC 2019 on sn-devel-184

(cherry picked from commit 1006f7abe8980d2c01c181db93225353ce494b3a)

4 years agoldb: Release ldb 2.0.7 ldb-2.0.7
Andrew Bartlett [Wed, 28 Aug 2019 05:44:52 +0000 (17:44 +1200)]
ldb: Release ldb 2.0.7

* Robustness improvements against duplicate attributes in ldb_filter_attrs()
  (bug 13695)
* Robustness improvements against invalid string DN values (bug 14049)

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Wed Sep  4 10:24:56 UTC 2019 on sn-devel-184

4 years agoldb: Extend the ldb_dn_explode test matrix
Andrew Bartlett [Tue, 27 Aug 2019 01:16:50 +0000 (13:16 +1200)]
ldb: Extend the ldb_dn_explode test matrix

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 10058bcfa16d5029e61252d64d142a8aab9ec296)

4 years agoldb: Do not read beyond the end of the extended DN component when printing
Andrew Bartlett [Tue, 27 Aug 2019 01:16:18 +0000 (13:16 +1200)]
ldb: Do not read beyond the end of the extended DN component when printing

The print functions used in Samba NULL terminate, but do not assume they will

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit a8a3cef3a768aaff01227dd7b229fb7b3aef926f)

4 years agoldb: Add test with == true or false to boolean if statements in ldb_dn_explode()
Andrew Bartlett [Wed, 21 Aug 2019 23:09:55 +0000 (11:09 +1200)]
ldb: Add test with == true or false to boolean if statements in ldb_dn_explode()

This is beyond the normal level of clarity we expect in Samba, and is of course
rudundent, but this is a complex routine that has confusing tests, some of
pointers and some of boolean state values.

This tries to make the code as clear as possible pending a more comprehensive
rewrite.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 52bd2dde5ae809ecc115f7087e367327f4771e73)

4 years agoldb: Rework all pointer NULL tests to use Samba's normal style
Andrew Bartlett [Wed, 21 Aug 2019 22:59:07 +0000 (10:59 +1200)]
ldb: Rework all pointer NULL tests to use Samba's normal style

Also avoid if () without braces

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 3f290e95c2c133eb2c983ecc984d3dff4809f3d3)

4 years agoldb: add some dn explode tests
Douglas Bagnall [Thu, 25 Jul 2019 00:09:16 +0000 (12:09 +1200)]
ldb: add some dn explode tests

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit a097ddf65ce56dcd2e0b072b6dd78f512a77a9da)

4 years agoldb: don't try to save a value that isn't there
Douglas Bagnall [Thu, 25 Jul 2019 21:49:13 +0000 (09:49 +1200)]
ldb: don't try to save a value that isn't there

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 54f30f2fe3f03c9640664f9a11260b093fc57a5b)

4 years agoldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure
Andrew Bartlett [Mon, 26 Aug 2019 02:50:15 +0000 (14:50 +1200)]
ldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug 27 01:16:33 UTC 2019 on sn-devel-184

(cherry picked from commit 1521a22f4366c86ec955cb9d32b7a758315d8ce0)

4 years agoldb: use TALLOC_FREE() over talloc_free() in ldb_filter_attrs()
Andrew Bartlett [Mon, 26 Aug 2019 02:48:52 +0000 (14:48 +1200)]
ldb: use TALLOC_FREE() over talloc_free() in ldb_filter_attrs()

This is a macro that sets the pointer to NULL after the talloc_free()
and is part of our standard coding practices.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 2117789c35fbf6d0ed02f391f17593e11727ec3e)

4 years agoldb: Correct Pigeonhole principle validation in ldb_filter_attrs()
Andrew Bartlett [Mon, 26 Aug 2019 01:04:07 +0000 (13:04 +1200)]
ldb: Correct Pigeonhole principle validation in ldb_filter_attrs()

Thankfully this only fails if the DB is corrupt and has a duplicate record.

The test was at the wrong end of the loop, and was for the
wrong boundary condition.  A write after the end of the array would
occour before the condition was hit.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit b1eec5b196e3d5a5716a5c74cf669ceaa5c0301f)

4 years agoldb: Fix mem-leak if talloc_realloc fails
Swen Schillig [Wed, 31 Jul 2019 08:27:37 +0000 (10:27 +0200)]
ldb: Fix mem-leak if talloc_realloc fails

In case of a failing talloc_realloc(), the only reference
to the originally allocated memory is overwritten.
Instead use a temp var until success is verified.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 99b4791cfe423b19f1f21d5f9fb42157336019f1)

4 years agoldb_dn: free dn components on explode failure
Douglas Bagnall [Thu, 7 Mar 2019 23:12:00 +0000 (12:12 +1300)]
ldb_dn: free dn components on explode failure

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
(cherry picked from commit b136f153b83d80a91ec9d5350fdf08412d881964)

4 years agoldb: do not allow adding a DN as a base to itself
Douglas Bagnall [Sat, 6 Jul 2019 11:24:43 +0000 (23:24 +1200)]
ldb: do not allow adding a DN as a base to itself

If you try to add a dn to itself, it expands as it goes. The resulting
loop cannot end well.

It looks like this in Python:

    dn = ldb.Dn(ldb.Ldb(), 'CN=y,DC=x')
    dn.add_base(dn)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry picked from commit 19a13cbe0681b3996c33f7449f69b0fb0dc5d640)

4 years agovfs_glusterfs: Use pthreadpool for scheduling aio operations
Poornima G [Wed, 24 Jul 2019 09:45:33 +0000 (15:15 +0530)]
vfs_glusterfs: Use pthreadpool for scheduling aio operations

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

Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 23 18:40:08 UTC 2019 on sn-devel-184

(cherry picked from commit d8863dd8cb74bb0534457ca930a71e77c367d994)

4 years agoctdb-recoverd: Fix typo in previous fix
Martin Schwenke [Tue, 27 Aug 2019 02:13:51 +0000 (12:13 +1000)]
ctdb-recoverd: Fix typo in previous fix

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Aug 27 15:29:11 UTC 2019 on sn-devel-184

(cherry picked from commit 8190993d99284162bd8699780248bb2edfec2673)

4 years agoctdb-tests: Clear deleted record via recovery instead of vacuuming
Martin Schwenke [Tue, 13 Aug 2019 04:45:33 +0000 (14:45 +1000)]
ctdb-tests: Clear deleted record via recovery instead of vacuuming

This test has been flapping because sometimes the record is not
vacuumed within the expected time period, perhaps even because the
check for the record can interfere with vacuuming.  However, instead
of waiting for vacuuming the record can be cleared by doing a
recovery.  This should be much more reliable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
RN: Fix flapping CTDB tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Aug 21 13:06:57 UTC 2019 on sn-devel-184

(cherry picked from commit 71ad473ba805abe23bbe6c1a1290612e448e73f3)

4 years agoctdb-tests: Strengthen volatile DB traverse test
Martin Schwenke [Mon, 29 Jul 2019 07:22:50 +0000 (17:22 +1000)]
ctdb-tests: Strengthen volatile DB traverse test

Check the record count more often, from multiple nodes.  Add a case
with multiple records.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit ca4df06080709adf0cbebc95b0a70b4090dad5ba)

4 years agoctdb-recoverd: Only check for LMASTER nodes in the VNN map
Martin Schwenke [Wed, 21 Aug 2019 04:35:09 +0000 (14:35 +1000)]
ctdb-recoverd: Only check for LMASTER nodes in the VNN map

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 5d655ac6f2ff82f8f1c89b06870d600a1a3c7a8a)

4 years agoctdb-tests: Don't retrieve the VNN map from target node for notlmaster
Martin Schwenke [Mon, 29 Jul 2019 06:45:07 +0000 (16:45 +1000)]
ctdb-tests: Don't retrieve the VNN map from target node for notlmaster

Use the VNN map from the node running node_has_status().

This means that

  wait_until_node_has_status 1 notlmaster 10 0

will run "ctdb status" on node 0 and check (for up to 10 seconds) if
node 1 is in the VNN map.

If the LMASTER capability has been dropped on node 1 then the above
will wait for the VNN map to be updated on node 0.  This will happen
as part of the recovery that is triggered by the change of LMASTER
capability.  The next command will then only be able to attach to
$TESTDB after the recovery is complete thus guaranteeing a sane state
for the test to continue.

This stops simple/79_volatile_db_traverse.sh from going into recovery
during the traverse or at some other inconvenient time.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 53daeb2f878af1634a26e05cb86d87e2faf20173)

4 years agoctdb-tests: Handle special cases first and return
Martin Schwenke [Mon, 29 Jul 2019 06:43:09 +0000 (16:43 +1000)]
ctdb-tests: Handle special cases first and return

All the other cases involve matching bits.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit bff1a3a548a2cace997b767d78bb824438664cb7)

4 years agoctdb-tests: Inline handling of recovered and notlmaster statuses
Martin Schwenke [Mon, 29 Jul 2019 05:45:41 +0000 (15:45 +1000)]
ctdb-tests: Inline handling of recovered and notlmaster statuses

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit bb59073515ee5f7886b5d9a20d7b2805857c2708)

4 years agoctdb-tests: Drop unused node statuses frozen/unfrozen
Martin Schwenke [Mon, 29 Jul 2019 05:40:16 +0000 (15:40 +1000)]
ctdb-tests: Drop unused node statuses frozen/unfrozen

Silently drop unused local variable mpat.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 9b09a87326af28877301ad27bcec5bb13744e2b6)

4 years agoctdb-tests: Reformat node_has_status()
Martin Schwenke [Mon, 29 Jul 2019 05:31:55 +0000 (15:31 +1000)]
ctdb-tests: Reformat node_has_status()

Re-indent and drop non-POSIX left-parenthesis from case labels.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 52227d19735a3305ad633672c70385f443f222f0)

4 years agoVERSION: Bump verison up to 4.11.0rc4...
Karolin Seeger [Tue, 3 Sep 2019 11:13:47 +0000 (13:13 +0200)]
VERSION: Bump verison up to 4.11.0rc4...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoVERSION: Disable GIT_SNAPSHOT for the 4.11.0rc3 release. samba-4.11.0rc3
Karolin Seeger [Tue, 3 Sep 2019 11:12:53 +0000 (13:12 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.11.0rc3 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Add release notes for Samba 4.11.0rc3.
Karolin Seeger [Tue, 3 Sep 2019 11:12:16 +0000 (13:12 +0200)]
WHATSNEW: Add release notes for Samba 4.11.0rc3.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoCVE-2019-10197: smbd: split change_to_user_impersonate() out of change_to_user_internal()
Stefan Metzmacher [Thu, 11 Jul 2019 15:02:15 +0000 (17:02 +0200)]
CVE-2019-10197: smbd: split change_to_user_impersonate() out of change_to_user_internal()

This makes sure we always call chdir_current_service() even
when we still impersonated the user. Which is important
in order to run the SMB* request within the correct working directory
and only if the user has permissions to enter that directory.

It makes sure we always update conn->lastused_count
in chdir_current_service() for each request.

Note that vfs_ChDir() (called from chdir_current_service())
maintains its own cache and avoids calling SMB_VFS_CHDIR()
if possible.

It means we still avoid syscalls if we get a multiple requests
for the same session/tcon tuple.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoCVE-2019-10197: test_smbclient_s3.sh: add regression test for the no permission on...
Stefan Metzmacher [Tue, 16 Jul 2019 13:40:38 +0000 (15:40 +0200)]
CVE-2019-10197: test_smbclient_s3.sh: add regression test for the no permission on share root problem

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 years agoCVE-2019-10197: selftest: make fsrvp_share its own independent subdirectory
Stefan Metzmacher [Tue, 30 Jul 2019 15:16:59 +0000 (17:16 +0200)]
CVE-2019-10197: selftest: make fsrvp_share its own independent subdirectory

The next patch will otherwise break the fsrvp related tests.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 years agoCVE-2019-10197: smbd: make sure we reset current_user.{need,done}_chdir in become_root()
Stefan Metzmacher [Tue, 18 Jun 2019 12:04:08 +0000 (14:04 +0200)]
CVE-2019-10197: smbd: make sure we reset current_user.{need,done}_chdir in become_root()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 years agoCVE-2019-10197: smbd: make sure that change_to_user_internal() always resets current_...
Stefan Metzmacher [Thu, 11 Jul 2019 15:01:29 +0000 (17:01 +0200)]
CVE-2019-10197: smbd: make sure that change_to_user_internal() always resets current_user.done_chdir

We should not leave current_user.done_chdir as true if we didn't call
chdir_current_service() with success.

This caused problems in when calling vfs_ChDir() in pop_conn_ctx() when
chdir_current_service() worked once on one share but later failed on another
share.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoCVE-2019-10197: smbd: separate out impersonation debug info into a new function.
Jeremy Allison [Fri, 12 Jul 2019 19:10:35 +0000 (12:10 -0700)]
CVE-2019-10197: smbd: separate out impersonation debug info into a new function.

Will be called on elsewhere on successful impersonation.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agoWHATSNEW: BIND9_FLATFILE / rndc command deprecated
Andrew Bartlett [Fri, 23 Aug 2019 09:13:22 +0000 (21:13 +1200)]
WHATSNEW: BIND9_FLATFILE / rndc command deprecated

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Wed Aug 28 10:48:10 UTC 2019 on sn-devel-184

4 years agodocs: Deprecate "rndc command" for Samba 4.11
Andrew Bartlett [Fri, 16 Aug 2019 18:59:33 +0000 (06:59 +1200)]
docs: Deprecate "rndc command" for Samba 4.11

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 561e0986ac96c842239b4e8c6509e05c836707b7)

4 years agoctdb-daemon: Make node inactive in the NODE_STOP control
Martin Schwenke [Mon, 19 Aug 2019 11:48:04 +0000 (21:48 +1000)]
ctdb-daemon: Make node inactive in the NODE_STOP control

Currently some of this is supported by a periodic check in the
recovery daemon's main_loop(), which notices the flag change, sets
recovery mode active and freezes databases.  If STOP_NODE returns
immediately then the associated recovery can complete and the node can
be continued before databases are actually frozen.

Instead, immediately do all of the things that make a node inactive.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
RN: Stop "ctdb stop" from completing before freezing databases

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Aug 20 08:32:27 UTC 2019 on sn-devel-184

(cherry picked from commit e9f2e205ee89f4f3d6302cc11b4d0eb2efaf0f53)

4 years agoctdb-daemon: Drop unused function ctdb_local_node_got_banned()
Martin Schwenke [Tue, 20 Aug 2019 01:29:42 +0000 (11:29 +1000)]
ctdb-daemon: Drop unused function ctdb_local_node_got_banned()

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 91ac4c13d8472955d1f04bd775ec4b3ff8bf1b61)

4 years agoctdb-daemon: Switch banning code to use ctdb_node_become_inactive()
Martin Schwenke [Mon, 19 Aug 2019 11:52:57 +0000 (21:52 +1000)]
ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()

There's no reason to avoid immediately setting recovery mode to active
and initiating freeze of databases.

This effectively reverts the following commits:

  d8f3b490bbb691c9916eed0df5b980c1aef23c85
  b4357a79d916b1f8ade8fa78563fbef0ce670aa9

The latter is now implemented using a control, resulting in looser
coupling.

See also the following commit:

  f8141e91a693912ea1107a49320e83702a80757a

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 0f5f7b7cf4e970f3f36c5e0b3d09e710fe90801a)

4 years agoctdb-daemon: Factor out new function ctdb_node_become_inactive()
Martin Schwenke [Mon, 19 Aug 2019 11:47:03 +0000 (21:47 +1000)]
ctdb-daemon: Factor out new function ctdb_node_become_inactive()

This is a superset of ctdb_local_node_got_banned() so will replace
that function, and will also be used in the NODE_STOP control.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit a42bcaabb63722411bee52b80cbfc795593defbc)

4 years agoctdb-tcp: Mark node as disconnected if incoming connection goes away
Martin Schwenke [Tue, 13 Aug 2019 07:08:43 +0000 (17:08 +1000)]
ctdb-tcp: Mark node as disconnected if incoming connection goes away

To make it easy to pass the node data to the upcall, the private data
for ctdb_tcp_read_cb() needs to be changed from tnode to node.

RN: Avoid marking a node as connected before it can receive packets
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Aug 16 22:50:35 UTC 2019 on sn-devel-184

(cherry picked from commit 73c850eda4209b688a169aeeb20c453b738cbb35)