Set PW_KEY_SEC_LABEL property on FreeBSD and avoid compiler warning.

This commit is contained in:
Gleb Popov 2021-10-22 19:07:45 +03:00
parent 43ef614537
commit a76ccfe64b

View file

@ -419,9 +419,10 @@ static struct client_data *client_new(struct server *s, int fd)
struct pw_impl_client *client; struct pw_impl_client *client;
struct pw_protocol *protocol = s->this.protocol; struct pw_protocol *protocol = s->this.protocol;
socklen_t len; socklen_t len;
struct ucred ucred;
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
struct xucred xucred; struct xucred xucred;
#else
struct ucred ucred;
#endif #endif
struct pw_context *context = protocol->context; struct pw_context *context = protocol->context;
struct pw_properties *props; struct pw_properties *props;
@ -477,6 +478,8 @@ static struct client_data *client_new(struct server *s, int fd)
#endif #endif
pw_properties_setf(props, PW_KEY_SEC_UID, "%d", xucred.cr_uid); pw_properties_setf(props, PW_KEY_SEC_UID, "%d", xucred.cr_uid);
pw_properties_setf(props, PW_KEY_SEC_GID, "%d", xucred.cr_gid); pw_properties_setf(props, PW_KEY_SEC_GID, "%d", xucred.cr_gid);
// this is what Linuxulator does at the moment, see sys/compat/linux/linux_socket.c
pw_properties_set(props, PW_KEY_SEC_LABEL, "unconfined");
} }
#endif #endif