[Pkg-samba-maint] [Git][samba-team/samba][stretch-security] 197 commits: VERSION: Bump version up to 4.5.7...

Mathieu Parent gitlab at salsa.debian.org
Tue Mar 13 09:51:38 UTC 2018


Mathieu Parent pushed to branch stretch-security at Debian Samba Team / samba


Commits:
520e1a58 by Karolin Seeger at 2017-03-09T10:19:50+01:00
VERSION: Bump version up to 4.5.7...

and re-enable GIT_SNAPSHOTS.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
73f60429 by Volker Lendecke at 2017-03-13T17:08:45+01:00
smbd: Do an early exit on negprot failure

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit cf9acf9a3da932fca115967eb3d9d9ed48fcbbfc)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Mon Mar 13 17:08:45 CET 2017 on sn-devel-144

- - - - -
8f4bb3af by Ralph Boehme at 2017-03-14T10:52:12+01:00
s3/wscript: fix Linux kernel oplock detection

Fix a copy/paste error, the Linux kernel oplocks check was copied from
the change notify support check.

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

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

- - - - -
c0d2c631 by Ralph Boehme at 2017-03-14T10:52:12+01:00
s3/smbd: add const to get_lease_type() args

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

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

- - - - -
52634536 by Ralph Boehme at 2017-03-14T10:52:12+01:00
s3/smbd: add comments and some reformatting to open_file_ntcreate()

No change in behaviour.

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

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

- - - - -
32faf95a by Ralph Boehme at 2017-03-14T10:52:12+01:00
s3/smbd: req is already validated at the beginning of open_file_ntcreate()

req can't be NULL because the if condition surrounding this code checks
!(oplock_request & INTERNAL_OPEN_ONLY).

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

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

- - - - -
8707c863 by Ralph Boehme at 2017-03-14T10:52:12+01:00
s3/smbd: simplify defer_open()

Add a helper function deferred_open_record_create() that creates a
deferred_open_record and let all callers pass all needed arguments
individually.

While we're at it, enhance the debug message in defer_open() to print
all variables.

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

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

- - - - -
6f7f8443 by Ralph Boehme at 2017-03-14T10:52:12+01:00
s3/smbd: add and use retry_open() instead of defer_open() in two places

Add a new function that does an immediate open rescheduling.

The first deferred open this commit changes was never scheduled, as the
scheduling relies on a timeout of the watch on the sharemode lock.

This has been broken since the commits in

$ git log --reverse -p -10 8283fd0e0090ed12b0b12d5acb550642d621b026

That patchset added the dbwrap watch record logic to defer_open() and
removed the timers.

I'm doing this mainly to untangle the defer_open() logic which is
complicated by the lck arg.

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

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

- - - - -
5e02ff15 by Ralph Boehme at 2017-03-14T10:52:13+01:00
s3/smbd: fix schedule_async_open() timer

schedule_async_open() was calling defer_open with sharemode lock = NULL,
as a result there was never an active 20 s timeout.

This has been broken since the commits in

$ git log --reverse -p -10 8283fd0e0090ed12b0b12d5acb550642d621b026

Just roll our own deferred record instead of calling defer_open() and
also set up timer that, as a last resort, catches stuck opens and just
exits for now.

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

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

- - - - -
5f098459 by Ralph Boehme at 2017-03-14T10:52:13+01:00
s3/smbd: remove async_open arg from defer_open()

All remaining callers pass false.

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

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

- - - - -
1b5e5040 by Ralph Boehme at 2017-03-14T10:52:13+01:00
s3/smbd: all callers of defer_open() pass a lck

No change in behaviour. Update the function comment explaining how it
works and relies on lck for a record watch.

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

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

- - - - -
a54aa79b by Ralph Boehme at 2017-03-14T10:52:13+01:00
s3/smbd: fix deferred open with streams and kernel oplocks

I noticed smbd can get stuck in an open() call with kernel oplocks
enabled and named streams (provided by vfs_streams_xattr):

- client opens a file and with an exclusive oplock

- client starts writing to the file

- client opens an existing stream of the file

- the smbd process gets stuck in an open()

What happens is:

we had setup a locking.tdb record watch in defer_open(), the watch was
triggered, we reattempted the open and got stuck in a blocking open
because the oplock holder (ourselves) hadn't given up the oplock yet.

Cf e576bf5310bc9de9686a71539e9a1b60b4fba5cc for the commit that added
the kernel oplock retry logic. tldr: with kernel oplocks the first open
is non-blocking, but the second one is blocking.

Detailed analysis follows.

When opening a named stream of a file, Samba internally opens the
underlying "base" file first. This internal open of the basefile suceeds
and does *not* trigger an oplock break (because it is an internal open
that doesn't call open() at all) but it is added as an entry to the
locking.tdb record of the file.

Next, the stream open ends up in streams_xattr where a non-blocking
open() on the base file is called. This open fails with EWOULDBLOCK
because we have another fd with a kernel oplock on the file.

So we call defer_open() which sets up a watch on the locking.tdb record.

In the subsequent error unwinding code in open_file_ntcreate() and
callers we close the internal open file handle of the basefile which
also removes the entry from the locking.tdb record and so *changes the
record*.

This fires the record watch and in the callback defer_open_done() we
don't check whether the condition (oplock gone) we're interested in is
actually met. The callback blindly reschedules the open request with
schedule_deferred_open_message_smb().

schedule_deferred_open_message_smb() schedules an immediate tevent event
which has precedence over the IPC fd events in messaging, so the open is
always (!) reattempted before processing the oplock break message.

As explained above, this second open will be a blocking one so we get
stuck in a blocking open.

It doesn't help to make all opens non-blocking, that would just result
in a busy loop failing the open, as we never process the oplock break
message (remember, schedule_deferred_open_message_smb() used immediate
tevent events).

To fix this we must add some logic to the record watch callback to check
whether the record watch was done for a kernel oplock file and if yes,
check if the oplock state changed. If not, simply reschedule the
deferred open and keep waiting.

This logic is only needed for kernel oplocks, not for Samba-level
oplocks, because there's no risk of deadlocking, the worst that can
happen is a rescheduled open that fails again in the oplock checks and
gets deferred again.

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

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

- - - - -
e103ad52 by Ralph Boehme at 2017-03-14T10:52:13+01:00
s3/selftest: adopt config.h check from source4

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(backported from commit 6e54d8d2bda2c9232676f8c08c626f22de50f52b)

- - - - -
f70070cb by Ralph Boehme at 2017-03-14T10:52:13+01:00
s4/torture: some tests for kernel oplocks

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(backported from commit fd03420c4f59d3248b80d07a302d1404ce78b09f)

- - - - -
708b1e20 by Ralph Boehme at 2017-03-14T11:53:47+01:00
manpages/vfs_fruit: document global options

Some options MUST be set in the global section, better document that.

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

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

- - - - -
62262616 by Andreas Schneider at 2017-03-15T10:00:27+01:00
replace: Include sysmacros.h

In the GNU C Library, "makedev" is defined by <sys/sysmacros.h>. For
historical compatibility, it is currently defined by <sys/types.h> as
well, but it is planned to remove this soon.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

(cherry picked from commit 0127bdd33b251a52c6ffc44b6cb3b82b16a80741)

- - - - -
28b33116 by Karolin Seeger at 2017-03-23T10:20:28+01:00
Merge tag 'samba-4.5.7' into v4-5-test

samba: tag release samba-4.5.7

- - - - -
d5379777 by Karolin Seeger at 2017-03-23T10:20:48+01:00
VERSION: Up to Samba 4.5.8.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
cd86895e by Jeremy Allison at 2017-03-23T13:04:07+01:00
s3: locking: Move two leases functions into a new file.

map_oplock_to_lease_type(), fsp_lease_type().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(back ported from commit 125c78ad0b8f9caaef1ba2f1aeb5ec593375fccd)

- - - - -
9533a55e by Jeremy Allison at 2017-03-23T13:04:07+01:00
s3: locking: Update oplock optimization for the leases era !

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Mar 15 20:04:32 CET 2017 on sn-devel-144

(cherry picked from commit 1c4b15aa5f6707e7bcfc21435e26929fb7f45c0f)

- - - - -
85e34461 by Andreas Schneider at 2017-03-23T13:04:07+01:00
s3:vfs_expand_msdfs: Do not open the remote address as a file

The arguments get passed in the wrong order to read_target_host().

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

Signed-off-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 1115f152de9ec25bc9e5e499874b4a7c92c888c0)

- - - - -
19b6c872 by Amitay Isaacs at 2017-03-23T13:04:07+01:00
ctdb-readonly: Avoid a tight loop waiting for revoke to complete

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

During revoking readonly delegations, if one of the nodes disappears, then
there is no point re-trying revoking readonly delegation.  The database
needs to be recovered before the revoke operation can succeed.  So retry
only after a grace period.

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Fri Mar 17 14:05:57 CET 2017 on sn-devel-144

(cherry picked from commit ad758cb869ac83534993caa212abc9fe9905ec68)

- - - - -
968e3e2f by Jeremy Allison at 2017-03-23T13:04:07+01:00
Fix for Solaris C compiler.

Inspired by comment 4 in bug 12559.

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

Signed-off-by: Tom Schulz <schulz at adi.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
(cherry picked from commit 59229276bcf5e2b7fa0ddf3ceb6fd3adccc01f9a)

- - - - -
8e8ebe54 by Jeremy Allison at 2017-03-23T17:08:09+01:00
Changes to make the Solaris C compiler happy.

Fix Bug 12693 dbwrap_watch.c syntax error before or at: }

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

Signed-off-by: Tom schulz <schulz at adi.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2780a56d0bb7848e017314a033ef22ee944d8b05)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Thu Mar 23 17:08:09 CET 2017 on sn-devel-144

- - - - -
cecab32b by Jeremy Allison at 2017-03-27T15:50:32+02:00
s3: libgpo: Allow skipping GPO objects that don't have the expected LDAP attributes.

We expect the following attributes to be present in an LDAP GPO object:

displayName
flags
gPCFileSysPath
name
ntSecurityDescriptor
versionNumber

and fail if a result is returned without them. Change this
to skip results that don't contain these attributes instead.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit 24622bab3a6f1e959c79dc9fc1850e9e64b15adc)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Mon Mar 27 15:50:32 CEST 2017 on sn-devel-144

- - - - -
a5c92d85 by Uri Simchoni at 2017-03-28T12:18:08+02:00
smbd: add zero_file_id flag

This flag instructs the SMB layer to report a zero on-disk
file identifier.

According to [MS-SMB2] 3.3.5.9.9, the reported on-disk file ID
SHOULD be unique. However, macOS clients seem to expect it to be
unique over time as well, like the HFS+ CNID. Reporting a file ID
of 0 seems to instruct the Mac client not to trust the server-reported
file ID.

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 6711522e1e57980e50e245f43167d0daf5a705ad)

- - - - -
3722b06f by Uri Simchoni at 2017-03-28T12:18:08+02:00
vfs_fruit: enable zero file id

Enable zero_file_id if both conditions are met:
- AAPL negotiated
- fruit:zero_file_id is set

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 245a325532c9a46ec3e459ceca38e903b203f691)

- - - - -
42b77e93 by Uri Simchoni at 2017-03-28T12:18:08+02:00
vfs_fruit: document added zero_file_id parameter

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit e11d4eb4d5c6cfc6daa3dbdcc301a4fa83298f0e)

- - - - -
d89cfae3 by Uri Simchoni at 2017-03-28T12:18:09+02:00
torture: add torture_assert_mem_not_equal_goto()

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f31fd41ca728d664ded940a7309ef1e32383bb66)

- - - - -
78b188d5 by Uri Simchoni at 2017-03-28T16:23:23+02:00
selftest: tests for vfs_fruite file-id behavior

The test is in its own suite because it validates
our hackish workaround rather than some reference
implementation behavior.

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Sun Mar 26 23:31:08 CEST 2017 on sn-devel-144

(cherry picked from commit b6baf35ebde68db75515910ede26e74bb8313284)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Tue Mar 28 16:23:23 CEST 2017 on sn-devel-144

- - - - -
e5094cfd by Jeremy Allison at 2017-03-29T10:23:16+02:00
s3: smbd: Fix incorrect logic exposed by fix for the security bug 12496 (CVE-2017-2619).

In a UNIX filesystem, the names "." and ".." by definition can *never*
be symlinks - they are already reserved names.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
(cherry picked from commit ae17bebd250bdde5614b2ac17e53512f19fe9b68)

- - - - -
c5c8e6aa by Jeremy Allison at 2017-03-29T10:23:17+02:00
s3: Test for CVE-2017-2619 regression with "follow symlinks = no".

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

Back-ported from commit 782172a9bef0040981d20e49519b13dd744df6a0

- - - - -
3b4cb587 by Jeremy Allison at 2017-03-29T10:23:17+02:00
s3: Fixup test for CVE-2017-2619 regression with "follow symlinks = no"

Use correct bash operators (not string operators).
Add missing "return".

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

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

- - - - -
9ddabbf4 by Jeremy Allison at 2017-03-29T10:23:17+02:00
s3: smbd: Fix "follow symlink = no" regression part 2.

Add an extra paramter to cwd_name to check_reduced_name().

If cwd_name == NULL then fname is a client given path relative
to the root path of the share.

If cwd_name != NULL then fname is a client given path relative
to cwd_name. cwd_name is relative to the root path of the share.

Not yet used, logic added in the next commit.

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

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

- - - - -
080a3900 by Jeremy Allison at 2017-03-29T10:23:17+02:00
s3: smbd: Fix "follow symlink = no" regression part 2.

Use the cwd_name parameter to reconstruct the original
client name for symlink testing.

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

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

- - - - -
342e39b0 by Jeremy Allison at 2017-03-29T14:26:27+02:00
s3: Test for CVE-2017-2619 regression with "follow symlinks = no" - part 2

Add tests for regular access.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Mar 28 17:05:27 CEST 2017 on sn-devel-144

(cherry picked from commit 4e734fcd1bf82c08aa303ce44e9735acccffcf06)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Wed Mar 29 14:26:27 CEST 2017 on sn-devel-144

- - - - -
25ed6156 by Karolin Seeger at 2017-03-31T10:15:40+02:00
Merge tag 'samba-4.5.8' into v4-5-test

samba: tag release samba-4.5.8

- - - - -
fa9bc20e by Karolin Seeger at 2017-03-31T10:16:13+02:00
VERSION: Bump version up to 4.5.9.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
82cf3678 by Ralph Boehme at 2017-04-20T12:26:10+02:00
winbindd: use correct domain name for failed lookupsids

What we want here is, for failed lookupsids, pass the domain name of the
SID we were trying to lookup to the idmap backend.

But as a domain member, using

  state->single_domains[state->single_sids_done]

for this purpose will always be use our primary domain name (for S-1-5-21
SIDs that are not in our local SAM).

So for now use find_domain_from_sid_noinit() to find the domain from the
domain list. This can be removed when we switch idmap backend
determination to be based on domain SIDs, not names.

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

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

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

- - - - -
d5d552d1 by Ralph Boehme at 2017-04-20T12:26:10+02:00
winbindd: remove unused single_domains array

This was added as part of 9be918116e356c358ef77cc2933e471090088293, but
is not needed anymore as the previous commit changed the logic.

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

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 9671811da8ad3f91ba7bb0fa868f806bc5afe863)

- - - - -
6249de7f by Ralph Boehme at 2017-04-20T12:26:10+02:00
selftest: new environment "ad_member_idmap_rid"

This uses idmap_rid for the primary domain.

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

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

- - - - -
107f3eee by Ralph Boehme at 2017-04-20T12:26:10+02:00
selftest: tests idmap mapping with idmap_rid

This adds two blackbox tests that run wbinfo --sids-to-unix-ids:

o a non-existing SID from the primary domain should return a mapping

o a SID with a bogus (and therefor unknown) domain must not return a mapping

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Fri Apr  7 00:05:02 CEST 2017 on sn-devel-144

(cherry picked from commit b680ceebf85b2403758a0f9e931f1211e9b80e8d)

- - - - -
3dc328cf by Christof Schmitt at 2017-04-20T12:26:10+02:00
winbindd: Fix password policy for pam authentication

Authenticating users from trusted domains would return the password
policy of the joined domain. Fix the code so that the password policy of
the joined domain is only returned for users from that domain.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Wed Mar 29 22:54:47 CEST 2017 on sn-devel-144

(cherry picked from commit bc39fb07ced84af4d97853d00d07fb4293352686)

- - - - -
2ead4b43 by Volker Lendecke at 2017-04-20T12:26:11+02:00
smbd: Fix smb1 findfirst with DFS

9377f3bce should have changed the callers of dfs_path_lookup. It now
takes a uint32_t ucf_flags, not a boolean anymore.

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

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

- - - - -
f54ff446 by Volker Lendecke at 2017-04-20T12:26:11+02:00
selftest: Test for bug 12558

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

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

- - - - -
1de3e926 by Andreas Schneider at 2017-04-20T12:26:11+02:00
waf: Explicitly link libreplace against libnss_wins.so

If we do not specify replace as a depencency here, it will not link to
libreplace using an rpath.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Jim McDonough <jmcd at samba.org>

(cherry picked from commit d8a5565ae647352d11d622bd4e73ff4568678a7c)

- - - - -
92cc3b27 by Ralph Boehme at 2017-04-20T12:26:11+02:00
vfs_fruit: resource fork open request with flags=O_CREAT|O_RDONLY

When receiving an SMB create request with read-only access mode and
open_if disposition, we end of calling the open() function with
flags=O_CREAT|O_RDONLY for the ._ AppleDouble file.

If the file doesn't exist, ie there's currently no rsrc stream, we create
it but then we fail to write the AppleDouble header into the file due to
the O_RDONLY open mode, leaving a 0 byte size ._ file.

Running this create requests against macOS SMB server yields an
interesting result: it returns NT_STATUS_OBJECT_NAME_NOT_FOUND even
though create dispotion is open_if. Another instance where the macOS SMB
server just exposes FSA behaviour (ie HFS+) and we have to adapt to be
compatible.

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

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

- - - - -
6bcfe2dc by Ralph Boehme at 2017-04-20T12:26:11+02:00
s4/torture: vfs_fruit: test for bug 12565

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

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

- - - - -
089711ef by Ralph Boehme at 2017-04-20T12:26:11+02:00
winbindd: use passdb backend for well-known SIDs

On a DC well-known SIDs like S-1-1-0 (everyone) *must* be handled by the
local domain, otherwise something simple like this fails with
WBC_ERR_DOMAIN_NOT_FOUND:

$ make testenv SELFTEST_TESTENV=nt4_dc SCREEN=1

localnt4dc2$ ./bin/wbinfo --sid-to-name S-1-1-0
failed to call wbcLookupSid: WBC_ERR_DOMAIN_NOT_FOUND
Could not lookup sid S-1-1-0

On a member server asking our DC works and is what we're currently
doing, but changing it to ask passdb avoids the overhead.

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

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

- - - - -
82bbb792 by Ralph Boehme at 2017-04-20T12:26:11+02:00
selftest: wbinfo -s tests for wellknown SIDs

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

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

- - - - -
888e75a3 by Ralph Boehme at 2017-04-20T12:26:11+02:00
selftest: wbinfo --sids-to-unix-ids tests for wellknown SIDs

This test passes even without the fix, as in sids2xids we use the
lookupnames just to determine the mapping domain, using the default
idmap domain as fallback if that fails.

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

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

- - - - -
cca29f8c by Ralph Boehme at 2017-04-20T12:26:11+02:00
winbindd: explicit check for well-known SIDs in wb_lookupsids_bulk()

Those are implicitly already catched by the

  if (sid->num_auths != 5)

check, but I'd like to make the desired behaviour more obvious.

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

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

- - - - -
27359922 by Ralph Boehme at 2017-04-20T12:26:11+02:00
selftest: fix for wbinfo -s tests for wellknown SIDs

Rework while loop to not use a pipe as that uses a subshell for the loop
which means assigning to the variable failed is not visible in the
main script.

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

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

- - - - -
f81a0ff5 by Ralph Boehme at 2017-04-20T12:26:11+02:00
s3/include: add NT_STATUS_LOOKUP_ERR

Useful helper macro to check the return value of LSA and SAMR
translations.

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

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

- - - - -
84c7c56d by Ralph Boehme at 2017-04-20T12:26:11+02:00
s3/rpc_client: use NT_STATUS_LOOKUP_ERR

No change in behaviour.

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

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

- - - - -
bc6d9010 by Ralph Boehme at 2017-04-20T12:26:11+02:00
s3/rpc_client: lookupsids error handling of NT_STATUS_NONE_MAPPED

NT_STATUS_NONE_MAPPED is not a fatal error, it just means we must return
all lsa_TranslatedName's as type SID_NAME_UNKNOWN.

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

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

- - - - -
46abe7f0 by Ralph Boehme at 2017-04-20T12:26:11+02:00
winbindd: error handling in rpc_lookup_sids()

NT_STATUS_NONE_MAPPED and NT_STATUS_SOME_NOT_MAPPED should not be
treated as fatal error. We should continue processing the results and
not bail out.

In case we got NT_STATUS_NONE_MAPPED we must have to ensure all
lsa_TranslatedName are of type SID_NAME_UNKNOWN.

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

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

- - - - -
490f7221 by Ralph Boehme at 2017-04-20T12:26:11+02:00
winbindd: trigger possible passdb_dsdb initialisation

If the passdb backend is passdb_dsdb the domain SID comes from dsdb, not
from secrets.tdb. As we use the domain SID in various places, we must
ensure the domain SID is migrated from dsdb to secrets.tdb before
get_global_sam_sid() is called the first time.

The migration is done as part of the passdb_dsdb initialisation, calling
pdb_get_domain_info() triggers it.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Apr  1 21:18:59 CEST 2017 on sn-devel-144

(cherry picked from commit 8b32fc4006ae338ddee7c0e5991958ec3463da0d)

- - - - -
8c283d4d by Amitay Isaacs at 2017-04-20T12:26:11+02:00
ctdb-docs: Fix documentation of -n option to ctdb tool

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

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: David Disseldorp <ddiss at samba.org>
(cherry picked from commit 7f714a436250dfeaa1970f78090ef066482711f0)

- - - - -
5e293796 by Uri Simchoni at 2017-04-20T12:26:11+02:00
selftest: test fetching a large ACL from vfs_acl_xattr

Add a test that fetches an ACL whose size is larger than 4K.

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(back-ported from commit 5017dfeef24b8d568e0146c085f3f979d688acf2)

- - - - -
4b0b0126 by Uri Simchoni at 2017-04-20T12:26:11+02:00
vfs_xattr_tdb: handle case of zero size.

With getxattr(), passing a zero buffer size is a
way of obtaining actual xattr size.

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4dfa2d6a0972847e3b21ddf05077e50ed72c4ea8)

- - - - -
c0bf985b by Uri Simchoni at 2017-04-20T12:26:12+02:00
vfs_acl_xattr: factor out fetching of an extended attribute

Pure refactoring - add a function that fetches an extended attribute
based on either the file descriptor or the file name.

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 7b775abd9278ae34110ec87d94a736be7f64884a)

- - - - -
5cba8bb5 by Uri Simchoni at 2017-04-20T12:26:12+02:00
vfs_acl_xattr: avoid needlessly supplying a large buffer to getxattr()

When obtaining the security descriptor via getxattr(), first try
optimistically to supply a buffer of 4K, and if that turns out
to be too small, determine the correct buffer size.

The previous behavior of falling back to a 64K buffer encountered
problem with Linux prior to version 3.6, due to pyisical memory
fragmentation. With those kernels, as long as the buffer is 8K or
smaller, getting the xattr is much less prone to failure due to
memory fragmentation.

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

Signed-off-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Apr 18 04:41:16 CEST 2017 on sn-devel-144

(cherry picked from commit 05d83ccf7a6fecf963fcb980acd50cebfc0c3ea9)

- - - - -
96c71509 by Jeremy Allison at 2017-04-20T12:26:12+02:00
lib: debug: Avoid negative array access.

Report and patch from Hanno Böck <hanno at hboeck.de>.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 600f8787e3b605c9f3e8f724c726e63157ee9efc)

- - - - -
36a97de0 by Jeremy Allison at 2017-04-20T12:26:12+02:00
s3:lib: Fix incorrect logic in sys_broken_getgroups()

If setlen == 0 then the second argument must be ignored.

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

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

- - - - -
685437eb by Jeremy Allison at 2017-04-20T16:36:14+02:00
s3:smbd: Fix incorrect use of sys_getgroups()

Second arg must be NULL when first arg is 0 (it is in all other places).

Bug report and patch from Hanno Böck <hanno at hboeck.de>

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Apr 18 15:43:02 CEST 2017 on sn-devel-144

(cherry picked from commit 76b351e907f67cc7d4af4e7d800c7a3aa1269ee8)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Thu Apr 20 16:36:14 CEST 2017 on sn-devel-144

- - - - -
ea910042 by Stefan Metzmacher at 2017-04-21T09:11:14+02:00
pam_winbind: no longer use wbcUserPasswordPolicyInfo when authenticating

The expiry time for the specific user comes from
info->pass_must_change_time and nothing else.

The authenticating DC knows which password policy applies
to the user, that's nothing the client can do, as
domain trusts and fine-grained password policies makes
this a very complex task.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit fba7ed9a3fa6fcb2d90d1271ae81ec11b554bd2d)

- - - - -
609ae136 by Michael Adam at 2017-04-21T09:11:14+02:00
s3:vfs:shadow_copy2: fix quoting in debug messages

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit fffd611fdc558ab428c8a21cf1e68feaf1f6f469)

- - - - -
5b0b84ed by Michael Adam at 2017-04-21T09:11:16+02:00
s3:vfs:shadow_copy2: fix the corner case if cwd=/ in make_relative_path

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 16c89835cf07caa2082b586666095deba38ef962)

- - - - -
136d0d8a by Michael Adam at 2017-04-21T09:11:16+02:00
s3:vfs:shadow_copy2: fix corner case of "/@GMT-token" in shadow_copy2_strip_snapshot

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 26661218b3d3f0d4ee89039727bc110e972c2851)

The last 3 patches address
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12743
vfs_shadow_copy2 fails to list snapshots from shares with GlusterFS backend

- - - - -
bd0f2e83 by Hanno Böck at 2017-04-21T13:28:33+02:00
cleanupdb: Fix a memory read error

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

Signed-off-by: Hanno Böck <hanno at hboeck.de>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit fd98a7b6a0053b62802e29fb729e219dc08eef6b)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Fri Apr 21 13:28:33 CEST 2017 on sn-devel-144

- - - - -
68007442 by Shilpa Krishnareddy at 2017-04-28T09:10:12+02:00
notify: Fix ordering of events in notifyd

In notifyd_trigger_parser() while initializing notify_event_msg values from
notify_trigger_msg, 'when' value is ignored. So the smbd process does not get
correct 'when' value and this is causing issues during qsort in
notify_marshall_changes(). Because of this issue, smb2.notify.dir test was
failing.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12756
Signed-off-by: Shilpa Krishnareddy <skrishnareddy at panzura.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Wed Apr 26 17:02:58 CEST 2017 on sn-devel-144

(cherry picked from commit 5701880655c8a82b6d533c7c2e131cc803e7570b)

- - - - -
36ff82f5 by Volker Lendecke at 2017-04-28T09:10:12+02:00
lib: Fix CID 1373623 Dereference after null check

We should not overload "p", this is used in the outer loop

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12276
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 6ec81ca3c196f3c4659a4e1c473759b393708d12)

- - - - -
68461b9a by Ralph Boehme at 2017-04-28T09:10:12+02:00
vfs_acl_xattr|tdb: ensure create mask is at least 0666 if ignore_system_acls is set

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Thu Apr 20 20:50:10 CEST 2017 on sn-devel-144

(cherry picked from commit 375d772d04338861d92e683ae3c6c9d7ecb846ad)

- - - - -
bc620911 by Ralph Boehme at 2017-04-28T13:17:18+02:00
vfs_fruit: lp_case_sensitive() does not return a bool

lp_case_sensitive() returns an int, not a bool, so with the default
setting of "Auto" by default we set the AAPL flag
SMB2_CRTCTX_AAPL_CASE_SENSITIVE.

This caused the client to believe the volume is case sensitive where it
wasn't, leading to an error when trying to rename files changing only
the case of the name.

Also fix the existing torture test that verifies AAPL context
negotiation and actually expected the server to return "case sensitive",
while the Samba default is really "case insensitive".

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

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

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Fri Apr 28 13:17:19 CEST 2017 on sn-devel-144

- - - - -
55426482 by Doug Nazar at 2017-05-02T13:54:40+02:00
s3: smbd: inotify_map_mask_to_filter incorrectly indexes an array.

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

Signed-off-by: Doug Nazar <nazard at nazar.ca>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit a939db725ea81944532ba3b035da0d145bc3b62a)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Tue May  2 13:54:40 CEST 2017 on sn-devel-144

- - - - -
935fab0d by Ralph Boehme at 2017-05-09T10:17:08+02:00
s3/locking: add const to fsp_lease_type

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

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

- - - - -
88360c7a by Ralph Boehme at 2017-05-09T10:17:08+02:00
s3/locking: helper functions for lease types

Add some helper functions that will be used to update a bunch of checks
for exclusive oplocks to the lease area.

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

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

- - - - -
bce65782 by Ralph Boehme at 2017-05-09T10:17:08+02:00
s3/smbd: update exclusive oplock optimisation to the lease area

This is similar to 9533a55ee5ffe430589dcea845851b84876ef656 but this
time in the contend_level2_oplocks_begin_default() function.

The idea of the optimisation is to avoid expensive db queries in
locking.tdb if we *know* we're the only open.

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

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

- - - - -
165cdf38 by Ralph Boehme at 2017-05-09T10:17:08+02:00
s3/smbd: update exclusive oplock optimisation to the lease area

Update an optimisation in update_num_read_oplocks() that checks for
exclusive oplocks to the lease area.

The idea of the optimisation is to avoid expensive db queries in
brlock.tdb if we *know* we're the only open.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Sat May  6 22:58:47 CEST 2017 on sn-devel-144

(cherry picked from commit a50343779a8a92d6f53095b36506b1d47ef68513)

- - - - -
8d11ac4f by Stefan Metzmacher at 2017-05-09T14:34:10+02:00
samba-tool: let 'samba-tool user syncpasswords' report deletions immediately

We need to use the show-recycled control in addition to the
notification control in order to get notifications about deletions.

There's no real problem as the next modification will report the deletion.
But it might be delayed a few minutes.

Note that show-recycled is a superset of show-deleted, so we only need one.

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

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

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Tue May  9 14:34:10 CEST 2017 on sn-devel-144

- - - - -
080f69ed by Volker Lendecke at 2017-05-16T09:15:06+02:00
idmap_rfc2307: Don't stop after 30 entries

We start over again and again, so we need to search in the whole list.
This is a quick hack generating a bad O(n^2). The real fix is to
call idmap_rfc2307_find_map with "maps" starting at the right offset,
but that's an optimization for later when it's restructured

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit 54a0e7e3d7332f420f36a3a20dd62156e6adea46)

- - - - -
d168aae6 by Volker Lendecke at 2017-05-16T09:15:06+02:00
idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit 17563f295ffa7379daa5bf7cc89540df4ae4f7b3)

- - - - -
dffa1199 by Volker Lendecke at 2017-05-16T09:15:06+02:00
test_idmap_rfc2307: Remove the correct file

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit 9e816ea2f8d21d392b4e9050e443ef936629202e)

- - - - -
99e8ff58 by Volker Lendecke at 2017-05-16T09:15:06+02:00
test_idmap_rfc2307: Avoid a tmpfile

We can << directly into ldbadd

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit 1893bb9bc48d9251820a185c95c65562f2878074)

- - - - -
07938b5d by Volker Lendecke at 2017-05-16T09:15:06+02:00
test_idmap_rfc2307: Correct usage

We already have 13 args at this point, and growing

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit f34ff621edbfd8b7c99cdadec166a80ae9c5646c)

- - - - -
a24025c7 by Volker Lendecke at 2017-05-16T09:15:06+02:00
test_idmap_rfc2307: Do a recursive delete in ou=idmap

We'll create more posix objects soon

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit 1f5097e3fbf9931c830880637622bb0b05863466)

- - - - -
babc72b1 by Volker Lendecke at 2017-05-16T09:15:06+02:00
test_idmap_rfc2307: Test wbinfo -r for 35 supplementary group memberships

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit e663357b4d7d5cb0c4d8a0ebc97cfcb58429b894)

- - - - -
0e6fe5c3 by Volker Lendecke at 2017-05-16T09:15:06+02:00
idmap_rfc2307: Don't stop after 30 entries

We start over again and again, so we need to search in the whole list.
This is a quick hack generating a bad O(n^2). The real fix is to
call idmap_rfc2307_find_map with "maps" starting at the right offset,
but that's an optimization for later when it's restructured

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit c0f12170e8b9fb3ab75f53bba637c72f6465192e)

- - - - -
3e250e6e by Volker Lendecke at 2017-05-16T09:15:06+02:00
idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit 803ea2d2b7820939d03f7eb381c3cf719a00ff4a)

- - - - -
90a28a91 by Volker Lendecke at 2017-05-16T09:15:06+02:00
selftest: Avoid idmap caching when testing idmap_rfc2307

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit da7481f835ddc1fab16d11ccbaf7f33c213af23a)

- - - - -
fce999cd by Volker Lendecke at 2017-05-16T13:34:00+02:00
idmap_rfc2307: Test unix-ids-to-sids with 35 groups

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit ee3b17ba4674a17a411c9ec4271e087c8cd7dad1)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Tue May 16 13:34:00 CEST 2017 on sn-devel-144

- - - - -
1d36d517 by Karolin Seeger at 2017-05-18T08:43:05+02:00
WHATSNEW: Add release notes for Samba 4.5.9.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
2cb8fc16 by Karolin Seeger at 2017-05-18T08:44:48+02:00
VERSION: Disable GIT_SNAPSHOTS for the 4.5.9 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
886edba0 by Karolin Seeger at 2017-05-18T08:47:52+02:00
VERSION: Bump version up to 4.5.10...

and re-enable GIT_SNAPSHOTS.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
79dc7911 by Karolin Seeger at 2017-05-19T12:03:49+02:00
VERSION: Bump version up to 4.5.10...

and re-enable GIT_SNAPSHOTS.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
(cherry picked from commit 886edba06129ff76af549cdc3b6c7d346525dc6e)

- - - - -
5f224a39 by Volker Lendecke at 2017-05-19T12:04:10+02:00
CVE-2017-7494: rpc_server3: Refuse to open pipe names with / inside

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
d6568b85 by Jeremy Allison at 2017-05-19T13:41:59+02:00
s3: smbd: Fix open_files.idl to correctly ignore share_mode_lease *lease in share_mode_entry.

This is currently marked 'skip', which means it isn't stored in the
db, but printed out in ndr dump. However, this pointer can be invalid
if the lease_idx is set to 0xFFFFFFFF (invalid).

This is fixed up inside parse_share_modes(), but not until after
ndr_pull_share_mode_data() is called. If lease_idx == 0xFFFFFFFF
then ndr_print_share_mode_lease() prints an invalid value and
crashes.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May 18 03:01:40 CEST 2017 on sn-devel-144

(cherry picked from commit b691f6d32f79ef8427f567612243dd51ea8d5584)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Fri May 19 13:41:59 CEST 2017 on sn-devel-144

- - - - -
c46ed35f by Karolin Seeger at 2017-05-23T10:15:41+02:00
WHATSNEW: Add release notes for Samba 4.5.10.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
558f8e68 by Karolin Seeger at 2017-05-23T10:15:45+02:00
VERSION: Disable GIT_SNAPSHOTS for the 4.5.10 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
15db83ff by Karolin Seeger at 2017-05-24T10:05:58+02:00
Merge tag 'samba-4.5.10' into v4-5-test

samba: tag release samba-4.5.10

- - - - -
7922d481 by Karolin Seeger at 2017-05-24T10:06:16+02:00
VERSION: Bump version up to 4.5.11.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
9dca467e by Amitay Isaacs at 2017-06-01T08:49:15+02:00
Revert "ctdb-readonly: Avoid a tight loop waiting for revoke to complete"

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

This reverts commit ad758cb869ac83534993caa212abc9fe9905ec68.

This is an incomplete fix and introduces a regression.

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

- - - - -
c8b18ab7 by Amitay Isaacs at 2017-06-01T08:49:15+02:00
ctdb-readonly: Avoid a tight loop waiting for revoke to complete

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

During revoking readonly delegations, if one of the nodes disappears,
then there is no point re-trying revoking readonly delegation immedately.
The database needs to be recovered before the revoke operation can
succeed.

However, if the revoke is successful, then all the write requests need
to be processed immediately before the read-only requests.  This avoids
starving write requests, in case there are read-only requests coming
from other nodes.

In deferred_call_destructor, the result of revoke is not available and
deferred calls cannot be correctly ordered.  To correctly order the
deferred calls, process them in revokechild_destructor where the result
of revoke is known.

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

- - - - -
36f2b52e by Martin Schwenke at 2017-06-01T08:49:15+02:00
ctdb-tools: Stop "ctdb nodestatus" from always showing all nodes

Exit code should only reflect current or specified nodes too.

Drop an unwanted call to get_nodemap() that overwrites the previously
calculated node map.

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

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

- - - - -
29b9e194 by Martin Schwenke at 2017-06-01T08:49:15+02:00
ctdb-tools: "ctdb nodestatus" should only display header for "all"

The "Number of nodes:" header should only be displayed when "all" is
specified.  This is how the command behaved in Samba <= 4.4.

Printing the number of nodes is not helpful and is rather confusing in
the default case where only the status of the current node is printed.

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

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

- - - - -
95e1df54 by Martin Schwenke at 2017-06-01T08:49:15+02:00
ctdb-tests: Add some extra tests for "ctdb nodestatus"

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Fri May 26 05:24:34 CEST 2017 on sn-devel-144

(cherry picked from commit ade535371b86294c12ca3f7eb98d8ef7ecd29caa)

- - - - -
be632f60 by Jeremy Allison at 2017-06-01T12:59:00+02:00
s3: VFS: Catia: Ensure path name is also converted.

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

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

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Thu Jun  1 12:59:00 CEST 2017 on sn-devel-144

- - - - -
9d6ac5b1 by Ralph Boehme at 2017-06-02T09:53:16+02:00
s3/locking: make find_share_mode_entry public

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 9d7739e819d5699209b5eacad4a0e2a8b8da0a86)

- - - - -
0e467e86 by Ralph Boehme at 2017-06-02T09:53:16+02:00
s3/smbd: fix exclusive lease optimisation

We need to expect any amount of "stat" opens on the file without
triggering an assert.

This is the correct fix for bug #11844. I guess we haven't seens this
very often before bug #12766 got fixed, because most clients were using
LEASES instead of OPLOCKS.

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

See also:
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11844
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12766

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 19b938e1fa9822ac417a3b3a34519087470d7a18)

- - - - -
176bc89a by Ralph Boehme at 2017-06-02T14:07:53+02:00
s4/torture: test for bug 12798

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

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit bd43939ec07a2fc6858d1265fc75a68a7cd96f58)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Fri Jun  2 14:07:53 CEST 2017 on sn-devel-144

- - - - -
7e753fdb by Martin Schwenke at 2017-06-19T11:05:25+02:00
ctdb-scripts: NFS call-out failures should cause event failure

Failures in startup/shutdown/releaseip/takeip are currently
incorrectly ignored.

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

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

- - - - -
e45a18f5 by Martin Schwenke at 2017-06-19T11:05:25+02:00
ctdb-tests: Add more NFS eventscript tests for call-out failures

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

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

- - - - -
53364472 by Andreas Schneider at 2017-06-19T15:16:54+02:00
libcli:smb2: Gracefully handle not supported for FSCTL_VALIDATE_NEGOTIATE_INFO

If FSCTL_VALIDATE_NEGOTIATE_INFO is not implemented, e.g. in a SMB2 only
server then gracefully handle NT_STATUS_NOT_SUPPORTED too.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Pair-Programmed-With: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Thu Jun 15 17:32:45 CEST 2017 on sn-devel-144

(cherry picked from commit a4d9438ecf92614a0915b9cf61f905ea8170043a)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Mon Jun 19 15:16:54 CEST 2017 on sn-devel-144

- - - - -
48ab0c36 by Stefan Metzmacher at 2017-06-26T12:34:22+02:00
s3:smb2_tcon: allow a compound request after a TreeConnect

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit f8974bcdbf8abe3803340dcd20206ff4de9d5079)

- - - - -
16d4fd93 by Stefan Metzmacher at 2017-06-26T12:34:22+02:00
s3:smb2_sesssetup: allow a compound request after a SessionSetup

This is not a full fix yet as we don't allow compound requests
after going async.

With SMB 3.11 requiring signed TreeConnect requests it's pointless
to try to compound requests after a SessionSetup.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Jun 17 10:55:25 CEST 2017 on sn-devel-144

(cherry picked from commit bb5c394fde03dc8230d5089a66fea1a2541952f5)

- - - - -
46ab108f by Richard Sharpe at 2017-06-26T12:34:22+02:00
Bug 15852. There are valid paths where conn->lsa_pipe_tcp->transport is NULL. Protect against this.

Based on a suggestion from Metze.

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

Signed-off-by: Richard Sharpe <realrichardsharpe at gmail.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jun 22 23:16:46 CEST 2017 on sn-devel-144

(cherry picked from commit 03042b85c8140842633b36f3124e504b97b852a1)

- - - - -
6627e192 by Amitay Isaacs at 2017-06-26T12:34:22+02:00
ctdb-scripts: Don't send empty argument string to logger

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

This stops logger reading from stdin.

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Sat Jun 24 14:37:48 CEST 2017 on sn-devel-144

(cherry picked from commit 2fa069e870c0e6f1daa2a08be5aacac7b1063a5e)

- - - - -
6c49f546 by Amitay Isaacs at 2017-06-26T12:34:22+02:00
ctdb-recovery: Assign banning credits if database fails to freeze

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

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

- - - - -
da97cd28 by Amitay Isaacs at 2017-06-26T12:34:22+02:00
ctdb-recovery: Setting up of recmode should be idempotent

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

If the recovery mode is already set to the expected value, there is
nothing to do.

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

- - - - -
40cc8d2b by Amitay Isaacs at 2017-06-26T12:34:22+02:00
ctdb-recovery: Simplify logging of recovery mode setting

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

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

- - - - -
10a763dd by Amitay Isaacs at 2017-06-26T12:34:23+02:00
ctdb-recovery: Finish processing for recovery mode ACTIVE first

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

This simplifies the code and avoids complicated conditions.

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

- - - - -
fc7b70f7 by Amitay Isaacs at 2017-06-26T12:34:23+02:00
ctdb-recovery: Get recmode unconditionally in the main_loop

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

This can be used later in the main_loop to avoid the local ip check.

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

- - - - -
17543bd0 by Amitay Isaacs at 2017-06-26T16:57:51+02:00
ctdb-recovery: Do not run local ip verification when in recovery

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

If we drop public IPs because CTDB is in recovery for too long, then
avoid spamming logs "Trigger takeoverrun" every second.

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

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Mon Jun 26 16:57:51 CEST 2017 on sn-devel-144

- - - - -
f3e22f56 by Jeremy Allison at 2017-06-28T11:20:08+02:00
s3: smbd: When deleting an fsp pointer ensure we don't keep any references to it around.

Based on a suggestion from <lev at zadarastorage.com>

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jun 22 00:12:49 CEST 2017 on sn-devel-144

- - - - -
bb6c6c63 by Jeremy Allison at 2017-06-28T11:20:08+02:00
s3: smbd: Add regression test for non-wide symlinks to directories fail over SMB3.

Mark as knownfail.

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

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

- - - - -
ecdbe6e7 by Daniel Kobras at 2017-06-28T11:20:08+02:00
s3: smbd: fix regression with non-wide symlinks to directories over SMB3.

The errno returned by open() is ambiguous when called with flags O_NOFOLLOW and
O_DIRECTORY on a symlink. With ELOOP, we know for certain that we've tried to
open a symlink. With ENOTDIR, we might have hit a symlink, and need to perform
further checks to be sure. Adjust non_widelink_open() accordingly. This fixes
a regression where symlinks to directories within the same share were no
longer followed for some call paths on systems returning ENOTDIR in the above
case.

Also remove the knownfail added in previous commit.

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

Signed-off-by: Daniel Kobras <d.kobras at science-computing.de>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit acc16592b451905dabc093f1d261e93cd3b59520)

- - - - -
1329592c by Stefan Metzmacher at 2017-06-28T15:32:51+02:00
auth/ntlmssp: enforce NTLMSSP_NEGOTIATE_NTLM2 for the NTLMv2 client case

Some servers may not announce the NTLMSSP_NEGOTIATE_NTLM2
(a.k.a. NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY) bit.

But if we're acting as a client using NTLMv2 we need to
enforce this flag, because it's not really a negotiationable
in that case.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 8ee4f8236830eb3fa1b273fa6927792a800f86bd)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Wed Jun 28 15:32:51 CEST 2017 on sn-devel-144

- - - - -
25441982 by Stefan Metzmacher at 2017-06-30T10:46:22+02:00
samba-tool: fix log message of 'samba-tool user syncpasswords'

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Fri May  5 01:37:45 CEST 2017 on sn-devel-144

(cherry picked from commit 4c17850ae7b6c85e99e5d4d5bc5d8e89a9ba6d47)

- - - - -
e260f4ff by Stefan Metzmacher at 2017-06-30T10:46:22+02:00
s3:smbd: unimplement FSCTL_VALIDATE_NEGOTIATE_INFO with "server max protocol = SMB2_02"

A client that supports SMB3 will do a signed FSCTL_VALIDATE_NEGOTIATE_INFO
after a tree connect. This FSCTL_VALIDATE_NEGOTIATE_INFO call contains
the client capabilities, client guid, security mode and the array of supported
dialects. But if SMB 2.02 is negotiated the doesn't send these values to the
server in the first connection attempt (when the client starts with a SMB1 Negotiate).

Windows servers that only support SMB2 just return NT_STATUS_FILE_CLOSED
as answer to FSCTL_VALIDATE_NEGOTIATE_INFO.

We should do the same if we just pretend to support SMB 2.02,
as SMB 2.10 always include an SMB2 Negotiate request we can leave it as is.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 295c9f7b322e6377d0df1b49cb26597d66e80eda)

- - - - -
48a69713 by Stefan Metzmacher at 2017-06-30T10:46:22+02:00
auth/spnego: fix gensec_update_ev() argument order for the SPNEGO_FALLBACK case

This went unnoticed so long as we don't use -Wc++-compat
and gensec_update_ev() used the sync update() hook for all
NTLMSSP and Kerberos.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 31691963b3d9ac460df0c56d36f81ec815db0225)

- - - - -
85896c3b by Jeremy Allison at 2017-06-30T10:46:22+02:00
libcli: smb: Add smbXcli_tcon_copy().

Makes a deep copy of a struct smbXcli_tcon *, will
be used later.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit 655e10685840fd5ebfde24396853b74020a1dc85)

- - - - -
43735d62 by Jeremy Allison at 2017-06-30T10:46:22+02:00
libcli: smb: Add smb2cli_tcon_set_id().

Will be used in test and client code.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit e726b60226105d0f52a66dac47bfc5797cfc18e7)

- - - - -
5ec9fca8 by Jeremy Allison at 2017-06-30T10:46:22+02:00
s3: libsmb: Add cli_state_save_tcon() / cli_state_restore_tcon().

Save and restore tcon pointers in smb1 or smb2 structs.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit 39026f1c5dbb83120b70b3d9131138a9c2344ba6)

- - - - -
5d9c3b3d by Jeremy Allison at 2017-06-30T10:46:22+02:00
s3: smbtorture: Show correct use of cli_state_save_tcon() / cli_state_restore_tcon().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit 5c0efc9a5ef8ddf96dc394110063bebd5f057415)

- - - - -
cf68b647 by Jeremy Allison at 2017-06-30T10:46:22+02:00
s3: libsmb: Widen cli_state_get_tid() / cli_state_set_tid() to 32-bits.

Copes with SMB2 connections.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit 93fa0c8660e47cb2605d70dac1156576ab719d64)

- - - - -
0d0d9820 by Jeremy Allison at 2017-06-30T10:46:22+02:00
s3: libsmb: Fix cli_state_has_tcon() to cope with SMB2 connections.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit c9178ed9cc69b9089292db28ac1a0b7a0519bc2c)

- - - - -
c939552b by Jeremy Allison at 2017-06-30T10:46:22+02:00
s3: libsmb: Correctly do lifecycle management on cli->smb1.tcon and cli->smb2.tcon.

Treat them identically. Create them on demand after for a tcon call,
and delete them on a tdis call.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit 50f50256aa8805921c42d0f9f2f8f89d06d9bd93)

- - - - -
dc4a6a98 by Jeremy Allison at 2017-06-30T10:46:22+02:00
s3: libsmb: Correctly save and restore connection tcon in smbclient, smbcacls and smbtorture3.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
(cherry picked from commit bd31d538a26bb21cbb53986a6105204da4392e2d)

- - - - -
7d8f7fbe by Stefan Metzmacher at 2017-06-30T14:57:14+02:00
s3:smb2_create: avoid reusing the 'tevent_req' within smbd_smb2_create_send()

As the caller ("smbd_smb2_request_process_create()") already sets the callback,
the first time, it's not safe to reuse the tevent_req structure.

The typical 'tevent_req_nterror(); return tevent_req_post()' will
crash as the tevent_req_nterror() already triggered the former callback,
which calls smbd_smb2_create_recv(), were tevent_req_received() invalidates
the tevent_req structure, so that tevent_req_post() will crash.

We just remember the required values from the old state
and move them to the new state.

We tried to write reproducers for this, but sadly weren't able to trigger
the backtrace we had from a create a customer (using recent code)
with commit 6beba782f1bf951236813e0b46115b8102212c03
included. And this patch fixed the situation for the
customer.

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

Pair-Programmed-With: Volker Lendecke <vl at samba.org>

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

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Fri Jun 30 14:57:14 CEST 2017 on sn-devel-144

- - - - -
96450f98 by Michael Saxl at 2017-07-03T13:04:12+02:00
s3:gse_krb5: fix a possible crash in fill_mem_keytab_from_system_keytab()

If the keytab file isn't readable, we may call
krb5_kt_end_seq_get() with an invalid kt_cursor.

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

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

Signed-off-by: Michael Saxl <mike at mwsys.mine.bz>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit a9780a2eaa9cba4ab87cc3371d97fa494fa0198c)

- - - - -
e4d7e602 by Stefan Metzmacher at 2017-07-03T13:04:12+02:00
wafsamba: add maxversion and version_blacklist to CHECK_BUNDLED_SYSTEM[_PKG]()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 4ca48ee4d060f773dcdf9f78a5e4c1b1263b61f4)

- - - - -
4f6e1f13 by Stefan Metzmacher at 2017-07-03T17:09:41+02:00
ldb: protect Samba < 4.7 against incompatible ldb versions and require ldb < 1.2.0

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Mon Jul  3 17:09:41 CEST 2017 on sn-devel-144

- - - - -
68ad60fa by Karolin Seeger at 2017-07-06T10:12:01+02:00
WHATSNEW: Add release notes for Samba 4.5.11.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
31052eb6 by Karolin Seeger at 2017-07-06T10:13:35+02:00
VERSION: Disable GIT_SNAPSHOTS for the 4.5.11 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
af9d932c by Karolin Seeger at 2017-07-06T10:14:14+02:00
VERSION: Bump version up to 4.5.12...

and re-enable GIT_SNAPSHOTS.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
229735bf by Jeffrey Altman at 2017-07-12T10:52:14+02:00
CVE-2017-11103: Orpheus' Lyre KDC-REP service name validation

In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.

Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.

Change-Id: I45ef61e8a46e0f6588d64b5bd572a24c7432547c

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12894
(based on heimdal commit 6dd3eb836bbb80a00ffced4ad57077a1cdf227ea)

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
31b6d82d by Bob Campbell at 2017-07-12T10:56:46+02:00
WHATSNEW: Add release notes for Samba 4.5.12

Signed-off-by: Bob Campbell <bobcampbell at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
6e6361ee by Bob Campbell at 2017-07-12T10:57:09+02:00
VERSION: Release Samba 4.5.12 for CVE-2017-11103

Signed-off-by: Bob Campbell <bobcampbell at catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
fd2156f9 by Mathieu Parent at 2017-07-28T20:38:35+02:00
gbp.conf: change debian-branch to stretch, and merge-mode to merge

- - - - -
19587dd5 by Mathieu Parent at 2017-07-28T20:42:03+02:00
New upstream version 4.5.12+dfsg
- - - - -
4f000a04 by Mathieu Parent at 2017-07-28T20:43:10+02:00
Merge tag 'upstream/4.5.12+dfsg' into stretch

Upstream version 4.5.12+dfsg

- - - - -
6fe24ea8 by Mathieu Parent at 2017-07-28T20:43:57+02:00
Remove CVE-2017-11103-Orpheus-Lyre-KDC-REP-service-name-val.patch and CVE-2017-7494.patch, merged

- - - - -
3a065f10 by Mathieu Parent at 2017-07-28T20:44:13+02:00
Properly quote subshell invocation in samba-common.preinst (Closes: #771689)

(cherry picked from commit 34b1c303b2f1f1139ebc5a79e4706d7be21d96a8)

- - - - -
0948463c by Mathieu Parent at 2017-07-28T20:45:35+02:00
Fix typo s/DESTIDR/DESTDIR/ in d/rules

Thanks Benjamin Bohard on ML

(cherry picked from commit 89e81deecf68357dac3606348683aaa43582bbc6)

- - - - -
89cea826 by Mathieu Parent at 2017-07-28T20:45:36+02:00
sysv: Use --pidfile in addition to --exec to avoid matching daemons in containers (Closes: #810794)

(cherry picked from commit 302e6c400106b52cbc8fab1608d70332485b1326)

- - - - -
e867dd3e by Mathieu Parent at 2017-07-28T20:45:36+02:00
Fix libpam-winbind.prerm to be multiarch-safe (Closes: #647430)

Inspired by other packages (systemd, sssd, pam, lxcfs, cgmanager)

(cherry picked from commit e64704dc309639b7321e82153ab68fa600c584a3)

- - - - -
659cb20f by Mathieu Parent at 2017-07-28T20:45:36+02:00
Add missing logrotate for /var/log/samba/log.samba (Closes: #803924)

(cherry picked from commit 8167381f50d56bff76f33c622406a1a1ff128932)

- - - - -
8e1edd14 by Amitay Isaacs at 2017-07-28T20:45:37+02:00
provision: Update root DNS servers list

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 0098a7b5564b60b3b29d3f1767adfd538d3ff55d)
(cherry picked from commit 899d0cf90b54cb5e4cb23e5aa6e3cfd111b200ba)

- - - - -
cfda5a31 by Mathieu Parent at 2017-07-28T20:45:37+02:00
Fix outdated DNS Root servers (Closes: #865406)

(cherry picked from commit 43dc188a9c6cbb4d1500063126c0a11275374046)

- - - - -
d2605c35 by Mathieu Parent at 2017-07-28T20:45:37+02:00
Fix logrotate for /var/log/samba/log.samba to send SIGHUP to all processes of the service (systemd only)

(cherry picked from commit d5518bbdc71c4c6cd7bf51c80af2cb9f4b56b21d)

- - - - -
909b78a9 by Mathieu Parent at 2017-07-28T20:45:38+02:00
Release 2:4.5.12+dfsg-1

- - - - -
c6a39598 by Mathieu Parent at 2017-08-26T17:34:19+02:00
Fix samba.logrotate (Thanks Thomas A. Reim)

(cherry picked from commit 57fbf8399242bb4d19058960d8c8a5d1be115110)

- - - - -
02759563 by Mathieu Parent at 2017-08-26T17:36:05+02:00
Re-release 2:4.5.12+dfsg-1

- - - - -
54bc9c5d by Mathieu Parent at 2017-09-25T15:18:01+02:00
Patches for CVE-2017-12150, CVE-2017-12151 and CVE-2017-12163

- - - - -
a0470951 by Stefan Metzmacher at 2017-09-25T15:22:03+02:00
CVE-2017-12150: s3:lib: get_cmdline_auth_info_signing_state smb_encrypt SMB_SIGNING_REQUIRED

This is an addition to the fixes for CVE-2015-5296.

It applies to smb2mount -e, smbcacls -e and smbcquotas -e.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
6f4f39ba by Stefan Metzmacher at 2017-09-25T15:22:03+02:00
CVE-2017-12150: s3:pylibsmb: make use of SMB_SIGNING_DEFAULT for 'samba.samba3.libsmb_samba_internal'

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
24710541 by Stefan Metzmacher at 2017-09-25T15:22:04+02:00
CVE-2017-12150: libgpo: make use of SMB_SIGNING_REQUIRED in gpo_connect_server()

It's important that we use a signed connection to get the GPOs!

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
043fb7ff by Stefan Metzmacher at 2017-09-25T15:22:04+02:00
CVE-2017-12150: auth/credentials: cli_credentials_authentication_requested() should check for NTLM_CCACHE/SIGN/SEAL

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
c66f05d0 by Stefan Metzmacher at 2017-09-25T15:22:04+02:00
CVE-2017-12150: libcli/smb: add smbXcli_conn_signing_mandatory()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
3791d24a by Stefan Metzmacher at 2017-09-25T15:22:05+02:00
CVE-2017-12150: s3:libsmb: only fallback to anonymous if authentication was not requested

With forced encryption or required signing we should also don't fallback.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
61a692bb by Stefan Metzmacher at 2017-09-25T15:22:05+02:00
CVE-2017-12151: s3:libsmb: add cli_state_is_encryption_on() helper function

This allows to check if the current cli_state uses encryption
(either via unix extentions or via SMB3).

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
8483981d by Stefan Metzmacher at 2017-09-25T15:22:06+02:00
CVE-2017-12151: s3:libsmb: make use of cli_state_is_encryption_on()

This will keep enforced encryption across dfs referrals.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
20c2272b by Jeremy Allison at 2017-09-25T15:22:06+02:00
CVE-2017-12163: s3:smbd: Prevent client short SMB1 write from writing server memory to file.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
8d185732 by Mathieu Parent at 2017-09-25T15:22:07+02:00
Release 2:4.5.12+dfsg-2

- - - - -
78bf4a5c by Jeremy Allison at 2017-11-20T23:23:34+01:00
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 at samba.org>
(cherry picked from commit 9227f4d46d707aa892fce50b5954b3de061fb477)

- - - - -
35c796c6 by Jeremy Allison at 2017-11-20T23:23:35+01:00
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 at 360.cn>

CVE-2017-14746

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

Signed-off-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 02eaa8dae0525966dffd223b7da6ec56bf06738c)

- - - - -
0ebec89b by Mathieu Parent at 2017-11-20T23:23:35+01:00
Patches for CVE-2017-15275 and CVE-2017-14746

(cherry picked from commit 438db971319883e75974f5e945c6fa21179dfedf)

- - - - -
6b982e98 by Mathieu Parent at 2017-11-20T23:25:13+01:00
Release 2:4.5.12+dfsg-2+deb9u1

- - - - -
d9778067 by Mathieu Parent at 2018-03-05T14:33:55+01:00
Rebaselined stretch-security from stretch

- - - - -
fbe5e359 by Jeremy Allison at 2018-03-05T14:40:27+01:00
CVE-2018-1050: s3: RPC: spoolss server. Protect against null pointer derefs.

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

Signed-off-by: Jeremy Allison <jra at samba.org>

- - - - -
121b8640 by Mathieu Parent at 2018-03-05T15:33:26+01:00
Patch for CVE-2018-1050: "Codenomicon crashes in spoolss server code"

- - - - -
f8f11248 by Ralph Boehme at 2018-03-05T15:33:26+01:00
CVE-2018-1057: s4:dsdb/tests: add a test for password change with empty delete

Note that the request using the clearTextPassword attribute for the
password change is already correctly rejected by the server.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
ef60d6a9 by Ralph Boehme at 2018-03-05T15:33:27+01:00
CVE-2018-1057: s4:dsdb/password_hash: add a helper variable for LDB_FLAG_MOD_TYPE

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
ff0f0cc1 by Ralph Boehme at 2018-03-05T15:33:27+01:00
CVE-2018-1057: s4:dsdb/password_hash: add a helper variable for passwordAttr->num_values

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
e47fb74e by Ralph Boehme at 2018-03-05T15:33:27+01:00
CVE-2018-1057: s4:dsdb/acl: only call dsdb_acl_debug() if we checked the acl in acl_check_password_rights()

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
9a04ea99 by Ralph Boehme at 2018-03-05T15:33:28+01:00
CVE-2018-1057: s4:dsdb/acl: remove unused else branches in acl_check_password_rights()

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
1dc0d1ca by Ralph Boehme at 2018-03-05T15:33:28+01:00
CVE-2018-1057: s4:dsdb/acl: check for internal controls before other checks

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
d79dba9d by Ralph Boehme at 2018-03-05T15:33:29+01:00
CVE-2018-1057: s4:dsdb/acl: add check for DSDB_CONTROL_PASSWORD_HASH_VALUES_OID control

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
5387ee93 by Ralph Boehme at 2018-03-05T15:33:29+01:00
CVE-2018-1057: s4:dsdb/acl: add a NULL check for talloc_new() in acl_check_password_rights()

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
272f8577 by Ralph Boehme at 2018-03-05T15:33:29+01:00
CVE-2018-1057: s4/dsdb: correctly detect password resets

This change ensures we correctly treat the following LDIF

  dn: cn=testuser,cn=users,...
  changetype: modify
  delete: userPassword
  add: userPassword
  userPassword: thatsAcomplPASS1

as a password reset. Because delete and add element counts are both
one, the ACL module wrongly treated this as a password change
request.

For a password change we need at least one value to delete and one value
to add. This patch ensures we correctly check attributes and their
values.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
9bdeb028 by Ralph Boehme at 2018-03-05T15:33:30+01:00
CVE-2018-1057: s4:dsdb/acl: run password checking only once

This is needed, because a later commit will let the acl module add a
control to the change request msg and we must ensure that this is only
done once.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
4f41ee25 by Ralph Boehme at 2018-03-05T15:33:30+01:00
CVE-2018-1057: s4:dsdb/samdb: define DSDB_CONTROL_PASSWORD_ACL_VALIDATION_OID control

Will be used to pass "user password change" vs "password reset" from the
ACL to the password_hash module, ensuring both modules treat the request
identical.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
2455be1c by Ralph Boehme at 2018-03-05T15:33:30+01:00
CVE-2018-1057: s4:dsdb: use DSDB_CONTROL_PASSWORD_ACL_VALIDATION_OID

This is used to pass information about which password change operation (change
or reset) the acl module validated, down to the password_hash module.

It's very important that both modules treat the request identical.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
022068fc by Ralph Boehme at 2018-03-05T15:33:31+01:00
CVE-2018-1057: s4:dsdb/acl: changing dBCSPwd is only allowed with a control

This is not strictly needed to fig bug 13272, but it makes sense to also
fix this while fixing the overall ACL checking logic.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
10d58b44 by Mathieu Parent at 2018-03-05T15:33:31+01:00
Patches for CVE-2018-1057: "Unprivileged user can change any user (and admin) password"

- - - - -
218e3c0b by Mathieu Parent at 2018-03-05T15:33:31+01:00
Release 2:4.5.12+dfsg-2+deb9u2

- - - - -


21 changed files:

- VERSION
- WHATSNEW.txt
- auth/gensec/spnego.c
- auth/ntlmssp/ntlmssp_util.c
- buildtools/wafsamba/samba_bundled.py
- ctdb/config/events.d/60.nfs
- ctdb/config/functions
- ctdb/doc/ctdb-statistics.7
- ctdb/doc/ctdb-statistics.7.html
- ctdb/doc/ctdb-tunables.7
- ctdb/doc/ctdb-tunables.7.html
- ctdb/doc/ctdb.1
- ctdb/doc/ctdb.1.html
- ctdb/doc/ctdb.1.xml
- ctdb/doc/ctdb.7
- ctdb/doc/ctdb.7.html
- ctdb/doc/ctdb_diagnostics.1
- ctdb/doc/ctdb_diagnostics.1.html
- ctdb/doc/ctdbd.1
- ctdb/doc/ctdbd.1.html
- ctdb/doc/ctdbd.conf.5


The diff was not included because it is too large.


View it on GitLab: https://salsa.debian.org/samba-team/samba/compare/612c59023d0a858cd97b386f0d80d41c0815a918...218e3c0babce4479d4f3d4641b83e63a3bc3d6aa

---
View it on GitLab: https://salsa.debian.org/samba-team/samba/compare/612c59023d0a858cd97b386f0d80d41c0815a918...218e3c0babce4479d4f3d4641b83e63a3bc3d6aa
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20180313/18e22729/attachment-0001.html>


More information about the Pkg-samba-maint mailing list