auth: Generate a human readable Authentication log message.
[amitay/samba.git] / source3 / modules / nfs4_acls.h
index fcab63591547af17d5380d0c58730f440efedc0b..a73b3154f0f39e19b3d5286c6b76f68d73fcccaa 100644 (file)
@@ -31,9 +31,9 @@
  * used in the NFS4 ACL structures. 
  */
 typedef union _SMB_NFS4_ACEWHOID_T {
-       uid_t   uid;    /* User id */
-       gid_t   gid;    /* Group id */
-       uint32  special_id;     /* Identifies special identities in NFS4 */
+       uid_t           uid;    /* User id */
+       gid_t           gid;    /* Group id */
+       uint32_t        special_id; /* Identifies special identities in NFS4 */
 
 #define SMB_ACE4_WHO_OWNER         0x00000001 /*The owner of the file. */
 #define SMB_ACE4_WHO_GROUP         0x00000002 /*The group associated with the file. */
@@ -46,11 +46,11 @@ typedef union _SMB_NFS4_ACEWHOID_T {
 #define SMB_ACE4_WHO_AUTHENTICATED 0x00000009 /*Any authenticated user (opposite of ANONYMOUS) */
 #define SMB_ACE4_WHO_SERVICE       0x0000000A /*Access from a system service. */
 #define SMB_ACE4_WHO_MAX               SMB_ACE4_WHO_SERVICE  /* largest valid ACE4_WHO */
-       uint32 id;
+       uint32_t id;
 } SMB_NFS4_ACEWHOID_T;
 
 typedef struct _SMB_ACE4PROP_T { 
-       uint32  flags;  /* Bit mask defining details of ACE */
+       uint32_t flags;         /* Bit mask defining details of ACE */
 /*The following are constants for flags field */
 /* #define     SMB_ACE4_ID_NOT_VALID   0x00000001 - from aix/jfs2 */
 #define        SMB_ACE4_ID_SPECIAL             0x00000002
@@ -59,15 +59,15 @@ typedef struct _SMB_ACE4PROP_T {
 
        /* The following part of ACE has the same layout as NFSv4 wire format. */
 
-       uint32  aceType;        /* Type of ACE PERMIT/ALLOW etc*/
+       uint32_t aceType;       /* Type of ACE PERMIT/ALLOW etc*/
 /*The constants used for the type field (acetype4) are as follows: */
 #define        SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE        0x00000000
 #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  aceFlags;       /* Controls Inheritance and such */
+       uint32_t aceFlags;      /* Controls Inheritance and such */
 /*The bitmask constants used for the flag field are as follows: */
 #define SMB_ACE4_FILE_INHERIT_ACE             0x00000001
 #define SMB_ACE4_DIRECTORY_INHERIT_ACE        0x00000002
@@ -81,7 +81,7 @@ typedef struct _SMB_ACE4PROP_T {
 | SMB_ACE4_NO_PROPAGATE_INHERIT_ACE | SMB_ACE4_INHERIT_ONLY_ACE | SMB_ACE4_SUCCESSFUL_ACCESS_ACE_FLAG \
 | SMB_ACE4_FAILED_ACCESS_ACE_FLAG | SMB_ACE4_IDENTIFIER_GROUP | SMB_ACE4_INHERITED_ACE)
 
-       uint32  aceMask;        /* Access rights */
+       uint32_t aceMask;       /* Access rights */
 /*The bitmask constants used for the access mask field are as follows: */
 #define SMB_ACE4_READ_DATA            0x00000001
 #define SMB_ACE4_LIST_DIRECTORY       0x00000001
@@ -107,44 +107,64 @@ 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
- */
-typedef struct _SMB4ACL_T {char dontuse;} SMB4ACL_T;
-typedef struct _SMB4ACE_T {char dontuse;} SMB4ACE_T;
+struct SMB4ACL_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;
+};
 
-SMB4ACL_T *smb_create_smb4acl(void);
+int smbacl4_get_vfs_params(struct connection_struct *conn,
+                          struct smbacl4_vfs_params *params);
+
+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(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(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);
+
+uint16_t smbacl4_get_controlflags(struct SMB4ACL_T *theacl);
 
-uint32 smb_get_naces(SMB4ACL_T *theacl);
+bool smbacl4_set_controlflags(struct SMB4ACL_T *theacl, uint16_t controlflags);
 
 NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
-       uint32 security_info,
-       struct security_descriptor **ppdesc, SMB4ACL_T *theacl);
+       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,
-       uint32 security_info,
-       struct security_descriptor **ppdesc, SMB4ACL_T *theacl);
+       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);
 
 /* Callback function needed to set the native acl
  * when applicable */
-typedef bool (*set_nfs4acl_native_fn_t)(files_struct *, SMB4ACL_T *);
+typedef bool (*set_nfs4acl_native_fn_t)(vfs_handle_struct *handle,
+                                       files_struct *,
+                                       struct SMB4ACL_T *);
 
-NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
-       uint32 security_info_sent,
+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);