[evince/mcatanzaro/#1333] Remove ability to launch actions
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/mcatanzaro/#1333] Remove ability to launch actions
- Date: Tue, 22 Sep 2020 15:24:13 +0000 (UTC)
commit e85a79a355ff40149669611812695aad87a1af8d
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Sep 22 10:23:41 2020 -0500
Remove ability to launch actions
This is basically only ever used by malware. Like PDF JavaScript, it's
more dangerous than useful.
Fixes #1333
shell/ev-window.c | 59 +++----------------------------------------------------
1 file changed, 3 insertions(+), 56 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 81a6ede1..69602ca6 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6697,62 +6697,9 @@ window_configure_event_cb (EvWindow *window, GdkEventConfigure *event, gpointer
static void
launch_action (EvWindow *window, EvLinkAction *action)
{
- EvWindowPrivate *priv = GET_PRIVATE (window);
- const char *filename = ev_link_action_get_filename (action);
- GAppInfo *app_info;
- GFile *file;
- GList file_list = {NULL};
- GdkAppLaunchContext *context;
- GdkScreen *screen;
- GError *error = NULL;
-
- if (filename == NULL)
- return;
-
- if (g_path_is_absolute (filename)) {
- file = g_file_new_for_path (filename);
- } else {
- GFile *base_file;
- gchar *dir;
-
- dir = g_path_get_dirname (priv->uri);
- base_file = g_file_new_for_uri (dir);
- g_free (dir);
-
- file = g_file_resolve_relative_path (base_file, filename);
- g_object_unref (base_file);
- }
-
- app_info = g_file_query_default_handler (file, NULL, &error);
- if (!app_info) {
- ev_window_error_message (window, error,
- "%s",
- _("Unable to launch external application."));
- g_object_unref (file);
- g_error_free (error);
-
- return;
- }
-
- screen = gtk_window_get_screen (GTK_WINDOW (window));
- context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
- gdk_app_launch_context_set_screen (context, screen);
- gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
-
- file_list.data = file;
- if (!g_app_info_launch (app_info, &file_list, G_APP_LAUNCH_CONTEXT (context), &error)) {
- ev_window_error_message (window, error,
- "%s",
- _("Unable to launch external application."));
- g_error_free (error);
- }
-
- g_object_unref (app_info);
- g_object_unref (file);
- /* FIXMEchpe: unref launch context? */
-
- /* According to the PDF spec filename can be an executable. I'm not sure
- allowing to launch executables is a good idea though. -- marco */
+ ev_window_warning_message (window,
+ _("Security alert: this document has been prevented from opening the file
ā%sā"),
+ ev_link_action_get_filename (action));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]