build: Move nfs4acl to the top level

This is to create IDL-stored NFSv4 ACLs, just as we use for posix ACLs
to permit better testing.

Andrew Bartlett

Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: Add vfs_handle_struct argument to smb_set_nt_acl_nfs4 and the callback

This allows the callback to call xattr based storage functions that need this argument.

Andrew Bartlett

Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: Allocate SMB4ACL_T on an explict memory context

This ensures the caller knows exactly what the memory lifetime of this
returned object is.  This makes the NFSv4 ACL code consistent with the
POSIX and NT ACL code, to avoid supprising developers who have worked
on those other parts of the ACL code.

Most of this patch is adding a memory context to the callers and passing it in.

Andrew Bartlett
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: Fix compile of vfs_gpfs.c.

Since the smb4acl is now correctly allocated on mem_ctx and not
the talloc stack frame we can free the stack frame correctly.
And the chmod emulation code now needs the vfs handle since
that is now required by the callback function to set the smb4acl.

Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: Remove unused security_info argument in vfz_zfsacl.c

Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: Add new VFS module vfs_nfs4acl_xattr to use nfs4acl.idl

This uses the xattr format used by the patches at http://users.suse.com/~agruen/nfs4acl/

Andrew Bartlett
Reviewed-by: Jeremy Allison <jra@samba.org>
build: Add vfs_nfs4acl to the autoconf build

Reviewed-by: Jeremy Allison <jra@samba.org>
librpc: Add special owner/group/other constants to nfs4acl.idl

As per nfs4acl-0.9/lib/nfs4acl.c (the package where this structure is originally defined)

Andrew Bartlett
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest: Run raw.acls test against the nfs4acl_xattr module

This is the first time we have tested the NFSv4 ACL mapping code.
Sadly most tests fail but these can be fixed from here.

This at least shows that the code does not segfault.

Andrew Bartlett
Reviewed-by: Jeremy Allison <jra@samba.org>
vfs: Add inheritance emulation to vfs_nfs4acl_xattr.

Recursively inherit ACL from parent directory if no acl xattr is
found on the current file.
Use a default ACL if a non-inheriting ACL is encountered.
With this the nfs4acl_xattr.dynamic test passes.
But the nfs4acl_xattr.inheritance test results in an error because
of warnings that cause the test to pass a failed result.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4-smbtorture: Set result message when failing the inheritance test.

Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Move up declaration of params struct and related function.

    We need the parameters earlier in the code so we move up
    the declaration of the params struct. Since reading the
    parameters is closely related the definition of the function
    smbacl4_get_vfs_params has also been moved up.

Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Change smbacl4_get_vfs_params to use connection_struct instead of fsp.

Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Add params parameter to smbacl4_nfs42win function.

Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Mapping of special entries to creator owner in mode simple.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Mapping of cifs creator owner to nfs owner@ ace.

This is ignored in nfs4mode special for compatibility.
Also ensure that we drop non inheriting creator owner
aces since these don't contribute to who can access
a file.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Add changes that keep nfs4:mode special behavior.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Use mode bits in some cases in mode simple.

Non inheriting ACL entries will show mode bits.
With this an file owner change does affect the effective ACL because
the special owner acl will now refer to the new owner.
This could be fixed by updating the ACL on a file owner change.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Update README.nfs4acls.txt

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3: Update vfs_gpfs man page with new nfs4:mode help text.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>