X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Futil.c;h=5062786b3c51b2e25d6b9f35d1a1f09f1f35867e;hb=1bbedb2dcb610160fe7fd2b44bd098248bfd83a0;hp=ec26d65f83deae9d500a64c9a9bc5d410e4bb2ee;hpb=faed98ab64dd3cbd29e674141cd074d6c9f8909c;p=apps%2Fmadmutt.git diff --git a/imap/util.c b/imap/util.c index ec26d65..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) { @@ -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; }