[PATCH wayland 2/2] support specifying custom directories for the client and server

Bryce Harrington bryce at osg.samsung.com
Wed Oct 15 22:17:45 PDT 2014


On Wed, Oct 15, 2014 at 05:36:27PM +0300, Imran Zaman wrote:
> 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;
>   }
> 

The tabbing seems to be off in the following chunk of code.  Maybe got
eaten when inlining the patch?

> + 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);
> + }

Return values should be checked on the chown and chmod.

Other than that, for both patches:

Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

> +
>   s->source = wl_event_loop_add_fd(display->loop, s->fd,
>   WL_EVENT_READABLE,
>   socket_data, display);
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list