freebsd-ports/sysutils/seatd/files/patch-pid
Jan Beich 6f6ef4a50c sysutils/seatd: add new port
seatd is a seat management deamon, that does everything it needs to
do. Nothing more, nothing less. Depends only on libc.

libseat is a seat management library allowing applications to use
whatever seat management is available.

Supports:
- seatd
- (e)logind
- embedded seatd for standalone operation

Each backend can be compile-time included and is runtime auto-detected
or manually selected with the `LIBSEAT_BACKEND` environment variable.

Which backend is in use is transparent to the application, providing a
simple common interface.

WWW: https://git.sr.ht/~kennylevinsen/seatd
2020-08-09 09:35:20 +00:00

20 lines
604 B
Text

Similar to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246189
--- seatd/client.c.orig 2020-08-08 13:27:43 UTC
+++ seatd/client.c
@@ -37,10 +37,14 @@ static int get_peer(int fd, pid_t *pid, uid_t *uid, gi
#elif defined(__FreeBSD__)
struct xucred cred;
socklen_t len = sizeof cred;
- if (getsockopt(fd, SOL_SOCKET, LOCAL_PEERCRED, &cred, &len) == -1) {
+ if (getsockopt(fd, 0, LOCAL_PEERCRED, &cred, &len) == -1) {
return -1;
}
+#if __FreeBSD__ < 13
*pid = -1;
+#else
+ *pid = cred.cr_pid;
+#endif
*uid = cred.cr_uid;
*gid = cred.cr_ngroups > 0 ? cred.cr_groups[0] : -1;
return 0;