Fix bug #10229 - No access check verification on stream files.

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

We need to check if the requested access mask
could be used to open the underlying file (if
it existed), as we're passing in zero for the
access mask to the base filename.

Back-ported for 4.0.x.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>

(Based on master commit 60f922bf1bd8816eacbb32c24793ad1f97a1d9f2)
Add regression test for bug #10229 - No access check verification on stream files.

Checks against a file with attribute READONLY, and
a security descriptor denying WRITE_DATA access.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov  4 23:10:10 CET 2013 on sn-devel-104
(cherry picked from commit 65882152cc7ccaba0e7903862b99ca93594ed080)

The last two patches address bug #10235 - CVE-2013-4475: No access
check verification on stream files.
CVE-2013-4476: lib-util: add file_check_permissions()

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
CVE-2013-4476: lib-util: split out file_save_mode() from file_save()

file_save_mode() writes files with specified mode.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
CVE-2013-4476: samba-tool provision: create ${private_dir}/tls with mode 0700

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
CVE-2013-4476: selftest/Samba4: use umask 0077 within mk_keyblobs()

We should generate private keys with 0600.

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

Pair-Programmed-With: Björn Baumbach <bb@sernet.de>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
CVE-2013-4476: s4:libtls: Create tls private key file (key.pem) with mode 0600

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
CVE-2013-4476: s4:libtls: check for safe permissions of tls private key file (key.pem)

If the tls key is not owned by root or has not mode 0600 samba will not
start up.

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

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
WHATSNEW: Add release notes for Samba 4.0.11.

Bug 10234 - CVE-2013-4476: key.pem world readable
Bug 10235 - CVE-2013-4475: No access check verification on stream files
(bug #10229).

Signed-off-by: Karolin Seeger <kseeger@samba.org>
VERSION: Disable git snapshots for the 4.0.11 release.

Bug 10234 - CVE-2013-4476: key.pem world readable
Bug 10235 - CVE-2013-4475: No access check verification on stream files
(bug #10229).

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Merge tag 'samba-4.0.11' into v4-0-test

samba: tag release samba-4.0.11
VERSION: Bump version number up to 4.0.12...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
xattr: fix listing EAs on *BSD for non-root users

Thanks to Stefan Rompf for reporting.

This fixes bug #10247

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov  8 20:43:30 CET 2013 on sn-devel-104
(cherry picked from commit 374b2cfde74e0c61f4b2da724b30d0e430596092)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Tue Nov 12 13:31:21 CET 2013 on sn-devel-104
Fix bug 10196 - RW Deny for a specific user is not overriding RW Allow for a group.

When the ID returned is ID_TYPE_BOTH we must *always* add it as both
a user and a group, not just in the owning case. Otherwise DENY
entries are not correctly processed.

Confirmed by the reporter as fixing the problem.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit 14813e74431816cd894fb242ff5633c2cd14ddca)
Fix bug 10196 - RW Deny for a specific user is not overriding RW Allow for a group.

Fix posix_acl tests to match the change in writing ACLs
with ID_TYPE_BOTH.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit a1bc1c32e33508c45e614646d69a5f5d67ba22be)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Thu Nov 14 11:39:10 CET 2013 on sn-devel-104
s3-winbindd: Fix #10264, cache_traverse_validate_fn failure for NDR cache entries.

We need to increase the keysize limit for NDR queries. A wbint_LookupSids query
for just 20 sids already hits the older limit.

Guenther

https://bugzilla.samba.org/show_bug.cgi?id=10264
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Nov 13 19:33:46 CET 2013 on sn-devel-104
(cherry picked from commit 944e9fbc20f125b52e047484dca1792d75561ed9)
util: Remove 32bit macros breaking strict aliasing.

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

These macros might have worked but they break strict aliasing in the
meantime and so the compiler is not able to optimize the relevant code.

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

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Nov 14 23:16:45 CET 2013 on sn-devel-104

(cherry picked from commit af69cb2a78810e608ccff115b433801a58a749e4)
Signed-off-by: Andreas Schneider <asn@samba.org>

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Fri Nov 15 13:39:05 CET 2013 on sn-devel-104
WHATSNEW: Add release notes for Samba 4.0.12.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
VERSION: Disable git snapshots for the 4.0.12 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
VERSION: Bump version number up to 4.0.13...

and re-enable git snapshots.

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