forked from enlightenment/enlightenment
parent
71bdb93fba
commit
2b8c0c4d6e
186
src/bin/e_ipc.c
186
src/bin/e_ipc.c
|
@ -2,9 +2,15 @@
|
||||||
|
|
||||||
#ifdef USE_IPC
|
#ifdef USE_IPC
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event);
|
static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__,
|
||||||
static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event);
|
int type __UNUSED__,
|
||||||
static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event);
|
void *event);
|
||||||
|
static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__,
|
||||||
|
int type __UNUSED__,
|
||||||
|
void *event);
|
||||||
|
static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__,
|
||||||
|
int type __UNUSED__,
|
||||||
|
void *event);
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
||||||
|
@ -32,35 +38,35 @@ e_ipc_init(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(buf, &st) == 0)
|
if (stat(buf, &st) == 0)
|
||||||
{
|
{
|
||||||
if ((st.st_uid ==
|
if ((st.st_uid ==
|
||||||
getuid()) &&
|
getuid()) &&
|
||||||
((st.st_mode & (S_IFDIR|S_IRWXU|S_IRWXG|S_IRWXO)) ==
|
((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) ==
|
||||||
(S_IRWXU|S_IFDIR)))
|
(S_IRWXU | S_IFDIR)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e_error_message_show(_("Possible IPC Hack Attempt. The IPC socket\n"
|
e_error_message_show(_("Possible IPC Hack Attempt. The IPC socket\n"
|
||||||
"directory already exists BUT has permissions\n"
|
"directory already exists BUT has permissions\n"
|
||||||
"that are too leanient (must only be readable\n" "and writable by the owner, and nobody else)\n"
|
"that are too leanient (must only be readable\n" "and writable by the owner, and nobody else)\n"
|
||||||
"or is not owned by you. Please check:\n"
|
"or is not owned by you. Please check:\n"
|
||||||
"%s/enlightenment-%s\n"), tmp, user);
|
"%s/enlightenment-%s\n"), tmp, user);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e_error_message_show(_("The IPC socket directory cannot be created or\n"
|
e_error_message_show(_("The IPC socket directory cannot be created or\n"
|
||||||
"examined.\n"
|
"examined.\n"
|
||||||
"Please check:\n"
|
"Please check:\n"
|
||||||
"%s/enlightenment-%s\n"),
|
"%s/enlightenment-%s\n"),
|
||||||
tmp, user);
|
tmp, user);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snprintf(buf, sizeof(buf), "%s/enlightenment-%s/disp-%s-%i", tmp, user, disp, pid);
|
snprintf(buf, sizeof(buf), "%s/enlightenment-%s/disp-%s-%i", tmp, user, disp, pid);
|
||||||
_e_ipc_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_SYSTEM, buf, 0, NULL);
|
_e_ipc_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_SYSTEM, buf, 0, NULL);
|
||||||
|
@ -84,8 +90,8 @@ e_ipc_shutdown(void)
|
||||||
e_ipc_codec_shutdown();
|
e_ipc_codec_shutdown();
|
||||||
if (_e_ipc_server)
|
if (_e_ipc_server)
|
||||||
{
|
{
|
||||||
ecore_ipc_server_del(_e_ipc_server);
|
ecore_ipc_server_del(_e_ipc_server);
|
||||||
_e_ipc_server = NULL;
|
_e_ipc_server = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -94,7 +100,9 @@ e_ipc_shutdown(void)
|
||||||
#ifdef USE_IPC
|
#ifdef USE_IPC
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_e_ipc_cb_client_add(void *data __UNUSED__,
|
||||||
|
int type __UNUSED__,
|
||||||
|
void *event)
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Event_Client_Add *e;
|
Ecore_Ipc_Event_Client_Add *e;
|
||||||
|
|
||||||
|
@ -104,7 +112,9 @@ _e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_e_ipc_cb_client_del(void *data __UNUSED__,
|
||||||
|
int type __UNUSED__,
|
||||||
|
void *event)
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Event_Client_Del *e;
|
Ecore_Ipc_Event_Client_Del *e;
|
||||||
|
|
||||||
|
@ -119,7 +129,9 @@ _e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
_e_ipc_cb_client_data(void *data __UNUSED__,
|
||||||
|
int type __UNUSED__,
|
||||||
|
void *event)
|
||||||
{
|
{
|
||||||
Ecore_Ipc_Event_Client_Data *e;
|
Ecore_Ipc_Event_Client_Data *e;
|
||||||
|
|
||||||
|
@ -133,67 +145,73 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
case E_IPC_DOMAIN_EVENT:
|
case E_IPC_DOMAIN_EVENT:
|
||||||
switch (e->minor)
|
switch (e->minor)
|
||||||
{
|
{
|
||||||
case E_IPC_OP_EXEC_ACTION:
|
case E_IPC_OP_EXEC_ACTION:
|
||||||
{
|
{
|
||||||
E_Ipc_2Str *req = NULL;
|
E_Ipc_2Str *req = NULL;
|
||||||
|
|
||||||
if (e_ipc_codec_2str_dec(e->data, e->size, &req))
|
if (e_ipc_codec_2str_dec(e->data, e->size, &req))
|
||||||
{
|
{
|
||||||
Eina_List *m = e_manager_list();
|
Eina_List *m = e_manager_list();
|
||||||
int len, ok = 0;
|
int len, ok = 0;
|
||||||
void *d;
|
void *d;
|
||||||
|
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
E_Manager *man = eina_list_data_get(m);
|
E_Manager *man = eina_list_data_get(m);
|
||||||
|
|
||||||
if (man)
|
if (man)
|
||||||
{
|
{
|
||||||
E_Action *act = e_action_find(req->str1);
|
E_Action *act = e_action_find(req->str1);
|
||||||
|
|
||||||
if (act && act->func.go)
|
if (act && act->func.go)
|
||||||
{
|
{
|
||||||
act->func.go(E_OBJECT(man), req->str2);
|
act->func.go(E_OBJECT(man), req->str2);
|
||||||
ok = 1;
|
ok = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d = e_ipc_codec_int_enc(ok, &len);
|
d = e_ipc_codec_int_enc(ok, &len);
|
||||||
if (d)
|
if (d)
|
||||||
{
|
{
|
||||||
ecore_ipc_client_send(e->client,
|
ecore_ipc_client_send(e->client,
|
||||||
E_IPC_DOMAIN_REPLY,
|
E_IPC_DOMAIN_REPLY,
|
||||||
E_IPC_OP_EXEC_ACTION_REPLY,
|
E_IPC_OP_EXEC_ACTION_REPLY,
|
||||||
0, 0, 0, d, len);
|
0, 0, 0, d, len);
|
||||||
free(d);
|
free(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req)
|
if (req)
|
||||||
{
|
{
|
||||||
E_FREE(req->str1);
|
E_FREE(req->str1);
|
||||||
E_FREE(req->str2);
|
E_FREE(req->str2);
|
||||||
E_FREE(req);
|
E_FREE(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_IPC_DOMAIN_THUMB:
|
case E_IPC_DOMAIN_THUMB:
|
||||||
e_thumb_client_data(e);
|
e_thumb_client_data(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_IPC_DOMAIN_FM:
|
case E_IPC_DOMAIN_FM:
|
||||||
e_fm2_client_data(e);
|
e_fm2_client_data(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_IPC_DOMAIN_INIT:
|
case E_IPC_DOMAIN_INIT:
|
||||||
e_init_client_data(e);
|
e_init_client_data(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue