metze/samba/wip.git
9 years agos3: smbd : SMB2 - fix SMB2_SEARCH when searching non wildcard string with a case...
Jeremy Allison [Tue, 10 Jun 2014 22:58:15 +0000 (15:58 -0700)]
s3: smbd : SMB2 - fix SMB2_SEARCH when searching non wildcard string with a case-canonicalized share.

We need to go through filename_convert() in order for the filename
canonicalization to be done on a non-wildcard search string (as is
done in the SMB1 findfirst code path).

Fixes Bug #10650 - "case sensitive = True" option doesn't work with "max protocol = SMB2" or higher in large directories.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: smbd - SMB[2|3]. Ensure a \ or / can't be found anywhere in a search path, not...
Jeremy Allison [Tue, 10 Jun 2014 21:41:45 +0000 (14:41 -0700)]
s3: smbd - SMB[2|3]. Ensure a \ or / can't be found anywhere in a search path, not just at the start.

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: enforce a positive allocation_file_size for non-empty files (bug #10543)
Björn Baumbach [Thu, 27 Mar 2014 10:17:30 +0000 (11:17 +0100)]
s3: enforce a positive allocation_file_size for non-empty files (bug #10543)

Some file systems do not allocate a block for very
small files. But for non-empty file should report a
positive size.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr  5 03:09:00 CEST 2014 on sn-devel-104

(cherry picked from commit c35b31f45244a8339684c3b83a7d86eefb80e0da)

9 years agopassdb: fix NT_STATUS_NO_SUCH_GROUP
Arvid Requate [Thu, 17 Jan 2013 15:44:28 +0000 (16:44 +0100)]
passdb: fix NT_STATUS_NO_SUCH_GROUP

Share options like "force group" and "valid users = @group1"
triggered a NT_STATUS_NO_SUCH_GROUP. While the group was found in
the SAM backend, its objectclass was not retrived.

This fix also revealed a talloc access after free in the group
branch of pdb_samba_dsdb_getgrfilter.

[Bug 9570] Access failure for shares with "force group" or "valid users = @group"

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

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3:libsmb: Set a max charge for SMB2 connections
Ross Lagerwall [Thu, 21 Aug 2014 06:32:36 +0000 (07:32 +0100)]
s3:libsmb: Set a max charge for SMB2 connections

Set a max charge for SMB2 connections so that larger request sizes can
be used and more requests can be in flight.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 21 17:31:11 CEST 2014 on sn-devel-104

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10778
libsmbclient with SMB2 doesn't pipeline or use large blocks

9 years agos3: smbd: POSIX ACLs. Remove incorrect check for SECINFO_PROTECTED_DACL in incoming...
Jeremy Allison [Thu, 21 Aug 2014 23:28:42 +0000 (16:28 -0700)]
s3: smbd: POSIX ACLs. Remove incorrect check for SECINFO_PROTECTED_DACL in incoming security_information flags in posix_get_nt_acl_common().

Tidy-up of code obsoleted by fixes for bug #10773 (SECINFO_PROTECTED_DACL is not ignored).
We now never pass SECINFO_PROTECTED_DACL in security_information flags to this layer.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug 22 11:26:57 CEST 2014 on sn-devel-104

9 years agolibcli/security: add better detection of SECINFO_[UN]PROTECTED_[D|S]ACL in get_sec_info()
Stefan Metzmacher [Wed, 20 Aug 2014 13:00:59 +0000 (15:00 +0200)]
libcli/security: add better detection of SECINFO_[UN]PROTECTED_[D|S]ACL in get_sec_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug 22 02:52:50 CEST 2014 on sn-devel-104

9 years agos3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS
Stefan Metzmacher [Wed, 20 Aug 2014 11:58:38 +0000 (13:58 +0200)]
s3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS

Sometimes Windows clients doesn't filter SECINFO_[UN]PROTECTED_[D|S]ACL flags
before sending the security_information to the server.

security_information = SECINFO_PROTECTED_DACL| SECINFO_DACL
results in a NULL dacl being returned from an GetSecurityDecriptor
request. This happens because posix_get_nt_acl_common()
has the following logic:

if ((security_info & SECINFO_DACL) && !(security_info & SECINFO_PROTECTED_DACL)) {
    ... create DACL ...
}

I'm not sure if the logic is correct or wrong in this place (I guess it's
wrong...).

But what I know is that the SMB server should filter the given
security_information flags before passing to the filesystem.

[MS-SMB2] 3.3.5.20.3 Handling SMB2_0_INFO_SECURITY
...
The server MUST ignore any flag value in the AdditionalInformation field that
is not specified in section 2.2.37.

Section 2.2.37 lists:
OWNER_SECURITY_INFORMATION
GROUP_SECURITY_INFORMATION
DACL_SECURITY_INFORMATION
SACL_SECURITY_INFORMATION
LABEL_SECURITY_INFORMATION
ATTRIBUTE_SECURITY_INFORMATION
SCOPE_SECURITY_INFORMATION
BACKUP_SECURITY_INFORMATION

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agosecurity.idl: add SMB_SUPPORTED_SECINFO_FLAGS
Stefan Metzmacher [Wed, 20 Aug 2014 11:43:13 +0000 (13:43 +0200)]
security.idl: add SMB_SUPPORTED_SECINFO_FLAGS

A SMB server should only care about specific SECINFO flags
and ignore others e.g. SECINFO_PROTECTED_DACL.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoFixed a memory leak in cli_set_mntpoint().
Har Gagan Sahai [Wed, 6 Aug 2014 09:02:35 +0000 (14:32 +0530)]
Fixed a memory leak in cli_set_mntpoint().

Fixes bug #10759 - Memory leak in libsmbclient in cli_set_mntpoint function

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

Signed-off-by: Har Gagan Sahai <SHarGagan@novell.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 13 04:36:50 CEST 2014 on sn-devel-104

9 years agolib: Remove unused nstrcpy
Volker Lendecke [Mon, 4 Aug 2014 05:29:14 +0000 (07:29 +0200)]
lib: Remove unused nstrcpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10758

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug  4 09:58:16 CEST 2014 on sn-devel-104

Signed-off-by: Volker Lendecke <vl@samba.org>
9 years agobuild: fix configure to honour --without-dmapi
Michael Adam [Mon, 18 Aug 2014 09:42:27 +0000 (11:42 +0200)]
build: fix configure to honour --without-dmapi

Previously, --without-dmapi would still autodetect and link a useable dmapi
library. This change allows to build without dmapi support even when a dmapi
library is found.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 2afacf940f21759c08bcc4a6e906428595966a19)

9 years agotests: dnsserver: Add a update test with name set to '.'
Amitay Isaacs [Mon, 28 Jul 2014 08:09:37 +0000 (18:09 +1000)]
tests: dnsserver: Add a update test with name set to '.'

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul 29 19:33:19 CEST 2014 on sn-devel-104

(cherry picked from commit 6d104182d9667e4f996439d24cfa052f34098ce4)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10742
samba-tool dns add 172.31.9.161 s4xdom.base . NS mydns.org. => NO_MEMORY

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Thu Aug 21 18:59:16 CEST 2014 on sn-devel-104

9 years agos4-rpc: dnsserver: Allow . to be specified for @ record
Amitay Isaacs [Mon, 28 Jul 2014 03:07:58 +0000 (13:07 +1000)]
s4-rpc: dnsserver: Allow . to be specified for @ record

Windows allow both . and @ to be specified with modifying @ record.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4b4e30b780345c74f9983ba77f04c616b3d034b7)

9 years agos3: net time - fix usage and core dump.
Jeremy Allison [Tue, 29 Jul 2014 21:12:31 +0000 (14:12 -0700)]
s3: net time - fix usage and core dump.

Bug 10728 - 'net time system' segfaults

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: xml-docs. Ensure users of 'net time' know the remote server must be specified...
Jeremy Allison [Tue, 29 Jul 2014 19:29:37 +0000 (12:29 -0700)]
s3: xml-docs. Ensure users of 'net time' know the remote server must be specified with -S.

Bug 10728 - 'net time system' segfaults

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agosys_poll_intr: fix timeout arithmetic
Daniel Kobras [Mon, 21 Jul 2014 08:47:53 +0000 (10:47 +0200)]
sys_poll_intr: fix timeout arithmetic

Callers of sys_poll_intr() assume timeout to be in milliseconds like
poll(2) expects, but implementation used nanosecond units. Also make
sure timeout doesn't become infinite by mistake during time arithmetic.

Signed-off-by: Daniel Kobras <d.kobras@science-computing.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10731

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 22 00:12:24 CEST 2014 on sn-devel-104

9 years agolib: tevent: make TEVENT_SIG_INCREMENT atomic.
Jeremy Allison [Wed, 30 Jul 2014 16:58:47 +0000 (09:58 -0700)]
lib: tevent: make TEVENT_SIG_INCREMENT atomic.

On arm platforms incrementing a variable is not
an atomic operation, so may be interrupted by
signal processing (if a signal interrupts another
signal handler).

Use compiler built-ins to make this atomic.
__sync_fetch_and_add() works on gcc, llvm,
IBM xlC on AIX, and Intel icc (10.1 and
above).

atomic_add_32() works on Oracle Solaris.

Based on an inital patch from kamei@osstech.co.jp.

Bug #10640 - smbd is not responding - tevent_common_signal_handler() increments non-atomic variables

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

Back-ported from master 536c799f00d7bdd6a574b6bdbc0e9c742eeef8b5

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
9 years agoVERSION: Bump version up to 4.0.22.
Karolin Seeger [Fri, 1 Aug 2014 11:16:31 +0000 (13:16 +0200)]
VERSION: Bump version up to 4.0.22.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoMerge tag 'samba-4.0.21' into v4-0-test
Karolin Seeger [Fri, 1 Aug 2014 11:14:43 +0000 (13:14 +0200)]
Merge tag 'samba-4.0.21' into v4-0-test

samba: tag release samba-4.0.21

9 years agoVERSION: Disable git snapshots for the 4.0.21 release. samba-upstream/tags/samba-4.0.21
Karolin Seeger [Thu, 31 Jul 2014 13:17:36 +0000 (15:17 +0200)]
VERSION: Disable git snapshots for the 4.0.21 release.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10735
CVE-2014-3560: unstrcpy macro length is invalid

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoWHATSNEW: Add release notes for Samba 4.0.21.
Karolin Seeger [Thu, 31 Jul 2014 13:15:24 +0000 (15:15 +0200)]
WHATSNEW: Add release notes for Samba 4.0.21.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10735
CVE-2014-3560: unstrcpy macro length is invalid

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agofix unstrcpy
Volker Lendecke [Tue, 22 Jul 2014 05:02:00 +0000 (07:02 +0200)]
fix unstrcpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10735
CVE-2014-3560: unstrcpy macro length is invalid

9 years agoVERSION: Bump version number up to 4.0.21...
Karolin Seeger [Mon, 28 Jul 2014 19:09:15 +0000 (21:09 +0200)]
VERSION: Bump version number up to 4.0.21...

and re-enable git snapshots.

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

9 years agoVERSION: Bump version number up to 4.0.21...
Karolin Seeger [Mon, 28 Jul 2014 19:09:15 +0000 (21:09 +0200)]
VERSION: Bump version number up to 4.0.21...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoVERSION: Disable git snapshots for the 4.0.20 release. samba-upstream/tags/samba-4.0.20
Karolin Seeger [Mon, 28 Jul 2014 19:08:21 +0000 (21:08 +0200)]
VERSION: Disable git snapshots for the 4.0.20 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoWHATSNEW: Add release notes for Samba 4.0.20.
Karolin Seeger [Mon, 28 Jul 2014 19:07:19 +0000 (21:07 +0200)]
WHATSNEW: Add release notes for Samba 4.0.20.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
Stefan Metzmacher [Wed, 16 Jul 2014 14:17:56 +0000 (16:17 +0200)]
ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()

Searches for '(objectCategory=Person)' will leak a ldb_dn structure
on the ldb_context. These searches are typically used by Zarafa.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 17 00:51:57 CEST 2014 on sn-devel-104

(cherry picked from commit 8d33cddcb001a5a78aca036161d6223268274211)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Thu Jul 17 23:07:24 CEST 2014 on sn-devel-104

9 years agos3: SMB2 : Fix leak of blocking lock records in the database.
Jeremy Allison [Thu, 26 Jun 2014 19:08:46 +0000 (12:08 -0700)]
s3: SMB2 : Fix leak of blocking lock records in the database.

Based on a fix from Hemanth Thummala <hemanth.thummala@gmail.com>
Bug #10673 - Increasing response times for byte range unlock requests.

The previous refactoring makes it obvious we need to call
remove_pending_lock() in all places where we are returning
from the SMB2 blocking lock call.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jun 30 14:59:16 CEST 2014 on sn-devel-104

(cherry picked from commit cee1531e551e5ccd5ccd4a55de226ad686919486)

9 years agos3: smb2: Simplify logic in reprocess_blocked_smb2_lock().
Jeremy Allison [Thu, 26 Jun 2014 19:01:56 +0000 (12:01 -0700)]
s3: smb2: Simplify logic in reprocess_blocked_smb2_lock().

SMB2 blocking locks can only have one lock per request, so
there can never be any other locks to wait for.

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

9 years agos3: smb2: Remove unused code from remove_pending_lock().
Jeremy Allison [Thu, 26 Jun 2014 00:10:45 +0000 (17:10 -0700)]
s3: smb2: Remove unused code from remove_pending_lock().

SMB2 blocking locks can only have one lock per request, so
there can never be any previous locks to remove.

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

9 years agoselftest: teardown the environments also on getting SIGPIPE
Stefan Metzmacher [Thu, 10 Jul 2014 12:28:56 +0000 (14:28 +0200)]
selftest: teardown the environments also on getting SIGPIPE

make test uses

selftest.pl | subuntu-filter.py ...

FAIL_IMMEDIATELY=1 lets subuntu-filter.py exit,
which generates SIGPIPE in selftest.pl.

We should handle this just like any other signal
and teardown all environments.

This should make the teardown process more reliable/verbose.

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit b2803950fc439017680069813fc49255a3f0cbbf)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10696
backport autobuild/selftest fixes from master

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Tue Jul 15 14:34:31 CEST 2014 on sn-devel-104

9 years agolibwbclient: allow only one initial_blob/challenge_blob in wbcCredentialCache()
Stefan Metzmacher [Thu, 10 Jul 2014 03:28:36 +0000 (05:28 +0200)]
libwbclient: allow only one initial_blob/challenge_blob in wbcCredentialCache()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3: libwbclient: Don't break out of loop too soon - find all parameters.
Jeremy Allison [Tue, 8 Jul 2014 23:36:30 +0000 (16:36 -0700)]
s3: libwbclient: Don't break out of loop too soon - find all parameters.

Fix bug #10692: wbcCredentialCache fails if challenge_blob is not first

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()
Stefan Metzmacher [Thu, 10 Jul 2014 19:08:06 +0000 (21:08 +0200)]
s3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()

We now pass the header to SMB_VFS_SENDFILE(), so we have to handle that also
in the fallback code.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul 11 22:57:17 CEST 2014 on sn-devel-104

(cherry picked from commit 7c5ea400ad1f280f5c338c31a0a893154340fdb3)

9 years agotorture4: Make raw.lock.multilock fail after 20 seconds
Volker Lendecke [Thu, 3 Jul 2014 10:05:55 +0000 (10:05 +0000)]
torture4: Make raw.lock.multilock fail after 20 seconds

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul  4 00:04:10 CEST 2014 on sn-devel-104

(cherry picked from commit 0c97b7eb5359b95c0d51a3b5524e82e34243d2d1)

The last 7 patches address bug #10684 - SMB1 blocking locks can fail
notification on unlock, causing client timeout.

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Sun Jul 13 23:35:54 CEST 2014 on sn-devel-104

9 years agotorture4: Adapt comment to code
Volker Lendecke [Thu, 3 Jul 2014 10:05:39 +0000 (10:05 +0000)]
torture4: Adapt comment to code

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

9 years agos4: smbtorture: Add multi-lock test. Regression test for bug #10684.
Jeremy Allison [Tue, 1 Jul 2014 19:05:07 +0000 (12:05 -0700)]
s4: smbtorture: Add multi-lock test. Regression test for bug #10684.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 64346a134dac2bd023f7473202ca38d35ffd3c89)

9 years agos3: smbd: Locking - re-add pending lock records if we fail to acquire a lock (and...
Jeremy Allison [Thu, 3 Jul 2014 03:51:24 +0000 (20:51 -0700)]
s3: smbd: Locking - re-add pending lock records if we fail to acquire a lock (and the lock hasn't timed out).

Keep the blocking lock record and the pending lock records consistent
if we are dealing with multiple blocking lock requests in one SMB1 LockingX
request.

Ensure we re-add the records under the record lock, to avoid race
conditions.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 954401f8b2b16b3e2ef9655e8ce94d657becce36)

9 years agos3: smbd: Locking - treat lock timeout the same as any other error.
Jeremy Allison [Thu, 3 Jul 2014 03:40:49 +0000 (20:40 -0700)]
s3: smbd: Locking - treat lock timeout the same as any other error.

Allows the special case in process_blocking_lock_queue()
that talks back to the client to be removed.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

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

9 years agos3: smbd: Locking - add and use utility function lock_timed_out().
Jeremy Allison [Thu, 3 Jul 2014 03:18:42 +0000 (20:18 -0700)]
s3: smbd: Locking - add and use utility function lock_timed_out().

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 12be57ef3b2d1b670be7a83f29cd580938030015)

9 years agos3: smbd: Locking - convert to using utility macro used elsewhere.
Jeremy Allison [Thu, 3 Jul 2014 00:25:22 +0000 (17:25 -0700)]
s3: smbd: Locking - convert to using utility macro used elsewhere.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 517fa80bd385c6adcfee03ea6b25599013ad88f5)

9 years agonet/doc: make clear that net vampire is for NT4 domains only
Björn Jacke [Fri, 13 Jun 2014 12:14:41 +0000 (14:14 +0200)]
net/doc: make clear that net vampire is for NT4 domains only

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>
9 years agoselftest/subunithelper.py: correctly pass testsuite-uxsuccess to end_testsuite()
Stefan Metzmacher [Wed, 12 Mar 2014 14:12:42 +0000 (15:12 +0100)]
selftest/subunithelper.py: correctly pass testsuite-uxsuccess to end_testsuite()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 13 23:49:36 CET 2014 on sn-devel-104

(cherry picked from commit 3632c59e250396b3974bccf7ad74cbe5c84fdba3)

The last 4 patches address bug #10696 - backport autobuild/selftest fixes from
master.

9 years agoselftest/subunithelper.py: correctly handle fail_immediately in end_testsuite of...
Stefan Metzmacher [Wed, 12 Mar 2014 14:12:42 +0000 (15:12 +0100)]
selftest/subunithelper.py: correctly handle fail_immediately in end_testsuite of FilterOps

This way --fail-immediately also works if a command segfaults.

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

9 years agoselftest/subunithelper.py: correctly handle unexpected success in FilterOps
Stefan Metzmacher [Wed, 12 Mar 2014 14:12:42 +0000 (15:12 +0100)]
selftest/subunithelper.py: correctly handle unexpected success in FilterOps

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

9 years agoscript/autobuild: use --force-rebase option
Stefan Metzmacher [Mon, 17 Feb 2014 08:15:30 +0000 (09:15 +0100)]
script/autobuild: use --force-rebase option

This makes sure the current user will be the committer.

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

9 years agotorture3: Fix bug 10687
Volker Lendecke [Wed, 2 Jul 2014 14:27:52 +0000 (14:27 +0000)]
torture3: Fix bug 10687

'RW2' smbtorture test fails when -N <numprocs> is set to 2 due to the invalid
status check in the second client.

Signed-off-by: Volker Lendecke <vl@samba.org>
Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Fri Jul 11 12:02:38 CEST 2014 on sn-devel-104

9 years agosmbd: Avoid double-free in get_print_db_byname
Volker Lendecke [Tue, 8 Jul 2014 12:30:54 +0000 (14:30 +0200)]
smbd: Avoid double-free in get_print_db_byname

Signed-off-by: Volker Lendecke <vl@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10699

9 years agos3: smbd: Locking, fix off-by one calculation in brl_pending_overlap().
Jeremy Allison [Tue, 1 Jul 2014 20:30:50 +0000 (13:30 -0700)]
s3: smbd: Locking, fix off-by one calculation in brl_pending_overlap().

Consider:

lock = start=110,size=10
pend_lock = 100, size=10

Should not overlap. However,

(lock->start <= pend_lock->start + pend_lock->size)
     110             100                10

is true, so it returns true (overlap).

lock->start <= pend_lock->start + pend_lock->size

should be:

lock->start < pend_lock->start + pend_lock->size

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agosmbstatus: Fix an uninitialized variable
Volker Lendecke [Sun, 29 Jun 2014 08:56:03 +0000 (08:56 +0000)]
smbstatus: Fix an uninitialized variable

We only print valid share mode entries, stale ones don't count. In
traverse, let the callback decide about staleness.

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

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

9 years agos3:winbindd - fix bad bugfix for bug #10280 - winbind panic if AD server is down.
Jeremy Allison [Wed, 2 Jul 2014 03:27:11 +0000 (20:27 -0700)]
s3:winbindd - fix bad bugfix for bug #10280 - winbind panic if AD server is down.

Previous bug fix reversed the sense of the test for out of memory.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Mon Jul  7 12:37:48 CEST 2014 on sn-devel-104

9 years agos3/s4: smbd, rpc, ldap, cldap, kdc services.
Jeremy Allison [Tue, 10 Jun 2014 17:48:30 +0000 (10:48 -0700)]
s3/s4: smbd, rpc, ldap, cldap, kdc services.

Allow us to start if we bind to *either* :: or 0.0.0.0.

Allows us to cope with systems configured as only IPv4
or only IPv6.

Back-port to 4.0.x.

Bug #10653 - Samba won't start on a machine configured with only IPv4.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Tue Jul  1 11:23:13 CEST 2014 on sn-devel-104

9 years agomsg_channel: Fix a 100% CPU loop
Volker Lendecke [Tue, 10 Jun 2014 14:21:07 +0000 (14:21 +0000)]
msg_channel: Fix a 100% CPU loop

In a ctdb setup, msg_read_got_ctdb did not set channel->pending_req to
NULL. In smbXsrv_session_close_loop in any error condition this leads to
a 100% loop. smbXsrv_session_close_loop continously retries, but because
close_channel->pending_req is != NULL, msg_read_send will always return
EBUSY, making smbXsrv_session_close_loop retry infinitely.

This patch makes sure that msg_read_got_ctdb correctly NULLs out pending_req.

msg_channel.c does not exist in master anymore, so this patch is 4.1 only.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10663
100% smbd cpu loop in ctdb setups

9 years agoautobuild: delete $NSS_MODULES in "make clean"
Björn Jacke [Tue, 10 Jun 2014 13:51:58 +0000 (15:51 +0200)]
autobuild: delete $NSS_MODULES in "make clean"

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoVERSION: Bump version up to 4.0.20.
Karolin Seeger [Mon, 23 Jun 2014 09:25:09 +0000 (11:25 +0200)]
VERSION: Bump version up to 4.0.20.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoMerge tag 'samba-4.0.19' into v4-0-test
Karolin Seeger [Mon, 23 Jun 2014 09:24:48 +0000 (11:24 +0200)]
Merge tag 'samba-4.0.19' into v4-0-test

samba: tag release samba-4.0.19

9 years agoVERSION: Disable git snapshot for the 4.0.19 release. samba-upstream/tags/samba-4.0.19
Karolin Seeger [Sun, 22 Jun 2014 15:03:05 +0000 (17:03 +0200)]
VERSION: Disable git snapshot for the 4.0.19 release.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10633
CVE-2014-0244: nmbd denial of service

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10654
CVE-2014-3493: Segmentation fault in smbd_marshall_dir_entry()'s
SMB_FIND_FILE_UNIX handler because push_ascii() has returned(uint32_t)-1
via srvstr_push(), incrementing p by 4GB

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoWHATSNEW: Add release notes for Samba 4.0.19.
Karolin Seeger [Sun, 22 Jun 2014 15:01:56 +0000 (17:01 +0200)]
WHATSNEW: Add release notes for Samba 4.0.19.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10633
CVE-2014-0244: nmbd denial of service

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10654
CVE-2014-3493: Segmentation fault in smbd_marshall_dir_entry()'s
SMB_FIND_FILE_UNIX handler because push_ascii() has returned(uint32_t)-1
via srvstr_push(), incrementing p by 4GB

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agos3: smbd - fix processing of packets with invalid DOS charset conversions.
Jeremy Allison [Sun, 8 Jun 2014 04:51:44 +0000 (21:51 -0700)]
s3: smbd - fix processing of packets with invalid DOS charset conversions.

Bug 10654 - Segmentation fault in smbd_marshall_dir_entry()'s SMB_FIND_FILE_UNIX handler

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

Signed-off-by: Jeremy Allison <jra@samba.org>
CVE-2014-3493

9 years agos3: nmbd: Fix bug 10633 - nmbd denial of service
Jeremy Allison [Wed, 28 May 2014 17:40:27 +0000 (10:40 -0700)]
s3: nmbd: Fix bug 10633 - nmbd denial of service

The Linux kernel has a bug in that it can give spurious
wakeups on a non-blocking UDP socket for a non-deliverable packet.

When nmbd was changed to use non-blocking sockets it
became vulnerable to a spurious wakeup from poll/epoll.

Fix sys_recvfile() to return on EWOULDBLOCK/EAGAIN.

CVE-2014-0244

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agoVERSION: Bump version up to 4.0.19...
Karolin Seeger [Sun, 22 Jun 2014 14:54:46 +0000 (16:54 +0200)]
VERSION: Bump version up to 4.0.19...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agowinbindd: Ensure we do not look at rid_array before checking if it was returned
Andrew Bartlett [Fri, 28 Mar 2014 03:30:28 +0000 (16:30 +1300)]
winbindd: Ensure we do not look at rid_array before checking if it was returned

We no longer return early if there are no members, we just return an empty array.

Fixes bug #10627 - rid_array used before status checked - segmentation fault due to null pointer dereference

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

Change-Id: I7b0949e0c0b9277426a8007514a8658615f6c709
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Wed Jun 11 11:40:38 CEST 2014 on sn-devel-104

10 years agoprinting: fix purge of all print jobs
David Disseldorp [Wed, 21 May 2014 19:55:58 +0000 (21:55 +0200)]
printing: fix purge of all print jobs

The incorrect (system) jobid is currently passed to the job deletion
function.

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

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit efb4684a3fc0b32a71eab013000f730e6b144a67)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Tue Jun  3 10:53:33 CEST 2014 on sn-devel-104

10 years agos3: smb2: Move from using SBVAL to put NTTIMEs on the wire to put_long_date_timespec.
Jeremy Allison [Wed, 21 May 2014 18:57:16 +0000 (11:57 -0700)]
s3: smb2: Move from using SBVAL to put NTTIMEs on the wire to put_long_date_timespec.

put_long_date_timespec() correctly calls round_timespec()
on the time parameters, and is the correct function to
use when writing *any* file-based NTTIME on the wire.

Move from using NTTIME variables internally
in the server to struct timespec variables, which is
what all the other server code uses. Only map to
NTTIME as the last step of marshalling the output
data.

The previous SMB2 create code missed the round_timespec()
call before marshalling.

Bug 3124 - xcopy /d with samba shares works not as aspected

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

which is a regression from a long-ago bug with
SMB1.

Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agos3: smb2: Move from using SBVAL to put NTTIMEs on the wire to put_long_date_timespec.
Jeremy Allison [Wed, 21 May 2014 18:31:44 +0000 (11:31 -0700)]
s3: smb2: Move from using SBVAL to put NTTIMEs on the wire to put_long_date_timespec.

put_long_date_timespec() correctly calls round_timespec()
on the time parameters, and is the correct function to
use when writing *any* file-based NTTIME on the wire.

The smb2_close() code being modified already did this by
hand, and so this doesn't change any of the functionality, only
makes the SMB2 code match all of the other server
code in Samba. Move from using NTTIME variables internally
in the server to struct timespec variables, which is
what all the other server code uses. Only map to
NTTIME as the last step of marshalling the output
data.

Not following the put_long_date_timespec()
convention in the SMB2 create code caused the
round_timespec() step to have been missed in
that code - thus bug:

Bug 3124 - xcopy /d with samba shares works not as aspected

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

which is a regression from a long-ago bug with
SMB1.

Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agoVERSION: Bump version number up to 4.0.19...
Karolin Seeger [Tue, 27 May 2014 17:18:37 +0000 (19:18 +0200)]
VERSION: Bump version number up to 4.0.19...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoVERSION: Disable git snapshots for the 4.0.18 release. samba-upstream/tags/samba-4.0.18
Karolin Seeger [Tue, 27 May 2014 12:03:28 +0000 (14:03 +0200)]
VERSION: Disable git snapshots for the 4.0.18 release.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10549
CVE-2014-0178: Malformed FSCTL_SRV_ENUMERATE_SNAPSHOTS response

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10609
CVE-2014-0239: DOS in DNS server packet handling

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoWHATSNEW: Add release notes for Samba 4.0.18.
Karolin Seeger [Tue, 27 May 2014 12:02:02 +0000 (14:02 +0200)]
WHATSNEW: Add release notes for Samba 4.0.18.

CVE-2014-0239 Don't reply to replies
CVE-2014-0178: Malformed FSCTL_SRV_ENUMERATE_SNAPSHOTS response

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agobug #10609: CVE-2014-0239 Don't reply to replies
Kai Blin [Tue, 13 May 2014 06:13:29 +0000 (08:13 +0200)]
bug #10609: CVE-2014-0239 Don't reply to replies

Due to insufficient input checking, the DNS server will reply to a packet that
has the "reply" bit set. Over UDP, this allows to send a packet with a spoofed
sender address and have two servers DOS each other with circular replies.

This patch fixes bug #10609 and adds a test to make sure we don't regress.
CVE-2014-2039 has been assigned to this issue.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10609

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Kai Blin <kai@samba.org>
Autobuild-Date(master): Tue May 20 04:15:44 CEST 2014 on sn-devel-104

(cherry picked from commit 392ec4d241eb19c812cd49ff73bd32b2b09d8533)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Mon May 26 14:54:32 CEST 2014 on sn-devel-104

10 years agopidl/lib/wscript_build: make use of PERL_LIB_INSTALL_DIR
Stefan Metzmacher [Fri, 9 May 2014 09:49:10 +0000 (11:49 +0200)]
pidl/lib/wscript_build: make use of PERL_LIB_INSTALL_DIR

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat May 10 01:37:33 CEST 2014 on sn-devel-104
(cherry picked from commit cf75ef9f73f2cdbf2a039bbc9468f5da6a14834e)

10 years agoscript/autobuild: make use of --with-perl-{arch,lib}-install-dir
Stefan Metzmacher [Fri, 9 May 2014 09:48:26 +0000 (11:48 +0200)]
script/autobuild: make use of --with-perl-{arch,lib}-install-dir

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

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

10 years agowafsamba: Fail with error message if perl doesn't provide valid dirs.
Stefan Metzmacher [Fri, 9 May 2014 07:42:23 +0000 (09:42 +0200)]
wafsamba: Fail with error message if perl doesn't provide valid dirs.

We try harder to get valid directories, we now fallback like this:

vendorarch => sitearch => archlib
and
vendorlib => sitelib => privlib

The new options are --with-perl-arch-install-dir and
--with-perl-lib-install-dir.

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

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

10 years agowafsamba: If perl can't provide defaults, define them.
Andreas Schneider [Tue, 15 Apr 2014 08:24:24 +0000 (10:24 +0200)]
wafsamba: If perl can't provide defaults, define them.

This should fix the installation on FreeBSD.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu May  8 13:55:50 CEST 2014 on sn-devel-104
(cherry picked from commit 0ba276ebad57d75a769e22414f94acbe8c177d97)

10 years agoFSCTL_GET_SHADOW_COPY_DATA: Don't return 4 extra bytes at end
Christof Schmitt [Mon, 5 Aug 2013 18:21:59 +0000 (11:21 -0700)]
FSCTL_GET_SHADOW_COPY_DATA: Don't return 4 extra bytes at end

labels_data_count already accounts for the unicode null character at the
end of the array. There is no need in adding space for it again.

Signed-off-by: Christof Schmitt <christof.schmitt@us.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Aug  6 04:03:17 CEST 2013 on sn-devel-104

(cherry picked from commit eb50fb8f3bf670bd7d1cf8fd4368ef4a73083696)

The last 2 patches address bug #10549 - CVE-2014-0178: Malformed
FSCTL_SRV_ENUMERATE_SNAPSHOTS response.

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Mon May 19 14:29:18 CEST 2014 on sn-devel-104

10 years agoFSCTL_GET_SHADOW_COPY_DATA: Initialize output array to zero
Christof Schmitt [Mon, 5 Aug 2013 18:16:22 +0000 (11:16 -0700)]
FSCTL_GET_SHADOW_COPY_DATA: Initialize output array to zero

Otherwise num_volumes and the end marker can return uninitialized data
to the client.

Signed-off-by: Christof Schmitt <christof.schmitt@us.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 30e724cbff1ecd90e5a676831902d1e41ec1b347)

10 years agos3: smbd : Fix wildcard unlink to fail if we get an error rather than trying to continue.
Jeremy Allison [Tue, 29 Apr 2014 23:59:55 +0000 (16:59 -0700)]
s3: smbd : Fix wildcard unlink to fail if we get an error rather than trying to continue.

This can break smbd if we end up leaving a SHARING_VIOLATION
retry record on the queue.

Signed-off-by: Jeremy Allison <jra@samba.org>
Fix bug #10577 - SMB1 wildcard unlink fail can leave a retry record on the open
retry queue.

10 years agos3: smbd: Remove open_file_fchmod().
Jeremy Allison [Thu, 1 May 2014 18:11:20 +0000 (11:11 -0700)]
s3: smbd: Remove open_file_fchmod().

No longer used (hurrah!).

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May  2 23:47:38 CEST 2014 on sn-devel-104

10 years agos3: smbd: change file_set_dosmode() to use get_file_handle_for_metadata() instead...
Jeremy Allison [Thu, 1 May 2014 18:07:44 +0000 (11:07 -0700)]
s3: smbd: change file_set_dosmode() to use get_file_handle_for_metadata() instead of open_file_fchmod().

get_file_handle_for_metadata() is a new function that
finds an existing open handle (fsp->fh->fd != -1) for
a given dev/ino if there is one available, and uses
INTERNAL_OPEN_ONLY with WRITE_DATA access if not.

Allows open_file_fchmod() to be removed next.

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
10 years agos3: smbd : Ensure file_new doesn't call into smbXsrv_open_create() for INTERNAL_OPEN_...
Jeremy Allison [Thu, 1 May 2014 18:01:03 +0000 (11:01 -0700)]
s3: smbd : Ensure file_new doesn't call into smbXsrv_open_create() for INTERNAL_OPEN_ONLY.

This causes deadlocks which cause smbd to crash if the locking
database has already been locked for a compound operation we
need to be atomic (as in the file rename case).

Ensure INTERNAL_OPEN_ONLY opens are synonymous with req==NULL.

INTERNAL_OPEN_ONLY opens leave a NO_OPLOCK record in
the share mode database, so they can be detected by other
processes for share mode violation purposes (because
they're doing an operation on the file that may include
reads or writes they need to have real state inside the
locking database) but have an fnum of FNUM_FIELD_INVALID
and a local share_file_id of zero, as they will never be
seen on the wire.

Ensure validate_my_share_entries() ignores
INTERNAL_OPEN_ONLY records (share_file_id == 0).

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
10 years agos3 : smbd : Protect all possible code paths from fsp->op == NULL.
Jeremy Allison [Thu, 1 May 2014 17:58:51 +0000 (10:58 -0700)]
s3 : smbd : Protect all possible code paths from fsp->op == NULL.

In changes to come this will be possible for an INTERNAL_OPEN_ONLY.
The protection was already in place for some code paths, this
makes the coverage compete.

Bug 10564 - Lock order violation and file lost

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
10 years agobyteorder: do not assume PowerPC is big-endian
David Disseldorp [Mon, 5 May 2014 11:42:36 +0000 (13:42 +0200)]
byteorder: do not assume PowerPC is big-endian

byteorder.h currently uses reverse-indexing ASM instructions for little
endian multi-byte storage/retrieval on PowerPC. With Power8 this is an
incorrect assumption, as it can be big or little endian.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit 5bf6ed5ebd0dc5ecdc5bcfb1d4720e9251849adc)

10 years agoFix an empty if statement.
Jose A. Rivera [Mon, 5 May 2014 11:46:58 +0000 (06:46 -0500)]
Fix an empty if statement.

Primarily following the precedent set by other uses of composite_is_ok(), but
also making sure nothing tries to use c after this point if it is in fact not
ok.

Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Fix bug #10348 - Empty body in if-statement in continue_domain_open_lookup.

10 years agoMinor typo fix in source3/wscript.
Jose A. Rivera [Mon, 5 May 2014 12:29:57 +0000 (07:29 -0500)]
Minor typo fix in source3/wscript.

Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May  5 22:41:19 CEST 2014 on sn-devel-104

Fix bug #10151 - Extra ':' in msg for Waf Cross Compile Build System with
Cross-answers command.

10 years agos3: smbd - smb1 - fix read of deleted memory in reply_writeclose().
Noel Power [Thu, 27 Feb 2014 20:07:11 +0000 (12:07 -0800)]
s3: smbd - smb1 - fix read of deleted memory in reply_writeclose().

While running smbtorture test raw.write under valgrind an "Invalid read"
was reported in methid reply_writeclose, it seems after closing a file
sometime later we try to access it again.

Signed-off-by: Noel Power <noel.power@suse.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Mar  3 20:42:40 CET 2014 on sn-devel-104
(cherry picked from commit 04e434661fa6b5f13776f925b0a7cbadb6b6d006)

Fix bug #10554 - request backport for 'smb1 - fix read of deleted memory in
reply_writeclose()'.

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Fri May  2 15:39:19 CEST 2014 on sn-devel-104

10 years agolib-util: rename memdup to smb_memdup and fix all callers (bug #10556)
Björn Baumbach [Mon, 14 Apr 2014 12:37:29 +0000 (14:37 +0200)]
lib-util: rename memdup to smb_memdup and fix all callers (bug #10556)

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit fae7e5d771d1c69bded1189b23335647023fa0f7)

Conflicts:
ctdb/lib/util/util.h

Also renamed memdup() in source3/locking/brlock.c

10 years agobuild: fix ordering problems with lib-provided and internal RPATHs
Michael Adam [Wed, 16 Oct 2013 13:17:18 +0000 (15:17 +0200)]
build: fix ordering problems with lib-provided and internal RPATHs

When a library or system (like cups) provides an RPATH,
e.g. with -Wl,-R or -Wl,-rpath, this was added by waf
to the LINKFLAGS, wich was later prepended to our RPATH.
But if the path by chance contains an older version of
one of our internal libraries like talloc, this would lead
to linking the too old talloc into our binaries.

This has been observed on, e.g., FreeBSD, but it is a general
problem.

This patch fixes the problem by specially parsing the RPATH
linker options from the pkg-config(, cups-config, ....) output
and putting the paths into the RPATH_<lib> container, which
is then later correctly appended to our internal RPATH.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 64f5e24100a764ec198cab9a8d2c43fa86e7027c)

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

10 years agoRevert "tevent: fix crash bug in tevent_queue_immediate_trigger()"
Karolin Seeger [Tue, 29 Apr 2014 08:23:03 +0000 (10:23 +0200)]
Revert "tevent: fix crash bug in tevent_queue_immediate_trigger()"

This reverts commit fc185a5f4cb34f4a2488eb336844c32812f930e7.

See https://bugzilla.samba.org/show_bug.cgi?id=10344 for details.

Stefan (metze) Metzmacher 2014-04-11 07:28:18 UTC

Karolin, please revert fc185a5f4cb34f4a2488eb336844c32812f930e7 in v4-0-test,
this somehow went in twice. 87a02403ee4fcc404dc3b887a851c421660cb4d8 is the
first commit.

It's not a real problem to have the same check twice, but it's a bit confusing
and may generate problems with future backports.

10 years agos3-lib/util: fix logic inside set_namearray loops.
Jeremy Allison [Tue, 8 Apr 2014 17:38:33 +0000 (10:38 -0700)]
s3-lib/util: fix logic inside set_namearray loops.

Additional fix for bug #10544 - s3-lib/util: set_namearray reads across end of namelist string.

Not strictly needed as the initial fix addresses
the problem, but corrects the internal logic
inside the loops.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 4f59580331b934b183c3344da57f2002d88d4512)

10 years agos3-lib/util: fix read across end of namelist string
Björn Baumbach [Mon, 7 Apr 2014 11:46:42 +0000 (13:46 +0200)]
s3-lib/util: fix read across end of namelist string

If the namelist is not terminated with a '/', we try to read
the next character after the string termination '\0'.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr  8 21:44:16 CEST 2014 on sn-devel-104
(cherry picked from commit 8f46b130c5c796d66d26982f5cd99c52f7c8ece1)

Fix bug #10544 - s3-lib/util: set_namearray reads across end of namelist
string.

10 years agos3-nmbd: reset debug settings after reading config file (bug #10239)
Björn Baumbach [Wed, 19 Mar 2014 14:01:11 +0000 (15:01 +0100)]
s3-nmbd: reset debug settings after reading config file (bug #10239)

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 25 18:29:06 CET 2014 on sn-devel-104

(cherry picked from commit a7df00c82049547129f063a40a842b156c8aead4)

10 years agoVERSION: Bump version number up to 4.0.18...
Karolin Seeger [Thu, 10 Apr 2014 09:52:52 +0000 (11:52 +0200)]
VERSION: Bump version number up to 4.0.18...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoWHATSNEW: Add release notes for Samba 4.0.17. samba-upstream/tags/samba-4.0.17
Karolin Seeger [Thu, 10 Apr 2014 09:41:12 +0000 (11:41 +0200)]
WHATSNEW: Add release notes for Samba 4.0.17.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agos3: messages: Implement cleanup of dead records.
Jeremy Allison [Wed, 2 Apr 2014 23:45:25 +0000 (16:45 -0700)]
s3: messages: Implement cleanup of dead records.

When a smbd process dies, pending messages.tdb records for this process
might not get cleaned up. Implement a cleanup for dead records that is
triggered after a smbd dies uncleanly; the records for that PID are
deleted.

Based on a patchset from Christof Schmitt <cs@samba.org>.

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

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10534
Cleanup messages.tdb record after unclean smbd shutdown

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Mon Apr  7 11:55:50 CEST 2014 on sn-devel-104

10 years agos3: smbd: Ensure we always go via getgroups_unix_user() when creating an NT token.
Jeremy Allison [Tue, 25 Mar 2014 15:47:39 +0000 (08:47 -0700)]
s3: smbd: Ensure we always go via getgroups_unix_user() when creating an NT token.

This has to be done in every code path that creates
an NT token, as remote users may have been added to
the local /etc/group database. Tokens created merely
from the info3 structs (via the DC or via the krb5 PAC)
won't have these local groups.

This code needs to special-case the guest user, as
this token can have the token_sid[0] set to the Guest
SID, not the mapping of UNIX uid -> SID.

Other users that may have a well-known SID
set in token_sid[0] (like SYSTEM) are usually
not mappable to UNIX users and can be ignored
when adding local groups from /etc/group.

Combined back-port of fixes
6034ab521c47fc5f4732398652c9c6847ff92035 and
a9fa09723bee3588db2168ac13f7ad0334452c11 from
master.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agotevent: fix crash bug in tevent_queue_immediate_trigger()
Stefan Metzmacher [Sat, 11 Jan 2014 07:58:05 +0000 (08:58 +0100)]
tevent: fix crash bug in tevent_queue_immediate_trigger()

Assume we we have a queue with 2 entries (A and B with triggerA() and triggerB()).
If triggerA() removes itself tevent_queue_entry_destructor() will be called
for A, this schedules the immediate event to call triggerB().
If triggerA() then also removes B by an explicit of implizit talloc_free(),
q->list is NULL, but the immediate event is still scheduled and can't be unscheduled.

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

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Tue Apr  1 11:33:36 CEST 2014 on sn-devel-104

10 years agolsa.idl: define lsa.ForestTrustCollisionInfo and ForestTrustCollisionRecord as public...
Alexander Bokovoy [Tue, 18 Mar 2014 17:41:38 +0000 (19:41 +0200)]
lsa.idl: define lsa.ForestTrustCollisionInfo and ForestTrustCollisionRecord as public structs

For Python bindings PIDL wants the struct to be defined as public if we
want to use __ndr_print/pack/unpack.

Define the [public] attribute to ForestTrustCollisionInfo/Record to
allow easier debugging when there is collision in establishing a trust.

This change does not affect C code as NDR functions are always
generated, only not exposed in Python bindings.

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

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Mon Mar 24 12:44:50 CET 2014 on sn-devel-104

(cherry picked from commit 59767911bded48388c27d5f9cd2ff1346a1c01a6)

10 years agos3-rpc_server: Fix handling of fragmented rpc requests.
Andreas Schneider [Thu, 20 Mar 2014 13:45:01 +0000 (14:45 +0100)]
s3-rpc_server: Fix handling of fragmented rpc requests.

We need to call pipe_init_outgoing_data() as the first thing in
process_complete_pdu(). Otherwise the caller may use uninitialized
memory and tries to write a response into the socket.

The problem happens only if a real socket is used, which means
in all cases for master and only with external rpc daemons in v4-0
and v4-1.

The problem looks like this in the logs.

    [2014/03/20 14:49:35.531663, 10, pid=7309, effective(0, 0), real(0, 0), class=rpc_srv] ../source3/rpc_server/srv_pipe.c:1627(process_complete_pdu)
      Processing packet type 0
    [2014/03/20 14:49:35.531695, 10, pid=7309, effective(0, 0), real(0, 0), class=rpc_srv] ../source3/rpc_server/srv_pipe.c:1472(dcesrv_auth_request)
      Checking request auth.
    [2014/03/20 14:49:35.531738, 10, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:521(named_pipe_packet_process)
      Sending 1 fragments in a total of 0 bytes
    [2014/03/20 14:49:35.531769, 10, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:526(named_pipe_packet_process)
      Sending PDU number: 0, PDU Length: 4294967228
    [2014/03/20 14:49:35.531801,  2, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:565(named_pipe_packet_done)
      Writev failed!
    [2014/03/20 14:49:35.531845,  2, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:595(named_pipe_packet_done)
      Fatal error(Message too long). Terminating client(127.0.0.1) connection!

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Guenther Deschner <gd@samba.org
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Mar 20 18:30:17 CET 2014 on sn-devel-104

(cherry picked from commit 5277fc4d0393ffe2e415ad26610b36d2986c62d7)

10 years agos3:rpc_server: minor refactoring of process_request_pdu()
Gregor Beck [Thu, 9 Jan 2014 09:15:31 +0000 (10:15 +0100)]
s3:rpc_server: minor refactoring of process_request_pdu()

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit b5f30205931a4b9d0b3b257d5855869e606f8b63)

10 years agopidl-waf: Only install Yapp::Driver if it is not available.
Andreas Schneider [Fri, 28 Feb 2014 15:00:54 +0000 (16:00 +0100)]
pidl-waf: Only install Yapp::Driver if it is not available.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Mar  6 23:30:47 CET 2014 on sn-devel-104

The last 9 patches address bug #10472 - pidl: waf should have an option
for the dir to install perl files and do not glob.