Allow ACLs to use groups as well as users, GitHub issue 4917.

This commit is contained in:
nicm
2026-06-08 21:38:19 +00:00
parent bf2e078ecf
commit 4d1ab1ba2a
5 changed files with 231 additions and 149 deletions

12
proc.c
View File

@@ -56,6 +56,7 @@ struct tmuxpeer {
struct imsgbuf ibuf;
struct event event;
uid_t uid;
gid_t gid;
int flags;
#define PEER_BAD 0x1
@@ -297,7 +298,6 @@ proc_add_peer(struct tmuxproc *tp, int fd,
void (*dispatchcb)(struct imsg *, void *), void *arg)
{
struct tmuxpeer *peer;
gid_t gid;
peer = xcalloc(1, sizeof *peer);
peer->parent = tp;
@@ -310,8 +310,10 @@ proc_add_peer(struct tmuxproc *tp, int fd,
imsgbuf_allow_fdpass(&peer->ibuf);
event_set(&peer->event, fd, EV_READ, proc_event_cb, peer);
if (getpeereid(fd, &peer->uid, &gid) != 0)
if (getpeereid(fd, &peer->uid, &peer->gid) != 0) {
peer->uid = (uid_t)-1;
peer->gid = (gid_t)-1;
}
log_debug("add peer %p: %d (%p)", peer, fd, arg);
TAILQ_INSERT_TAIL(&tp->peers, peer, entry);
@@ -380,3 +382,9 @@ proc_get_peer_uid(struct tmuxpeer *peer)
{
return (peer->uid);
}
gid_t
proc_get_peer_gid(struct tmuxpeer *peer)
{
return (peer->gid);
}