"Fossies" - the Fresh Open Source Software Archive

Member "usr/include/cygwin/acl.h" (19 Aug 2019, 3796 Bytes) of package /windows/misc/cygwin-20190819-x86.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* cygwin/acl.h header file for Cygwin.
    2    Written by C. Vinschen.
    3 
    4 This file is part of Cygwin.
    5 
    6 This software is a copyrighted work licensed under the terms of the
    7 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
    8 details. */
    9 
   10 #ifndef _CYGWIN_ACL_H
   11 #ifdef __cplusplus
   12 extern "C" {
   13 #endif
   14 #define _CYGWIN_ACL_H
   15 
   16 #include <_ansi.h>
   17 
   18 #include <sys/types.h>
   19 #include <sys/stat.h>
   20 
   21 /* Values for `cmd' in calls to acl(2) and facl(2) */
   22 #define SETACL          (0x0)
   23 #define GETACL          (0x1)
   24 #define GETACLCNT       (0x2)
   25 
   26 /* Windows ACLs have a maximum size of 64K.  Counting the most pessimistic way,
   27    the maximum number of ACEs is 3276.  Technet claims "approximately 1820",
   28    which uses the length of normal user and group SIDs for the computation. 
   29    We're now going with 2730, the number of aclent_t entries matching a 32K
   30    buffer.
   31    On one hand, there are only a limited number of SIDs shorter than the normal
   32    user/group SIDs, on the other hand there are no deny aclent_t entries, so we
   33    should be fine with 32K aclbuf_t buffers provided by the caller. */
   34 #define MIN_ACL_ENTRIES (3)    /* minimal acl entries from GETACLCNT        */
   35 #define MAX_ACL_ENTRIES (2730) /* max entries of each type          */
   36 
   37 /* Return values of aclcheck(3) in case of error */
   38 #define GRP_ERROR       (0x1)
   39 #define USER_ERROR      (0x2)
   40 #define CLASS_ERROR     (0x3)
   41 #define OTHER_ERROR     (0x4)
   42 #define DUPLICATE_ERROR (0x5)
   43 #define ENTRY_ERROR     (0x6)
   44 #define MISS_ERROR      (0x7) /* which = -1 */
   45 #define MEM_ERROR       (0x8) /* which = -1 */
   46 
   47 /* Values for entry type of struct acl */
   48 #define USER_OBJ        (0x0001)                /* owner            */
   49 #define USER            (0x0002)                /* additional user      */
   50 #define GROUP_OBJ       (0x0004)                /* owning group         */
   51 #define GROUP           (0x0008)                /* additional group     */
   52 #define CLASS_OBJ       (0x0010)                /* mask entry           */
   53 #define OTHER_OBJ       (0x0020)                /* others           */
   54 #define ACL_DEFAULT     (0x1000)                /* default flag         */
   55 #define DEF_USER_OBJ    (ACL_DEFAULT|USER_OBJ)  /* default owner        */
   56 #define DEF_USER        (ACL_DEFAULT|USER)      /* default additional user  */
   57 #define DEF_GROUP_OBJ   (ACL_DEFAULT|GROUP_OBJ) /* default owning group     */
   58 #define DEF_GROUP       (ACL_DEFAULT|GROUP)     /* default additional group */
   59 #define DEF_CLASS_OBJ   (ACL_DEFAULT|CLASS_OBJ) /* default mask entry       */
   60 #define DEF_OTHER_OBJ   (ACL_DEFAULT|OTHER_OBJ) /* default others       */
   61 /* Values with equivalent meanings */
   62 #define USER_OWNER      USER_OBJ
   63 #define GROUP_OWNER     GROUP_OBJ
   64 #define MASK            CLASS_OBJ
   65 #define OTHER           OTHER_OBJ
   66 
   67 typedef struct acl {
   68     int          a_type;    /* entry type  */
   69     id_t         a_id;      /* UID | GID   */
   70     mode_t       a_perm;    /* permissions */
   71 } aclent_t;
   72 
   73 #ifndef __INSIDE_CYGWIN__
   74 extern int   acl (const char *__path, int __cmd, int __nentries,
   75               aclent_t *__aclbufp);
   76 extern int   facl (int __fd, int __cmd, int __nentries,
   77                aclent_t *__aclbufp);
   78 extern int   aclcheck (aclent_t *__aclbufp, int __nentries, int *__which);
   79 extern int   aclsort (int __nentries, int __calclass, aclent_t *__aclbufp);
   80 extern int   acltomode (aclent_t *__aclbufp, int __nentries,
   81                 mode_t *__modep);
   82 extern int   aclfrommode (aclent_t *__aclbufp, int __nentries,
   83                   mode_t *__modep);
   84 extern int   acltopbits (aclent_t *__aclbufp, int __nentries,
   85                  mode_t *__pbitsp);
   86 extern int   aclfrompbits (aclent_t *__aclbufp, int __nentries,
   87                    mode_t *__pbitsp);
   88 extern char *acltotext (aclent_t *__aclbufp, int __aclcnt);
   89 extern aclent_t *aclfromtext (char *__acltextp, int *__aclcnt);
   90 #endif
   91 
   92 #ifdef __cplusplus
   93 }
   94 #endif
   95 #endif /* _CYGWIN_ACL_H */