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
VERSION: Bump version up to 4.0.19...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
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>
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
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>
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>
Merge tag 'samba-4.0.19' into v4-0-test

samba: tag release samba-4.0.19
VERSION: Bump version up to 4.0.20.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
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>
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
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
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
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)
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>
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
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
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)
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)
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)
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.