aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/providers/local/camel-mbox-store.c14
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,