diff options
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | 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 <fejj@ximian.com> + + * providers/imap/camel-imap-store.c (get_folder_online): + Rearranged some error checking code to fix bug #56405. + 2004-04-13 Not Zed <NotZed@Ximian.com> * 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; |