From 4e0b71d26ea73fe5ae324cc9c5caa7f204760781 Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Wed, 15 Feb 2012 14:55:25 -0500 Subject: [PATCH] Hm, it turns out we need to make sure we call getname() until we get a NULL, otherwise the next set of calls to it will be working from the "old" search string. --- sbr/addrsbr.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index 633f6ef..ffdac3f 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -373,8 +373,13 @@ ismymbox (struct mailname *np) if ((am = context_find ("local-mailbox"))) { struct mailname *mptr; - if ((mptr = getm (am, NULL, 0, AD_NAME, NULL)) == NULL) { - admonish (NULL, "invalid entry in local-mailbox: %s", am); + if ((cp = getname(am)) == NULL) { + admonish (NULL, "Unable to find address in local-mailbox"); + return 0; + } + + if ((mptr = getm (cp, NULL, 0, AD_NAME, NULL)) == NULL) { + admonish (NULL, "invalid entry in local-mailbox: %s", cp); return 0; } @@ -387,6 +392,14 @@ ismymbox (struct mailname *np) mq = *mptr; free(mptr); + + /* + * Sigh, it turns out that the address parser gets messed up + * if you don't call getname() until it returns NULL. + */ + + while ((cp = getname(am)) != NULL) + ; } else { mq.m_mbox = getusername (); } -- 1.7.10.4