Date: Thu, 14 May 2009 11:06:46 -0700 (PDT) From: Doug Hardie <bc979@lafn.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/134545: spamlogd does not use proper white expiration time Message-ID: <200905141806.n4EI6kFf091051@zool.lafn.org> Resent-Message-ID: <200905141840.n4EIe1OL060766@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 134545 >Category: ports >Synopsis: spamlogd does not use proper white expiration time >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 14 18:40:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Doug Hardie >Release: FreeBSD 7.2-RELEASE i386 >Organization: >Environment: System: FreeBSD zool.lafn.org 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Thu May 7 01:54:57 PDT 2009 doug@zool.lafn.org:/usr2/obj/usr2/src/sys/LAFN i386 >Description: If you use a different spamd white expiration time (via the -G argument then spamlogd will use the default when it updates the real expriration date in the database. As a result, entries will be expired at an unexpected time. >How-To-Repeat: Setup spamd with a -G argument where the white expiration time is different from the default. Activate spamlogd. Send mail to get an address white listed. Check the expiration date for that source. send additional mail from that source. Check the expiration date again. It will not be what you expect but will be the default white expiration date. >Fix: Attached patch to spamlogd to include the -G argument to enable it to use the proper white expiration time. --- spamlogd/spamlogd.c.orig 2007-06-03 08:22:33.000000000 -0700 +++ spamlogd/spamlogd.c 2009-05-14 10:47:22.000000000 -0700 @@ -87,6 +87,11 @@ int use_pf = 1; #endif +time_t passtime = PASSTIME; +time_t greyexp = GREYEXP; +time_t whiteexp = WHITEEXP; + + extern char *__progname; void logmsg(int , const char *, ...); @@ -158,10 +163,12 @@ pcap_freecode(&bpfp); +#ifdef BIOCLOCK if (ioctl(pcap_fileno(hpcap), BIOCLOCK) < 0) { logmsg(LOG_ERR, "BIOCLOCK: %s", strerror(errno)); return (-1); } +#endif return (0); } @@ -269,7 +276,7 @@ gd.first = now; gd.bcount = 1; gd.pass = now; - gd.expire = now + WHITEEXP; + gd.expire = now + whiteexp; memset(&dbk, 0, sizeof(dbk)); dbk.size = strlen(ip); dbk.data = ip; @@ -289,7 +296,7 @@ } memcpy(&gd, dbd.data, sizeof(gd)); gd.pcount++; - gd.expire = now + WHITEEXP; + gd.expire = now + whiteexp; memset(&dbk, 0, sizeof(dbk)); dbk.size = strlen(ip); dbk.data = ip; @@ -305,7 +312,7 @@ db->close(db); db = NULL; if (syncsend) - sync_white(now, now + WHITEEXP, ip); + sync_white(now, now + whiteexp, ip); return (0); bad: db->close(db); @@ -318,6 +325,8 @@ { fprintf(stderr, "usage: %s [-DI] [-i interface] [-l pflog_interface] [-Y synctarget]\n" + "\t[-G passtime:greyexp:whiteexp]\n" + #ifdef __FreeBSD__ "\t[-m mode]\n" #endif @@ -343,9 +352,9 @@ errx(1, "Can't find service \"spamd-sync\" in /etc/services"); sync_port = ntohs(ent->s_port); #ifndef __FreeBSD__ - while ((ch = getopt(argc, argv, "DIi:l:Y:")) != -1) { + while ((ch = getopt(argc, argv, "DIi:l:Y:G:")) != -1) { #else - while ((ch = getopt(argc, argv, "DIi:l:Y:m:")) != -1) { + while ((ch = getopt(argc, argv, "DIi:l:Y:m:G:")) != -1) { #endif switch (ch) { case 'D': @@ -371,6 +380,18 @@ use_pf=0; break; #endif + + case 'G': + if (sscanf(optarg, "%d:%d:%d", &passtime, &greyexp, + &whiteexp) != 3) + usage(); + /* convert to seconds from minutes */ + passtime *= 60; + /* convert to seconds from hours */ + whiteexp *= (60 * 60); + /* convert to seconds from hours */ + greyexp *= (60 * 60); + break; default: usage(); --- spamlogd/spamlogd.8.orig 2007-04-02 04:27:07.000000000 -0700 +++ spamlogd/spamlogd.8 2009-05-14 10:49:20.000000000 -0700 @@ -23,6 +23,10 @@ .Sh SYNOPSIS .Nm spamlogd .Op Fl DI +.Oo +.Fl G +.Ar passtime : Ns Ar greyexp : Ns Ar whiteexp +.Oc .Op Fl i Ar interface .Op Fl l Ar pflog_interface .Op Fl Y Ar synctarget @@ -60,6 +64,18 @@ Debugging mode. .Nm does not disassociate from the controlling terminal. +.It Xo +.Fl G +.Ar passtime : Ns Ar greyexp : Ns Ar whiteexp +.Xc +Adjust the three time parameters for greylisting. +.Ar passtime +defaults to 25 (minutes), +.Ar greyexp +to 4 (hours), +and +.Ar whiteexp +to 864 (hours, approximately 36 days). .It Fl I Specify that .Nm >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905141806.n4EI6kFf091051>