Hi support for adjusting socket access rights to allow group of users to connect to the socket.
This is used for nested compositor architectures. ----- diff --git a/src/wayland-server.c b/src/wayland-server.c index ce1eca8..b1ca5e6 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -39,6 +39,8 @@ #include <fcntl.h> #include <sys/file.h> #include <sys/stat.h> +#include <sys/types.h> +#include <grp.h> #include <ffi.h> #include "wayland-private.h" @@ -1079,6 +1081,10 @@ wl_socket_init_for_display_name(struct wl_socket *s, const char *name) { int name_size; const char *runtime_dir; + const char *socket_mode_str; + const char *socket_group_str; + const struct group *socket_group; + unsigned socket_mode; runtime_dir = getenv("WAYLAND_SERVER_DIR"); if (runtime_dir == NULL) @@ -1133,6 +1139,18 @@ _wl_display_add_socket(struct wl_display *display, struct wl_socket *s) return -1; } + socket_group_str = getenv("WAYLAND_SERVER_GROUP"); + if (socket_group_str != NULL) { + socket_group = getgrnam(socket_group_str); + if (socket_group != NULL) + chown(s->addr.sun_path, -1, socket_group->gr_gid); + } + socket_mode_str = getenv("WAYLAND_SERVER_MODE"); + if (socket_mode_str != NULL) { + if (sscanf(socket_mode_str, "%o", &socket_mode) > 0) + chmod(s->addr.sun_path, socket_mode); + } + s->source = wl_event_loop_add_fd(display->loop, s->fd, WL_EVENT_READABLE, socket_data, display); _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel