summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2007-04-13 22:05:43 +0000
committerbeck <beck@openbsd.org>2007-04-13 22:05:43 +0000
commit454d30b46667b7413a93c381401c82263810022d (patch)
tree2bc0b83fcad636f8bd80ed953ade7a436e73b659
parentdocument dmesg(8) attachment a little more fully; ok ray (diff)
downloadwireguard-openbsd-454d30b46667b7413a93c381401c82263810022d.tar.xz
wireguard-openbsd-454d30b46667b7413a93c381401c82263810022d.zip
fix helo to error out if no domain is provided
ok millert@
-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;
}