All checks were successful
Test / Create distribution (push) Successful in 6m57s
Test / Sandbox (push) Successful in 8m53s
Test / Hpkg (push) Successful in 10m40s
Test / Sandbox (race detector) (push) Successful in 10m50s
Test / Create distribution (pull_request) Successful in 10m12s
Test / Hakurei (race detector) (push) Successful in 11m27s
Test / Hakurei (race detector) (pull_request) Successful in 11m24s
Test / Sandbox (pull_request) Successful in 40s
Test / Sandbox (race detector) (pull_request) Successful in 40s
Test / Hpkg (pull_request) Successful in 41s
Test / Hakurei (push) Successful in 2m39s
Test / Hakurei (pull_request) Successful in 2m33s
Test / Flake checks (pull_request) Successful in 1m44s
Test / Flake checks (push) Successful in 1m46s
This is required for securely providing access to PipeWire. This change has already been manually tested and confirmed to work correctly. This unfortunately cannot be upstreamed in its current state as libpipewire-0.3 breaks static linking. Signed-off-by: Ophestra <cat@gensokyo.uk>
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
#include <stdbool.h>
|
|
#include <sys/un.h>
|
|
|
|
typedef enum {
|
|
HAKUREI_PIPEWIRE_SUCCESS,
|
|
/* pw_main_loop_new failed, errno */
|
|
HAKUREI_PIPEWIRE_MAINLOOP,
|
|
/* pw_context_new failed, errno */
|
|
HAKUREI_PIPEWIRE_CTX,
|
|
/* pw_context_connect failed, errno */
|
|
HAKUREI_PIPEWIRE_CONNECT,
|
|
/* pw_core_get_registry failed */
|
|
HAKUREI_PIPEWIRE_REGISTRY,
|
|
/* no security context object found */
|
|
HAKUREI_PIPEWIRE_NOT_AVAIL,
|
|
/* socket failed, errno */
|
|
HAKUREI_PIPEWIRE_SOCKET,
|
|
/* bind failed, errno */
|
|
HAKUREI_PIPEWIRE_BIND,
|
|
/* listen failed, errno */
|
|
HAKUREI_PIPEWIRE_LISTEN,
|
|
/* pw_security_context_create failed, translated errno */
|
|
HAKUREI_PIPEWIRE_ATTACH,
|
|
|
|
/* ensure pathname failed, implemented in conn.go */
|
|
HAKUREI_PIPEWIRE_CREAT,
|
|
} hakurei_pipewire_res;
|
|
|
|
hakurei_pipewire_res hakurei_pw_security_context_bind(
|
|
char *socket_path,
|
|
char *remote_path,
|
|
int close_fd);
|
|
|
|
/* returns whether the specified size fits in the sun_path field of sockaddr_un */
|
|
static inline bool hakurei_pw_is_valid_size_sun_path(size_t sz) {
|
|
struct sockaddr_un sockaddr;
|
|
return sz <= sizeof(sockaddr.sun_path);
|
|
};
|