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.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
make: Add gdbtestenv target.

This starts the sever components in a xterm with gdb.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3: smbd: Locking, fix off-by one calculation in brl_pending_overlap().

Consider:

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

Do 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

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Jul  2 10:18:17 CEST 2014 on sn-devel-104
s3-libnet: Improve error message.

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

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jul  2 16:54:10 CEST 2014 on sn-devel-104
ctdb-scripts: Always print footer when debugging hung script

There shouldn't be an early exit for the "init" event.  Just make the
"ctdb scriptstatus" call conditional.

While here, move the comment about only running a single instance to
be near locking code.  The comment is more useful there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-tests: Fix racy test for debugging hung scripts

Debugging can still be running when a monitor event times out and
scriptstatus output changes.

When debugging a hung script to a log file, write to a temporary file
and move the temporary file over the log file when done.  The test
then waits for the log file to appear.

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

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Jul  3 08:19:23 CEST 2014 on sn-devel-104
torture3: Fix bug 10687

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): Thu Jul  3 19:07:15 CEST 2014 on sn-devel-104
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>
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>
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>
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>
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>
torture4: Adapt comment to code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
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
secrets: Ensure we store the secureChannelType when written to secrets.ldb

This will allow winbindd to know when we are an RODC
without needing to dig into sam.ldb.

Change-Id: Ibdfa37fe6269305ccc5db42479f4a8db5eea53f3
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
winbindd: Allow the AD-DC to call getdcname

This is particularly useful for RODC and eliminates a knownfail.

Change-Id: Ia5089761dcabb1620eadd530dbc9b05580cddd1f
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
selftest: Make the wbinfo userinfo tests work properly with the qualified name

This eliminates a knownfail.

Change-Id: I7331a4e62ef8c1f2a9999a78865023ae19beeaca
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
s4-auth: Do not override the NT_STATUS_NOT_IMPLEMENTED error for winbindd

This changes the auth code in winbindd to use this as a flag, and to
therefore contact the RW DC.

Change-Id: If4164d27b57b453b398642fdf7d46d03cd0e65f2
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
selftest: Use s4 RPC servers in the s4member environment

Change-Id: I645669d551d7bb988c69da7b3805e3056ab1e8c8
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
winbindd: Use a remote RPC server when we are an RODC when needed

This allows us to operate against the local cache where possible, but
to forward some operations to the read-write DC.

Andrew Bartlett

Change-Id: Idc78ae379a402969381758919fcede17568f094e
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>