[PATCH weston 3/4] shell: Use pid when binding the client shell

Kristian Høgsberg hoegsberg at gmail.com
Thu Apr 4 14:27:39 PDT 2013


On Thu, Apr 04, 2013 at 06:07:39PM -0300, Tiago Vignatti wrote:
> If a shell client decides to call wl_display_connect more than once and only
> later bind the desktop_shell interface, then the logic that uses the client
> pointer fails, because the current client trying to connect won't match with
> the first one assigned there.
> 
> In special, GTK+ is connecting twice every time one application is starting.
> It checks whether a connection to the default display server is possible
> during initialisation and fail otherwise:
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=694465
> 
> I'm afraid we'll want to change the weston_client_launch API to
> return the PID instead, and change the logic in all the callers.

I think we need to look at how to make GTK+ connect to the fd we're
passing to the client instead.  Patches 3 and 4 breaks the trusted
client logic that we use launch helpers and ensure that only they can
connect.

Kristian

> Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
> ---
>  src/shell.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index 246d342..f23b855 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -3397,12 +3397,14 @@ bind_desktop_shell(struct wl_client *client,
>  {
>  	struct desktop_shell *shell = data;
>  	struct wl_resource *resource;
> +	pid_t pid;
>  
>  	resource = wl_client_add_object(client, &desktop_shell_interface,
>  					&desktop_shell_implementation,
>  					id, shell);
>  
> -	if (client == shell->child.client) {
> +	wl_client_get_credentials(client, &pid, NULL, NULL);
> +	if (pid == shell->child.process.pid || pid == getpid()) {
>  		resource->destroy = unbind_desktop_shell;
>  		shell->child.desktop_shell = resource;
>  		return;
> -- 
> 1.7.9.5
> 
> _______________________________________________
> 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