idl: define sparse file fsctl structures

As documented in MS-FSCC 2.3.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
torture: test FSCTL_SET_SPARSE

Check that the FILE_ATTRIBUTE_SPARSE is set following FSCTL_SET_SPARSE.
Also confirm that adding the attribute on create doesn't carry through
to subsequent SMB2_GETINFO_FILE requests.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
torture: test FSCTL_SET_SPARSE against a directory

Expect STATUS_INVALID_PARAMETER, as is returned by Windows Server 2012
and 2008. Samba is currently broken, in that it currently processes the
request and sets the sparse DOS attribute on the directory - fix to
follow.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
torture: test FSCTL_SET_SPARSE without SetSparse buffer

This test checks for the following MS-FSCC 2.3.63 behaviour:

If there is no data element, the sparse flag for the file is set,
exactly as if the FILE_SET_SPARSE_BUFFER element was supplied and had a
SetSparse value of TRUE.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
torture: trivial test_ioctl_network_interface_info cleanup

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
ntvfs/posix: don't advertise FS_ATTR_SPARSE_FILES

Handling of the FSCTL_SET_SPARSE ioctl in ntvfs is broken. Removing
FS_ATTR_SPARSE_FILES from the filesystem attributes ensures that
clients, including the smbtorture ioctl tests, don't attempt to use this
functionality.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri Aug 29 22:06:21 CEST 2014 on sn-devel-104
torture3: Allow padding byte for LARGE_READX responses

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest: Add readx test for dc to known fail

The new 16bit alignment check will fail.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
smbd: Add padding byte to readx response

MS-CIFS 2.2.4.42.2 states: "Pad (1 byte): This field is optional. When
using the NT LAN Manager dialect, this field can be used to align the
Data field to a 16-bit boundary relative to the start of the SMB Header.
If Unicode strings are being used, this field MUST be present. When
used, this field MUST be one padding byte long."

Always add the padding byte to all readx responses to avoid additional
complexity.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:libcli/raw: Make flags2 and offset available to callers of readx

This will be used by smbtorture.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
torture: Add test for 16 bit alignment of readx data

MS-CIFS requires a one byte pad to guarantee 16 bit alignment of the
data:

Pad (1 byte): This field is optional. When using the NT LAN Manager
dialect, this field can be used to align the Data field to a 16-bit
boundary relative to the start of the SMB Header. If Unicode strings are
being used, this field MUST be present. When used, this field MUST be
one padding byte long.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
torture: Use torture_fail macro in check_buffer for read requests

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
torture: Use torture_assert macro for status check in raw.read

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
torture: Use torture_assert macro for value check in raw.read

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
torture: Also run raw.read against the aio share

This tests the changes in the aio code path.

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 30 02:51:46 CEST 2014 on sn-devel-104
s3-winbindd: Use correct realm for trusted domains in idmap child

When authenticating users in a trusted domain, the idmap_ad module
always connects to a local DC instead of one in the trusted domain.

Fix this by passing the correct realm to connect to.

Also Comment parameters passed to ads_cached_connection_connect

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3-winbindd: Use more descriptive parameter names in ads_cached_connection_connect

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3-winbindd: Document parameters in ads_cached_connection_reuse

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 30 06:10:36 CEST 2014 on sn-devel-104