From: Michael Jeanson Date: Wed, 24 Feb 2021 20:12:12 +0000 (-0500) Subject: fix: unix socket peercred on FreeBSD X-Git-Tag: v2.11.4~8 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5d519a990b9edfe86cc0d99d542b3bf17f3b576f;p=lttng-ust.git fix: unix socket peercred on FreeBSD Include 'sys/un.h' for LOCAL_PEERCRED. The uid member of 'struct xucred' is 'cr_uid'. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: I6d94e5ad53292401afebeae0cbbba82e7568a847 --- diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index db1e219d..e99ee8c4 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1828,6 +1828,7 @@ int get_cred(int sock, } #elif defined(__FreeBSD__) #include +#include /* * Override application uid/gid with unix socket credentials. Use the @@ -1855,11 +1856,11 @@ int get_cred(int sock, } DBG("Unix socket peercred [ uid: %u, gid: %u ], " "application registered claiming [ pid: %d, ppid: %d, uid: %u, gid: %u ]", - xucred.uid, xucred.cr_groups[0], + xucred.cr_uid, xucred.cr_groups[0], reg_msg->pid, reg_msg->ppid, reg_msg->uid, reg_msg->gid); *pid = reg_msg->pid; *ppid = reg_msg->ppid; - *uid = xucred.uid; + *uid = xucred.cr_uid; *gid = xucred.cr_groups[0]; return 0; }