summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2018-12-16 11:13:20 +0100
committerBoris Faure <billiob@gmail.com>2018-12-16 11:36:15 +0100
commit1ac204da9148e7bccb1b5f34b523e2094dfc39e2 (patch)
tree64fa3fae7d9d19fa510e1af19d2f720bef5d0a9d
parent64b58bb09452ae9799c477aef2767f9aecb981d9 (diff)
media: only popup known media types through special escape codes. Closes T7504
Those media files are opened within Terminology and not through an external component, thus reducing the attack surface. It is still possible to disable Terminology's escape codes in the settings panel.
-rw-r--r--src/bin/media.c19
-rw-r--r--src/bin/media.h1
-rw-r--r--src/bin/win.c5
3 files changed, 1 insertions, 24 deletions
diff --git a/src/bin/media.c b/src/bin/media.c
index 29381a0..d715519 100644
--- a/src/bin/media.c
+++ b/src/bin/media.c
@@ -1531,22 +1531,3 @@ media_control_get(const Evas_Object *obj)
1531 if (!sd) return NULL; 1531 if (!sd) return NULL;
1532 return sd->o_ctrl; 1532 return sd->o_ctrl;
1533} 1533}
1534
1535void
1536media_unknown_handle(const char *handler, const char *src)
1537{
1538 const char *cmd;
1539 char buf[PATH_MAX];
1540 char *escaped;
1541
1542 cmd = "xdg-open";
1543 escaped = ecore_file_escape_name(src);
1544 if (!escaped)
1545 return;
1546 if (handler && *handler)
1547 cmd = handler;
1548 snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
1549 free(escaped);
1550
1551 ecore_exe_run(buf, NULL);
1552}
diff --git a/src/bin/media.h b/src/bin/media.h
index 5f33cd4..014ed8f 100644
--- a/src/bin/media.h
+++ b/src/bin/media.h
@@ -38,6 +38,5 @@ void media_stop(Evas_Object *obj);
38const char *media_get(const Evas_Object *obj); 38const char *media_get(const Evas_Object *obj);
39Media_Type media_src_type_get(const char *src); 39Media_Type media_src_type_get(const char *src);
40Evas_Object *media_control_get(const Evas_Object *obj); 40Evas_Object *media_control_get(const Evas_Object *obj);
41void media_unknown_handle(const char *handler, const char *src);
42 41
43#endif 42#endif
diff --git a/src/bin/win.c b/src/bin/win.c
index 5b3dd01..75c7cd8 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -4082,7 +4082,7 @@ static Eina_Bool
4082_media_http_head_timeout(void *data) 4082_media_http_head_timeout(void *data)
4083{ 4083{
4084 Ty_Http_Head *ty_head = data; 4084 Ty_Http_Head *ty_head = data;
4085 media_unknown_handle(ty_head->handler, ty_head->src); 4085
4086 ty_head->timeout = NULL; 4086 ty_head->timeout = NULL;
4087 _ty_http_head_delete(ty_head); 4087 _ty_http_head_delete(ty_head);
4088 return ECORE_CALLBACK_CANCEL; 4088 return ECORE_CALLBACK_CANCEL;
@@ -4151,7 +4151,6 @@ _media_http_head_complete(void *data,
4151 _ty_http_head_delete(ty_head); 4151 _ty_http_head_delete(ty_head);
4152 return EINA_TRUE; 4152 return EINA_TRUE;
4153error: 4153error:
4154 media_unknown_handle(ty_head->handler, ty_head->src);
4155 _ty_http_head_delete(ty_head); 4154 _ty_http_head_delete(ty_head);
4156 return EINA_TRUE; 4155 return EINA_TRUE;
4157} 4156}
@@ -4192,8 +4191,6 @@ _popmedia(Term *term, const char *src)
4192error: 4191error:
4193 _ty_http_head_delete(ty_head); 4192 _ty_http_head_delete(ty_head);
4194#endif 4193#endif
4195
4196 media_unknown_handle(config->helper.local.general, src);
4197 } 4194 }
4198 else 4195 else
4199 { 4196 {