diff options
author | Michael Adam <obnox@samba.org> | 2007-11-15 00:46:20 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2007-12-19 23:07:57 +0100 |
commit | c650857fac826697cb1d9441b9ea869b85190d25 (patch) | |
tree | f6d91f2c2d79f64ea7245354716dd48d0e87e7fc /source3 | |
parent | cb69a78505854342013f67630bfd38a3c5cd7857 (diff) | |
download | samba-c650857fac826697cb1d9441b9ea869b85190d25.tar.gz samba-c650857fac826697cb1d9441b9ea869b85190d25.tar.bz2 samba-c650857fac826697cb1d9441b9ea869b85190d25.zip |
Split smb_get_nt_acl_nfs4 into two (f- and non-f-variant).
This is the next step in preparation of a get_nt_acl prototype change.
Michael
(This used to be commit 7afeb1c6cb1bdb58d1e61c54ae215d947d8dc3ea)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/nfs4_acls.c | 44 | ||||
-rw-r--r-- | source3/modules/nfs4_acls.h | 7 | ||||
-rw-r--r-- | source3/modules/vfs_aixacl2.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_gpfs.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_zfsacl.c | 2 |
5 files changed, 44 insertions, 13 deletions
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 94666ba00d..70bb6a02e8 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -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}; diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h index ceb66ec094..0f783aa977 100644 --- a/source3/modules/nfs4_acls.h +++ b/source3/modules/nfs4_acls.h @@ -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); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index ab7c75691c..0cb40a2214 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -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, diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 91d38874b9..418a81ffb4 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -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")); diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 0fe21b2909..88cd0879cf 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -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. */ |