データ構造 | |
union | _SMB_NFS4_ACEWHOID_T |
struct | _SMB_ACE4PROP_T |
struct | _SMB4ACL_T |
struct | _SMB4ACE_T |
型定義 | |
typedef _SMB_NFS4_ACEWHOID_T | SMB_NFS4_ACEWHOID_T |
typedef _SMB_ACE4PROP_T | SMB_ACE4PROP_T |
typedef _SMB4ACL_T | SMB4ACL_T |
typedef _SMB4ACE_T | SMB4ACE_T |
typedef BOOL(*) | set_nfs4acl_native_fn_t (files_struct *, SMB4ACL_T *) |
関数 | |
SMB4ACL_T * | smb_create_smb4acl (void) |
SMB4ACE_T * | smb_add_ace4 (SMB4ACL_T *acl, SMB_ACE4PROP_T *prop) |
SMB_ACE4PROP_T * | smb_get_ace4 (SMB4ACE_T *ace) |
SMB4ACE_T * | smb_first_ace4 (SMB4ACL_T *acl) |
SMB4ACE_T * | smb_next_ace4 (SMB4ACE_T *ace) |
uint32 | smb_get_naces (SMB4ACL_T *acl) |
size_t | smb_get_nt_acl_nfs4 (files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc, SMB4ACL_T *acl) |
BOOL | smb_set_nt_acl_nfs4 (files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd, set_nfs4acl_native_fn_t set_nfs4_native) |
typedef union _SMB_NFS4_ACEWHOID_T SMB_NFS4_ACEWHOID_T |
typedef struct _SMB_ACE4PROP_T SMB_ACE4PROP_T |
typedef struct _SMB4ACL_T SMB4ACL_T |
typedef struct _SMB4ACE_T SMB4ACE_T |
typedef BOOL(*) set_nfs4acl_native_fn_t(files_struct *, SMB4ACL_T *) |
nfs4_acls.h の 139 行で定義されています。
SMB4ACL_T* smb_create_smb4acl | ( | void | ) |
nfs4_acls.c の 84 行で定義されています。
参照先 errno・_SMB_ACL4_INT_T::magic・main_loop_talloc_get().
参照元 aixjfs2_get_nfs4_acl()・gpfs_get_nfs4_acl()・smbacl4_win2nfs4().
00085 { 00086 TALLOC_CTX *mem_ctx = main_loop_talloc_get(); 00087 SMB_ACL4_INT_T *acl = (SMB_ACL4_INT_T *)TALLOC_SIZE(mem_ctx, sizeof(SMB_ACL4_INT_T)); 00088 if (acl==NULL) 00089 { 00090 DEBUG(0, ("TALLOC_SIZE failed\n")); 00091 errno = ENOMEM; 00092 return NULL; 00093 } 00094 memset(acl, 0, sizeof(SMB_ACL4_INT_T)); 00095 acl->magic = SMB_ACL4_INT_MAGIC; 00096 /* acl->first, last = NULL not needed */ 00097 return (SMB4ACL_T *)acl; 00098 }
SMB4ACE_T* smb_add_ace4 | ( | SMB4ACL_T * | acl, | |
SMB_ACE4PROP_T * | prop | |||
) |
nfs4_acls.c の 100 行で定義されています。
参照先 errno・_SMB_ACL4_INT_T::first・get_validated_aclint()・_SMB_ACL4_INT_T::last・_SMB_ACE4_INT_T::magic・main_loop_talloc_get()・_SMB_ACL4_INT_T::naces・_SMB_ACE4_INT_T::next・_SMB_ACE4_INT_T::prop.
参照元 aixjfs2_get_nfs4_acl()・gpfs_get_nfs4_acl()・smbacl4_win2nfs4().
00101 { 00102 SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); 00103 TALLOC_CTX *mem_ctx = main_loop_talloc_get(); 00104 SMB_ACE4_INT_T *ace; 00105 00106 ace = (SMB_ACE4_INT_T *)TALLOC_SIZE(mem_ctx, sizeof(SMB_ACE4_INT_T)); 00107 if (ace==NULL) 00108 { 00109 DEBUG(0, ("TALLOC_SIZE failed\n")); 00110 errno = ENOMEM; 00111 return NULL; 00112 } 00113 memset(ace, 0, sizeof(SMB_ACE4_INT_T)); 00114 ace->magic = SMB_ACE4_INT_MAGIC; 00115 /* ace->next = NULL not needed */ 00116 memcpy(&ace->prop, prop, sizeof(SMB_ACE4PROP_T)); 00117 00118 if (aclint->first==NULL) 00119 { 00120 aclint->first = ace; 00121 aclint->last = ace; 00122 } else { 00123 aclint->last->next = (void *)ace; 00124 aclint->last = ace; 00125 } 00126 aclint->naces++; 00127 00128 return (SMB4ACE_T *)ace; 00129 }
SMB_ACE4PROP_T* smb_get_ace4 | ( | SMB4ACE_T * | ace | ) |
nfs4_acls.c の 131 行で定義されています。
参照先 get_validated_aceint()・_SMB_ACE4_INT_T::prop.
参照元 aixjfs2_process_smbacl()・gpfsacl_process_smbacl().
00132 { 00133 SMB_ACE4_INT_T *aceint = get_validated_aceint(ace); 00134 if (aceint==NULL) 00135 return NULL; 00136 00137 return &aceint->prop; 00138 }
nfs4_acls.c の 149 行で定義されています。
参照先 _SMB_ACL4_INT_T::first・get_validated_aclint().
参照元 aixjfs2_process_smbacl()・gpfsacl_process_smbacl().
00150 { 00151 SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); 00152 if (aclint==NULL) 00153 return NULL; 00154 00155 return (SMB4ACE_T *)aclint->first; 00156 }
nfs4_acls.c の 140 行で定義されています。
参照先 get_validated_aceint()・_SMB_ACE4_INT_T::next.
参照元 aixjfs2_process_smbacl()・gpfsacl_process_smbacl().
00141 { 00142 SMB_ACE4_INT_T *aceint = get_validated_aceint(ace); 00143 if (aceint==NULL) 00144 return NULL; 00145 00146 return (SMB4ACE_T *)aceint->next; 00147 }
uint32 smb_get_naces | ( | SMB4ACL_T * | acl | ) |
nfs4_acls.c の 158 行で定義されています。
参照先 get_validated_aclint()・_SMB_ACL4_INT_T::naces.
参照元 aixjfs2_process_smbacl()・smb_get_nt_acl_nfs4().
00159 { 00160 SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); 00161 if (aclint==NULL) 00162 return 0; 00163 00164 return aclint->naces; 00165 }
size_t smb_get_nt_acl_nfs4 | ( | files_struct * | fsp, | |
uint32 | security_info, | |||
SEC_DESC ** | ppdesc, | |||
SMB4ACL_T * | acl | |||
) |
nfs4_acls.c の 270 行で定義されています。
参照先 files_struct::fsp_name・gid_to_sid()・main_loop_talloc_get()・make_sec_acl()・make_sec_desc()・smb_get_naces()・smbacl4_GetFileOwner()・smbacl4_nfs42win()・uid_to_sid().
参照元 aixjfs2_get_nt_acl_common()・gpfsacl_get_nt_acl_common().
00273 { 00274 int good_aces = 0; 00275 SMB_STRUCT_STAT sbuf; 00276 DOM_SID sid_owner, sid_group; 00277 size_t sd_size = 0; 00278 SEC_ACE *nt_ace_list = NULL; 00279 SEC_ACL *psa = NULL; 00280 TALLOC_CTX *mem_ctx = main_loop_talloc_get(); 00281 00282 DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name)); 00283 00284 if (acl==NULL || smb_get_naces(acl)==0) 00285 return 0; /* special because we shouldn't alloc 0 for win */ 00286 00287 if (smbacl4_GetFileOwner(fsp, &sbuf)) 00288 return 0; 00289 00290 uid_to_sid(&sid_owner, sbuf.st_uid); 00291 gid_to_sid(&sid_group, sbuf.st_gid); 00292 00293 if (smbacl4_nfs42win(acl, 00294 &sid_owner, 00295 &sid_group, 00296 &nt_ace_list, 00297 &good_aces 00298 )==False) { 00299 DEBUG(8,("smbacl4_nfs42win failed\n")); 00300 return 0; 00301 } 00302 00303 psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 00304 good_aces, nt_ace_list); 00305 if (psa == NULL) { 00306 DEBUG(2,("make_sec_acl failed\n")); 00307 return 0; 00308 } 00309 00310 DEBUG(10,("after make sec_acl\n")); 00311 *ppdesc = make_sec_desc(mem_ctx, SEC_DESC_REVISION, 00312 SEC_DESC_SELF_RELATIVE, 00313 (security_info & OWNER_SECURITY_INFORMATION) 00314 ? &sid_owner : NULL, 00315 (security_info & GROUP_SECURITY_INFORMATION) 00316 ? &sid_group : NULL, 00317 NULL, psa, &sd_size); 00318 if (*ppdesc==NULL) { 00319 DEBUG(2,("make_sec_desc failed\n")); 00320 return 0; 00321 } 00322 00323 DEBUG(10, ("smb_get_nt_acl_nfs4 successfully exited with sd_size %d\n", sd_size)); 00324 return sd_size; 00325 }
BOOL smb_set_nt_acl_nfs4 | ( | files_struct * | fsp, | |
uint32 | security_info_sent, | |||
SEC_DESC * | psd, | |||
set_nfs4acl_native_fn_t | set_nfs4_native | |||
) |
nfs4_acls.c の 580 行で定義されています。
参照先 files_struct::conn・current_user・security_descriptor_info::dacl・_smbacl4_vfs_params::do_chown・errno・files_struct::fsp_name・result・smbacl4_dump_nfs4acl()・smbacl4_get_vfs_params()・smbacl4_GetFileOwner()・smbacl4_win2nfs4()・strerror()・try_chown()・_unix_token::uid・unpack_nt_owners()・current_user::ut.
参照元 aixjfs2_set_nt_acl_common()・gpfsacl_set_nt_acl_internal().
00584 { 00585 smbacl4_vfs_params params; 00586 SMB4ACL_T *acl = NULL; 00587 BOOL result; 00588 00589 SMB_STRUCT_STAT sbuf; 00590 BOOL need_chown = False; 00591 uid_t newUID = (uid_t)-1; 00592 gid_t newGID = (gid_t)-1; 00593 00594 DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name)); 00595 00596 if ((security_info_sent & (DACL_SECURITY_INFORMATION | 00597 GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION)) == 0) 00598 { 00599 DEBUG(9, ("security_info_sent (0x%x) ignored\n", 00600 security_info_sent)); 00601 return True; /* won't show error - later to be refined... */ 00602 } 00603 00604 /* Special behaviours */ 00605 if (smbacl4_get_vfs_params(SMBACL4_PARAM_TYPE_NAME, fsp, ¶ms)) 00606 return False; 00607 00608 if (smbacl4_GetFileOwner(fsp, &sbuf)) 00609 return False; 00610 00611 if (params.do_chown) { 00612 /* chown logic is a copy/paste from posix_acl.c:set_nt_acl */ 00613 if (!unpack_nt_owners(SNUM(fsp->conn), &newUID, &newGID, security_info_sent, psd)) 00614 { 00615 DEBUG(8, ("unpack_nt_owners failed")); 00616 return False; 00617 } 00618 if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) || 00619 ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) { 00620 need_chown = True; 00621 } 00622 if (need_chown) { 00623 if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) { 00624 if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { 00625 DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n", 00626 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, strerror(errno) )); 00627 return False; 00628 } 00629 DEBUG(10,("chown %s, %u, %u succeeded.\n", 00630 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 00631 if (smbacl4_GetFileOwner(fsp, &sbuf)) 00632 return False; 00633 need_chown = False; 00634 } else { /* chown is needed, but _after_ changing acl */ 00635 sbuf.st_uid = newUID; /* OWNER@ in case of e_special */ 00636 sbuf.st_gid = newGID; /* GROUP@ in case of e_special */ 00637 } 00638 } 00639 } 00640 00641 if ((security_info_sent & DACL_SECURITY_INFORMATION)!=0 && psd->dacl!=NULL) 00642 { 00643 acl = smbacl4_win2nfs4(psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); 00644 if (!acl) 00645 return False; 00646 00647 smbacl4_dump_nfs4acl(10, acl); 00648 00649 result = set_nfs4_native(fsp, acl); 00650 if (result!=True) 00651 { 00652 DEBUG(10, ("set_nfs4_native failed with %s\n", strerror(errno))); 00653 return False; 00654 } 00655 } else 00656 DEBUG(10, ("no dacl found; security_info_sent = 0x%x\n", security_info_sent)); 00657 00658 /* Any chown pending? */ 00659 if (need_chown) { 00660 DEBUG(3,("chown#2 %s. uid = %u, gid = %u.\n", 00661 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 00662 if (try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { 00663 DEBUG(2,("chown#2 %s, %u, %u failed. Error = %s.\n", 00664 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, 00665 strerror(errno))); 00666 return False; 00667 } 00668 DEBUG(10,("chown#2 %s, %u, %u succeeded.\n", 00669 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 00670 } 00671 00672 DEBUG(10, ("smb_set_nt_acl_nfs4 succeeded\n")); 00673 return True; 00674 }