static char * vfswrap_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen) { return sys_acl_to_text(theacl, plen); }
char * vfswrap_sys_acl_to_text(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) { return sys_acl_to_text(theacl, plen); }
static acl_t smb_acl_to_posix(const struct smb_acl_t *acl) { acl_t result; int i; result = acl_init(acl->count); if (result == NULL) { DEBUG(10, ("acl_init failed\n")); return NULL; } for (i=0; i<acl->count; i++) { const struct smb_acl_entry *entry = &acl->acl[i]; acl_entry_t e; acl_tag_t tag; if (acl_create_entry(&result, &e) != 0) { DEBUG(1, ("acl_create_entry failed: %s\n", strerror(errno))); goto fail; } switch (entry->a_type) { case SMB_ACL_USER: tag = ACL_USER; break; case SMB_ACL_USER_OBJ: tag = ACL_USER_OBJ; break; case SMB_ACL_GROUP: tag = ACL_GROUP; break; case SMB_ACL_GROUP_OBJ: tag = ACL_GROUP_OBJ; break; case SMB_ACL_OTHER: tag = ACL_OTHER; break; case SMB_ACL_MASK: tag = ACL_MASK; break; default: DEBUG(1, ("Unknown tag value %d\n", entry->a_type)); goto fail; } if (acl_set_tag_type(e, tag) != 0) { DEBUG(10, ("acl_set_tag_type(%d) failed: %s\n", tag, strerror(errno))); goto fail; } switch (entry->a_type) { case SMB_ACL_USER: if (acl_set_qualifier(e, &entry->info.user.uid) != 0) { DEBUG(1, ("acl_set_qualifiier failed: %s\n", strerror(errno))); goto fail; } break; case SMB_ACL_GROUP: if (acl_set_qualifier(e, &entry->info.group.gid) != 0) { DEBUG(1, ("acl_set_qualifiier failed: %s\n", strerror(errno))); goto fail; } break; default: /* Shut up, compiler! :-) */ break; } if (smb_acl_set_mode(e, entry->a_perm) != 0) { goto fail; } } if (acl_valid(result) != 0) { char *acl_string = sys_acl_to_text(acl, NULL); DEBUG(0, ("smb_acl_to_posix: ACL %s is invalid for set (%s)\n", acl_string, strerror(errno))); SAFE_FREE(acl_string); goto fail; } return result; fail: if (result != NULL) { acl_free(result); } return NULL; }