bbaumbach/samba.git
6 years agoVERSION: Disable GIT_SNAPSHOT for the 4.6.11 release samba-4.6.11
Karolin Seeger [Mon, 20 Nov 2017 10:13:55 +0000 (11:13 +0100)]
VERSION: Disable GIT_SNAPSHOT for the 4.6.11 release

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoWHATSNEW: Add release notes for Samba 4.6.11.
Karolin Seeger [Mon, 20 Nov 2017 10:10:36 +0000 (11:10 +0100)]
WHATSNEW: Add release notes for Samba 4.6.11.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agos3: smbd: Chain code can return uninitialized memory when talloc buffer is grown.
Jeremy Allison [Wed, 20 Sep 2017 18:04:50 +0000 (11:04 -0700)]
s3: smbd: Chain code can return uninitialized memory when talloc buffer is grown.

Ensure we zero out unused grown area.

CVE-2017-15275

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

Signed-off-by: Jeremy Allison <jra@samba.org>
6 years agos3: smbd: Fix SMB1 use-after-free crash bug. CVE-2017-14746
Jeremy Allison [Tue, 19 Sep 2017 23:11:33 +0000 (16:11 -0700)]
s3: smbd: Fix SMB1 use-after-free crash bug. CVE-2017-14746

When setting up the chain, always use 'next->' variables
not the 'req->' one.

Bug discovered by 连一汉 <lianyihan@360.cn>

CVE-2017-14746

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

Signed-off-by: Jeremy Allison <jra@samba.org>
6 years agoVERSION: Re-enable GIT_SNAPSHOT.
Karolin Seeger [Mon, 20 Nov 2017 10:09:57 +0000 (11:09 +0100)]
VERSION: Re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoVERSION: Bump version up to 4.6.11...
Karolin Seeger [Tue, 14 Nov 2017 12:01:58 +0000 (13:01 +0100)]
VERSION: Bump version up to 4.6.11...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit b196d0efcfaad6ea42ed0873b430ff3d416dd731)

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

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

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-6-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-6-test): Tue Nov 14 16:39:11 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 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

(backported 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 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 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

(cherry picked from commit 5ec68b2e44e5c0c4e6fae362c7e36ad99124faa8)

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: version 0.9.33
Stefan Metzmacher [Fri, 21 Jul 2017 12:34:59 +0000 (14:34 +0200)]
tevent: version 0.9.33

* make tevent_req_print() more robust against crashes

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

Autobuild-User(v4-7-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-7-test): Sun Jul 23 14:41:25 CEST 2017 on sn-devel-144

(cherry picked from commit 892c3aaeb683f2ed51a60ac49fc2c2ea4dede6e8)

6 years agotevent: handle passing req = NULL to tevent_req_print()
Stefan Metzmacher [Thu, 20 Jul 2017 12:20:03 +0000 (14:20 +0200)]
tevent: handle passing req = NULL to tevent_req_print()

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

6 years agotevent: avoid calling talloc_get_name(NULL) in tevent_req_default_print()
Stefan Metzmacher [Thu, 20 Jul 2017 12:16:44 +0000 (14:16 +0200)]
tevent: avoid calling talloc_get_name(NULL) in tevent_req_default_print()

We have the same information available under req->internal.private_type.

This way it's possible to call tevent_req_print() after
tevent_req_received() was called.

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

6 years agotevent: version 0.9.32
Stefan Metzmacher [Tue, 20 Jun 2017 10:17:32 +0000 (12:17 +0200)]
tevent: version 0.9.32

* Fix mutex locking in tevent_threaded_context_destructor().
* Fix a memleak on FreeBSD.
* Re-init threading in tevent_re_initialise().
* Include the finish location in tevent_req_default_print().

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): Thu Jun 22 17:17:33 CEST 2017 on sn-devel-144

(cherry picked from commit e9b4978a764839a142d9f7c166db436bdabea82c)

6 years agotevent: include the finish location in tevent_req_default_print()
Stefan Metzmacher [Wed, 14 Jun 2017 14:59:10 +0000 (16:59 +0200)]
tevent: include the finish location in tevent_req_default_print()

It's verify useful when debugging code without a debugger to
be able to use tevent_req_print() in DEBUG statements.

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

6 years agotevent: Simplify create_immediate
Volker Lendecke [Sat, 17 Jun 2017 19:26:27 +0000 (21:26 +0200)]
tevent: Simplify create_immediate

Not much change, just 9 lines less of code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a7504f555eff101a10ded653ceac98d8294c1659)

6 years agotevent_threads: Fix a rundown race introduced with 1828011317b
Volker Lendecke [Thu, 15 Jun 2017 09:48:24 +0000 (11:48 +0200)]
tevent_threads: Fix a rundown race introduced with 1828011317b

The race is easily reproduced by adding a poll(NULL,0,10) in between the two
pthread_mutex_unlock calls in _tevent_threaded_schedule_immediate.

Before 1828011317b, the main thread was signalled only after the helper
had already unlocked event_ctx_mutex.

Full explaination follows:
-----------------------------------------------------------------
Inside _tevent_threaded_schedule_immediate() we have:

476         ret = pthread_mutex_unlock(&ev->scheduled_mutex);
477         if (ret != 0) {
478                 abort();
479         }

HERE!!!!

481         ret = pthread_mutex_unlock(&tctx->event_ctx_mutex);
482         if (ret != 0) {
483                 abort();
484         }

At the HERE!!! point, what happens is tevent_common_threaded_activate_immediate(),
which is blocked on ev->scheduled_mutex, get released and does:

514         while (ev->scheduled_immediates != NULL) {
515                 struct tevent_immediate *im = ev->scheduled_immediates;
516                 DLIST_REMOVE(ev->scheduled_immediates, im);
517                 DLIST_ADD_END(ev->immediate_events, im);
518         }

- making an immediate event ready to be scheduled.

This then returns into epoll_event_loop_once(), which then calls:

910         if (ev->immediate_events &&
911             tevent_common_loop_immediate(ev)) {
912                 return 0;
913         }

which causes the immediate event to fire. This immediate
event is the pthread job terminate event, which was previously
set up in pthreadpool_tevent_job_signal() by:

198         if (state->tctx != NULL) {
199                 /* with HAVE_PTHREAD */
200                 tevent_threaded_schedule_immediate(state->tctx, state->im,
201                                                    pthreadpool_tevent_job_done,
202                                                    state);

So we now call pthreadpool_tevent_job_done() - which does:

225         TALLOC_FREE(state->tctx);

calling tevent_threaded_context_destructor():

384         ret = pthread_mutex_destroy(&tctx->event_ctx_mutex); <---------------- BOOM returns an error !
385         if (ret != 0) {
386                 abort();
387         }

as we haven't gotten to line 481 above (the line after
HERE!!!!) so the tctx->event_ctx_mutex is still
locked when we try to destroy it.

So doing an additional:

        ret = pthread_mutex_lock(&tctx->event_ctx_mutex);
        ret = pthread_mutex_unlock(&tctx->event_ctx_mutex);

(error checking elided) forces tevent_threaded_context_destructor()
to wait until tctx->event_ctx_mutex is unlocked before it locks/unlocks
and then is guaranteed safe to destroy.

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

6 years agotevent: Fix a race condition in tevent context rundown
Volker Lendecke [Wed, 24 May 2017 14:22:34 +0000 (16:22 +0200)]
tevent: Fix a race condition in tevent context rundown

We protect setting tctx->event_ctx=NULL with tctx->event_ctx_mutex.
But in _tevent_threaded_schedule_immediate we have the classic
TOCTOU race: After we checked "ev==NULL", looking at
tevent_common_context_destructor the event context can go after
_tevent_threaded_schedule_immediate checked. We need to serialize
things a bit by keeping tctx->event_ctx_mutex locked while we
reference "ev", in particular in the

DLIST_ADD_END(ev->scheduled_immediates,im);

I think the locking hierarchy is still maintained, tevent_atfork_prepare()
first locks all the tctx locks, and then the scheduled_mutex.  Also,
I don't think this will impact parallelism too badly: event_ctx_mutex
is only used to protect setting tctx->ev.

Found by staring at code while fixing the FreeBSD memleak due to
not destroying scheduled_mutex.

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): Fri Jun  9 00:45:26 CEST 2017 on sn-devel-144

(cherry picked from commit 1828011317b0a8142c3b66fff22661a962760574)

6 years agotevent: Fix a memleak on FreeBSD
Volker Lendecke [Wed, 24 May 2017 14:21:40 +0000 (16:21 +0200)]
tevent: Fix a memleak on FreeBSD

FreeBSD has malloc'ed memory attached to mutexes. We need to clean this up.

valgrind really helped here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 00390ae27b6bd207add571d7975c37951e15a3e5)

6 years agotevent: Add tevent_re_initialise to threaded test
Volker Lendecke [Mon, 5 Jun 2017 05:29:11 +0000 (07:29 +0200)]
tevent: Add tevent_re_initialise to threaded test

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ca715762418284a1a2acc81d40e9e429e407ce14)

6 years agotevent: Re-init threading in tevent_re_initialise
Volker Lendecke [Mon, 5 Jun 2017 05:16:17 +0000 (07:16 +0200)]
tevent: Re-init threading in tevent_re_initialise

Without this threading is not usable after that call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit afe026d3030c0c05a31de872dd0d120511ba6652)

6 years agotevent: Factor out context initialization
Volker Lendecke [Mon, 5 Jun 2017 04:58:37 +0000 (06:58 +0200)]
tevent: Factor out context initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 97d912d99afb115e17f683a55aef447dc92ced49)

6 years agotevent: Fix a typo
Volker Lendecke [Mon, 5 Jun 2017 05:23:27 +0000 (07:23 +0200)]
tevent: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b03475048a49db78422d1bfc11f2c69d56fbf87f)

6 years agoRevert "tevent: Fix a race condition"
Stefan Metzmacher [Mon, 13 Nov 2017 22:29:42 +0000 (23:29 +0100)]
Revert "tevent: Fix a race condition"

This reverts commit 6a43b1b17902c8fbc319e13f31f6c9177f38371c.

This will reapplied shortly in the correct order relative to
other backports.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
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-6-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-6-test): Mon Nov 13 14:23:54 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 agoRevert "s3: smbclient: Test we can rename with a name containing."
Karolin Seeger [Thu, 2 Nov 2017 12:00:14 +0000 (13:00 +0100)]
Revert "s3: smbclient: Test we can rename with a name containing."

This reverts commit 8c7d944f106ca54581f5757bb8fa9c85169a04f2.

Autobuild-User(v4-6-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-6-test): Thu Nov  2 16:56:03 CET 2017 on sn-devel-144

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: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)

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 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 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 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 agoVERSION: Bump version up to 4.6.10...
Karolin Seeger [Wed, 25 Oct 2017 08:49:09 +0000 (10:49 +0200)]
VERSION: Bump version up to 4.6.10...

and re-enable GIT_SNAPSHOTS.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoVERSION: Disable GIT_SNAPSHOTS for the 4.6.9 release. samba-4.6.9
Karolin Seeger [Wed, 25 Oct 2017 08:48:29 +0000 (10:48 +0200)]
VERSION: Disable GIT_SNAPSHOTS for the 4.6.9 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoWHATSNEW: Add release notes for Samba 4.6.9.
Karolin Seeger [Wed, 25 Oct 2017 08:48:00 +0000 (10:48 +0200)]
WHATSNEW: Add release notes for Samba 4.6.9.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
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-6-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-6-test): Wed Oct 25 12:49:20 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 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>
(backported 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 path to ad_convert
Ralph Boehme [Tue, 10 Oct 2017 14:15:49 +0000 (16:15 +0200)]
vfs_fruit: pass path 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>
(backported 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>
(backported from commit f8bd63e19c8b1c063dd6f41b405d6864a9b546ff)

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 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 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 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/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

(backported 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>
(backported from commit fb8e0343ebebac322d545b54c33b3c1e7bcda393)

6 years agomessaging: Remove messaging_handler_send
Volker Lendecke [Sat, 24 Jun 2017 07:01:46 +0000 (09:01 +0200)]
messaging: Remove messaging_handler_send

This did not really take off, notifyd was the only user

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

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): Fri Jul  7 05:11:48 CEST 2017 on sn-devel-144

(cherry picked from commit 5eccc2fd0072409f166c63e6876266f926411423)

6 years agonotifyd: Remove notifyd_handler_done
Volker Lendecke [Sat, 24 Jun 2017 06:57:18 +0000 (08:57 +0200)]
notifyd: Remove notifyd_handler_done

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 197186a1fcc2c190fac9a16893234c337e6ec01c)

6 years agonotifyd: Use messaging_register for MSG_SMB_NOTIFY_DB
Volker Lendecke [Sat, 24 Jun 2017 06:56:35 +0000 (08:56 +0200)]
notifyd: Use messaging_register for MSG_SMB_NOTIFY_DB

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 9430fab61cb746e590db307af37219f8f29b7fd8)

6 years agonotifyd: Use messaging_register for MSG_SMB_NOTIFY_GET_DB
Volker Lendecke [Sat, 24 Jun 2017 06:48:45 +0000 (08:48 +0200)]
notifyd: Use messaging_register for MSG_SMB_NOTIFY_GET_DB

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit dc39bb45624f8d6859dadc3c9a9a85793a5a7d0d)

6 years agonotifyd: Use messaging_register for MSG_SMB_NOTIFY_TRIGGER
Volker Lendecke [Sat, 24 Jun 2017 06:45:17 +0000 (08:45 +0200)]
notifyd: Use messaging_register for MSG_SMB_NOTIFY_TRIGGER

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit db15feb162326cb03fb06df24bcdafa5d5cb3087)

6 years agonotifyd: Use messaging_register for MSG_SMB_NOTIFY_REC_CHANGE
Volker Lendecke [Sat, 24 Jun 2017 06:38:53 +0000 (08:38 +0200)]
notifyd: Use messaging_register for MSG_SMB_NOTIFY_REC_CHANGE

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b6079af1c41481714ac981fdd19f89ee197b4200)

6 years agomessaging: make messaging_rec_create public
Volker Lendecke [Sat, 24 Jun 2017 06:38:19 +0000 (08:38 +0200)]
messaging: make messaging_rec_create public

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0c1e08b5901e54c70cf72c74837a8ed8cc77f0b8)

6 years agonotifyd: Avoid an if-expression
Volker Lendecke [Wed, 5 Jul 2017 07:37:14 +0000 (09:37 +0200)]
notifyd: Avoid an if-expression

Best reviewed with "git show -b -U10"

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b8dccd11ea3d43b9ee51811c1ce7d81b91a549ca)

6 years agonotifyd: Consolidate two #ifdef CLUSTER into one
Volker Lendecke [Wed, 5 Jul 2017 07:34:51 +0000 (09:34 +0200)]
notifyd: Consolidate two #ifdef CLUSTER into one

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d0a7bccae9856aba44a057c09499aa0de6b21862)

6 years agonotifyd: Only ask for messaging_ctdb_conn when clustering
Volker Lendecke [Fri, 16 Jun 2017 13:20:22 +0000 (15:20 +0200)]
notifyd: Only ask for messaging_ctdb_conn when clustering

Without clustering, messaging_ctdb_conn will fail anyway.

Review with "git show -b".

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 939576d968d1e0159456baf6dd1e3c454b98995a)

6 years agoselftest: prevent interpretation of escape sequences in test_give_owner.sh
Ralph Boehme [Fri, 13 Oct 2017 12:32:58 +0000 (14:32 +0200)]
selftest: prevent interpretation of escape sequences in test_give_owner.sh

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Oct 14 06:02:50 CEST 2017 on sn-devel-144

(cherry picked from commit 7abf0acef48cb585fa8e5666fd4c27692b9c8ae3)

6 years agoselftest: add some debugging to test_give_owner.sh
Ralph Boehme [Thu, 12 Oct 2017 15:07:15 +0000 (17:07 +0200)]
selftest: add some debugging to test_give_owner.sh

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

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): Fri Oct 13 01:22:05 CEST 2017 on sn-devel-144

(cherry picked from commit 156015aed0b5a72b2f7150beb5cdaffa32b554e5)