Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 May 2009 22:50:03 GMT
From:      olli hauer <ohauer@gmx.de>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/134347: mail/spamd: spamlogd's whitelist expiration period is hardcoded
Message-ID:  <200905092250.n49Mo3JF045962@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/134347; it has been noted by GNATS.

From: olli hauer <ohauer@gmx.de>
To: bug-followup@FreeBSD.org, rs@bytecamp.net, ohauer@gmx.de
Cc:  
Subject: Re: ports/134347: mail/spamd: spamlogd's whitelist expiration
	period is hardcoded
Date: Sun, 10 May 2009 00:41:40 +0200

 --r5Pyd7+fXNt84Ff3
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hi,
 
 overlooked in the first mail that you mean spamlogd and not spamd.
 
 Ok, I created a patch for spamlogd which adds a new parameter -W.
 
 This new parameter takes the whiteexp time in hours (min 1 max 2160)
 
 To apply the patch:
 
 cd /usr/ports/mail/spamd/
  patch < patch_spamd_spamlogd.txt
 
 I think this is what you want, also I will send the patch uptstream
 to OpenBSD (this means that parameters can change if the patch goes
 official into OpenBSD)
 
 Please give feedback if the patch works for you, so others can also
 benefit from your expirience.
 
 
 //olli
 
 
 
 --r5Pyd7+fXNt84Ff3
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="patch_spamd_spamlogd.txt"
 
 --- files/patch-spamlogd.orig	2007-10-05 21:03:52.000000000 +0200
 +++ files/patch-spamlogd	2009-05-10 00:16:29.000000000 +0200
 @@ -1,6 +1,14 @@
 ---- spamlogd/spamlogd.c.orig	Sat Jun 23 15:28:14 2007
 -+++ spamlogd/spamlogd.c	Sat Jun 23 15:28:27 2007
 -@@ -158,10 +158,12 @@
 +--- spamlogd/spamlogd.c.orig	2007-06-03 17:22:33.000000000 +0200
 ++++ spamlogd/spamlogd.c	2009-05-10 00:09:47.000000000 +0200
 +@@ -85,6 +85,7 @@
 + int sdata = 0;					/* dummy */
 + char *pid_file = "/var/run/spamlogd.pid";
 + int use_pf = 1;
 ++time_t whiteexp = WHITEEXP;
 + #endif
 + 
 + extern char		*__progname;
 +@@ -158,10 +159,12 @@
   
   	pcap_freecode(&bpfp);
   
 @@ -13,3 +21,85 @@
   
   	return (0);
   }
 +@@ -269,7 +272,11 @@
 + 		gd.first = now;
 + 		gd.bcount = 1;
 + 		gd.pass = now;
 ++#ifdef __FreeBSD__
 ++		gd.expire = now + whiteexp;
 ++#else
 + 		gd.expire = now + WHITEEXP;
 ++#endif
 + 		memset(&dbk, 0, sizeof(dbk));
 + 		dbk.size = strlen(ip);
 + 		dbk.data = ip;
 +@@ -289,7 +296,11 @@
 + 		}
 + 		memcpy(&gd, dbd.data, sizeof(gd));
 + 		gd.pcount++;
 ++#ifdef __FreeBSD__
 ++		gd.expire = now + whiteexp;
 ++#else
 + 		gd.expire = now + WHITEEXP;
 ++#endif
 + 		memset(&dbk, 0, sizeof(dbk));
 + 		dbk.size = strlen(ip);
 + 		dbk.data = ip;
 +@@ -305,7 +316,11 @@
 + 	db->close(db);
 + 	db = NULL;
 + 	if (syncsend)
 ++#ifdef __FreeBSD__
 ++		sync_white(now, now + whiteexp, ip);
 ++#else
 + 		sync_white(now, now + WHITEEXP, ip);
 ++#endif
 + 	return (0);
 +  bad:
 + 	db->close(db);
 +@@ -317,9 +332,11 @@
 + usage(void)
 + {
 + 	fprintf(stderr,
 ++#ifndef __FreeBSD__
 + 	    "usage: %s [-DI] [-i interface] [-l pflog_interface] [-Y synctarget]\n"
 +-#ifdef __FreeBSD__
 +-		"\t[-m mode]\n"
 ++#else
 ++	    "usage: %s [-DI] [-i interface] [-l pflog_interface] [-W whiteexp]\n"
 ++        "\t[-Y synctarget] [-m mode]\n"
 + #endif
 + 	    ,__progname);
 + 	exit(1);
 +@@ -330,6 +347,8 @@
 + {
 + #ifdef __FreeBSD__
 + 	FILE		*fpid = NULL;
 ++    const char *errstr;
 ++    int i;
 + #endif	
 + 	int		 ch;
 + 	struct passwd	*pw;
 +@@ -345,7 +364,7 @@
 + #ifndef __FreeBSD__
 + 	while ((ch = getopt(argc, argv, "DIi:l:Y:")) != -1) {
 + #else
 +-	while ((ch = getopt(argc, argv, "DIi:l:Y:m:")) != -1) {
 ++	while ((ch = getopt(argc, argv, "DIi:l:W:Y:m:")) != -1) {
 + #endif
 + 		switch (ch) {
 + 		case 'D':
 +@@ -360,6 +379,13 @@
 + 		case 'l':
 + 			pflogif = optarg;
 + 			break;
 ++		case 'W':
 ++            /* limit whiteexp to 2160h (90 days) */
 ++			i = strtonum(optarg, 1, (24 * 90), &errstr);
 ++			if (errstr)
 ++				usage();
 ++			whiteexp = (i * 60 * 60);
 ++			break;
 + 		case 'Y':
 + 			if (sync_addhost(optarg, sync_port) != 0)
 + 				sync_iface = optarg;
 --- files/patch-spamlogd_8.orig	2009-05-10 00:24:45.000000000 +0200
 +++ files/patch-spamlogd_8	2009-05-10 00:13:44.000000000 +0200
 @@ -0,0 +1,21 @@
 +--- spamlogd/spamlogd.8.orig	2007-04-02 13:27:07.000000000 +0200
 ++++ spamlogd/spamlogd.8	2009-05-10 00:12:32.000000000 +0200
 +@@ -25,6 +25,7 @@
 + .Op Fl DI
 + .Op Fl i Ar interface
 + .Op Fl l Ar pflog_interface
 ++.Op Fl W Ar whiteexp
 + .Op Fl Y Ar synctarget
 + .Sh DESCRIPTION
 + .Nm
 +@@ -77,6 +78,10 @@
 + interface to listen for connection notifications.
 + The default is to watch for connections logged on
 + .Dq pflog0 .
 ++.It Fl W Ar whiteexp
 ++Adjust the time for whiteexp in hours (default is 864
 ++hours, approximately 36 days, min is 1 hour, max is 2160 
 ++hours or 90 days).
 + .It Fl Y Ar synctarget
 + Add a target to receive synchronisation messages; see
 + .Sx SYNCHRONISATION
 
 --r5Pyd7+fXNt84Ff3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905092250.n49Mo3JF045962>