sfrench/samba-autobuild/.git
9 years agosmbd: Remove unused blocking_lock_record* from VFS_BRL_LOCK_WINDOWS
Volker Lendecke [Thu, 3 Jul 2014 13:51:45 +0000 (13:51 +0000)]
smbd: Remove unused blocking_lock_record* from VFS_BRL_LOCK_WINDOWS

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Remove two outdated comments
Volker Lendecke [Thu, 3 Jul 2014 10:30:56 +0000 (10:30 +0000)]
smbd: Remove two outdated comments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Use brl_delete_lock_struct in brl_lock_cancel_default
Volker Lendecke [Thu, 3 Jul 2014 10:18:36 +0000 (10:18 +0000)]
smbd: Use brl_delete_lock_struct in brl_lock_cancel_default

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Factor out unlocking from smbd_do_locking
Volker Lendecke [Thu, 3 Jul 2014 10:06:56 +0000 (10:06 +0000)]
smbd: Factor out unlocking from smbd_do_locking

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Remove an outdated comment
Volker Lendecke [Thu, 3 Jul 2014 09:37:10 +0000 (09:37 +0000)]
smbd: Remove an outdated comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos4-winbind: Use winbindd in the AD DC by default
Andrew Bartlett [Mon, 19 May 2014 22:15:31 +0000 (10:15 +1200)]
s4-winbind: Use winbindd in the AD DC by default

(Including changes to knownfail to match the new winbindd in use in each environment)

Change-Id: I9e08086eba98e95e05a99afef28315e2857aae56
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jul  4 05:19:54 CEST 2014 on sn-devel-104

9 years agowinbindd: Use a remote RPC server when we are an RODC when needed
Andrew Bartlett [Sun, 25 May 2014 23:58:38 +0000 (11:58 +1200)]
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>
9 years agoselftest: Use s4 RPC servers in the s4member environment
Andrew Bartlett [Mon, 19 May 2014 23:10:22 +0000 (11:10 +1200)]
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>
9 years agos4-auth: Do not override the NT_STATUS_NOT_IMPLEMENTED error for winbindd
Andrew Bartlett [Mon, 30 Jun 2014 00:04:03 +0000 (12:04 +1200)]
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>
9 years agoselftest: Make the wbinfo userinfo tests work properly with the qualified name
Garming Sam [Mon, 30 Jun 2014 02:58:21 +0000 (14:58 +1200)]
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>
9 years agowinbindd: Allow the AD-DC to call getdcname
Garming Sam [Mon, 30 Jun 2014 02:23:58 +0000 (14:23 +1200)]
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>
9 years agosecrets: Ensure we store the secureChannelType when written to secrets.ldb
Andrew Bartlett [Sun, 25 May 2014 23:58:38 +0000 (11:58 +1200)]
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>
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

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>
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>
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>
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>
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>
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>
9 years agotorture3: Fix bug 10687
Volker Lendecke [Wed, 2 Jul 2014 14:27:52 +0000 (14:27 +0000)]
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

9 years agoctdb-tests: Fix racy test for debugging hung scripts
Martin Schwenke [Thu, 26 Jun 2014 05:16:12 +0000 (15:16 +1000)]
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

9 years agoctdb-scripts: Always print footer when debugging hung script
Martin Schwenke [Thu, 26 Jun 2014 04:46:54 +0000 (14:46 +1000)]
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>
9 years agos3-libnet: Improve error message.
Andreas Schneider [Wed, 2 Jul 2014 11:25:12 +0000 (13:25 +0200)]
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

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

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

9 years agomake: Add gdbtestenv target.
Andreas Schneider [Tue, 1 Jul 2014 13:05:21 +0000 (15:05 +0200)]
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>
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.

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>
9 years agosmbd: Fix some typos
Volker Lendecke [Mon, 30 Jun 2014 08:32:29 +0000 (08:32 +0000)]
smbd: Fix some typos

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): Wed Jul  2 02:25:47 CEST 2014 on sn-devel-104

9 years agosmbd: Remove an unused variable
Volker Lendecke [Mon, 30 Jun 2014 09:44:26 +0000 (09:44 +0000)]
smbd: Remove an unused variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Clarify smb2 lock checks
Volker Lendecke [Mon, 30 Jun 2014 09:39:20 +0000 (09:39 +0000)]
smbd: Clarify smb2 lock checks

When reading the code it was not immediately clear to me how one of the
conditions in [MS-SMB2] 3.3.5.14.2 was satisfied. A separate loop to me
is clearer and given that we don't expect thousands of locks in a single
call also not significantly less efficient.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: Add a check to verify MS-SMB2 3.3.5.14.2
Volker Lendecke [Mon, 30 Jun 2014 09:37:47 +0000 (09:37 +0000)]
torture: Add a check to verify MS-SMB2 3.3.5.14.2

If we have more than one lock and there is any blocking lock, we need
to fail with NT_STATUS_INVALID_PARAMETER. At a quick glance I did not
find this tested, so add it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agolibcli: Remove an unused variable
Volker Lendecke [Mon, 30 Jun 2014 18:53:29 +0000 (18:53 +0000)]
libcli: Remove an unused variable

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): Tue Jul  1 00:43:18 CEST 2014 on sn-devel-104

9 years agosmbd: validate_lock_entries does not need mem_ctx anymore
Volker Lendecke [Sun, 29 Jun 2014 09:38:35 +0000 (11:38 +0200)]
smbd: validate_lock_entries does not need mem_ctx anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Simplify validate_lock_entries
Volker Lendecke [Sun, 29 Jun 2014 09:36:24 +0000 (11:36 +0200)]
smbd: Simplify validate_lock_entries

Signed-off-by: Volker Lendecke <vl@samba.org>
9 years agosmbd: Factor out brl_delete_lock_struct
Volker Lendecke [Sun, 29 Jun 2014 09:31:18 +0000 (11:31 +0200)]
smbd: Factor out brl_delete_lock_struct

memmove calculations are never nice, and this is going to be used in
validate_lock_entries soon :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Simplify validate_lock_entries
Volker Lendecke [Sun, 29 Jun 2014 09:22:13 +0000 (11:22 +0200)]
smbd: Simplify validate_lock_entries

... saves >100 bytes object code :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture3: Add some brlock entries in cleanup2
Volker Lendecke [Sun, 29 Jun 2014 09:07:08 +0000 (11:07 +0200)]
torture3: Add some brlock entries in cleanup2

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-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>
9 years agolibcli: Make cli_smb2_close_fnum async
Volker Lendecke [Fri, 27 Jun 2014 09:47:36 +0000 (09:47 +0000)]
libcli: Make cli_smb2_close_fnum async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agolib: Align nt_time_to_unix_timespec with unix_timespec_to_nt_time
Volker Lendecke [Wed, 18 Jun 2014 12:21:06 +0000 (12:21 +0000)]
lib: Align nt_time_to_unix_timespec with unix_timespec_to_nt_time

Both take and return values now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agolib: Align unix_timespec_to_nt_time with nt_time_to_unix_timespec
Volker Lendecke [Wed, 18 Jun 2014 12:21:06 +0000 (12:21 +0000)]
lib: Align unix_timespec_to_nt_time with nt_time_to_unix_timespec

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agolibcli: Make smb2cli_create return blobs
Volker Lendecke [Fri, 27 Jun 2014 09:32:34 +0000 (09:32 +0000)]
libcli: Make smb2cli_create return blobs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agovfs_snapper: use a talloc hierarchy for arrays
David Disseldorp [Mon, 30 Jun 2014 12:40:14 +0000 (14:40 +0200)]
vfs_snapper: use a talloc hierarchy for arrays

Currently the config and snapshot array entries are freed individually.
A talloc hierarchy can be used to avoid this behaviour.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 30 21:41:13 CEST 2014 on sn-devel-104

9 years agovfs_snapper: don't redefine GMT_FORMAT macro
David Disseldorp [Mon, 30 Jun 2014 12:40:13 +0000 (14:40 +0200)]
vfs_snapper: don't redefine GMT_FORMAT macro

Use existing header definition.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agodoc: add vfs_snapper manpage
David Disseldorp [Fri, 27 Jun 2014 13:31:37 +0000 (15:31 +0200)]
doc: add vfs_snapper manpage

Document usage of the snapper VFS module, detailing permissions required
to list and access snapshots.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agovfs: add previous file version support for vfs_snapper
David Disseldorp [Fri, 27 Jun 2014 13:31:36 +0000 (15:31 +0200)]
vfs: add previous file version support for vfs_snapper

Windows attempts to access previous file versions by first issuing an
FSCTL_SRV_ENUMERATE_SNAPSHOTS request, and then using the corresponding
snapshot timestamps in subsequent path based requests.

This change sees vfs_snapper provide snapshot enumeration data via the
get_shadow_copy_data VFS hook. Path based operations are also
intercepted, with @GMT-$time components converted to snapper .snapshot/#
paths.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agovfs: add vfs_snapper module
David Disseldorp [Fri, 27 Jun 2014 13:31:35 +0000 (15:31 +0200)]
vfs: add vfs_snapper module

Provides an interface for accessing snapshots exposed by Snapper. The
module communicates with snapperd on the local machine using the D-Bus
interface.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agosmbd: Make messaging_send_to_children static
Christof Schmitt [Thu, 26 Jun 2014 21:51:23 +0000 (14:51 -0700)]
smbd: Make messaging_send_to_children static

This function is only used in server.c

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 Jun 30 17:20:00 CEST 2014 on sn-devel-104

9 years agosmbd: Use common function for FORCE_DIS and KILL_CLIENT_IP in parent
Christof Schmitt [Thu, 26 Jun 2014 21:50:38 +0000 (14:50 -0700)]
smbd: Use common function for FORCE_DIS and KILL_CLIENT_IP in parent

The parent smbd process only forwards the message to the child
processes. Use a common function instead of two separate ones that do
the same thing.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
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

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>
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>
9 years agoctdb-packaging: Update configure.rpm with minimum library versions
Amitay Isaacs [Mon, 30 Jun 2014 05:22:49 +0000 (15:22 +1000)]
ctdb-packaging: Update configure.rpm with minimum library versions

This makes configure command consistent with spec file.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Jun 30 11:23:18 CEST 2014 on sn-devel-104

9 years agoctdb-packaging: Minimum required tevent library is 0.9.16
Amitay Isaacs [Thu, 26 Jun 2014 04:16:13 +0000 (14:16 +1000)]
ctdb-packaging: Minimum required tevent library is 0.9.16

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agos3-shadow-copy2: Protect against already converted names
Volker Lendecke [Thu, 18 Oct 2012 13:24:39 +0000 (15:24 +0200)]
s3-shadow-copy2: Protect against already converted names

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 27 09:03:53 CEST 2014 on sn-devel-104

9 years agos3-shadow-copy2: Add more debugs
Volker Lendecke [Wed, 17 Oct 2012 10:11:37 +0000 (12:11 +0200)]
s3-shadow-copy2: Add more debugs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
9 years agos3-shadow-copy2: Fix incorrect case submounts
Volker Lendecke [Wed, 17 Oct 2012 10:08:26 +0000 (12:08 +0200)]
s3-shadow-copy2: Fix incorrect case submounts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
9 years agos3-shadow-copy2: Remove TODO and fix comments
Christof Schmitt [Thu, 26 Jun 2014 19:43:03 +0000 (12:43 -0700)]
s3-shadow-copy2: Remove TODO and fix comments

The patch "s3-shadow-copy2: Fix dir/@GMT-2012.10.15-13.48.43 form of
paths" takes care of a case marked as TODO, remove it and adjust the
comments accordingly.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agos3-shadow-copy2: Fix dir/@GMT-2012.10.15-13.48.43 form of paths
Volker Lendecke [Mon, 15 Oct 2012 16:16:44 +0000 (18:16 +0200)]
s3-shadow-copy2: Fix dir/@GMT-2012.10.15-13.48.43 form of paths

The previous clause in shadow_copy2_strip_snapshot would only handle @GMT-
at the end of a pathname if it was the *only* pathname component. XP
seems to send @GMT- at the end under certain circumstances even with a
path prefix.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
9 years agos3-shadow-copy2: Add extreme debug output to shadow_copy2_strip_snapshot
Volker Lendecke [Mon, 15 Oct 2012 16:13:33 +0000 (18:13 +0200)]
s3-shadow-copy2: Add extreme debug output to shadow_copy2_strip_snapshot

This is sooo hairy to debug when things go wrong :-(

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
9 years agodbwrap: Print wait times with full precision
Volker Lendecke [Thu, 6 Mar 2014 06:27:36 +0000 (07:27 +0100)]
dbwrap: Print wait times with full precision

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
9 years agosmb2: Fix smb2_lease_state
Volker Lendecke [Thu, 26 Jun 2014 10:35:20 +0000 (10:35 +0000)]
smb2: Fix smb2_lease_state

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Jun 26 17:30:00 CEST 2014 on sn-devel-104

9 years agotdb: defragment the freelist in tdb_allocate_from_freelist()
Michael Adam [Wed, 11 Jun 2014 10:05:57 +0000 (12:05 +0200)]
tdb: defragment the freelist in tdb_allocate_from_freelist()

While we are traversing the freelist anyways, merge a record
with the left if it is also a free list record.

That partially makes up for the fragmentation introduced by
the lack of merging with right records in tdb_free().

Note there is a potential slight downside:
If the left record we merge the current record into was earlier
in the chain and has hence already been met in traverse,
then we can not use the enlarged record even if it might be
a new best fit.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun 26 12:16:03 CEST 2014 on sn-devel-104

9 years agotdb: add "freelist_size" sub-command to tdbtool
Michael Adam [Mon, 10 Feb 2014 06:39:31 +0000 (07:39 +0100)]
tdb: add "freelist_size" sub-command to tdbtool

With the new code, this has the side effect of
merging adjacent records in the freelist if the
database is not read-only.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: use tdb_freelist_merge_adjacent in tdb_freelist_size()
Michael Adam [Wed, 11 Jun 2014 15:26:51 +0000 (17:26 +0200)]
tdb: use tdb_freelist_merge_adjacent in tdb_freelist_size()

So that we automatically defragment the free list when freelist_size is called
(unless the database is read only).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: add tdb_freelist_merge_adjacent()
Michael Adam [Mon, 10 Feb 2014 01:39:09 +0000 (02:39 +0100)]
tdb: add tdb_freelist_merge_adjacent()

This is intended to be called to reduce the fragmentation in the
freelist. This is to make up the deficiency of the freelist
to be not doubly linked. If the freelist were doubly linked,
we could easily avoid the creation of adjacent freelist entries.
But with the current singly linked list, it is only possible
to cheaply merge a new free record into a freelist entry on the left,
not on the right...

This can be called periodically, e.g. in the vacuuming process
of a ctdb cluster.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: add utility function check_merge_ptr_with_left_record()
Michael Adam [Wed, 11 Jun 2014 10:04:01 +0000 (12:04 +0200)]
tdb: add utility function check_merge_ptr_with_left_record()

Variant of check_merge_with_left_record() that reads the record
itself if necessary.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: simplify tdb_free() using check_merge_with_left_record()
Michael Adam [Wed, 11 Jun 2014 10:03:01 +0000 (12:03 +0200)]
tdb: simplify tdb_free() using check_merge_with_left_record()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: add utility function check_merge_with_left_record()
Michael Adam [Wed, 11 Jun 2014 10:00:48 +0000 (12:00 +0200)]
tdb: add utility function check_merge_with_left_record()

Check whether the record left of a given freelist record is
also a freelist record, and if so, merge the two records.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: improve comments for tdb_free().
Michael Adam [Fri, 18 Apr 2014 23:49:44 +0000 (01:49 +0200)]
tdb: improve comments for tdb_free().

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: factor merge_with_left_record() out of tdb_free()
Michael Adam [Mon, 10 Feb 2014 01:01:38 +0000 (02:01 +0100)]
tdb: factor merge_with_left_record() out of tdb_free()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: fix debug message in tdb_free()
Michael Adam [Mon, 10 Feb 2014 00:51:39 +0000 (01:51 +0100)]
tdb: fix debug message in tdb_free()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: reduce indentation in tdb_free() for merging left
Michael Adam [Mon, 10 Feb 2014 00:46:42 +0000 (01:46 +0100)]
tdb: reduce indentation in tdb_free() for merging left

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: increase readability of read_record_on_left()
Michael Adam [Mon, 10 Feb 2014 00:39:15 +0000 (01:39 +0100)]
tdb: increase readability of read_record_on_left()

by using early returns and better variable names,
and reducing indentation.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotdb: factor read_record_on_left() out of tdb_free()
Michael Adam [Mon, 10 Feb 2014 00:31:50 +0000 (01:31 +0100)]
tdb: factor read_record_on_left() out of tdb_free()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
9 years agotorture4: Add a little test that truncate actually works :-)
Volker Lendecke [Wed, 25 Jun 2014 08:49:45 +0000 (08:49 +0000)]
torture4: Add a little test that truncate actually works :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Jun 25 13:37:24 CEST 2014 on sn-devel-104

9 years agosmbd: Remove 2 indentation levels
Volker Lendecke [Wed, 25 Jun 2014 08:36:47 +0000 (08:36 +0000)]
smbd: Remove 2 indentation levels

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
9 years agos4: torture: Add regression test case for #10671 - Samba file corruption as a result...
Jeremy Allison [Tue, 24 Jun 2014 21:22:24 +0000 (14:22 -0700)]
s4: torture: Add regression test case for #10671 - Samba file corruption as a result of failed lock check.

Adds a new test to raw.open.

Opens a file with SHARE_NONE, writes 1 byte at offset 1023,
attempts a second open with r/w access+truncate disposition,
then checks that open fails with SHARING_VIOLATION, and
the file is not truncated (is still size 1024). Correctly
detects the bug and fixed smbd for me.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
9 years agos3: smbd - Prevent file truncation on an open that fails with share mode violation.
Jeremy Allison [Tue, 24 Jun 2014 21:19:30 +0000 (14:19 -0700)]
s3: smbd - Prevent file truncation on an open that fails with share mode violation.

Fix from Volker, really - just tidied up a little.
The S_ISFIFO check may not be strictly neccessary,
but doesn't hurt (might make the code a bit more complex
than it needs to be).

Fixes bug #10671 - Samba file corruption as a result of failed lock check.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@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.

CVE-2014-3493

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>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 25 03:47:55 CEST 2014 on sn-devel-104

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

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoctdb-build: Instead of default test_wrap, install fixed test_wrap
Amitay Isaacs [Mon, 23 Jun 2014 06:31:25 +0000 (16:31 +1000)]
ctdb-build: Instead of default test_wrap, install fixed test_wrap

tests/scripts/test_wrap script is updated based on the configured paths.
This should be installed instead of the stock version in the source.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Jun 24 09:37:39 CEST 2014 on sn-devel-104

9 years agoctdb-build: Fix sed expression to protect '\'
Amitay Isaacs [Mon, 23 Jun 2014 05:58:06 +0000 (15:58 +1000)]
ctdb-build: Fix sed expression to protect '\'

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agoctdb-build: Use correct path variables for ctdb_run_tests.sh
Amitay Isaacs [Mon, 23 Jun 2014 05:48:37 +0000 (15:48 +1000)]
ctdb-build: Use correct path variables for ctdb_run_tests.sh

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agoctdb-build: Use CTDB_ETCDIR instead of ETCDIR/ctdb
Amitay Isaacs [Mon, 23 Jun 2014 08:03:17 +0000 (18:03 +1000)]
ctdb-build: Use CTDB_ETCDIR instead of ETCDIR/ctdb

This avoids hardcoding path components in source.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agoctdb-build: Use CTDB_RUNDIR instead of VARDIR/run/ctdb
Amitay Isaacs [Mon, 23 Jun 2014 05:20:44 +0000 (15:20 +1000)]
ctdb-build: Use CTDB_RUNDIR instead of VARDIR/run/ctdb

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agoctdb-build: Add special target to get build version
Amitay Isaacs [Mon, 23 Jun 2014 02:55:19 +0000 (12:55 +1000)]
ctdb-build: Add special target to get build version

This avoids the need to build a tarball to get version information.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agoctdb-build: Allow waf to build rpms without configure first
Amitay Isaacs [Mon, 23 Jun 2014 02:24:38 +0000 (12:24 +1000)]
ctdb-build: Allow waf to build rpms without configure first

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
9 years agotorture: Remove confusing reference to (1 sec == 0.25)
Andrew Bartlett [Fri, 20 Jun 2014 10:28:53 +0000 (22:28 +1200)]
torture: Remove confusing reference to (1 sec == 0.25)

The write should never update the time, so the fraction of the write
time delay we use is not important.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 24 01:44:06 CEST 2014 on sn-devel-104

9 years agotorture: tidy up whitespace for clarity
Andrew Bartlett [Fri, 20 Jun 2014 10:28:52 +0000 (22:28 +1200)]
torture: tidy up whitespace for clarity

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoselftest: Run base.delaywrite against plugin_s4_dc only, and with kerberos for faster...
Andrew Bartlett [Fri, 20 Jun 2014 10:28:51 +0000 (22:28 +1200)]
selftest: Run base.delaywrite against plugin_s4_dc only, and with kerberos for faster connections

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture-base.delaywrite: assert the for a delayed write, that it just takes longer...
Andrew Bartlett [Fri, 20 Jun 2014 10:28:50 +0000 (22:28 +1200)]
torture-base.delaywrite: assert the for a delayed write, that it just takes longer than our configured delay

This removes the hardcoded TIMEDELAY_SECS that was then made variable
by the confusing "secs" variable

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: Only error if the write time was updated is less than the expected delay
Andrew Bartlett [Fri, 20 Jun 2014 10:28:49 +0000 (22:28 +1200)]
torture: Only error if the write time was updated is less than the expected delay

The previous test was far, far too tight, it was in seconds 1/4 of the
fraction of the normal delay we had configured Samba to use so (1/4) *
(500 000 / 2000 000) = 1/16 (sec).  This margin appears to just be too
tight for our loaded test server.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: Store writetimeupdatedelay in a double to allow easier comparison
Andrew Bartlett [Fri, 20 Jun 2014 10:28:48 +0000 (22:28 +1200)]
torture: Store writetimeupdatedelay in a double to allow easier comparison

In particular, this avoids a comparison with
double diff = timeval_elapsed() being promoted to an integer.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: convert raw.mux to use torture_comment() macros instead of printf()
Andrew Bartlett [Fri, 20 Jun 2014 10:28:47 +0000 (22:28 +1200)]
torture: convert raw.mux to use torture_comment() macros instead of printf()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: convert raw.mux to use torture_assert() macros
Andrew Bartlett [Fri, 20 Jun 2014 10:28:46 +0000 (22:28 +1200)]
torture: convert raw.mux to use torture_assert() macros

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: convert CHECK_STATUS into torture_assert_ntstatus_equal in raw.mux tests
Andrew Bartlett [Fri, 20 Jun 2014 10:28:45 +0000 (22:28 +1200)]
torture: convert CHECK_STATUS into torture_assert_ntstatus_equal in raw.mux tests

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agoselftest: Only run samba4.rpc.samr.passwords.{lockout,badpwdcount} once
Andrew Bartlett [Fri, 20 Jun 2014 10:28:44 +0000 (22:28 +1200)]
selftest: Only run samba4.rpc.samr.passwords.{lockout,badpwdcount} once

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agotorture: Use torture_assert() macros in rpc.samr test
Andrew Bartlett [Fri, 20 Jun 2014 10:28:43 +0000 (22:28 +1200)]
torture: Use torture_assert() macros in rpc.samr test

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3: Fix fsctl_validate_neg_info to pass MS compliance suite.
Ira Cooper [Sat, 21 Jun 2014 04:41:19 +0000 (21:41 -0700)]
s3: Fix fsctl_validate_neg_info to pass MS compliance suite.

It turns out that all the client and server need to agree on is what
protocol should have been negotiated.  If they disagree, they should
disconnect.  The contents of the list of protocols used during
negotiate and during FSCTL_VALIDATE_NEGOTIATE_INFO do not need to match.

Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 23 14:28:25 CEST 2014 on sn-devel-104

9 years agos3: Refactor smbd_smb2_request_process_negprot
Ira Cooper [Sat, 21 Jun 2014 04:29:26 +0000 (21:29 -0700)]
s3: Refactor smbd_smb2_request_process_negprot

Breakout smb2_protocol_dialect_match to support future work in
fsctl_validate_neg_info.

Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>