Update vfs version as I've added a const to the security_descriptor paramter in fset_...
[jra/samba/.git] / source3 / modules / nfs4_acls.c
index 0c3d010dcde64553487648b50ef23dc6e46d619f..f1b8cfffced9cc68afaf406fd3bd81be82d1f7be 100644 (file)
@@ -25,6 +25,8 @@
 
 #define SMBACL4_PARAM_TYPE_NAME "nfs4"
 
+extern const struct generic_mapping file_generic_mapping;
+
 #define SMB_ACE4_INT_MAGIC 0x76F8A967
 typedef struct _SMB_ACE4_INT_T
 {
@@ -42,11 +44,6 @@ typedef struct _SMB_ACL4_INT_T
        SMB_ACE4_INT_T  *last;
 } SMB_ACL4_INT_T;
 
-extern struct current_user current_user;
-extern int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid);
-extern NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp,
-       uint32 security_info_sent, SEC_DESC *psd);
-
 static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *acl)
 {
        SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl;
@@ -517,7 +514,7 @@ static bool smbacl4_fill_ace4(
        smbacl4_vfs_params *params,
        uid_t ownerUID,
        gid_t ownerGID,
-       SEC_ACE *ace_nt, /* input */
+       const SEC_ACE *ace_nt, /* input */
        SMB_ACE4PROP_T *ace_v4 /* output */
 )
 {
@@ -529,6 +526,8 @@ static bool smbacl4_fill_ace4(
        ace_v4->aceMask = ace_nt->access_mask &
                (STD_RIGHT_ALL_ACCESS | SA_RIGHT_FILE_ALL_ACCESS);
 
+       se_map_generic(&ace_v4->aceMask, &file_generic_mapping);
+
        if (ace_v4->aceFlags!=ace_nt->flags)
                DEBUG(9, ("ace_v4->aceFlags(0x%x)!=ace_nt->flags(0x%x)\n",
                        ace_v4->aceFlags, ace_nt->flags));
@@ -647,7 +646,7 @@ static int smbacl4_MergeIgnoreReject(
 
 static SMB4ACL_T *smbacl4_win2nfs4(
        const char *filename,
-       SEC_ACL *dacl,
+       const SEC_ACL *dacl,
        smbacl4_vfs_params *pparams,
        uid_t ownerUID,
        gid_t ownerGID
@@ -691,7 +690,7 @@ static SMB4ACL_T *smbacl4_win2nfs4(
 
 NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
        uint32 security_info_sent,
-       SEC_DESC *psd,
+       const SEC_DESC *psd,
        set_nfs4acl_native_fn_t set_nfs4_native)
 {
        smbacl4_vfs_params params;
@@ -732,7 +731,8 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
                        need_chown = True;
                }
                if (need_chown) {
-                       if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) {
+                       if ((newUID == (uid_t)-1
+                            || newUID == fsp->conn->server_info->utok.uid)) {
                                if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
                                        DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
                                                 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,