discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=a6a0332f45fc591603cb4d3115e16d057287de37

commit a6a0332f45fc591603cb4d3115e16d057287de37
Author: Seunghun Lee <shiin....@samsung.com>
Date:   Mon Sep 7 13:12:53 2015 -0400

    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
---
 src/modules/wl_text_input/e_mod_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/modules/wl_text_input/e_mod_main.c 
b/src/modules/wl_text_input/e_mod_main.c
index 718aaeb..473d479 100644
--- a/src/modules/wl_text_input/e_mod_main.c
+++ b/src/modules/wl_text_input/e_mod_main.c
@@ -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,

-- 


Reply via email to