Implement POSIX.1e ACL functions

* Makefile.in (DLL_OFILES): Add sec_posixacl.o.
	(SUBLIBS): Add libacl.a
	(libacl.a): New rule to create libacl.a.
	* common.din: Export POSIX ACL functions as well as most libacl.a
	extensions.
	* fhandler.h (fhander_base::acl_get): New prototype.
	(fhander_base::acl_set): Ditto.
	(fhandler_disk_file::acl_get): Ditto.
	(fhandler_disk_file::acl_set): Ditto.
	* include/acl/libacl.h: New file.
	* include/cygwin/version.h: Bump API minor version.
	* include/sys/acl.h: Drop including cygwin/acl.h.  Accommodate
	throughout Cygwin.  Add POSIX ACL definitions.
	* sec_acl.cc: Include sec_posixacl.h.  Replace ILLEGAL_UID and
	ILLEGAL_GID with ACL_UNDEFINED_ID where sensible.
	(__aclcheck): New internal acl check function to be used for
	Solaris and POSIX ACLs.
	(aclcheck32): Call __aclcheck.
	(__aclcalcmask): New function to compute ACL_MASK value.
	(__aclsort): New internal acl sort function to be used for Solaris
	and POSIX ACLs.
	(aclsort32): Call __aclsort.
	(permtostr): Work directly on provided buffer.
	(__acltotext): New internal acltotext function to be used for
	Solaris and POSIX ACLs.
	(acltotext32): Call __acltotext.
	(__aclfromtext): New internal aclfromtext function to be used for
	Solaris and POSIX ACLs.
	(aclfromtext32): Call __aclfromtext.
	* sec_posixacl.cc: New file implemeting POSIX ACL functions.
	* sec_posixacl.h: New internal header.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2016-01-06 18:41:36 +01:00
parent edd7d93484
commit 9ddf063921
18 changed files with 1849 additions and 300 deletions

View File

@ -56,6 +56,7 @@ typedef struct __DIR DIR;
struct dirent;
struct iovec;
struct acl;
struct __acl_t;
enum dirent_states
{
@ -355,6 +356,8 @@ public:
virtual int __reg1 fchmod (mode_t mode);
virtual int __reg2 fchown (uid_t uid, gid_t gid);
virtual int __reg3 facl (int, int, struct acl *);
virtual struct __acl_t * __reg2 acl_get (uint32_t);
virtual int __reg3 acl_set (struct __acl_t *, uint32_t);
virtual ssize_t __reg3 fgetxattr (const char *, void *, size_t);
virtual int __reg3 fsetxattr (const char *, const void *, size_t, int);
virtual int __reg3 fadvise (off_t, off_t, int);
@ -1011,6 +1014,8 @@ class fhandler_disk_file: public fhandler_base
int __reg1 fchmod (mode_t mode);
int __reg2 fchown (uid_t uid, gid_t gid);
int __reg3 facl (int, int, struct acl *);
struct __acl_t * __reg2 acl_get (uint32_t);
int __reg3 acl_set (struct __acl_t *, uint32_t);
ssize_t __reg3 fgetxattr (const char *, void *, size_t);
int __reg3 fsetxattr (const char *, const void *, size_t, int);
int __reg3 fadvise (off_t, off_t, int);