Binding input method will be allowed to wl_client that is created by enlightenment.

Summary:
Added code to check whether wl_client's pid is equal to enlightenment's.
this means, only enlightenment modules can bind wl_text_input interface.

Reviewers: zmike, devilhorns, ManMower

Reviewed By: devilhorns, ManMower

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2981
This commit is contained in:
Seunghun Lee 2015-09-07 13:12:53 -04:00 committed by Mike Blumenkrantz
parent 92d1c36be7
commit a6a0332f45
1 changed files with 12 additions and 4 deletions

View File

@ -853,6 +853,7 @@ _e_text_cb_bind_input_method(struct wl_client *client, void *data EINA_UNUSED, u
{
E_Input_Method *input_method;
struct wl_resource *resource;
pid_t pid;
resource = wl_resource_create(client, &wl_input_method_interface, 1, id);
if (!resource)
@ -869,9 +870,17 @@ _e_text_cb_bind_input_method(struct wl_client *client, void *data EINA_UNUSED, u
wl_resource_destroy(resource);
return;
}
#warning FIXME SECURITY
/* FIXME: we need to make sure the client attempting to bind
this interface really provides vkbd. */
wl_client_get_credentials(client, &pid, NULL, NULL);
if (pid != getpid())
{
ERR("Permission to bind input method denied");
wl_resource_post_error(resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"permission to bind input_method denied");
wl_resource_destroy(resource);
return;
}
input_method = E_NEW(E_Input_Method, 1);
if (!input_method)
@ -900,7 +909,6 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Text_Input" };
EAPI void *
e_modapi_init(E_Module *m)
{
return NULL;
// FIXME: create only one input method object per seat.
e_comp->wl_comp_data->seat.im.global =
wl_global_create(e_comp->wl_comp_data->wl.disp, &wl_input_method_interface, 1,