lib/util: use proper include for struct stat

use <sys/stat.h> instead of forward declaring it
This fixes the build on AIX

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Thu Nov 21 22:12:45 CET 2013 on sn-devel-104
s3-lib: Add grpname to talloc_sub_specified().

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3-winbind: Pass the group name to fillup_pw_field().

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov 22 02:04:54 CET 2013 on sn-devel-104
lib/param: Consolidate code to enable smb signing on the server, always enable on AD DC

This uses the code from the source4/ SMB server (the NTVFS smb server)
in common, to force SMB Signing to be on when we are an AD DC.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri Nov 22 13:13:05 CET 2013 on sn-devel-104
Rename the profile enums with a SAMBA_ prefix to avoid conflict with system files.

WRITE_FLUSH is defined in fs.h in Linux.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
selftest/s3: expose share with FS applicable config

Attempt to determine the underlying test share filesystem using statfs.
If the filesystem is detected and an applicable configuration is
available, then apply it to a new filesystem specific share.
Btrfs is currently the only VFS module to utilize this logic.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/s3: run smb2.ioctl against FS specific share

Run the smb2.ioctl tests against the filesystem specific share.
This adds ~12s to the selftest runtime on my SSD+Btrfs setup.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
torture: test dir non-inherit in compress_inherit_disable

Also add a note reguarding Windows 2008GM copy-chunk note:
Windows 2008GM (non-R2) fails the copy-chunk src=dest overlap test, as
it appears to use a different chunk copy algorithm to 208R2.
Takeaway advice is to avoid using copy-chunk when the source and
destination ranges overlap in the same file.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
torture: attempt to set compression via SetInfo

Doing so should give a successful SetInfo response, however the
attribute should not be set in subsequent GetInfo / ioctl responses.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: add [GET/SET]_COMPRESSION hooks

The VFS interfaces are sychronous, as the operations only modify
meta-data.
These hooks are dependent on support for transparent compression by the
underlying filesystem - vfs_default returns INVALID_DEVICE_REQUEST.
Support for other filesystems providing transparent comression, such as
Btrfs and ZFS, can be added in future.

The get_compression function takes fsp and smb_fname arguments. The
smb_fname argument is needed due to the current dosmode() code-path.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
smb2/ioctl: add support for FSCTL_[GET/SET]_COMPRESSION

In line with MS-FSCC 2.3.47, the FSCTL_SET_COMPRESSION ioctl allows
remote SMB2 clients to enable and disable compression on a
per-file or per-directory basis.
Compression state can be retrieved using the FSCTL_GET_COMPRESSION
request.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs_btrfs: add [GET/SET]_COMPRESSION handlers

Translate such requests into FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls
respectively. The module makes no distinction between compression types,
only whether or not compression is enabled.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs_btrfs: fix copy-chunk dest unlock args

src_fsp used instead of dest_fsp for unlock.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs_btrfs: advertise per-file compression capability

Plumb into the get_fs_capabilities code path to advertise the
FILE_FILE_COMPRESSION attribute.

Also, document file compression support in the VFS btrfs man page.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
smbd: split out dos_mode debug print function

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3-smbd: support FILE_ATTRIBUTE_COMPRESSED

The FILE_ATTRIBUTE_COMPRESSED flag is computed based on whether the
filesystem exposes the FILE_FILE_COMPRESSION capability, and whether
SMB_VFS_GET_COMPRESSION() reports that the file or directory is
currently compressed.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
smbd/open: disable compression with FILE_NO_COMPRESSION

Files and directories created with FILE_NO_COMPRESSION should not
inherit the compression attribute from their parent directory.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
torture: split open from test_setup_create_fill

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
torture: test get/set compression ioctl permissions

Windows Server 2012[r2] exhibits some strange behaviour with regard
to handling the compression fsctls.
[READ/WRITE]_ATTR permissions are not required for the corresponding
get/set compression ioctls. WRITE_DATA is required for set compression.

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): Fri Nov 22 19:57:48 CET 2013 on sn-devel-104
smbd: Factor out get_share_mode_write_time of get_file_infos

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