samba.git
6 years agoVERSION: Disable GIT_SNAPSHOT for the 4.7.2 release. samba-4.7.2
Karolin Seeger [Tue, 14 Nov 2017 12:23:27 +0000 (13:23 +0100)]
VERSION: Disable GIT_SNAPSHOT for the 4.7.2 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoWHATSNEW: Add release notes for Samba 4.7.2.
Karolin Seeger [Tue, 14 Nov 2017 12:22:52 +0000 (13:22 +0100)]
WHATSNEW: Add release notes for Samba 4.7.2.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agos4: torture: kernel oplocks. Add smb2.kernel-oplocks.kernel_oplocks8
Jeremy Allison [Thu, 9 Nov 2017 17:59:23 +0000 (09:59 -0800)]
s4: torture: kernel oplocks. Add smb2.kernel-oplocks.kernel_oplocks8

Test if the server blocks whilst waiting on a kernel lease held by
a non-smbd process.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Nov 11 20:12:26 CET 2017 on sn-devel-144

(cherry picked from commit ad82557e1355107920ae80fd6a0df0f16d1bdb6c)

Autobuild-User(v4-7-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-7-test): Tue Nov 14 16:59:15 CET 2017 on sn-devel-144

6 years agos3: smbd: kernel oplocks. Replace retry_open() with setup_kernel_oplock_poll_open().
Jeremy Allison [Thu, 9 Nov 2017 20:48:15 +0000 (12:48 -0800)]
s3: smbd: kernel oplocks. Replace retry_open() with setup_kernel_oplock_poll_open().

If a O_NONBLOCK open fails with EWOULDBLOCK, this code changes smbd to
do a retry open every second, until either the timeout or we get a successful
open. If we're opening a file that has a kernel lease set by a non-smbd
process, this is the best we can do.

Prior to this, smbd would block on the second open on such a leased file
(not using O_NONBLOCK) which freezes active clients.

Regression test to follow.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 47c13fc10a2c9709e9511b2ffcf0e1004497887d)

6 years agopython: use communicate to fix Popen deadlock
Joe Guo [Fri, 15 Sep 2017 04:13:26 +0000 (16:13 +1200)]
python: use communicate to fix Popen deadlock

`Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the
child process generates large output to a pipe such that it blocks waiting for
the OS pipe buffer to accept more data. Use communicate() to avoid that.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Oct 19 09:27:16 CEST 2017 on sn-devel-144

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

(cherry picked from commit 5dc773a5b00834c7a53130a73a48f49048bd55e8)

6 years agoblackbox tests: method to check specific exit codes
Gary Lockyer [Wed, 16 Aug 2017 01:52:25 +0000 (13:52 +1200)]
blackbox tests: method to check specific exit codes

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 74ebcf6dfc84b6aab6838fa99e12808eb6b913d9)

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

6 years agotevent: version 0.9.34
Stefan Metzmacher [Mon, 13 Nov 2017 10:05:04 +0000 (11:05 +0100)]
tevent: version 0.9.34

* Remove unused select backend
* Fix a race condition in tevent_threaded_schedule_immediate()
  (bug #13130)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Nov 13 18:02:46 CET 2017 on sn-devel-144

(cherry picked from commit 2e573eead96b2e98dd8a15c9c8e470679e530392)

6 years agolib: tevent: Remove select backend.
Jeremy Allison [Tue, 12 Sep 2017 19:08:38 +0000 (12:08 -0700)]
lib: tevent: Remove select backend.

select() is no longer useful on modern systems.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Sep 16 08:35:39 CEST 2017 on sn-devel-144

(cherry picked from commit 2a003b1a576dcbbba0d60bae90427776a5c27867)

6 years agotevent: Fix a race condition
Volker Lendecke [Fri, 10 Nov 2017 20:22:26 +0000 (21:22 +0100)]
tevent: Fix a race condition

We can't rely on tctx to exist after we unlocked the mutex. It took a
while, but this does lead to data corruption. If *tctx is replaced with
something where tctx->wakeup_fd points to a real, existing file
descriptor, we're screwed. And by screwed, this means file corruption
on disk.

Again. I am not tall enough for this business.

http://bholley.net/blog/2015/must-be-this-tall-to-write-multi-threaded-code.html

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

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): Sat Nov 11 03:20:09 CET 2017 on sn-devel-144

(cherry picked from commit 20cfcb7dbc5dd099384b76a76e3d35cf627100b6)

Autobuild-User(v4-7-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-7-test): Mon Nov 13 13:54:56 CET 2017 on sn-devel-144

6 years agos4: torture: Add smb2 FIND_and_set_DOC test case.
Ralph Wuerthner [Fri, 27 Oct 2017 12:59:32 +0000 (14:59 +0200)]
s4: torture: Add smb2 FIND_and_set_DOC test case.

Regression tests doing an SMB2_find followed by
a set delete on close and then close on a directory.

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sun Nov  5 12:31:12 CET 2017 on sn-devel-144

(cherry picked from commit 44c018bdcc2d81aaf667d11c0c8fae209419ddd7)

6 years agos3: smbd: Fix delete-on-close after smb2_find
Ralph Wuerthner [Fri, 3 Nov 2017 22:33:28 +0000 (22:33 +0000)]
s3: smbd: Fix delete-on-close after smb2_find

Both dptr_create() and can_delete_directory_fsp() are calling OpenDir_fsp()
to get a directory handle. This causes an issue when delete-on-close is
set after smb2_find because both directory handle instances share the same
underlying file descriptor. In addition the SMB_ASSERT() in destructor
smb_Dir_destructor() gets triggered.

To avoid this use OpenDir() instead of OpenDir_fsp().

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit c9e996d78df3ce326a5c13f8f4f1426918769ceb)

6 years agos4: torture: kernel_oplocks. Create a regression test case for bug #13058.
Jeremy Allison [Fri, 3 Nov 2017 19:02:17 +0000 (12:02 -0700)]
s4: torture: kernel_oplocks. Create a regression test case for bug #13058.

It implements the following test case:

1. client of smbd-1 opens the file and sets the oplock.
2. client of smbd-2 tries to open the file. open() fails(EAGAIN) and open is deferred.
3. client of smbd-1 sends oplock break request to the client.
4. client of smbd-1 closes the file.
5. client of smbd-1 opens the file and sets the oplock.
6. client of smbd-2 calls defer_open_done(), sees that the file lease was not changed
and does not reschedule open.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
(cherry picked from commit 15597a95ecd2d1c2b7edce4942d489c95796951f)

6 years agoRevert "s3/smbd: fix deferred open with streams and kernel oplocks"
Jeremy Allison [Fri, 3 Nov 2017 21:47:01 +0000 (21:47 +0000)]
Revert "s3/smbd: fix deferred open with streams and kernel oplocks"

This reverts commit b35a296a27a0807c780f2a9e7af2f2e93feefaa8.

This was the cause of

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

1. client of smbd-1 opens the file and sets the oplock.
2. client of smbd-2 tries to open the file. open() fails(EAGAIN) and open is deferred.
3. client of smbd-1 sends oplock break request to the client.
4. client of smbd-1 closes the file.
5. client of smbd-1 opens the file and sets the oplock.
6. client of smbd-2 calls defer_open_done(), sees that the file lease was not changed
and does not reschedule open.

and is no longer needed now vfs_streams_xattr.c no longer opens
the base file internally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
(cherry picked from commit 62a556d5c8ce0650e3a2095ee62bea16c8eab1d5)

6 years agoVERSION: Bump version up to 4.7.2...
Karolin Seeger [Thu, 2 Nov 2017 11:36:25 +0000 (12:36 +0100)]
VERSION: Bump version up to 4.7.2...

and re-enable GIT_SNAPSHOTS.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoVERSION: Disable GIT_SNAPSHOTS for the Samba 4.7.1 release. samba-4.7.1
Karolin Seeger [Thu, 2 Nov 2017 11:35:19 +0000 (12:35 +0100)]
VERSION: Disable GIT_SNAPSHOTS for the Samba 4.7.1 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoWHATSNEW: Add release notes for Samba 4.7.1.
Karolin Seeger [Thu, 2 Nov 2017 11:34:42 +0000 (12:34 +0100)]
WHATSNEW: Add release notes for Samba 4.7.1.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agos4:pyparam: Fix resource leaks on error
Andreas Schneider [Wed, 25 Oct 2017 17:25:20 +0000 (19:25 +0200)]
s4:pyparam: Fix resource leaks on error

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e56626e864492831a3dbbca2d4fb8f3281547a90)

Autobuild-User(v4-7-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-7-test): Wed Nov  1 14:59:46 CET 2017 on sn-devel-144

6 years agos3:modules: Check correct variable for NULL in posixacl_xattr
Andreas Schneider [Wed, 25 Oct 2017 17:55:32 +0000 (19:55 +0200)]
s3:modules: Check correct variable for NULL in posixacl_xattr

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 27 04:54:22 CEST 2017 on sn-devel-144

(cherry picked from commit 327190893f5f3352a2e6abc4872b54092ee7de68)

6 years agos3:passdb: Make sure the salt is fully initialized before passing
Andreas Schneider [Wed, 25 Oct 2017 17:50:57 +0000 (19:50 +0200)]
s3:passdb: Make sure the salt is fully initialized before passing

Otherwise the magic member is not initialized.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5274beba4cf722a34403dc07bf287815a6df6281)

6 years agos3:secrets: Do not leak memory of pw and old_pw
Andreas Schneider [Wed, 25 Oct 2017 17:30:28 +0000 (19:30 +0200)]
s3:secrets: Do not leak memory of pw and old_pw

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d6a418c13f0a41851ecc0579765502e076a5cd3b)

6 years agos3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()
Andreas Schneider [Wed, 25 Oct 2017 17:39:34 +0000 (19:39 +0200)]
s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()

Found by cppcheck.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 16389bed0773952ca563b7bf1fecc2a737587257)

6 years agos4:scripting: Fix ntstatus_gen.h generation on 32bit
Andreas Schneider [Wed, 25 Oct 2017 15:37:24 +0000 (17:37 +0200)]
s4:scripting: Fix ntstatus_gen.h generation on 32bit

The hex() function results in different output on 32bit systems. It adds
a L for long for some numbers. Thus we have a different header file.

This patch makes sure we have a consistent file generation on different
paltforms.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Oct 25 22:28:39 CEST 2017 on sn-devel-144

(cherry picked from commit 2d260b28f50ea6ee704d9fab2aaf26f760fa110f)

6 years agoctdb-tests: Process-exists unit tests should wait until PID is registered
Martin Schwenke [Wed, 25 Oct 2017 01:15:23 +0000 (12:15 +1100)]
ctdb-tests: Process-exists unit tests should wait until PID is registered

Otherwise the client registration can race with the check in the test.

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

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): Thu Oct 26 13:32:24 CEST 2017 on sn-devel-144

(cherry picked from commit 0e8b781e0740310d251bf1fa7db7a467d4f7f9b5)

6 years agoctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't
Martin Schwenke [Wed, 25 Oct 2017 06:52:04 +0000 (17:52 +1100)]
ctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't

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

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

6 years agoctdb-tests: Skip starting fake_ctdbd when current node is disconnected
Martin Schwenke [Wed, 25 Oct 2017 10:43:56 +0000 (21:43 +1100)]
ctdb-tests: Skip starting fake_ctdbd when current node is disconnected

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

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

6 years agoctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't
Martin Schwenke [Wed, 25 Oct 2017 07:52:10 +0000 (18:52 +1100)]
ctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't

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

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

6 years agoctdb-tests: Allow wait_until() to be used in unit tests
Martin Schwenke [Wed, 25 Oct 2017 01:04:49 +0000 (12:04 +1100)]
ctdb-tests: Allow wait_until() to be used in unit tests

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

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

6 years agoreplmd: check for duplicate values in MOD_REPLACE case
Douglas Bagnall [Tue, 24 Oct 2017 21:12:09 +0000 (10:12 +1300)]
replmd: check for duplicate values in MOD_REPLACE case

Because we already have a sorted parsed_dn list, this is a simple
linear scan.

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

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

6 years agolinked attribute tests: test against duplicates in replace
Douglas Bagnall [Tue, 24 Oct 2017 21:54:42 +0000 (10:54 +1300)]
linked attribute tests: test against duplicates in replace

We should not be able to introduce duplicate links using MOD_REPLACE.
It turns out we could and weren't testing.

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

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

6 years agos3: smbclient: Test we can rename with a name containing.
Jeremy Allison [Mon, 23 Oct 2017 22:40:04 +0000 (15:40 -0700)]
s3: smbclient: Test we can rename with a name containing.

Samba always allowed this anyway, but it's a good place
to ensure we don't regress.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 24 23:32:58 CEST 2017 on sn-devel-144

(cherry picked from commit 7abe56ccfa4aba75c5e166a7bd0bb8141c3f258b)

6 years agos3: smbclient: Ensure we call client_clean_name() before all operations on remote...
Jeremy Allison [Fri, 20 Oct 2017 22:09:38 +0000 (15:09 -0700)]
s3: smbclient: Ensure we call client_clean_name() before all operations on remote pathnames.

This allows names containing .. components to be resolved on the client side
before being sent to the server. Relative names work in SMB1 but not in SMB2.
Fix both client.c and clitar.c

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit f81c34c296f87127c6d1e4dd6ea74aa75660885d)

6 years agos3: client: Add new utility function client_clean_name().
Jeremy Allison [Sat, 21 Oct 2017 00:08:08 +0000 (00:08 +0000)]
s3: client: Add new utility function client_clean_name().

Correctly canonicalizes a remote pathname removing '..'
elements before sending to a remote server. '..' elements
work in SMB1 pathnames, but not in SMB2.

Not yet used.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit d4d9d1941bdac9993968c34cf928c645e4152fd3)

6 years agovfs_glusterfs: Fix exporting subdirs with shadow_copy2
Michael Adam [Fri, 20 Oct 2017 12:55:10 +0000 (14:55 +0200)]
vfs_glusterfs: Fix exporting subdirs with shadow_copy2

Since the glusterfs vfs module does not operate on a
locally mounted path, but on a "virtual" path starting
at the volume root, some assumptions of the code about
the vfs connect path fail. One example is the shadow_copy2
module which tries to detect the mount point from the
connectpath. In order to circumvent this problem, this
patch forces the "shadow:mountpoint" option to "/", which
skips the mount-point-detection code.

This patch will only have an effect if both the glusterfs
and the shadow_copy2 module are listed in vfs objects
in the right order, i.e. first shadow_copy2, and then
glusterfs.

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

Pair-Programmed-With: Anoop C S <anoopcs@redhat.com>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 1249801ec73c55449068dd72efde81ce6235ec8e)

6 years agoreplace: Link to -lbsd when building replace.c by hand
Andrew Bartlett [Sat, 14 Oct 2017 09:38:18 +0000 (22:38 +1300)]
replace: Link to -lbsd when building replace.c by hand

This ensures that we correctly detect HAVE_IFACE_GETIFADDRS
et al, which are based on a "build the source" style test.

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

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

6 years agovfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR
Anoop C S [Fri, 13 Oct 2017 15:08:31 +0000 (20:38 +0530)]
vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR

Pointer to directory 'dh' inside fruit_rmdir() is obtained using
SMB_VFS_OPENDIR. But this handle is closed directly by invoking
closedir() rather than SMB_VFS_CLOSEDIR. This will result in a
smbd crash if this handle was not obtained from local file system.
Therefore use SMB_VFS_CLOSEDIR corresponding to SMB_VFS_OPENDIR
to correctly close the directory handle.

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

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Oct 16 19:56:55 CEST 2017 on sn-devel-144

(cherry picked from commit 7917f9721c9f8efdf9e7b7c50a9e5147250e36fe)

6 years agoselftest: Also run smbtorture smb2.compound with aio enabled
Christof Schmitt [Wed, 20 Sep 2017 23:13:38 +0000 (16:13 -0700)]
selftest: Also run smbtorture smb2.compound with aio enabled

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Sep 22 09:49:30 CEST 2017 on sn-devel-144

(cherry picked from commit 3a360f552d6641952931d3aa8a9ce85a648de3e1)

6 years agotorture: Add testcase for compound CREATE-WRITE-CLOSE request
Christof Schmitt [Wed, 20 Sep 2017 23:07:50 +0000 (16:07 -0700)]
torture: Add testcase for compound CREATE-WRITE-CLOSE request

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 508aebf40abe83b6319700260c405ada0566a46b)

6 years agosmbd/aio: Do not go async for SMB2 compound requests
Christof Schmitt [Thu, 21 Sep 2017 19:08:01 +0000 (12:08 -0700)]
smbd/aio: Do not go async for SMB2 compound requests

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a2b081e159403e10295a1bc089b48e816ce698b9)

6 years agosmbd: Move check for SMB2 compound request to new function
Christof Schmitt [Fri, 22 Sep 2017 00:41:25 +0000 (17:41 -0700)]
smbd: Move check for SMB2 compound request to new function

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cfa2c3083080016a1288474b8879039db4dbf6b1)

6 years agovfs_catia: Fix a potential memleak
Volker Lendecke [Mon, 16 Oct 2017 15:43:09 +0000 (17:43 +0200)]
vfs_catia: Fix a potential memleak

Together with the previous commit this fixes a memleak (twice) that
happens when vfs_catia is loaded with no mappings defined.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Oct 17 18:53:48 CEST 2017 on sn-devel-144

(cherry picked from commit f6d6af3b2d5efcd160c1e5e09778fb1129530be0)

Autobuild-User(v4-7-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-7-test): Wed Oct 25 12:59:23 CEST 2017 on sn-devel-144

6 years agovfs_catia: Fix a memory leak
Volker Lendecke [Tue, 17 Oct 2017 09:28:36 +0000 (11:28 +0200)]
vfs_catia: Fix a memory leak

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit e77b7aff86ab1cb603f59961f2f5689e4dc770ea)

6 years agosmb.conf.5: sort parameters alphabetically
Alexander Bokovoy [Fri, 6 Oct 2017 19:49:11 +0000 (22:49 +0300)]
smb.conf.5: sort parameters alphabetically

Content of each separate parameter description file is added
into a parameters.all.xml file before compiling smb.conf.5.

The issue is that POSIX file systems generally don't give any
promises over how glob-produced files are sorted. Thus, we need to sort
them in a predictable way.

This patch adds sorting based on a file name as a string. Since all
parameter files named after the parameter itself (plus .xml), we can
use file name sorting.

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

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-By: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 543c0af4767f5be723594b87d078357e1e04f02e)

6 years agokrb5_wrap: ADDRTYPE_INET6 is available in all supported MIT versions
Stefan Metzmacher [Mon, 9 Oct 2017 10:50:35 +0000 (12:50 +0200)]
krb5_wrap: ADDRTYPE_INET6 is available in all supported MIT versions

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
(cherry picked from commit 96e471eecce91e6cd9b92d854a3c6ca10e0634f3)

6 years agokrb5_wrap: KRB5_ADDRESS_INET6 is not a define in Heimdal
Stefan Metzmacher [Mon, 9 Oct 2017 10:50:35 +0000 (12:50 +0200)]
krb5_wrap: KRB5_ADDRESS_INET6 is not a define in Heimdal

All supported versions of Heimal already have KRB5_ADDRESS_INET6,
so there's no need for an explicit check.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
(cherry picked from commit 70146841272bc87c335bd24b736ba2c62efdfe06)

6 years agos4/torture: vfs_fruit: test xattr unpacking
Ralph Boehme [Wed, 11 Oct 2017 14:04:58 +0000 (16:04 +0200)]
s4/torture: vfs_fruit: test xattr unpacking

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Oct 13 21:44:02 CEST 2017 on sn-devel-144

(cherry picked from commit 5f52a0fbe8c9f52c6fed206fd5cd47bd0de867a1)

6 years agos4/torture: vfs_fruit: replace AppleDouble data blob with xattr data
Ralph Boehme [Mon, 9 Oct 2017 14:18:18 +0000 (16:18 +0200)]
s4/torture: vfs_fruit: replace AppleDouble data blob with xattr data

The osx_adouble_w_xattr datablob is used to test conversion from sidecar
._ file metdata to Samba compatible ._ file.

The previous data blob didn't contain xattr data, the new one does.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit c5b25d40e1ab3906805538abdb8f07a934c629f7)

6 years agovfs_fruit: on-access conversion of AppleDouble xattr data
Ralph Boehme [Wed, 11 Oct 2017 10:58:59 +0000 (12:58 +0200)]
vfs_fruit: on-access conversion of AppleDouble xattr data

This finally adds on-access conversion of xattr data stored in sidecar
AppleDouble files.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit d7068324407a9a0b94d992b539631246e97c9098)

6 years agovfs_fruit: static string fruit_catia_maps
Ralph Boehme [Tue, 10 Oct 2017 17:13:36 +0000 (19:13 +0200)]
vfs_fruit: static string fruit_catia_maps

In a later commit these will be used somewhere else too.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit ce516a34972f51eda48c1536858d47dc230ea99a)

6 years agovfs_fruit: pass smb_fname to ad_convert
Ralph Boehme [Tue, 10 Oct 2017 14:15:49 +0000 (16:15 +0200)]
vfs_fruit: pass smb_fname to ad_convert

This will be needed in a later commit when converting xattrs in sidecar
AppleDouble files.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 386249eea3a13303744dbab88480e80790138329)

6 years agovfs_fruit: unpack AppleDouble xattr header if present
Ralph Boehme [Tue, 10 Oct 2017 14:06:33 +0000 (16:06 +0200)]
vfs_fruit: unpack AppleDouble xattr header if present

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit fb137d6070c8cd872a66a4628b0e392cf40c180e)

6 years agovfs_fruit: allocate ad_data buffer up to AD_XATTR_MAX_HDR_SIZE bytes
Ralph Boehme [Tue, 10 Oct 2017 14:04:29 +0000 (16:04 +0200)]
vfs_fruit: allocate ad_data buffer up to AD_XATTR_MAX_HDR_SIZE bytes

This is in preperation of reading potential xattr header data from the
AppleDouble file, not just reading a fixed amount of bytes.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit ab8d01959b906d0b2873357f836bff72d209ff98)

6 years agovfs_fruit: add AppleDouble xattr structure definitions
Ralph Boehme [Tue, 10 Oct 2017 14:03:13 +0000 (16:03 +0200)]
vfs_fruit: add AppleDouble xattr structure definitions

Reference:
https://opensource.apple.com/source/xnu/xnu-4570.1.46/bsd/vfs/vfs_xattr.c

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit b5a664e2580d8823f4f2d3e7e516b576317eb290)

6 years agovfs_fruit: fix ftruncating resource fork
Ralph Boehme [Wed, 11 Oct 2017 16:11:12 +0000 (18:11 +0200)]
vfs_fruit: fix ftruncating resource fork

fruit_ftruncate_rsrc_adouble() is called to effectively ftruncate() the
._ AppleDouble file to the requested size.

The VFS function SMB_VFS_NEXT_FTRUNCATE() otoh would attempt to truncate
to fsp *stream* in any way the next VFS module seems fit. As we know
we're stacked with a streams module, the module will attempt to truncate
the stream. So we're not truncating the ._ file.

This went unnoticed as the AppleDouble file header contains the
authorative resource fork size that was updated correctly.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 3d7932a33263514785fa3e95e2d5502bc02b4ea4)

6 years agovfs_catia: factor out mapping functions
Ralph Boehme [Wed, 11 Oct 2017 09:35:15 +0000 (11:35 +0200)]
vfs_catia: factor out mapping functions

This moves the core mapping functions to a seperate file and makes them
global.

string_replace_init_map() is called to parse a mapping in string and
produce a mapping object that can then be passed to
string_replace_allocate() to do the actual mapping of a string.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit f8bd63e19c8b1c063dd6f41b405d6864a9b546ff)

6 years agoctdb-tests: Add tests for event scripts with multiple '.'s
Amitay Isaacs [Thu, 12 Oct 2017 03:44:03 +0000 (14:44 +1100)]
ctdb-tests: Add tests for event scripts with multiple '.'s

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Oct 18 10:19:48 CEST 2017 on sn-devel-144

(cherry picked from commit 3bc8880ea0532abed1db002710d3dd6a91f750dc)

6 years agoctdb-common: Ignore event scripts with multiple '.'s
Amitay Isaacs [Thu, 12 Oct 2017 03:42:59 +0000 (14:42 +1100)]
ctdb-common: Ignore event scripts with multiple '.'s

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

This avoids running event script copies left by a package manager.

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

6 years agos3: VFS: Protect errno if sys_getwd() fails across free() call.
Jeremy Allison [Tue, 3 Oct 2017 17:58:00 +0000 (10:58 -0700)]
s3: VFS: Protect errno if sys_getwd() fails across free() call.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 4800ed3595513ce1e2f4edee36c35daafc63a3d5)

6 years agos3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.
Jeremy Allison [Tue, 3 Oct 2017 17:37:55 +0000 (10:37 -0700)]
s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit fb9ce0685e5d46e3d7abf5fac07b4f626339a413)

6 years agos3: VFS: Ensure default SMB_VFS_GETWD() call can't return a partially completed struc...
Jeremy Allison [Tue, 3 Oct 2017 00:36:51 +0000 (17:36 -0700)]
s3: VFS: Ensure default SMB_VFS_GETWD() call can't return a partially completed struct smb_filename.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Oct  4 14:05:33 CEST 2017 on sn-devel-144

(cherry picked from commit b07f22158d7feaf9146b68a874427efe0538dbb6)

6 years agonet: groupmap cleanup should not delete BUILTIN mappings
Ralph Boehme [Sat, 30 Sep 2017 06:45:41 +0000 (08:45 +0200)]
net: groupmap cleanup should not delete BUILTIN mappings

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Oct  2 15:17:00 CEST 2017 on sn-devel-144

(cherry picked from commit 064e17c0d6934f685c075abe0cf4913fa20d3a94)

6 years agoctdb-common: Do not queue a packet if queue does not have valid fd
Amitay Isaacs [Fri, 29 Sep 2017 04:23:24 +0000 (14:23 +1000)]
ctdb-common: Do not queue a packet if queue does not have valid fd

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

The only time a ctdb_queue is created without valid fd is when CTDB
is trying to establish connections with other nodes in the cluster.
All the other uses always create a ctdb_queue with valid fd.

This avoids queueing up packets for dead nodes or nodes that are not
running in the cluster and stops consuming memory.

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

6 years agoctdb-tests: Send broadcast to connected nodes, not configured nodes
Amitay Isaacs [Thu, 28 Sep 2017 01:47:24 +0000 (11:47 +1000)]
ctdb-tests: Send broadcast to connected nodes, not configured nodes

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

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

6 years agoctdb-daemon: Send broadcast to connected nodes, not configured nodes
Amitay Isaacs [Thu, 28 Sep 2017 01:47:00 +0000 (11:47 +1000)]
ctdb-daemon: Send broadcast to connected nodes, not configured nodes

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

Database recovery takes care of attaching missing databases on all the nodes.

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

6 years agovfs_solarisacl: fix build for samba 4.7 and up
Jorge Schrauwen via samba-technical [Tue, 3 Oct 2017 17:55:28 +0000 (19:55 +0200)]
vfs_solarisacl: fix build for samba 4.7 and up

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

Signed-off-by: Jorge Schrauwen <sjorge@blackdot.be>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d774aeba5e04eacb98cf938d356e4cc502caa2e7)

6 years agolib: gpo: Put enforced GPOs at the end of the list.
Lutz Justen [Thu, 21 Sep 2017 17:32:05 +0000 (10:32 -0700)]
lib: gpo: Put enforced GPOs at the end of the list.

Enforced GPOs should be applied on top of all non-enforced GPOs,
so that they override policies set in non-enforced GPOs.

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

Signed-off-by: Lutz Justen <ljusten@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Sat Sep 23 05:25:19 CEST 2017 on sn-devel-144

(cherry picked from commit 5f2576a9af4f3c33121ad2b27a621b5f3bb34374)

6 years agolib: gpo: Fixes issue with GPOPTIONS_BLOCK_INHERITANCE.
Lutz Justen [Thu, 21 Sep 2017 17:11:15 +0000 (10:11 -0700)]
lib: gpo: Fixes issue with GPOPTIONS_BLOCK_INHERITANCE.

GP links with the GPOPTIONS_BLOCK_INHERITANCE option set
were blocking GPOs from the same link (i.e. an OU with
the flag set would block its own GPOs). This patch makes
sure the GPOs from the link are added to the list.

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

Signed-off-by: Lutz Justen <ljusten@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 69410c0a02f7b4d7d20eadf4b4fda8ea064e4a0e)

6 years agolib: gpo: Changes order to match GPO application order.
Lutz Justen [Thu, 21 Sep 2017 17:01:58 +0000 (10:01 -0700)]
lib: gpo: Changes order to match GPO application order.

The order of GPOs in a gpo_list generated by ads_get_gpo_list
did not match the order of application. Since GPOs are pushed
to the FRONT of gpo_list, GPOs have to be pushed in the opposite
order of application. (Pushing to front is useful to get
inheritance blocking right).

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

Signed-off-by: Lutz Justen <ljusten@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 6a531773b841f6b713226d1166a1e7d4dbc9b282)

6 years agolib: Use CTDB_CONTROL_CHECK_PID_SRVID
Volker Lendecke [Tue, 29 Aug 2017 11:31:07 +0000 (13:31 +0200)]
lib: Use CTDB_CONTROL_CHECK_PID_SRVID

Also check the unique ID for remote server ids, just like we do for
local server ids

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Sep 26 13:47:31 CEST 2017 on sn-devel-144

(cherry picked from commit 61de349673809b17e680496b616bc432bf0823b0)

6 years agolib: Add "unique_id" to ctdbd_process_exists
Volker Lendecke [Tue, 29 Aug 2017 11:26:20 +0000 (13:26 +0200)]
lib: Add "unique_id" to ctdbd_process_exists

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit f059585fe61e33ce2dd518464829c183de874d8a)

6 years agoctdb-tests: Add tests for client with multiple connections
Amitay Isaacs [Fri, 22 Sep 2017 04:17:59 +0000 (14:17 +1000)]
ctdb-tests: Add tests for client with multiple connections

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 22 20:58:46 CEST 2017 on sn-devel-144

(cherry picked from commit 4df3dcdda692ef65b7d95c4b5623905982b4bd2b)

6 years agoctdb-tests: Add support for multiple ctdb connections in dummy_client
Amitay Isaacs [Fri, 22 Sep 2017 04:14:00 +0000 (14:14 +1000)]
ctdb-tests: Add support for multiple ctdb connections in dummy_client

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 90f7e06c2553a13779dd24739aeefea96f55ba3e)

6 years agoctdb-tests: Check all connections from a process in CHECK_PID_SRVID control
Amitay Isaacs [Fri, 22 Sep 2017 04:04:50 +0000 (14:04 +1000)]
ctdb-tests: Check all connections from a process in CHECK_PID_SRVID control

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 6ed2ed7e2dc55e2508f31f32e53db5dab1fce2a8)

6 years agoctdb-daemon: Check all connections from a process in CHECK_PID_SRVID control
Amitay Isaacs [Fri, 22 Sep 2017 03:52:09 +0000 (13:52 +1000)]
ctdb-daemon: Check all connections from a process in CHECK_PID_SRVID control

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit e342f1f078fa50904216e6e45fb9b6e40043eb98)

6 years agoctdb-tests: Add tests for PID with srvid
Amitay Isaacs [Wed, 30 Aug 2017 06:35:49 +0000 (16:35 +1000)]
ctdb-tests: Add tests for PID with srvid

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Sep 21 12:56:30 CEST 2017 on sn-devel-144

(cherry picked from commit 503bc3997800cfb2fd9f7f092ef896c355b844cd)

6 years agoctdb-tests: Implement control CHECK_PID_SRVID in fake daemon
Amitay Isaacs [Wed, 30 Aug 2017 07:04:44 +0000 (17:04 +1000)]
ctdb-tests: Implement control CHECK_PID_SRVID in fake daemon

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

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

6 years agoctdb-tests: Reimplement message handlers using srvid abstraction
Amitay Isaacs [Wed, 30 Aug 2017 06:59:16 +0000 (16:59 +1000)]
ctdb-tests: Reimplement message handlers using srvid abstraction

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

This is required for CHECK_PID_SRVID control implementation.

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

6 years agoctdb-tool: Update process-exists command to pass optional srvid
Amitay Isaacs [Wed, 30 Aug 2017 06:29:01 +0000 (16:29 +1000)]
ctdb-tool: Update process-exists command to pass optional srvid

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

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

6 years agoctdb-client: Add client code for control CHECK_PID_SRVID
Amitay Isaacs [Thu, 21 Sep 2017 05:52:14 +0000 (15:52 +1000)]
ctdb-client: Add client code for control CHECK_PID_SRVID

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

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

6 years agoctdb-daemon: Add implementation of control CHECK_PID_SRVID
Amitay Isaacs [Wed, 30 Aug 2017 06:18:02 +0000 (16:18 +1000)]
ctdb-daemon: Add implementation of control CHECK_PID_SRVID

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

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

6 years agoctdb-protocol: Add marshalling for control CHECK_PID_SRVID
Amitay Isaacs [Wed, 30 Aug 2017 05:13:53 +0000 (15:13 +1000)]
ctdb-protocol: Add marshalling for control CHECK_PID_SRVID

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

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

6 years agoctdb-protocol: Add marshalling for struct ctdb_pid_srvid
Amitay Isaacs [Wed, 30 Aug 2017 05:13:12 +0000 (15:13 +1000)]
ctdb-protocol: Add marshalling for struct ctdb_pid_srvid

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

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

6 years agoctdb-protocol: Add new control CTDB_CONTROL_CHECK_PID_SRVID
Amitay Isaacs [Wed, 30 Aug 2017 05:10:56 +0000 (15:10 +1000)]
ctdb-protocol: Add new control CTDB_CONTROL_CHECK_PID_SRVID

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

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

6 years agoctdb-common: Extend srvid_exists() check to support optional private_data
Amitay Isaacs [Wed, 30 Aug 2017 03:27:12 +0000 (13:27 +1000)]
ctdb-common: Extend srvid_exists() check to support optional private_data

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

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

6 years agos3: smbd: Currently if getwd() fails after a chdir(), we panic.
Jeremy Allison [Wed, 4 Oct 2017 19:43:22 +0000 (12:43 -0700)]
s3: smbd: Currently if getwd() fails after a chdir(), we panic.

Change this to return to the previous $cwd, and return -1 for the chdir().

If the return to the previous $cwd fails, still panic as we
can't return an unknown state.

Also do early return from failing SMB_VFS_CHDIR, reducing indentation level

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Böhme <slow@samba.org>
(cherry picked from commit 272f1c9febdf51dd6ec7b862d33d2010621e840a)

6 years agos3/smbd: use correct access in get_file_handle_for_metadata
Ralph Boehme [Tue, 29 Aug 2017 14:08:06 +0000 (16:08 +0200)]
s3/smbd: use correct access in get_file_handle_for_metadata

All we want here is FILE_WRITE_ATTRIBUTES, not FILE_WRITE_DATA.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Oct 17 11:48:09 CEST 2017 on sn-devel-144

(cherry picked from commit a3cc2fedab37134edd401b88087e20881c4ea18f)

6 years agos3/smbd: fix access checks in set_ea_dos_attribute()
Ralph Boehme [Tue, 29 Aug 2017 13:55:19 +0000 (15:55 +0200)]
s3/smbd: fix access checks in set_ea_dos_attribute()

We wanted to set the DOS attributes and failed with permission denied
from the VFS/kernel/filesystem. Next thing we wanna do here is override
this if either

- "dos filemode = true" is set and the security descriptor gives the
  user write access or if

- the stored security descriptor has FILE_WRITE_ATTRIBUTES

The former was working, but the latter was not implemented at all.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 143d26283dad8422fba557de311c304f0093d647)

6 years agos3/smbd: README.Coding fixes in set_ea_dos_attribute
Ralph Boehme [Thu, 12 Oct 2017 13:41:01 +0000 (15:41 +0200)]
s3/smbd: README.Coding fixes in set_ea_dos_attribute

While I'm at it, some README.Coding fixes in set_ea_dos_attribute.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit fbad64200e0199acb644d83073234b2f6c200fce)

6 years agos3: spoolss: Fix GUID string format on GetPrinter info
Samuel Cabrero [Thu, 21 Sep 2017 07:53:35 +0000 (09:53 +0200)]
s3: spoolss: Fix GUID string format on GetPrinter info

Fix regression introduced by commit a4157e7c5d75 which removed the braces
around the printer GUID in the printer info level 7 structure.

MS-RPRN section 2.2 says this protocol uses curly-braced GUIDs so printers
are deleted from the directory by the domain controller's pruning service.

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

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct  6 05:21:25 CEST 2017 on sn-devel-144

(cherry picked from commit fc03049ca1721c25c6ad3d01cba2501af3f39b93)

6 years agos3/mdssvc: missing assignment in sl_pack_float
Ralph Boehme [Sun, 27 Aug 2017 17:22:38 +0000 (19:22 +0200)]
s3/mdssvc: missing assignment in sl_pack_float

Spotted by -Werror=maybe-uninitialized:

../source3/rpc_server/mdssvc/marshalling.c: In function ‘sl_pack_float’:
../source3/rpc_server/mdssvc/marshalling.c:171:11: error:
‘ieee_fp_union.w’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  offset = sl_push_uint64_val(buf, offset, bufsize, ieee_fp_union.w);

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 7b58c8f54499f01778bcbfc2ad21521ceed2dd57)

6 years agos4:rpc_server:backupkey: Move variable into scope
Andreas Schneider [Tue, 18 Jul 2017 10:49:05 +0000 (12:49 +0200)]
s4:rpc_server:backupkey: Move variable into scope

CID: #1415510

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4791c152b02a47a59fe33870741b2f4c80351e55)

6 years agos4-dnsserver: Check for too many DNS results
Andrew Bartlett [Tue, 29 Aug 2017 02:19:22 +0000 (14:19 +1200)]
s4-dnsserver: Check for too many DNS results

If we had this check in when the wildcard DNS tests were written, we would have
noticed that the name needed to be escaped (see previous commit).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12994
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 9e9a8d8f887a3b13d06a7cc71edad78c140bb0be)

6 years agos4-dnsserver: Always encode user-supplied names when looking up DNS records
Andrew Bartlett [Mon, 28 Aug 2017 23:48:46 +0000 (11:48 +1200)]
s4-dnsserver: Always encode user-supplied names when looking up DNS records

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

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

6 years agosamba-tool dns query: Allow '*' in names
Gary Lockyer [Wed, 19 Jul 2017 21:13:43 +0000 (09:13 +1200)]
samba-tool dns query: Allow '*' in names

As DNS wild cards are now supported we need to allow '*' characters in
the domain names.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
(cherry picked from commit 29b3a2b0d1e5abc1ca9f112f680251e34fa6e3af)

6 years agosamba-tool dns: Test support of DNS wild card in names
Gary Lockyer [Mon, 7 Aug 2017 01:42:02 +0000 (13:42 +1200)]
samba-tool dns: Test support of DNS wild card in names

As DNS wild cards are now supported we need to allow '*' characters in
the domain names.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
(cherry picked from commit 3d2bd849f119480f0c1262c00e45179ceaa6e755)

6 years agodnsserver: Add support for dns wildcards
Gary Lockyer [Thu, 3 Aug 2017 03:12:02 +0000 (15:12 +1200)]
dnsserver: Add support for dns wildcards

Add support for dns wildcard records. i.e. if the following records
exist

  exact.samba.example.com 3600 A 1.1.1.1
  *.samba.example.com     3600 A 1.1.1.2

look up on exact.samba.example.com will return 1.1.1.1
look up on *.samba.example.com     will return 1.1.1.2
look up on other.samba.example.com will return 1.1.1.2

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
(cherry picked from commit edcbc991253f4d6f59ef9a43a691c66cbbdc2b6d)

6 years agodnsserver: Tighten DNS name checking
Gary Lockyer [Thu, 3 Aug 2017 03:12:51 +0000 (15:12 +1200)]
dnsserver: Tighten DNS name checking

Add checks for the maximum permitted length, maximum number of labels
and the maximum label length.  These extra checks will be used by the
DNS wild card handling.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
(cherry picked from commit 34acf5a99214639e5e7792a9e85d24c9fd7640ac)

6 years agodnsserver: Tests for dns wildcard entries
Gary Lockyer [Tue, 25 Jul 2017 02:14:53 +0000 (14:14 +1200)]
dnsserver: Tests for dns wildcard entries

Add tests for dns wildcards.
Tests validated against Windows Server 2012 R2

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952
(cherry picked from commit 1184770a76800897d59f1c20adaee3b0240697de)

6 years agos4/torture: add a test for rename change notification with inotify enabled
Ralph Boehme [Thu, 13 Jul 2017 14:05:49 +0000 (16:05 +0200)]
s4/torture: add a test for rename change notification with inotify enabled

This is already fixed in master by
5eccc2fd0072409f166c63e6876266f926411423~10..5eccc2fd0072409f166c63e6876266f926411423.

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

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): Sat Aug 26 05:05:08 CEST 2017 on sn-devel-144

(cherry picked from commit 51f40a0e1d10069f55a5884ff1579e8f15f10a1e)

6 years agoselftest: run smb2.notify-inotify testsuite against fileserver
Ralph Boehme [Thu, 13 Jul 2017 14:04:50 +0000 (16:04 +0200)]
selftest: run smb2.notify-inotify testsuite against fileserver

Next commit adds the suite and a test.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 71a68d22a15d12c4038026dd065c54721ddc6723)

6 years agoselftest: enable kernel change notifications in the fileserver environment
Ralph Boehme [Thu, 13 Jul 2017 14:01:53 +0000 (16:01 +0200)]
selftest: enable kernel change notifications in the fileserver environment

This environment is currently not used for any test in the smb2
testsuite, so this change doesn't affect any existing test.

A subsequent commit will add a test for change notifications with kernel
change notify enabled. It verifies a bug (this one) that only crops up
in such a setup and causes rename events to get lost.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit fb8e0343ebebac322d545b54c33b3c1e7bcda393)