From 76447f763262557489a58b4c6f4145433d5ea8ae Mon Sep 17 00:00:00 2001 From: Rocco Rutte Date: Tue, 2 Jun 2009 17:24:06 +0200 Subject: [PATCH] Fix duplicate mailbox detection for remote folders --- ChangeLog | 9 +++++++++ buffy.c | 10 ++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb6d4dde1..ab8dc8c71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-06-02 17:05 +0200 Rocco Rutte (9ca14dff45c5) + + * smtp.c: Fix array size + +2009-06-02 15:43 +0200 Rocco Rutte (df4a17222b03) + + * ChangeLog, buffy.c: Thoroughly check for duplicates when parsing + 'mailboxes' command. Closes #1428. + 2009-06-01 14:50 +0200 Rocco Rutte (7a277ba306c9) * gnupgparse.c: Use mutt_atoi() when parsing GnuPG output. Closes diff --git a/buffy.c b/buffy.c index 3e9ec2631..40c229ec6 100644 --- a/buffy.c +++ b/buffy.c @@ -197,6 +197,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e char buf[_POSIX_PATH_MAX]; struct stat sb; char f1[PATH_MAX], f2[PATH_MAX]; + char *p, *q; while (MoreArgs (s)) { @@ -219,15 +220,12 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e /* Skip empty tokens. */ if(!*buf) continue; - if (!realpath (buf, f1)) - continue; - /* avoid duplicates */ + p = realpath (buf, f1); for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) { - if (!realpath ((*tmp)->path, f2)) - continue; - if (mutt_strcmp (f1, f2) == 0) + q = realpath ((*tmp)->path, f2); + if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0) { dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); break; -- 2.40.0