diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2004-03-01 17:47:08 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2004-03-01 17:47:08 +0000 |
commit | d9873e06e82f9d33629f79736c84fd76d0cacbcc (patch) | |
tree | f02003837bf868632e97c88d5a9f868674446d17 /usr.sbin | |
parent | 9a3a52f8b9c57cdb361940f301178ea6cc323feb (diff) |
paranoia and cleanup, document output format
ok millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/spamdb/spamdb.8 | 51 | ||||
-rw-r--r-- | usr.sbin/spamdb/spamdb.c | 30 |
2 files changed, 65 insertions, 16 deletions
diff --git a/usr.sbin/spamdb/spamdb.8 b/usr.sbin/spamdb/spamdb.8 index 85d676ef119..dcb588eb29d 100644 --- a/usr.sbin/spamdb/spamdb.8 +++ b/usr.sbin/spamdb/spamdb.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: spamdb.8,v 1.1 2004/02/26 07:28:55 beck Exp $ +.\" $OpenBSD: spamdb.8,v 1.2 2004/03/01 17:47:07 beck Exp $ .\" .\" Copyright (c) 2004 Bob Beck. All rights reserved. .\" @@ -43,10 +43,57 @@ Updates time last seen to now. Delete a whitelist entry for IP address "ip". .El .Pp +.Ss DATABASE OUTPUT FORMAT If invoked without any arguments, .Nm lists the contents of the database -in a text format. +in a text format. The format is as follows: +.Bd -literal -offset 4n +type:source ip:from:to:first:pass:expire:block:pass +.Ed +.Pp +The fields are as follows: +.Bl -tag -width Ds -offset indent -compact +.It type +.Em WHITE +if whitelisted or +.Em GREY +if greylisted +.It source ip +IP address the connection originated from +.It from +envelope-from address for +.Em GREY +(empty for +.Em WHITE +entries). +.It to +envelope-to address for +.Em GREY +(empty for +.Em WHITE +entries). +.It first +time the entry was first seen +.It pass +time the entry passed from being +.Em GREY +to being +.Em WHITE +.It expire +time the entry will expire and be removed from the database +.It block +number of times a corresponding connection recieved a temporary +failure from +.Xr spamd 8 +.It pass +number of times a corresponding connection has been seen to pass +to the real MTA by +.Xr spamlogd 8 . +.El +.Pp +Note that times are in seconds since the epoch, in the manner returned by +.Xr time 3 . .Sh FILES /var/db/spamd .Sh SEE ALSO diff --git a/usr.sbin/spamdb/spamdb.c b/usr.sbin/spamdb/spamdb.c index 2530a0d38f0..8abd40545eb 100644 --- a/usr.sbin/spamdb/spamdb.c +++ b/usr.sbin/spamdb/spamdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamdb.c,v 1.3 2004/02/26 08:28:57 beck Exp $ */ +/* $OpenBSD: spamdb.c,v 1.4 2004/03/01 17:47:07 beck Exp $ */ /* * Copyright (c) 2004 Bob Beck. All rights reserved. @@ -46,10 +46,6 @@ size_t whitecount, whitealloc; char **whitelist; int pfdev; -DB *db; -DBT dbk, dbd; -BTREEINFO btreeinfo; - /* borrowed from dhartmei.. */ static int address_valid_v4(const char *a) @@ -67,9 +63,12 @@ address_valid_v4(const char *a) int dbupdate(char *dbname, char *ip, int add) { - struct gdata gd; - time_t now; - int r; + BTREEINFO btreeinfo; + DBT dbk, dbd; + DB *db; + struct gdata gd; + time_t now; + int r; now = time(NULL); memset(&btreeinfo, 0, sizeof(btreeinfo)); @@ -159,8 +158,11 @@ dbupdate(char *dbname, char *ip, int add) int dblist(char *dbname) { - struct gdata gd; - int r; + BTREEINFO btreeinfo; + DBT dbk, dbd; + DB *db; + struct gdata gd; + int r; /* walk db, list in text format */ memset(&btreeinfo, 0, sizeof(btreeinfo)); @@ -186,7 +188,7 @@ dblist(char *dbname) cp = strchr(a, '\n'); if (cp == NULL) /* this is a whitelist entry */ - printf("WHITE:%s:%d:%d:%d:%d:%d\n", a, gd.first, + printf("WHITE:%s:::%d:%d:%d:%d:%d\n", a, gd.first, gd.pass, gd.expire, gd.bcount, gd.pcount); else { char *from, *to; @@ -250,13 +252,13 @@ main(int argc, char **argv) switch (action) { case 0: - dblist("/var/db/spamd"); + dblist(PATH_SPAMD_DB); break; case 1: - dbupdate("/var/db/spamd", ip, 1); + dbupdate(PATH_SPAMD_DB, ip, 1); break; case 2: - dbupdate("/var/db/spamd", ip, 0); + dbupdate(PATH_SPAMD_DB, ip, 0); break; default: errx(-1, "bad action"); |