From 636c862c7aa0be1dca505032225e3601ae2e219b Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 13 Apr 2004 20:53:58 +0000 Subject: Rearranged some error checking code to fix bug #56405. 2004-04-13 Jeffrey Stedfast * providers/imap/camel-imap-store.c (get_folder_online): Rearranged some error checking code to fix bug #56405. svn path=/trunk/; revision=25448 --- camel/ChangeLog | 5 +++++ camel/providers/imap/camel-imap-store.c | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index d01fd2a9b5..6ad5407bc5 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2004-04-13 Jeffrey Stedfast + + * providers/imap/camel-imap-store.c (get_folder_online): + Rearranged some error checking code to fix bug #56405. + 2004-04-13 Not Zed * camel-folder.c (folder_getv): implement the new counts, and get diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 5b083972be..58e60cd1a7 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -524,8 +524,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE int port, ret; char *buf; - h = camel_service_gethost (service, ex); - if (!h) + if (!(h = camel_service_gethost (service, ex))) return FALSE; port = service->url->port ? service->url->port : 143; @@ -1791,7 +1790,14 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca return NULL; } - c = folder_name; + if ((parent_name = strrchr (folder_name, '/'))) { + parent_name = g_strndup (folder_name, parent_name - folder_name); + parent_real = camel_imap_store_summary_path_to_full (imap_store->summary, parent_name, store->dir_sep); + } else { + parent_real = NULL; + } + + c = parent_name ? parent_name : folder_name; while (*c && *c != imap_store->dir_sep && !strchr ("#%*", *c)) c++; @@ -1800,16 +1806,11 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH, _("The folder name \"%s\" is invalid because it contains the character \"%c\""), folder_name, *c); + g_free (parent_name); + g_free (parent_real); return NULL; } - if ((parent_name = strrchr (folder_name, '/'))) { - parent_name = g_strndup (folder_name, parent_name - folder_name); - parent_real = camel_imap_store_summary_path_to_full (imap_store->summary, parent_name, store->dir_sep); - } else { - parent_real = NULL; - } - if (parent_real != NULL) { gboolean need_convert = FALSE; char *resp, *thisone; -- cgit