diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-02-20 02:58:18 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-02-20 02:58:18 +0800 |
commit | 7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f (patch) | |
tree | 4c39cf895ceec582a0f3a3050b36201e184870b2 /camel | |
parent | 2aa12fd3ee68f73fc82251388af26d0e0d86a615 (diff) | |
download | gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.tar gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.tar.gz gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.tar.bz2 gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.tar.lz gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.tar.xz gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.tar.zst gsoc2013-evolution-7ed1e7cc4810f2ca5a48b88e2fbf2041e9ef4f6f.zip |
Add sanity checking to the folder name if we are going to create it, just
2004-02-19 Jeffrey Stedfast <fejj@ximian.com>
* providers/local/camel-mbox-store.c (get_folder): Add sanity
checking to the folder name if we are going to create it, just
like we do in create_folder().
svn path=/trunk/; revision=24796
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/providers/local/camel-mbox-store.c | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 58ef4d3209..5d7d8aeee0 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2004-02-19 Jeffrey Stedfast <fejj@ximian.com> + + * providers/local/camel-mbox-store.c (get_folder): Add sanity + checking to the folder name if we are going to create it, just + like we do in create_folder(). + 2004-02-19 Not Zed <NotZed@Ximian.com> * providers/*/camel-*-provider.c diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index ef11791e8c..12be516797 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -145,6 +145,7 @@ get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelExcep name = mbox_folder_name_to_path(store, folder_name); if (stat(name, &st) == -1) { + const char *basename; char *dirname; int fd; @@ -164,6 +165,19 @@ get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelExcep return NULL; } + /* sanity check the folder name */ + if (!(basename = strrchr (folder_name, '/'))) + basename = folder_name; + else + basename++; + + if (basename[0] == '.' || ignore_file (basename, TRUE)) { + camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot create a folder by this name.")); + g_free (name); + return NULL; + } + dirname = g_path_get_dirname(name); if (camel_mkdir(dirname, 0777) == -1 && errno != EEXIST) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, |