HWRF
trunk@4391
|
Manipulates Access Control Lists (ACL) More...
Manipulates Access Control Lists (ACL)
This module is a wrapper around the C libacl library, which provides support for POSIX Access Control Lists, as defined by the abandoned draft standard "IEEE 1003.1e draft 17". Only the widely-supported features are implemented. It is intended to be used with the Linux libacl, but might be portable to other versions if the module-scope acl_library variable is changed to the name of your "dll" or "so" file for libacl and values of ACL_TYPE_ACCESS and ACL_TYPE_DEFAULT are changed. In addition, one must change the means by which errno is accessed if switching from glibc to another C library.
Classes | |
class | ACL |
ACL class wrapped around the libacl library: More... | |
class | ACLCannotGet |
Raised when the libacl library could not get a file's ACL. More... | |
class | ACLCannotSet |
Raised when the libacl library could not set a file's ACL. More... | |
class | ACLCannotStringify |
Raised when libacl cannot convert an ACL to text. More... | |
class | ACLError |
Superclass of any ACL errors. More... | |
class | ACLLibraryError |
Raised when the libacl library could not be loaded. More... | |
class | ACLMissingError |
Raised when a function that requires an ACL object received None, or an invalid ACL. More... | |
Functions | |
def | load_libc () |
Library loading routine: More... | |
def | load_libacl () |
Loads the libacl library. More... | |
def | acl_to_text (acl) |
Returns a string representation of the given access control list object. More... | |
def | acl_get_file |
Returns an object that represents the access control list for the specified file. More... | |
def | acl_get_fd (fd) |
Returns an object that represents the access control list for an open file descriptor. More... | |
def | acl_set_file |
Sets the named file's access control list. More... | |
def | acl_set_fd (fd, acl) |
Given an open file descriptor, sets the corresponding file's access control list. More... | |
def | acl_from_text (txt) |
Converts text to an access control list. More... | |
def | copy_acl_fd (fromfd, tofd) |
Simplified wrappers that perform common tasks: More... | |
Variables | |
libacl = None | |
The loaded libacl library from ctypes.cdll.LoadLibrary. More... | |
libc = None | |
The loaded libc library from ctypes.cdll.LoadLibrary. More... | |
int | ACL_TYPE_ACCESS = 32768 |
The ACL_TYPE for Access Control Lists, defined in the libacl header files. More... | |
int | ACL_TYPE_DEFAULT = 16384 |
The ACL_TYPE for Default Access Control Lists defined in the libacl header files. More... | |
string | acl_library = 'libacl.so.1' |
The ACL library name or path for input to ctypes.cdll.LoadLibrary. More... | |
string | c_library = 'libc.so.6' |
The C library name for input to ctypes.cdll.LoadLibrary. More... | |
get_errno = None | |
Function that returns the value of errno. More... | |
def produtil.acl.acl_from_text | ( | txt | ) |
def produtil.acl.acl_get_fd | ( | fd | ) |
def produtil.acl.acl_get_file | ( | filename, | |
access = ACL_TYPE_ACCESS |
|||
) |
def produtil.acl.acl_set_fd | ( | fd, | |
acl | |||
) |
def produtil.acl.acl_set_file | ( | filename, | |
acl, | |||
access = ACL_TYPE_ACCESS |
|||
) |
def produtil.acl.acl_to_text | ( | acl | ) |
def produtil.acl.copy_acl_fd | ( | fromfd, | |
tofd | |||
) |
Simplified wrappers that perform common tasks:
Copy an access control list from one object to another
Copies a POSIX Access Control List (ACL) from one open file to another. The arguments should be either UNIX file descriptors, or the return values from open(). This routine is quicker than using the ACL() object due to avoidance of creating unnecessary Python objects. However, the access control list information is discarded in this routine, so it can only be used when the sole need is to copy the information from one file to another.
fromfd | the source file descriptor |
tofd | the target file descriptor |
def produtil.acl.load_libacl | ( | ) |
Loads the libacl library.
Loads the libacl library whose name is specified in the module scope acl_library variable. This function is called automatically when needed; you should never need to call it directly.
Definition at line 97 of file acl.py.
Referenced by produtil.acl.ACL.__init__(), and produtil.acl.copy_acl_fd().
def produtil.acl.load_libc | ( | ) |
Library loading routine:
Loads the libc library.
Loads the standard C library, which is needed to test the value of errno in order to report errors. This function is called automatically when needed; you should never need to call it directly.
Definition at line 76 of file acl.py.
Referenced by produtil.acl.load_libacl().
produtil.acl.acl_library = 'libacl.so.1' |
The ACL library name or path for input to ctypes.cdll.LoadLibrary.
This is intended to be modified externally from this module if needed before using the produtil.acl module.
produtil.acl.ACL_TYPE_ACCESS = 32768 |
produtil.acl.ACL_TYPE_DEFAULT = 16384 |
produtil.acl.c_library = 'libc.so.6' |
The C library name for input to ctypes.cdll.LoadLibrary.
This is intended to be modified externally from this module if needed before using the produtil.acl module.
produtil.acl.get_errno = None |
Function that returns the value of errno.
Used for testing for errors in libacl routines.
Definition at line 71 of file acl.py.
Referenced by produtil.acl.copy_acl_fd(), produtil.acl.ACL.from_fd(), produtil.acl.ACL.from_file(), produtil.acl.ACL.from_text(), produtil.acl.ACL.to_fd(), produtil.acl.ACL.to_file(), and produtil.acl.ACL.to_text().
produtil.acl.libacl = None |