[PATCH weston 1/3] shell: Skip malicious clients on kill binding

Kristian Høgsberg hoegsberg at gmail.com
Thu Oct 4 08:05:57 PDT 2012


On Thu, Sep 27, 2012 at 05:48:35PM +0300, Tiago Vignatti wrote:
> Also remove superfluous variables.

Committed with a tweak to the comments: it's not malicious clients, in
fact it's the opposite, it's clients that we've forked ourselves and
typically trust more than the average client.

Kristian

> Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
> ---
>  src/shell.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index e043004..789fc36 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -3506,15 +3506,17 @@ force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
>  	struct wl_surface *focus_surface;
>  	struct wl_client *client;
>  	pid_t pid;
> -	uid_t uid;
> -	gid_t gid;
>  
>  	focus_surface = seat->keyboard->focus;
>  	if (!focus_surface)
>  		return;
>  
>  	client = focus_surface->resource.client;
> -	wl_client_get_credentials(client, &pid, &uid, &gid);
> +	wl_client_get_credentials(client, &pid, NULL, NULL);
> +
> +	/* skip malicious clients */
> +	if (pid == getpid())
> +		return;
>  
>  	kill(pid, SIGKILL);
>  }
> -- 
> 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