diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2003-10-22 21:31:39 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2003-10-22 21:31:39 +0000 |
commit | 0664cae15abf02851288841d75ddd0a09f6d1d08 (patch) | |
tree | ab4d704085e41f31c54b409c0545eecd677fc733 /libexec/spamd | |
parent | b121c0a9ca1422179b257866630c9b6f47cd4db7 (diff) |
make logging less verbose by default - default logs connect, disconnect
and blacklist matches. Add -v (verbose) flag to allow other detailed
logging (subject, body, smtp dialogue, etc.) when it's needed.
ok dhartmei@ -> ok deraadt@
Diffstat (limited to 'libexec/spamd')
-rw-r--r-- | libexec/spamd/spamd.8 | 10 | ||||
-rw-r--r-- | libexec/spamd/spamd.c | 19 |
2 files changed, 21 insertions, 8 deletions
diff --git a/libexec/spamd/spamd.8 b/libexec/spamd/spamd.8 index c91daadafab..5904c7083a1 100644 --- a/libexec/spamd/spamd.8 +++ b/libexec/spamd/spamd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: spamd.8,v 1.39 2003/09/25 09:07:33 jmc Exp $ +.\" $OpenBSD: spamd.8,v 1.40 2003/10/22 21:31:38 beck Exp $ .\" .\" Copyright (c) 2002 Theo de Raadt. All rights reserved. .\" @@ -81,6 +81,14 @@ This defaults to 450. Delay each character sent to the client by the specified amount of seconds. Defaults to 1. +.It Fl v +Enable verbose logging. By default +.Nm +logs connections, disconnections and blacklist matches to +.Xr syslog 8 +at LOG_INFO level. With verbose logging enabled, message detail +including subject and recipient information is logged at LOG_INFO, along +with the message body and SMTP dialogue being logged at LOG_DEBUG level. .It Fl w Ar window Set the socket receive buffer to this many bytes, adjusting the window size. .El diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c index 7996c5fc096..c0afcf32400 100644 --- a/libexec/spamd/spamd.c +++ b/libexec/spamd/spamd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd.c,v 1.49 2003/10/03 17:05:50 beck Exp $ */ +/* $OpenBSD: spamd.c,v 1.50 2003/10/22 21:31:38 beck Exp $ */ /* * Copyright (c) 2002 Theo de Raadt. All rights reserved. @@ -116,6 +116,7 @@ time_t t; int maxcon = MAXCON; int clients; int debug; +int verbose; int stutter = 1; int window; #define MAXTIME 400 @@ -673,11 +674,11 @@ nextstate(struct con *cp) } if (!cp->data_body && !*cp->ibuf) cp->data_body = 1; - if (cp->data_body && *cp->ibuf) - syslog_r(LOG_INFO, &sdata, "%s: Body: %s", cp->addr, + if (verbose && cp->data_body && *cp->ibuf) + syslog_r(LOG_DEBUG, &sdata, "%s: Body: %s", cp->addr, cp->ibuf); - else if (match(cp->ibuf, "FROM:") || match(cp->ibuf, "TO:") || - match(cp->ibuf, "SUBJECT:")) + else if (verbose && (match(cp->ibuf, "FROM:") || + match(cp->ibuf, "TO:") || match(cp->ibuf, "SUBJECT:"))) syslog_r(LOG_INFO, &sdata, "%s: %s", cp->addr, cp->ibuf); cp->ip = cp->ibuf; @@ -734,8 +735,9 @@ handler(struct con *cp) cp->ip--; *cp->ip = '\0'; cp->r = 0; - syslog_r(LOG_DEBUG, &sdata, "%s: says '%s'", cp->addr, - cp->ibuf); + if (verbose) + syslog_r(LOG_DEBUG, &sdata, "%s: says '%s'", cp->addr, + cp->ibuf); nextstate(cp); } } @@ -837,6 +839,9 @@ main(int argc, char *argv[]) case 'n': spamd = optarg; break; + case 'v': + verbose = 1; + break; case 'w': window = atoi(optarg); if (window <= 0) |