X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Futil.c;h=5062786b3c51b2e25d6b9f35d1a1f09f1f35867e;hb=777c7ccc259a8b7f5fadac70267c59e62a2cb300;hp=18d055a58e213e5026579b909e6e75ffe6337e77;hpb=6833ce8bdca2d64e14485118f2a4417b7e1cb1b1;p=apps%2Fmadmutt.git diff --git a/imap/util.c b/imap/util.c index 18d055a..5062786 100644 --- a/imap/util.c +++ b/imap/util.c @@ -20,6 +20,8 @@ /* general IMAP utility functions */ +#include "config.h" + #include "mutt.h" #include "mx.h" /* for M_IMAP */ #include "url.h" @@ -148,7 +150,7 @@ int imap_parse_path (const char* path, IMAP_MBOX* mx) } if (n > 1) { - if (sscanf (tmp, ":%hd%127s", &(mx->account.port), tmp) >= 1) + if (sscanf (tmp, ":%hu%127s", &(mx->account.port), tmp) >= 1) mx->account.flags |= M_ACCT_PORT; if (sscanf (tmp, "/%s", tmp) == 1) { @@ -164,7 +166,7 @@ int imap_parse_path (const char* path, IMAP_MBOX* mx) } } -#ifdef USE_SSL +#if defined(USE_SSL) || defined(USE_GNUTLS) if (option (OPTIMAPFORCESSL)) mx->account.flags |= M_ACCT_SSL; #endif @@ -269,6 +271,7 @@ void imap_free_idata (IMAP_DATA** idata) { * in IMAP. Additionally, the filesystem converts multiple hierarchy * delimiters into a single one, ie "///" is equal to "/". IMAP servers * are not required to do this. + * Moreover, IMAP servers may dislike the path ending with the delimiter. */ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, size_t plen) @@ -295,6 +298,8 @@ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, } x++; } + if (x && path[--x] != idata->delim) + x++; path[x] = '\0'; return path; }