summaryrefslogtreecommitdiff
path: root/libexec/spamd/spamd.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2007-04-13 22:05:44 +0000
committerBob Beck <beck@cvs.openbsd.org>2007-04-13 22:05:44 +0000
commit4704e640a756e08ecc24cab22781cbfa1ea52c4d (patch)
tree6169fcb430023a6c9a8423a2f2056c9649af0273 /libexec/spamd/spamd.c
parent6d8eba7acc344e783695b2afa54aeabf77f7f3c1 (diff)
fix helo to error out if no domain is provided
ok millert@
Diffstat (limited to 'libexec/spamd/spamd.c')
-rw-r--r--libexec/spamd/spamd.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c
index b8ebaef39a1..c13c830bdc1 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.101 2007/03/26 16:40:56 beck Exp $ */
+/* $OpenBSD: spamd.c,v 1.102 2007/04/13 22:05:43 beck Exp $ */
/*
* Copyright (c) 2002-2007 Bob Beck. All rights reserved.
@@ -733,14 +733,22 @@ nextstate(struct con *cp)
/* received input: parse, and select next state */
if (match(cp->ibuf, "HELO") ||
match(cp->ibuf, "EHLO")) {
+ int nextstate = 2;
+ cp->helo[0] = '\0';
gethelo(cp->helo, sizeof cp->helo, cp->ibuf);
- snprintf(cp->obuf, cp->osize,
- "250 Hello, spam sender. "
- "Pleased to be wasting your time.\r\n");
+ if (cp->helo[0] == '\0') {
+ nextstate = 0;
+ snprintf(cp->obuf, cp->osize,
+ "501 helo requires domain name.\r\n");
+ } else {
+ snprintf(cp->obuf, cp->osize,
+ "250 Hello, spam sender. "
+ "Pleased to be wasting your time.\r\n");
+ }
cp->op = cp->obuf;
cp->ol = strlen(cp->op);
cp->laststate = cp->state;
- cp->state = 2;
+ cp->state = nextstate;
cp->w = t + cp->stutter;
break;
}