/* * convert either the access or the default part of a * soaris acl to the SMB_ACL format. */ static SMB_ACL_T solaris_acl_to_smb_acl(SOLARIS_ACL_T solaris_acl, int count, SMB_ACL_TYPE_T type) { SMB_ACL_T result; int i; if ((result = sys_acl_init(0)) == NULL) { DEBUG(10, ("error allocating memory for SMB_ACL\n")); goto fail; } for (i = 0; i < count; i++) { SMB_ACL_ENTRY_T smb_entry; SMB_ACL_PERM_T smb_perm; if (!_IS_OF_TYPE(solaris_acl[i], type)) { continue; } result = SMB_REALLOC(result, sizeof(struct smb_acl_t) + (sizeof(struct smb_acl_entry) * (result->count + 1))); if (result == NULL) { DEBUG(10, ("error reallocating memory for SMB_ACL\n")); goto fail; } smb_entry = &result->acl[result->count]; if (sys_acl_set_tag_type(smb_entry, solaris_tag_to_smb_tag(solaris_acl[i].a_type)) != 0) { DEBUG(10, ("invalid tag type given: 0x%04x\n", solaris_acl[i].a_type)); goto fail; } /* intentionally not checking return code here: */ sys_acl_set_qualifier(smb_entry, (void *)&solaris_acl[i].a_id); smb_perm = solaris_perm_to_smb_perm(solaris_acl[i].a_perm); if (sys_acl_set_permset(smb_entry, &smb_perm) != 0) { DEBUG(10, ("invalid permset given: %d\n", solaris_acl[i].a_perm)); goto fail; } result->count += 1; } goto done; fail: SAFE_FREE(result); done: DEBUG(10, ("solaris_acl_to_smb_acl %s\n", ((result == NULL) ? "failed" : "succeeded"))); return result; }
/* * convert either the access or the default part of a * soaris acl to the SMB_ACL format. */ static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpux_acl, int count, SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx) { SMB_ACL_T result; int i; if ((result = sys_acl_init(mem_ctx)) == NULL) { DEBUG(10, ("error allocating memory for SMB_ACL\n")); goto fail; } for (i = 0; i < count; i++) { SMB_ACL_ENTRY_T smb_entry; SMB_ACL_PERM_T smb_perm; if (!_IS_OF_TYPE(hpux_acl[i], type)) { continue; } result->acl = talloc_realloc(result, result->acl, struct smb_acl_entry, result->count + 1); if (result->acl == NULL) { DEBUG(10, ("error reallocating memory for SMB_ACL\n")); goto fail; } smb_entry = &result->acl[result->count]; if (sys_acl_set_tag_type(smb_entry, hpux_tag_to_smb_tag(hpux_acl[i].a_type)) != 0) { DEBUG(10, ("invalid tag type given: 0x%04x\n", hpux_acl[i].a_type)); goto fail; } /* intentionally not checking return code here: */ sys_acl_set_qualifier(smb_entry, (void *)&hpux_acl[i].a_id); smb_perm = hpux_perm_to_smb_perm(hpux_acl[i].a_perm); if (sys_acl_set_permset(smb_entry, &smb_perm) != 0) { DEBUG(10, ("invalid permset given: %d\n", hpux_acl[i].a_perm)); goto fail; } result->count += 1; } goto done; fail: TALLOC_FREE(result); done: DEBUG(10, ("hpux_acl_to_smb_acl %s\n", ((result == NULL) ? "failed" : "succeeded"))); return result; }
int vfswrap_sys_acl_set_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) { return sys_acl_set_qualifier(entry, qual); }