diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-28 14:15:52 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-28 14:15:52 +0000 |
commit | 6dbe30997e112fba9bddf60cecdcb864bd470de4 (patch) | |
tree | c2d62cc0cd717e89f72e44597ae33c7154dd4948 | |
parent | 11527568264fe64c53f09cc9a3c17b561619bc25 (diff) |
if recipient was provided as a username, append the local hostname, this
unbreaks:
$ echo foo | mail gilles
send-mail: invalid recipient address.
-rw-r--r-- | usr.sbin/smtpd/enqueue.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index 0eb5cd47b3d..c2c37bae80e 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.4 2009/01/28 11:27:57 gilles Exp $ */ +/* $OpenBSD: enqueue.c,v 1.5 2009/01/28 14:15:51 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -153,6 +153,14 @@ enqueue_add_recipient(struct message *messagep, char *recipient) errx(1, "recipient address too long."); return 0; } + + if (strchr(buffer, '@') == NULL) { + if (! bsnprintf(buffer, sizeof(buffer), "%s@%s", + buffer, messagep->sender.domain)) + errx(1, "recipient address too long."); + } + + printf("recipient: %s", buffer); if (! recipient_to_path(&message.recipient, buffer)) { errx(1, "invalid recipient address."); |