diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-07-25 15:45:01 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-07-25 15:45:01 +0800 |
commit | 6147ca54a454838e00dfa108db5b13ec10b9aa2f (patch) | |
tree | c1eecdeca212e75521bd23e2ed7700add5206a11 /filter/filter-file.c | |
parent | e5cd4631f66e182c67bfb45df3f8a04f08761ce2 (diff) | |
download | gsoc2013-evolution-6147ca54a454838e00dfa108db5b13ec10b9aa2f.tar.gz gsoc2013-evolution-6147ca54a454838e00dfa108db5b13ec10b9aa2f.tar.zst gsoc2013-evolution-6147ca54a454838e00dfa108db5b13ec10b9aa2f.zip |
Do some minimalistic validation of command-lines (ie, make sure it isn't
2002-07-25 Jeffrey Stedfast <fejj@ximian.com>
* filter-file.c (validate): Do some minimalistic validation of
command-lines (ie, make sure it isn't an empty string).
* filtertypes.xml: s/shell-exec/shell/ (for the action) and pass
"/bin/sh" "-c" as the first 2 arguments. For the shell-exec
*rule*, change the name to "pipe-message" and add the "/bin/sh"
"-c" arguments too.
svn path=/trunk/; revision=17584
Diffstat (limited to 'filter/filter-file.c')
-rw-r--r-- | filter/filter-file.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/filter/filter-file.c b/filter/filter-file.c index b34dd0f773..14f8e04d5b 100644 --- a/filter/filter-file.c +++ b/filter/filter-file.c @@ -181,29 +181,34 @@ validate (FilterElement *fe) return FALSE; } - /* FIXME: validate command-lines? */ + /* FIXME: do more to validate command-lines? */ if (strcmp (file->type, "file") != 0) { if (stat (file->path, &st) == -1 || !S_ISREG (st.st_mode)) { char *errmsg; - errmsg = g_strdup_printf (_("File '%s' does not exist or is not a regular file."), file->path); + errmsg = g_strdup_printf (_("File '%s' does not exist or is not a regular file."), + file->path); dialog = gnome_ok_dialog (errmsg); g_free (errmsg); gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); return FALSE; } + } else if (strcmp (file->type, "command") != 0) { + /* only requirements so far is that the command can't + be an empty string */ + return file->path[0] != '\0'; } return TRUE; } static int -file_eq(FilterElement *fe, FilterElement *cm) +file_eq (FilterElement *fe, FilterElement *cm) { FilterFile *ff = (FilterFile *)fe, *cf = (FilterFile *)cm; - + return ((FilterElementClass *)(parent_class))->eq(fe, cm) && ((ff->path && cf->path && strcmp(ff->path, cf->path) == 0) || (ff->path == NULL && cf->path == NULL)) @@ -216,7 +221,6 @@ xml_create (FilterElement *fe, xmlNodePtr node) { /* parent implementation */ ((FilterElementClass *)(parent_class))->xml_create (fe, node); - } static xmlNodePtr |