Split smb_get_nt_acl_nfs4 into two (f- and non-f-variant).
authorMichael Adam <obnox@samba.org>
Wed, 14 Nov 2007 23:46:20 +0000 (00:46 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 19 Dec 2007 22:07:57 +0000 (23:07 +0100)
This is the next step in preparation of a get_nt_acl prototype change.

Michael
(This used to be commit 7afeb1c6cb1bdb58d1e61c54ae215d947d8dc3ea)

source3/modules/nfs4_acls.c
source3/modules/nfs4_acls.h
source3/modules/vfs_aixacl2.c
source3/modules/vfs_gpfs.c
source3/modules/vfs_zfsacl.c

index 94666ba00d0f8141dd606312cd5f196f36697b6f..70bb6a02e8d88e9a812bfd87433f52d18c2b2c62 100644 (file)
@@ -268,29 +268,24 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
        return True;
 }
 
-NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp,
+static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf,
        uint32 security_info,
        SEC_DESC **ppdesc, SMB4ACL_T *acl)
 {
        int     good_aces = 0;
-       SMB_STRUCT_STAT sbuf;
        DOM_SID sid_owner, sid_group;
        size_t sd_size = 0;
        SEC_ACE *nt_ace_list = NULL;
        SEC_ACL *psa = NULL;
        TALLOC_CTX *mem_ctx = talloc_tos();
 
-       DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
-
        if (acl==NULL || smb_get_naces(acl)==0)
                return NT_STATUS_ACCESS_DENIED; /* special because we
                                                 * shouldn't alloc 0 for
                                                 * win */
 
-       if (smbacl4_fGetFileOwner(fsp, &sbuf))
-               return map_nt_error_from_unix(errno);
-       uid_to_sid(&sid_owner, sbuf.st_uid);
-       gid_to_sid(&sid_group, sbuf.st_gid);
+       uid_to_sid(&sid_owner, sbuf->st_uid);
+       gid_to_sid(&sid_group, sbuf->st_gid);
 
        if (smbacl4_nfs42win(mem_ctx, acl, &sid_owner, &sid_group, &nt_ace_list, &good_aces)==False) {
                DEBUG(8,("smbacl4_nfs42win failed\n"));
@@ -313,12 +308,43 @@ NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp,
                return NT_STATUS_NO_MEMORY;
        }
 
-       DEBUG(10, ("smb_get_nt_acl_nfs4 successfully exited with sd_size %d\n",
+       DEBUG(10, ("smb_get_nt_acl_nfs4_common successfully exited with sd_size %d\n",
                   sec_desc_size(*ppdesc)));
 
        return NT_STATUS_OK;
 }
 
+NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
+                              uint32 security_info,
+                              SEC_DESC **ppdesc, SMB4ACL_T *acl)
+{
+       SMB_STRUCT_STAT sbuf;
+
+       DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
+
+       if (smbacl4_fGetFileOwner(fsp, &sbuf)) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl);
+}
+
+NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn,
+                             const char *name,
+                             uint32 security_info,
+                             SEC_DESC **ppdesc, SMB4ACL_T *acl)
+{
+       SMB_STRUCT_STAT sbuf;
+
+       DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", name));
+
+       if (smbacl4_GetFileOwner(conn, name, &sbuf)) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl);
+}
+
 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};
 
index ceb66ec09460a51baf7fb8ae694054e25fb699b6..0f783aa977c7cb43451bdae678ab5c933a57f0e9 100644 (file)
@@ -129,7 +129,12 @@ SMB4ACE_T *smb_next_ace4(SMB4ACE_T *ace);
 
 uint32 smb_get_naces(SMB4ACL_T *acl);
 
-NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp,
+NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
+       uint32 security_info,
+       SEC_DESC **ppdesc, SMB4ACL_T *acl);
+
+NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn,
+       const char *name,
        uint32 security_info,
        SEC_DESC **ppdesc, SMB4ACL_T *acl);
 
index ab7c75691c4c56f14a9088f25d03f70e72803d87..0cb40a22140c375c9af13c05c7af0b0c454a6bf5 100644 (file)
@@ -175,7 +175,7 @@ static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp,
        if (result==False)
                return NT_STATUS_ACCESS_DENIED;
 
-       return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
+       return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
 }
 
 NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
index 91d38874b9a2ad97b8ff4003793f1cae03edee8b..418a81ffb478804dcd64ab88b34b18b211eab898 100644 (file)
@@ -236,7 +236,7 @@ static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp,
        result = gpfs_get_nfs4_acl(fsp->fsp_name, &pacl);
 
        if (result == 0)
-               return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
+               return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
 
        if (result > 0) {
                DEBUG(10, ("retrying with posix acl...\n"));
index 0fe21b2909883483d76160544d96eb209f3e4276..88cd0879cf87cfc64ecc4d972b2e455e99780a8d 100644 (file)
@@ -92,7 +92,7 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
                        return NT_STATUS_NO_MEMORY;
        }
 
-       return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
+       return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
 }
 
 /* call-back function processing the NT acl -> ZFS acl using NFSv4 conv. */