s3-libads: Add a function to retrieve the SPNs of a computer account.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 4eaa4ccbdf279f1ff6d8218b36d92aeea0114cd8)
s3-libads: Add function to search for an element in an array.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit e1ee4c8bc7018db7787dd9a0be6d3aa40a477ee2)
s3-libnet: Add libnet_join_get_machine_spns().

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 7e0b8fcce5572c88d50993a1dbd90f65638ba90f)
s3-libnet: Make sure we do not overwrite precreated SPNs.

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

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Sep 26 08:22:45 CEST 2014 on sn-devel-104

(cherry picked from commit 0aacbe78bb40d76b65087c2a197c92b0101e625e)
idmap_rfc2307: Fix a crash after connection problem to DC

When the connection to the DC has a problem, the code behind
ads_do_search_retry closes the current connection and opens a new one.
The new connection has a new struct LDAP to represent the connection. In
this case, the LDAP pointer in the idmap_rfc2307_context becomes
invalid.

Fix this problem by updating the local pointer after calling
ads_do_search_retry.

Signed-off-by: Christof Schmitt <cs@samba.org>

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10837
winbind crash in idmap_rfc2307 module
s3: Move init_lsa_ref_domain_list to lib

This will be used in the next patch in winbind.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

(cherry picked from commit 16594e7fc0a46249a48d0d0635de0c1050ecd340)
s3-winbindd: Do not use domain SID from LookupSids for Sids2UnixIDs call

Create a new lsa_RefDomainList and populate it with the domain SID from
the original query. That avoids the problem that for migrated objects,
LookupSids returns the SID of the new domain, and combining that with
the RID from the input results in an invalid SID.

A better fix would be querying the RID of the user in the new domain,
but the approach here at least avoids id mappings entries for invalid
SIDs.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep 29 13:15:18 CEST 2014 on sn-devel-104

(cherry picked from commit 9c9216410faf707edc4ba05f2b715d45f7f51ca4)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10838
Invalid id mappings for users/groups migrated from another domain
registry: Don't leave dangling transactions

When a createkey fails due to access denied, we need to do a
transaction_cancel. Otherwise the lock on the db will stay around.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10860
s3-libads: Add all machine account principals to the keytab.

This adds all SPNs defined in the DC for the computer account to the
keytab using 'net ads keytab create -P'.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 5d58b92f8fcbc509f4fe2bd3617bcaeada1806b6)
s3: smb2cli: query info return length check was reversed.

Make it identical to the check in libcli/smb/smb2cli_ioctl.c

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

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct  2 04:42:26 CEST 2014 on sn-devel-104

(cherry picked from commit 6c05cd3e895831be7d9a68a51de2048d04c188a0)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Thu Oct  9 23:43:36 CEST 2014 on sn-devel-104
lib: util: Signal handling - change CatchChild() and CatchChildLeaveStatus() to return the previous handler.

Bug #10831 - SIGCLD Signal handler not correctly reinstalled on old library code use - smbrun etc.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
s3: lib: Signal handling - ensure smbrun and change password code save and restore existing SIGCHLD handlers.

Bug #10831 - SIGCLD Signal handler not correctly reinstalled on old library code use - smbrun etc.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
pthreadpool: Slightly serialize jobs

Using the new msg_source program with 1.500 instances against a single
msg_sink I found the msg_source process to spawn two worker threads for
synchronously sending the data towards the receiving socket. This should
not happen: Per destination node we only create one queue. We strictly
only add pthreadpool jobs one after the other, so a single helper thread
should be perfectly sufficient.

It turned out that under heavy overload the main sending thread was
scheduled before the thread that just had finished its send() job. So
the helper thread was not able to increment the pool->num_idle variable
indicating that we don't have to create a new thread when the new job
is added.

This patch moves the signalling write under the mutex. This means that
indicating readiness via the pipe and the pool->num_idle variable happen both
under the same mutex lock and thus are atomic. No superfluous threads anymore.

Back port of commit 1c4284c7395f23cefa61a407db74cf5067aee2aa
that went into master.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: nmbd: Ensure the main nmbd process doesn't create zombies.

Use the same mechanism as setup for smbd and winbindd.

Fixes bug #10830 - nmbd can leave unreaped zombies.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Sun Oct 19 23:19:38 CEST 2014 on sn-devel-104
WHATSNEW: Add release notes for Samba 4.1.13.

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

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

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
nss_winbind: add getgroupmembership for FreeBSD

The getgroupmembership call on FreeBSD is needed for "winbind expand groups=0"
(the new default in 4.2) to work.

Thanks to Timur I. Bakeyev for the enhancement patch.

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 8ccf5f66691e2bbf0883afa658282ef2ac60b015)
vfs_glusterfs: Comment the top of the file.

Change-Id: I98b512da2e0e56f061247a7c48ce576287b43827
Signed-off-by: Christopher R. Hertel <crh@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Ira Cooper <ira@samba.org>
vfs_glusterfs: smb_stat_ex_from_stat commenting and cleanup.

Change-Id: If1b54e62b4fc2240aa17e5d1eae8f279f2fdfc42
Signed-off-by: Christopher R. Hertel <crh@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Ira Cooper <ira@samba.org>