diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-04-28 23:51:57 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-04-28 23:51:57 +0800 |
commit | fdf4f455f632048edbb63096b767453456c617e4 (patch) | |
tree | faff1243782d2c42c610d9343e08b4f6feea0f70 /mail/em-composer-prefs.c | |
parent | 518c1cc2fd6d3e7255bc498e4ca67872b7370c4f (diff) | |
download | gsoc2013-evolution-fdf4f455f632048edbb63096b767453456c617e4.tar.gz gsoc2013-evolution-fdf4f455f632048edbb63096b767453456c617e4.tar.zst gsoc2013-evolution-fdf4f455f632048edbb63096b767453456c617e4.zip |
Use g_shell_parse_argv() to get the actual script path and then check that
2004-04-28 Jeffrey Stedfast <fejj@ximian.com>
* em-composer-prefs.c (sig_add_script_response): Use
g_shell_parse_argv() to get the actual script path and then check
that we can exec argv[0] rather than treating the entire
command-line as the signature script. Fixes bug #57305.
svn path=/trunk/; revision=25667
Diffstat (limited to 'mail/em-composer-prefs.c')
-rw-r--r-- | mail/em-composer-prefs.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 554e115e78..b5193900ed 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -355,9 +355,10 @@ sig_add_cb (GtkWidget *widget, EMComposerPrefs *prefs) static void sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs) { - const char *name; - char *script; + char *script, **argv = NULL; GtkWidget *entry; + const char *name; + int argc; if (button == GTK_RESPONSE_ACCEPT) { entry = glade_xml_get_widget (prefs->sig_script_gui, "fileentry_add_script_script"); @@ -365,10 +366,10 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs) entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name"); name = gtk_entry_get_text (GTK_ENTRY (entry)); - if (script && *script) { + if (script && *script && g_shell_parse_argv (script, &argc, &argv, NULL)) { struct stat st; - if (stat (script, &st) && S_ISREG (st.st_mode) && access (script, X_OK) == 0) { + if (stat (argv[0], &st) && S_ISREG (st.st_mode) && access (argv[0], X_OK) == 0) { GtkWidget *parent; ESignature *sig; @@ -385,14 +386,16 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs) } gtk_widget_hide (prefs->sig_script_dialog); - g_free(script); + g_strfreev (argv); + g_free (script); return; } } - e_error_run((GtkWindow *)prefs->sig_script_dialog, "mail:signature-notscript", script, NULL); - g_free(script); + e_error_run((GtkWindow *)prefs->sig_script_dialog, "mail:signature-notscript", argv ? argv[0] : script, NULL); + g_strfreev (argv); + g_free (script); return; } |