fsaccess.h File Reference

The ISC filesystem access module encapsulates the setting of file and directory access permissions into one API that is meant to be portable to multiple operating systems. More...

#include <isc/lang.h>
#include <isc/types.h>

Go to the source code of this file.

Defines

#define ISC_FSACCESS_H   1
#define ISC_FSACCESS_OWNER   0x1
 User account.
#define ISC_FSACCESS_GROUP   0x2
 Primary group owner.
#define ISC_FSACCESS_OTHER   0x4
 Not the owner or the group owner.
#define ISC_FSACCESS_WORLD   0x7
 User, Group, Other.
#define ISC_FSACCESS_READ   0x00000001
 File only.
#define ISC_FSACCESS_WRITE   0x00000002
 File only.
#define ISC_FSACCESS_EXECUTE   0x00000004
 File only.
#define ISC_FSACCESS_CREATECHILD   0x00000008
 Dir only.
#define ISC_FSACCESS_DELETECHILD   0x00000010
 Dir only.
#define ISC_FSACCESS_LISTDIRECTORY   0x00000020
 Dir only.
#define ISC_FSACCESS_ACCESSCHILD   0x00000040
 Dir only.
#define ISC__FSACCESS_PERMISSIONBITS   10
 Adding any permission bits beyond 0x200 would mean typedef'ing isc_fsaccess_t as isc_uint64_t, and redefining this value to reflect the new range of permission types, Probably to 21 for maximum flexibility. The number of bits has to accommodate all of the permission types, and three full sets of them have to fit within an isc_fsaccess_t.

Functions

ISC_LANG_BEGINDECLS void isc_fsaccess_add (int trustee, int permission, isc_fsaccess_t *access)
void isc_fsaccess_remove (int trustee, int permission, isc_fsaccess_t *access)
isc_result_t isc_fsaccess_set (const char *path, isc_fsaccess_t access)


Detailed Description

The ISC filesystem access module encapsulates the setting of file and directory access permissions into one API that is meant to be portable to multiple operating systems.

The two primary operating system flavors that are initially accommodated are POSIX and Windows NT 4.0 and later. The Windows NT access model is considerable more flexible than POSIX's model (as much as I am loathe to admit it), and so the ISC API has a higher degree of complexity than would be needed to simply address POSIX's needs.

The full breadth of NT's flexibility is not available either, for the present time. Much of it is to provide compatibility with what Unix programmers are expecting. This is also due to not yet really needing all of the functionality of an NT system (or, for that matter, a POSIX system) in BIND9, and so resolving how to handle the various incompatibilities has been a purely theoretical exercise with no operational experience to indicate how flawed the thinking may be.

Some of the more notable dumbing down of NT for this API includes:

Unix's dumbing down includes:

The rest of this comment discusses a few of the incompatibilities between the two systems that need more thought if this API is to be extended to accommodate them.

The Windows standard access right "DELETE" doesn't have a direct equivalent in the Unix world, so it isn't clear what should be done with it.

The Unix sticky bit is not supported. While NT does have a concept of allowing users to create files in a directory but not delete or rename them, it does not have a concept of allowing them to be deleted if they are owned by the user trying to delete/rename. While it is probable that something could be cobbled together in NT 5 with inheritance, it can't really be done in NT 4 as a single property that you could set on a directory. You'd need to coordinate something with file creation so that every file created had DELETE set for the owner but noone else.

On Unix systems, setting ISC_FSACCESS_LISTDIRECTORY sets READ. ... setting either ISC_FSACCESS_CREATECHILD or ISC_FSACCESS_DELETECHILD sets WRITE. ... setting ISC_FSACCESS_ACCESSCHILD sets EXECUTE.

On NT systems, setting ISC_FSACCESS_LISTDIRECTORY sets FILE_LIST_DIRECTORY. ... setting ISC_FSACCESS_CREATECHILD sets FILE_CREATE_CHILD independently. ... setting ISC_FSACCESS_DELETECHILD sets FILE_DELETE_CHILD independently. ... setting ISC_FSACCESS_ACCESSCHILD sets FILE_TRAVERSE.

Unresolved: XXXDCL

Definition in file fsaccess.h.


Define Documentation

#define ISC_FSACCESS_H   1

Definition at line 21 of file fsaccess.h.

#define ISC_FSACCESS_OWNER   0x1

User account.

Definition at line 139 of file fsaccess.h.

Referenced by dst__privstruct_writefile(), isc_fsaccess_add(), isc_fsaccess_remove(), and write_public_key().

#define ISC_FSACCESS_GROUP   0x2

Primary group owner.

Definition at line 140 of file fsaccess.h.

Referenced by isc_fsaccess_add(), and isc_fsaccess_remove().

#define ISC_FSACCESS_OTHER   0x4

Not the owner or the group owner.

Definition at line 141 of file fsaccess.h.

Referenced by isc_fsaccess_add(), and isc_fsaccess_remove().

#define ISC_FSACCESS_WORLD   0x7

User, Group, Other.

Definition at line 142 of file fsaccess.h.

#define ISC_FSACCESS_READ   0x00000001

File only.

Definition at line 147 of file fsaccess.h.

Referenced by check_bad_bits(), dst__privstruct_writefile(), isc_fsaccess_set(), and write_public_key().

#define ISC_FSACCESS_WRITE   0x00000002

File only.

Definition at line 148 of file fsaccess.h.

Referenced by check_bad_bits(), dst__privstruct_writefile(), isc_fsaccess_set(), and write_public_key().

#define ISC_FSACCESS_EXECUTE   0x00000004

File only.

Definition at line 149 of file fsaccess.h.

Referenced by check_bad_bits(), and isc_fsaccess_set().

#define ISC_FSACCESS_CREATECHILD   0x00000008

Dir only.

Definition at line 150 of file fsaccess.h.

Referenced by check_bad_bits(), and isc_fsaccess_set().

#define ISC_FSACCESS_DELETECHILD   0x00000010

Dir only.

Definition at line 151 of file fsaccess.h.

Referenced by check_bad_bits(), and isc_fsaccess_set().

#define ISC_FSACCESS_LISTDIRECTORY   0x00000020

Dir only.

Definition at line 152 of file fsaccess.h.

Referenced by check_bad_bits(), and isc_fsaccess_set().

#define ISC_FSACCESS_ACCESSCHILD   0x00000040

Dir only.

Definition at line 153 of file fsaccess.h.

Referenced by check_bad_bits(), and isc_fsaccess_set().

#define ISC__FSACCESS_PERMISSIONBITS   10

Adding any permission bits beyond 0x200 would mean typedef'ing isc_fsaccess_t as isc_uint64_t, and redefining this value to reflect the new range of permission types, Probably to 21 for maximum flexibility. The number of bits has to accommodate all of the permission types, and three full sets of them have to fit within an isc_fsaccess_t.

Definition at line 163 of file fsaccess.h.


Function Documentation

ISC_LANG_BEGINDECLS void isc_fsaccess_add ( int  trustee,
int  permission,
isc_fsaccess_t access 
)

Definition at line 38 of file fsaccess.c.

References GROUP, ISC_FSACCESS_GROUP, ISC_FSACCESS_OTHER, ISC_FSACCESS_OWNER, OTHER, and REQUIRE.

Referenced by dst__privstruct_writefile(), and write_public_key().

void isc_fsaccess_remove ( int  trustee,
int  permission,
isc_fsaccess_t access 
)

Definition at line 53 of file fsaccess.c.

References GROUP, ISC_FSACCESS_GROUP, ISC_FSACCESS_OTHER, ISC_FSACCESS_OWNER, OTHER, and REQUIRE.

isc_result_t isc_fsaccess_set ( const char *  path,
isc_fsaccess_t  access 
)

Definition at line 36 of file fsaccess.c.

References check_bad_bits(), INSIST, isc__errno2result, ISC_FALSE, ISC_FSACCESS_ACCESSCHILD, ISC_FSACCESS_CREATECHILD, ISC_FSACCESS_DELETECHILD, ISC_FSACCESS_EXECUTE, ISC_FSACCESS_LISTDIRECTORY, ISC_FSACCESS_READ, ISC_FSACCESS_WRITE, ISC_R_INVALIDFILE, ISC_R_SUCCESS, ISC_TRUE, and SET_AND_CLEAR.

Referenced by dst__privstruct_writefile(), and write_public_key().


Generated on Tue Apr 28 17:41:15 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha