From: Michael Jeanson Date: Wed, 24 Feb 2021 20:12:12 +0000 (-0500) Subject: fix: unix socket peercred on FreeBSD X-Git-Tag: v2.13.0-rc1~366 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e494a9cdf17705bddf2169adf3945ed2ae335db9;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 0272d9b9..f66e0bc5 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -2067,6 +2067,7 @@ int get_cred(int sock, } #elif defined(__FreeBSD__) #include +#include /* * Override application uid/gid with unix socket credentials. Use the @@ -2094,11 +2095,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; }