summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2007-02-23 22:40:51 +0000
committerBob Beck <beck@cvs.openbsd.org>2007-02-23 22:40:51 +0000
commit771f29855204c3081e6cdbe0535e92ecf5439aac (patch)
tree9e461732b057f37ffe9daa0e347f2208fb1d156f /usr.sbin
parent27e24051e0b64336cd01241c62240c6b8c2b2394 (diff)
Make spamd include the HELO/EHLO identification string sent by
the connecting hosts in the tuple key when greylisting. catches a few more bogus hosts and will let us trap based on HELO later. Changes spamdb(8) output to include the new field. ok deraadt@, jmc@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/spamdb/spamdb.87
-rw-r--r--usr.sbin/spamdb/spamdb.c34
2 files changed, 29 insertions, 12 deletions
diff --git a/usr.sbin/spamdb/spamdb.8 b/usr.sbin/spamdb/spamdb.8
index d759a90a22f..cd39d460ec2 100644
--- a/usr.sbin/spamdb/spamdb.8
+++ b/usr.sbin/spamdb/spamdb.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: spamdb.8,v 1.11 2007/02/23 19:22:07 beck Exp $
+.\" $OpenBSD: spamdb.8,v 1.12 2007/02/23 22:40:50 beck Exp $
.\"
.\" Copyright (c) 2004 Bob Beck. All rights reserved.
.\"
@@ -116,7 +116,7 @@ will be when the IP is due to be removed from the blacklist.
.Pp
For GREY or WHITE entries, the format is:
.Pp
-.Dl type|source IP|from|to|first|pass|expire|block|pass
+.Dl type|source IP|helo|from|to|first|pass|expire|block|pass
.Pp
The fields are as follows:
.Pp
@@ -128,6 +128,9 @@ if whitelisted or
if greylisted
.It source IP
IP address the connection originated from
+.It helo
+what the connecting host sent as identification in the HELO/EHLO command in the
+SMTP dialogue
.It from
envelope-from address for
.Em GREY
diff --git a/usr.sbin/spamdb/spamdb.c b/usr.sbin/spamdb/spamdb.c
index 82648231b4b..d067242ec24 100644
--- a/usr.sbin/spamdb/spamdb.c
+++ b/usr.sbin/spamdb/spamdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamdb.c,v 1.19 2007/01/04 21:41:37 beck Exp $ */
+/* $OpenBSD: spamdb.c,v 1.20 2007/02/23 22:40:50 beck Exp $ */
/*
* Copyright (c) 2004 Bob Beck. All rights reserved.
@@ -209,22 +209,36 @@ dblist(DB *db)
break;
}
} else {
- char *from, *to;
+ char *helo, *from, *to;
/* greylist entry */
*cp = '\0';
- from = cp + 1;
- to = strchr(from, '\n');
- if (to == NULL) {
+ helo = cp + 1;
+ from = strchr(helo, '\n');
+ if (from == NULL) {
warnx("No from part in grey key %s", a);
free(a);
goto bad;
}
- *to = '\0';
- to++;
- printf("GREY|%s|%s|%s|%d|%d|%d|%d|%d\n",
- a, from, to, gd.first, gd.pass, gd.expire,
- gd.bcount, gd.pcount);
+ *from = '\0';
+ from++;
+ to = strchr(from, '\n');
+ if (to == NULL) {
+ /* probably old format - print it the
+ * with an empty HELO field instead
+ * of erroring out.
+ */
+ printf("GREY|%s|%s|%s|%s|%d|%d|%d|%d|%d\n",
+ a, "", helo, from, gd.first, gd.pass,
+ gd.expire, gd.bcount, gd.pcount);
+
+ } else {
+ *to = '\0';
+ to++;
+ printf("GREY|%s|%s|%s|%s|%d|%d|%d|%d|%d\n",
+ a, helo, from, to, gd.first, gd.pass,
+ gd.expire, gd.bcount, gd.pcount);
+ }
}
free(a);
}