Home | History | Annotate | Download | only in acl
      1 /*
      2   File: libacl.h
      3 
      4   (C) 1999, 2000 Andreas Gruenbacher, <a.gruenbacher (at) computer.org>
      5 
      6   This program is free software: you can redistribute it and/or modify it
      7   under the terms of the GNU Lesser General Public License as published by
      8   the Free Software Foundation, either version 2.1 of the License, or
      9   (at your option) any later version.
     10 
     11   This program is distributed in the hope that it will be useful,
     12   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14   GNU General Public License for more details.
     15 
     16   You should have received a copy of the GNU General Public License
     17   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     18 */
     19 
     20 #ifndef __ACL_LIBACL_H
     21 #define __ACL_LIBACL_H
     22 
     23 #include <sys/acl.h>
     24 
     25 #ifdef __cplusplus
     26 extern "C" {
     27 #endif
     28 
     29 /* Flags for acl_to_any_text() */
     30 
     31 /* Print NO, SOME or ALL effective permissions comments. SOME prints
     32    effective rights comments for entries which have different permissions
     33    than effective permissions.  */
     34 #define TEXT_SOME_EFFECTIVE		0x01
     35 #define TEXT_ALL_EFFECTIVE		0x02
     36 
     37 /* Align effective permission comments to column 32 using tabs or
     38    use a single tab. */
     39 #define TEXT_SMART_INDENT		0x04
     40 
     41 /* User and group IDs instead of names. */
     42 #define TEXT_NUMERIC_IDS		0x08
     43 
     44 /* Only output the first letter of entry types
     45    ("u::rwx" instead of "user::rwx"). */
     46 #define TEXT_ABBREVIATE			0x10
     47 
     48 /* acl_check error codes */
     49 
     50 #define ACL_MULTI_ERROR		(0x1000)     /* multiple unique objects */
     51 #define ACL_DUPLICATE_ERROR	(0x2000)     /* duplicate Id's in entries */
     52 #define ACL_MISS_ERROR		(0x3000)     /* missing required entry */
     53 #define ACL_ENTRY_ERROR		(0x4000)     /* wrong entry type */
     54 
     55 extern char *acl_to_any_text(acl_t acl, const char *prefix,
     56 			     char separator, int options);
     57 extern int acl_cmp(acl_t acl1, acl_t acl2);
     58 extern int acl_check(acl_t acl, int *last);
     59 extern acl_t acl_from_mode(mode_t mode);
     60 extern int acl_equiv_mode(acl_t acl, mode_t *mode_p);
     61 int acl_extended_file(const char *path_p);
     62 int acl_extended_file_nofollow(const char *path_p);
     63 int acl_extended_fd(int fd);
     64 extern int acl_entries(acl_t acl);
     65 extern const char *acl_error(int code);
     66 extern int acl_get_perm(acl_permset_t permset_d, acl_perm_t perm);
     67 
     68 /* Copying permissions between files */
     69 struct error_context;
     70 extern int perm_copy_file (const char *, const char *,
     71 			    struct error_context *);
     72 extern int perm_copy_fd (const char *, int, const char *, int,
     73 			  struct error_context *);
     74 
     75 #ifdef __cplusplus
     76 }
     77 #endif
     78 
     79 #endif  /* __ACL_LIBACL_H */
     80 
     81