server: wl_client: introduce method for getting client security context

Introduces a function wl_client_get_security_context for obtaining the
security context of a connected client by using SO_PEERSEC on supported
systems. Returns NULL for unsupported systems (inline with behaviour of
e.g. Linux attempting to get a security context for a client that does
not exist, which is a valid state).

Signed-off-by: Rahul Sandhu <nvraxn@gmail.com>
This commit is contained in:
Rahul Sandhu 2025-02-23 20:29:31 +00:00
parent 1ab6b693b1
commit 5ed36d2b44
4 changed files with 74 additions and 0 deletions

View file

@ -35,6 +35,9 @@ wl_os_socket_cloexec(int domain, int type, int protocol);
int
wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid);
int
wl_os_socket_peersec(int sockfd, char **security_context);
int
wl_os_dupfd_cloexec(int fd, int minfd);