From a5317546c373f64c4c63fa6354dfe61f1d9e17f3 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Thu, 22 Sep 2005 03:09:49 +0000 Subject: [PATCH] Don't allow imap URLs with empty hosts. Also don't attempt to complete on open connections when there aren't any (diagnosed by Nico Golde). Closes: #2079. --- imap/imap.c | 2 +- imap/util.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imap/imap.c b/imap/imap.c index 9be978b8..743137c4 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1612,7 +1612,7 @@ imap_complete_hosts (char *dest, size_t len) } } - for (conn = mutt_socket_head (); conn->next; conn = conn->next) + for (conn = mutt_socket_head (); conn && conn->next; conn = conn->next) { ciss_url_t url; char urlstr[LONG_STRING]; diff --git a/imap/util.c b/imap/util.c index 1ae9e238..8df1fa41 100644 --- a/imap/util.c +++ b/imap/util.c @@ -107,7 +107,7 @@ int imap_parse_path (const char* path, IMAP_MBOX* mx) url_parse_ciss (&url, c); if (url.scheme == U_IMAP || url.scheme == U_IMAPS) { - if (mutt_account_fromurl (&mx->account, &url) < 0) + if (mutt_account_fromurl (&mx->account, &url) < 0 || !*mx->account.host) { FREE (&c); return -1; @@ -165,7 +165,7 @@ int imap_parse_path (const char* path, IMAP_MBOX* mx) } } } - + if ((mx->account.flags & M_ACCT_SSL) && !(mx->account.flags & M_ACCT_PORT)) mx->account.port = ImapsPort; -- 2.40.0