From a70bf0ba6127c7d095e0f655159910501d54035e Mon Sep 17 00:00:00 2001 From: Rocco Rutte Date: Tue, 2 Jun 2009 15:43:31 +0200 Subject: [PATCH] Thoroughly check for duplicates when parsing 'mailboxes' command. Closes #1428. --- ChangeLog | 13 +++++++++++++ buffy.c | 13 +++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15a13add1..cb6d4dde1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-06-01 14:50 +0200 Rocco Rutte (7a277ba306c9) + + * gnupgparse.c: Use mutt_atoi() when parsing GnuPG output. Closes + #3145 + +2009-06-01 13:22 +0200 Rocco Rutte (82a581c24f1a) + + * hcache.c, mh.c: More atoi() fixes + +2009-06-01 11:27 +0200 Rocco Rutte (371d7556fec3) + + * ChangeLog, smtp.c: SMTP: Use mutt_atoi() to parse server responses + 2009-06-01 11:26 +0200 Rocco Rutte (35a444838167) * curs_main.c, edit.c, init.c, main.c, menu.c, mh.c, parse.c, diff --git a/buffy.c b/buffy.c index 0c851b5f7..3e9ec2631 100644 --- a/buffy.c +++ b/buffy.c @@ -196,6 +196,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e BUFFY **tmp,*tmp1; char buf[_POSIX_PATH_MAX]; struct stat sb; + char f1[PATH_MAX], f2[PATH_MAX]; while (MoreArgs (s)) { @@ -218,11 +219,19 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e /* Skip empty tokens. */ if(!*buf) continue; - /* simple check to avoid duplicates */ + if (!realpath (buf, f1)) + continue; + + /* avoid duplicates */ for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) { - if (mutt_strcmp (buf, (*tmp)->path) == 0) + if (!realpath ((*tmp)->path, f2)) + continue; + if (mutt_strcmp (f1, f2) == 0) + { + dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); break; + } } if(data == M_UNMAILBOXES) -- 2.40.0