acl-util.h revision e738c945ec16e14b96eab402024b0caca47f89d8
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#pragma once
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/***
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2011 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering***/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
3c0cf502796be355431d4a64d738e75f543aa51dLennart Poettering#ifdef HAVE_ACL
3c0cf502796be355431d4a64d738e75f543aa51dLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include <stdbool.h>
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include <sys/acl.h>
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering#include <acl/libacl.h>
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering#include "macro.h"
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poetteringint acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poetteringint calc_acl_mask_if_needed(acl_t *acl_p);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poetteringint add_base_acls_if_needed(acl_t *acl_p, const char *path);
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poetteringint acl_search_groups(const char* path, char ***ret_groups);
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poetteringint parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* acl_free takes multiple argument types.
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen * Multiple cleanup functions are necessary. */
91b14d6ff362b938a72db17b095ee9903d07381bTom GundersenDEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free);
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering#define acl_free_charp acl_free
3c0cf502796be355431d4a64d738e75f543aa51dLennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp);
3c0cf502796be355431d4a64d738e75f543aa51dLennart Poettering#define acl_free_uid_tp acl_free
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#define acl_free_gid_tp acl_free
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp);
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen#endif
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen