From: Michael Jeanson Date: Wed, 24 Feb 2021 20:12:12 +0000 (-0500) Subject: fix: unix socket peercred on FreeBSD X-Git-Tag: v2.12.2~8 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9f327dfe52bb19211f4bdef5206e94dd091af55e;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 048d0127..39860ebf 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1841,6 +1841,7 @@ int get_cred(int sock, } #elif defined(__FreeBSD__) #include +#include /* * Override application uid/gid with unix socket credentials. Use the @@ -1868,11 +1869,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; }