#include "acl-update.h" #include #include #include #include acl_t f_acl_get_file(const char *path_p, acl_type_t type) { acl_t acl = acl_get_file(path_p, type); free((void *)path_p); return acl; } int f_acl_set_file(const char *path_p, acl_type_t type, acl_t acl) { if (acl_valid(acl) != 0) { return -1; } int ret = acl_set_file(path_p, type, acl); free((void *)path_p); return ret; } void f_acl_delete_by_uid(acl_t acl, uid_t uid) { acl_entry_t entry; // acl_get_entry does not store entry_p acl_tag_t tag_type; // acl_get_tag_type does not store tag_type_p void *qualifier_p; bool res; for (int r = acl_get_entry(acl, ACL_FIRST_ENTRY, &entry); r == 1; r = acl_get_entry(acl, ACL_NEXT_ENTRY, &entry)) { if (acl_get_tag_type(entry, &tag_type) != 0) return; if (tag_type != ACL_USER) continue; qualifier_p = acl_get_qualifier(entry); if (qualifier_p == NULL) return; res = *(uid_t *)qualifier_p == uid; acl_free(qualifier_p); if (!res) continue; acl_delete_entry(acl, entry); break; } }