From: Timo Sirainen Date: Fri, 4 Feb 2011 17:48:29 +0000 (+0200) Subject: lmtp: Fixed handling recipient_delimiter when it was found from domain name. X-Git-Tag: 2.0.10~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b22071c71a99bcb71ee9fcfbb83ed5bf5e08a2d;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Fixed handling recipient_delimiter when it was found from domain name. --- diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index 07e7c4fc1b..8de0046085 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -323,7 +323,7 @@ static const char *lmtp_unescape_address(const char *name) static void rcpt_address_parse(struct client *client, const char *address, const char **username_r, const char **detail_r) { - const char *p, *p2; + const char *p, *domain; *username_r = address; *detail_r = ""; @@ -331,16 +331,16 @@ static void rcpt_address_parse(struct client *client, const char *address, if (*client->set->recipient_delimiter == '\0') return; + domain = strchr(address, '@'); p = strstr(address, client->set->recipient_delimiter); - if (p != NULL) { + if (p != NULL && (domain == NULL || p < domain)) { /* user+detail@domain */ *username_r = t_strdup_until(*username_r, p); - p2 = strchr(p, '@'); - if (p2 == NULL) + if (domain == NULL) *detail_r = p+1; else { - *detail_r = t_strdup_until(p+1, p2); - *username_r = t_strconcat(*username_r, p2, NULL); + *detail_r = t_strdup_until(p+1, domain); + *username_r = t_strconcat(*username_r, domain, NULL); } } }