summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortodd <todd@openbsd.org>2012-08-23 13:16:02 +0000
committertodd <todd@openbsd.org>2012-08-23 13:16:02 +0000
commitfc01a027ae1599db75c449cabf2f5095dda56585 (patch)
treea4ec300315ceabfa51d15d773c132db32aa5eee3
parentadd -R to sendmail compat flags that do nothing (for now) (diff)
downloadwireguard-openbsd-fc01a027ae1599db75c449cabf2f5095dda56585.tar.xz
wireguard-openbsd-fc01a027ae1599db75c449cabf2f5095dda56585.zip
fix multiple recipient support, from sunil on irc
tested by me, ok gilles@
-rw-r--r--usr.sbin/smtpd/enqueue.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index ad442be9633..05a4880021b 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.59 2012/08/23 13:06:29 todd Exp $ */
+/* $OpenBSD: enqueue.c,v 1.60 2012/08/23 13:16:02 todd Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -636,12 +636,27 @@ static void
rcpt_add(char *addr)
{
void *nrcpts;
+ char *p;
+ int n;
+
+ n = 1;
+ p = addr;
+ while ((p = strchr(p, ',')) != NULL) {
+ n++;
+ p++;
+ }
if ((nrcpts = realloc(msg.rcpts,
- sizeof(char *) * (msg.rcpt_cnt + 1))) == NULL)
+ sizeof(char *) * (msg.rcpt_cnt + n))) == NULL)
err(1, "rcpt_add realloc");
msg.rcpts = nrcpts;
- msg.rcpts[msg.rcpt_cnt++] = qualify_addr(addr);
+
+ while (n--) {
+ if ((p = strchr(addr, ',')) != NULL)
+ *p++ = '\0';
+ msg.rcpts[msg.rcpt_cnt++] = qualify_addr(addr);
+ addr = p;
+ }
}
static int