nss_wrapper: Align indentation with the rest of Samba

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
nss_wrapper: Fix some "discarding const" warnings

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
torture: validate FSCTL_SRV_ENUMERATE_SNAPSHOTS response

Check the NumberOfSnapShotsReturned and SnapShotArraySize fields in the
FSCTL_SRV_ENUMERATE_SNAPSHOTS response match expected values.

This is a regression test for bso#10549.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
torture: add timeout sleeps to fsrvp create helper

Attempt to trip message sequence timeouts at various points in the FSRVP
shadow-copy creation state machine.

The default timeout-injection sleep durations correspond to those
documented in MS-FSRVP (+500ms). They can also be manually set using the
"fss: sequence timeout" parameter.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
torture: add FSRVP message sequence timeout test

Sleep at various points in the FSRVP snapshot creation state machine,
and confirm that the state timeout is reflected in subsequent server
responses.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
torture: add FSRVP share snapshot ACL test

The new test_fsrvp_share_sd test sets a unique ACL on the base share,
and then confirms that snapshot shares carry the same ACL.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Sat Jun 21 15:10:12 CEST 2014 on sn-devel-104
libsmb: Make cli_smb2_create_fnum async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Add cli_create_send/recv

Async wrapper around smb1 and smb2 create

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Replace async cli_ntcreate by cli_create

Done by rename cli_ntcreate_send/recv to cli_ntcreate1_send/recv and
cli_create_send/recv to cli_ntcreate_send/recv

Possibly cli_create might be the better name, but I am sooo used to
cli_ntcreate() that I don't really want to rename this ;-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: remove smb2 switch from cli_ntcreate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Align cli_ntcreate with other sync wrappers

... saves 5 lines :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Enable oplocks for smb2 cli_ntcreate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Make smb2cli_create cancellable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Make cli_smb2_create_fnum cancellable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Make cli_ntcreate1 cancellable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libsmb: Make cli_ntcreate cancellable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
smbd: Store "struct deferred_open_record" instead of anonymous data on pml

The main point is to get a talloc parent that will go away when the
request is cancelled

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
smbd: First watch, then defer

We exit if any of these if-statement fails, so a simple swap should not
make a difference.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
smbd: Fix bug 10593

Bug 10593 is a panic that happens if we get an oplock break reply via
dbwrap_watch for which we can't find the SMB request anymore. This
error condition can legally happen when a client cancels the create
request before the oplock break response comes in. This patch drops the
dbwrap_watch_send request waiting for the oplock break when the request
is cancelled. Yet another talloc hierarchy problem, but if done right,
talloc hierarchies can make rundown of state easy :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
torture3: Reproducer for bug 10593

We panic if we get an oplock break response for a cancelled create request

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 21 23:05:47 CEST 2014 on sn-devel-104