netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
acl.h File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/acl.h>

Go to the source code of this file.

Macros

#define O_NETATALK_ACL   (O_NOFOLLOW << 1)
#define O_IGNORE   (O_NOFOLLOW << 2)
#define chmod_acl   nfsv4_chmod
#define chmod_acl   posix_chmod
#define fchmod_acl   posix_fchmod

Functions

int get_nfsv4_acl (const char *name, ace_t **retAces)
 Get ACL.
int remove_nfsv4_acl_vfs (const char *name)
 Removes all non-trivial ACLs from object.
int strip_trivial_aces (ace_t **saces, int sacecount)
 Remove any trivial ACE "in-place".
int strip_nontrivial_aces (ace_t **saces, int sacecount)
 Remove non-trivial ACEs "in-place".
ace_t * concat_aces (ace_t *aces1, int ace1count, ace_t *aces2, int ace2count)
int nfsv4_chmod (char *name, mode_t mode)
 Change mode of file preserving existing explicit ACEs.
int remove_posix_acl_vfs (const char *name)
 Remove any ACL_USER, ACL_GROUP, ACL_MASK or ACL_TYPE_DEFAULT ACEs from an object.
int posix_chmod (const char *name, mode_t mode)
 POSIX ACL chmod.
int posix_fchmod (int fd, mode_t mode)
 POSIX ACL fchmod.

Macro Definition Documentation

◆ chmod_acl [1/2]

#define chmod_acl   posix_chmod

◆ chmod_acl [2/2]

#define chmod_acl   nfsv4_chmod

◆ fchmod_acl

#define fchmod_acl   posix_fchmod

◆ O_IGNORE

#define O_IGNORE   (O_NOFOLLOW << 2)

◆ O_NETATALK_ACL

#define O_NETATALK_ACL   (O_NOFOLLOW << 1)

Function Documentation

◆ concat_aces()

ace_t * concat_aces ( ace_t * aces1,
int ace1count,
ace_t * aces2,
int ace2count )
extern

Concatenate ACEs

◆ get_nfsv4_acl()

int get_nfsv4_acl ( const char * name,
ace_t ** retAces )
extern

Get ACL.

Note
Allocates storage as needed. Caller must free.
Returns
no of ACEs or -1 on error.

◆ nfsv4_chmod()

int nfsv4_chmod ( char * name,
mode_t mode )
extern

Change mode of file preserving existing explicit ACEs.

nfsv4_chmod

  1. reads objects ACL (acl1), may return 0 or -1 NFSv4 ACEs on e.g. UFS fs
  2. removes all trivial ACEs from the ACL by calling strip_trivial_aces(), possibly leaving 0 ACEs in the ACL if there were only trivial ACEs as mapped from the mode
  3. calls chmod() with mode, we're done if step (1) returned 0 for noaces
  4. reads the changed ACL (acl2) which a. might still contain explicit ACEs (up to onnv132) b. will have any explicit ACE removed (starting with onnv145/Openindiana)
  5. strip any explicit ACE from acl2 using strip_nontrivial_aces()
  6. merge acl2 and acl2
  7. set the ACL merged ACL on the object

◆ posix_chmod()

int posix_chmod ( const char * name,
mode_t mode )
extern

POSIX ACL chmod.

This is a workaround for chmod() on filestystems supporting Posix 1003.1e draft 17 compliant ACLs. For objects with extended ACLs, e.g. objects with an ACL_MASK entry, chmod() manipulates ACL_MASK instead of ACL_GROUP_OBJ. As OS X isn't aware of this behavior calling FPSetFileDirParms may lead to unpredictable results. For more information see section 23.1.2 of Posix 1003.1e draft 17.

Note
accepts the same arguments as chmod()
Returns
0 in case of success or -1 in case something went wrong.

◆ posix_fchmod()

int posix_fchmod ( int fd,
mode_t mode )
extern

POSIX ACL fchmod.

Note
accepts the same arguments as fchmod()
Returns
0 in case of success or -1 in case something went wrong.

◆ remove_nfsv4_acl_vfs()

int remove_nfsv4_acl_vfs ( const char * name)
extern

Removes all non-trivial ACLs from object.

Returns
full AFPERR code

◆ remove_posix_acl_vfs()

int remove_posix_acl_vfs ( const char * name)
extern

Remove any ACL_USER, ACL_GROUP, ACL_MASK or ACL_TYPE_DEFAULT ACEs from an object.

Parameters
namefilesystem object name
Returns
AFP error code, AFP_OK (= 0) on success, AFPERR_MISC on error

◆ strip_nontrivial_aces()

int strip_nontrivial_aces ( ace_t ** saces,
int sacecount )
extern

Remove non-trivial ACEs "in-place".

Returns
no of trivial ACEs.

◆ strip_trivial_aces()

int strip_trivial_aces ( ace_t ** saces,
int sacecount )
extern

Remove any trivial ACE "in-place".

Returns
no of non-trivial ACEs