Cygwin: implement getfacl(1) for socket files
Do this by defining the acl_get method for the fhandler_socket_local and fhandler_socket_unix classes. Also define acl_set for these classes. Partially addresses: https://cygwin.com/pipermail/cygwin/2022-July/251768.html
This commit is contained in:
parent
1503d14af1
commit
72f855f32b
winsup/cygwin
|
@ -861,6 +861,8 @@ class fhandler_socket_local: public fhandler_socket_wsock
|
||||||
int fchmod (mode_t newmode);
|
int fchmod (mode_t newmode);
|
||||||
int fchown (uid_t newuid, gid_t newgid);
|
int fchown (uid_t newuid, gid_t newgid);
|
||||||
int facl (int, int, struct acl *);
|
int facl (int, int, struct acl *);
|
||||||
|
struct __acl_t *acl_get (uint32_t);
|
||||||
|
int acl_set (struct __acl_t *, uint32_t);
|
||||||
int link (const char *);
|
int link (const char *);
|
||||||
|
|
||||||
/* from here on: CLONING */
|
/* from here on: CLONING */
|
||||||
|
@ -1143,6 +1145,8 @@ class fhandler_socket_unix : public fhandler_socket
|
||||||
int fchmod (mode_t newmode);
|
int fchmod (mode_t newmode);
|
||||||
int fchown (uid_t newuid, gid_t newgid);
|
int fchown (uid_t newuid, gid_t newgid);
|
||||||
int facl (int, int, struct acl *);
|
int facl (int, int, struct acl *);
|
||||||
|
struct __acl_t *acl_get (uint32_t);
|
||||||
|
int acl_set (struct __acl_t *, uint32_t);
|
||||||
int link (const char *);
|
int link (const char *);
|
||||||
|
|
||||||
/* select.cc */
|
/* select.cc */
|
||||||
|
|
|
@ -25,3 +25,5 @@ What changed:
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
- Don't error out if getfacl(1) is called on a socket file.
|
||||||
|
Partially addresses: https://cygwin.com/pipermail/cygwin/2022-July/251768.html
|
||||||
|
|
|
@ -633,6 +633,44 @@ fhandler_disk_file::acl_get (acl_type_t type)
|
||||||
return acl;
|
return acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acl_t
|
||||||
|
fhandler_socket_local::acl_get (acl_type_t type)
|
||||||
|
{
|
||||||
|
if (!dev ().isfs ())
|
||||||
|
/* acl_get_fd on a socket. */
|
||||||
|
return fhandler_base::acl_get (type);
|
||||||
|
|
||||||
|
/* acl_get_fd on a socket opened with O_PATH or acl_get_file on a
|
||||||
|
socket file. */
|
||||||
|
if (get_flags () & O_PATH)
|
||||||
|
{
|
||||||
|
set_errno (EBADF);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
fhandler_disk_file fh (pc);
|
||||||
|
return fh.acl_get (type);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WITH_AF_UNIX
|
||||||
|
acl_t
|
||||||
|
fhandler_socket_unix::acl_get (acl_type_t type)
|
||||||
|
{
|
||||||
|
if (!dev ().isfs ())
|
||||||
|
/* acl_get_fd on a socket. */
|
||||||
|
return fhandler_base::acl_get (type);
|
||||||
|
|
||||||
|
/* acl_get_fd on a socket opened with O_PATH or acl_get_file on a
|
||||||
|
socket file. */
|
||||||
|
if (get_flags () & O_PATH)
|
||||||
|
{
|
||||||
|
set_errno (EBADF);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
fhandler_disk_file fh (pc);
|
||||||
|
return fh.acl_get (type);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" acl_t
|
extern "C" acl_t
|
||||||
acl_get_fd (int fd)
|
acl_get_fd (int fd)
|
||||||
{
|
{
|
||||||
|
@ -765,6 +803,44 @@ fhandler_disk_file::acl_set (acl_t acl, acl_type_t type)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fhandler_socket_local::acl_set (acl_t acl, acl_type_t type)
|
||||||
|
{
|
||||||
|
if (!dev ().isfs ())
|
||||||
|
/* acl_set_fd on a socket. */
|
||||||
|
return fhandler_base::acl_set (acl, type);
|
||||||
|
|
||||||
|
/* acl_set_fd on a socket opened with O_PATH or acl_set_file on a
|
||||||
|
socket file. */
|
||||||
|
if (get_flags () & O_PATH)
|
||||||
|
{
|
||||||
|
set_errno (EBADF);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fhandler_disk_file fh (pc);
|
||||||
|
return fh.acl_set (acl, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WITH_AF_UNIX
|
||||||
|
int
|
||||||
|
fhandler_socket_unix::acl_set (acl_t acl, acl_type_t type)
|
||||||
|
{
|
||||||
|
if (!dev ().isfs ())
|
||||||
|
/* acl_set_fd on a socket. */
|
||||||
|
return fhandler_base::acl_set (acl, type);
|
||||||
|
|
||||||
|
/* acl_set_fd on a socket opened with O_PATH or acl_set_file on a
|
||||||
|
socket file. */
|
||||||
|
if (get_flags () & O_PATH)
|
||||||
|
{
|
||||||
|
set_errno (EBADF);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fhandler_disk_file fh (pc);
|
||||||
|
return fh.acl_set (acl, type);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" int
|
extern "C" int
|
||||||
acl_set_fd (int fd, acl_t acl)
|
acl_set_fd (int fd, acl_t acl)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue