From f12a4efd8cb7268e67cc8929083a2d81e4cba051 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Thu, 2 Sep 2021 20:06:40 +0200 Subject: [PATCH] freebsd: Do not use cr_pid from LOCAL_PEERCRED LOCAL_PEERCRED is used as substitute for SO_PEERCRED on FreeBSD. One of the fields needed from there is the PID of the peer process. However, while SO_PEERCRED returns the PID at the time of connect(2), LOCAL_PEERCRED returns the PID at the time of listen(2). If the dbus daemon fork(2)'d after listen(2) to daemonize, then the PID returned will no longer exist, which breaks basu. Remove the use of cr_pid for now, as it cannot be used. --- src/basic/socket-util.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index ba438bc..c2c3797 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -41,11 +41,7 @@ int getpeercred(int fd, struct ucred *ucred) { } struct ucred u = { -#if __FreeBSD_version >= 1300030 || (__FreeBSD_version >= 1202506 && __FreeBSD_version < 1300000) - .pid = cred.cr_pid, -#else .pid = -1, -#endif .uid = cred.cr_uid, .gid = cred.cr_ngroups > 0 ? cred.cr_groups[0] : (gid_t)-1, }; -- 2.45.2