s3:utils: Use talloc instead of malloc functions
[samba.git] / source3 / modules / nfs4_acls.h
index bd1b9985eaee4a8440916cc21edfeddda419eee9..011b9da555454eb16659c262a56881f0e03301d9 100644 (file)
 #ifndef __NFS4_ACLS_H__
 #define __NFS4_ACLS_H__
 
-#define SMB_ACLTYPE_NONE 0
-#define SMB_ACLTYPE_UNKNOWN 1
-#define SMB_ACLTYPE_POSIX 2
-#define SMB_ACLTYPE_NFS4 4
-
 /* 
  * Following union captures the identity as 
  * used in the NFS4 ACL structures. 
@@ -65,7 +60,7 @@ typedef struct _SMB_ACE4PROP_T {
 #define        SMB_ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
 #define        SMB_ACE4_SYSTEM_AUDIT_ACE_TYPE  0x00000002
 #define        SMB_ACE4_SYSTEM_ALARM_ACE_TYPE  0x00000003
-#define SMB_ACE4_MAX_TYPE      ACE4_SYSTEM_ALARM_ACE_TYPE  /* largest valid ACE4_TYPE */
+#define SMB_ACE4_MAX_TYPE      SMB_ACE4_SYSTEM_ALARM_ACE_TYPE  /* largest valid ACE4_TYPE */
 
        uint32_t aceFlags;      /* Controls Inheritance and such */
 /*The bitmask constants used for the flag field are as follows: */
@@ -107,26 +102,51 @@ typedef struct _SMB_ACE4PROP_T {
 | SMB_ACE4_WRITE_ACL | SMB_ACE4_WRITE_OWNER | SMB_ACE4_SYNCHRONIZE )
 } SMB_ACE4PROP_T;
 
-/*
- * Never allocate these structures on your own
- * use create_smb4acl instead
- */
 struct SMB4ACL_T;
-typedef struct _SMB4ACE_T {char dontuse;} SMB4ACE_T;
+struct SMB4ACE_T;
+
+enum smbacl4_mode_enum {e_simple=0, e_special=1};
+enum smbacl4_acedup_enum {e_dontcare=0, e_reject=1, e_ignore=2, e_merge=3};
+
+struct smbacl4_vfs_params {
+       enum smbacl4_mode_enum mode;
+       bool do_chown;
+       enum smbacl4_acedup_enum acedup;
+       bool map_full_control;
+};
+
+int smbacl4_get_vfs_params(struct connection_struct *conn,
+                          struct smbacl4_vfs_params *params);
+
+int nfs4_acl_stat(struct vfs_handle_struct *handle,
+                 struct smb_filename *smb_fname);
+
+int nfs4_acl_fstat(struct vfs_handle_struct *handle,
+                  struct files_struct *fsp,
+                  SMB_STRUCT_STAT *sbuf);
+
+int nfs4_acl_lstat(struct vfs_handle_struct *handle,
+                  struct smb_filename *smb_fname);
+
+int nfs4_acl_fstatat(struct vfs_handle_struct *handle,
+                    const struct files_struct *dirfsp,
+                    const struct smb_filename *smb_fname,
+                    SMB_STRUCT_STAT *sbuf,
+                    int flags);
 
 struct SMB4ACL_T *smb_create_smb4acl(TALLOC_CTX *mem_ctx);
 
 /* prop's contents are copied */
 /* it doesn't change the order, appends */
-SMB4ACE_T *smb_add_ace4(struct SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop);
+struct SMB4ACE_T *smb_add_ace4(struct SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop);
 
-SMB_ACE4PROP_T *smb_get_ace4(SMB4ACE_T *ace);
+SMB_ACE4PROP_T *smb_get_ace4(struct SMB4ACE_T *ace);
 
 /* Returns NULL if none - or error */
-SMB4ACE_T *smb_first_ace4(struct SMB4ACL_T *theacl);
+struct SMB4ACE_T *smb_first_ace4(struct SMB4ACL_T *theacl);
 
 /* Returns NULL in the end - or error */
-SMB4ACE_T *smb_next_ace4(SMB4ACE_T *ace);
+struct SMB4ACE_T *smb_next_ace4(struct SMB4ACE_T *ace);
 
 uint32_t smb_get_naces(struct SMB4ACL_T *theacl);
 
@@ -134,13 +154,17 @@ uint16_t smbacl4_get_controlflags(struct SMB4ACL_T *theacl);
 
 bool smbacl4_set_controlflags(struct SMB4ACL_T *theacl, uint16_t controlflags);
 
+bool nfs_ace_is_inherit(SMB_ACE4PROP_T *ace);
+
 NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
+       const struct smbacl4_vfs_params *pparams,
        uint32_t security_info,
        TALLOC_CTX *mem_ctx,
        struct security_descriptor **ppdesc, struct SMB4ACL_T *theacl);
 
 NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn,
-       const char *name,
+       const struct smb_filename *smb_fname,
+       const struct smbacl4_vfs_params *pparams,
        uint32_t security_info,
        TALLOC_CTX *mem_ctx,
        struct security_descriptor **ppdesc, struct SMB4ACL_T *theacl);
@@ -152,6 +176,7 @@ typedef bool (*set_nfs4acl_native_fn_t)(vfs_handle_struct *handle,
                                        struct SMB4ACL_T *);
 
 NTSTATUS smb_set_nt_acl_nfs4(vfs_handle_struct *handle, files_struct *fsp,
+       const struct smbacl4_vfs_params *pparams,
        uint32_t security_info_sent,
        const struct security_descriptor *psd,
        set_nfs4acl_native_fn_t set_nfs4_native);