ports/60229: Update of mail/relaydb port

Michael O. Boev mike at tric.tomsk.gov.ru
Sun Dec 14 12:00:41 UTC 2003


>Number:         60229
>Category:       ports
>Synopsis:       Update of mail/relaydb port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 14 04:00:34 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michael O. Boev
>Release:        FreeBSD 4.9-RELEASE i386
>Organization:
>Environment:
System: FreeBSD isrv.tric.tomsk.gov.ru 4.9-RELEASE FreeBSD 4.9-RELEASE #3: Tue Nov 4 20:06:56 NOVT 2003 root at isrv.tric.tomsk.gov.ru:/usr/obj/usr/src/sys/ISRV i386



>Description:
	The mail/relaydb port is (a bit) outdated.
>How-To-Repeat:
	Ports have version 1.3, where, e.g., the OpenBSD ports have 1.6
>Fix:
	The following patch updates the port.

	It adds the following files:
	pkg-message		Warning to users that DB format has changed
				and upgrades require user activity to
				succeed
	files/patch-aa		Patches relaydb.c for an additional option (-O)
				so that upgrades don't shoot one's feet, also
				some printf format issues
	files/patch-ab		Patches relaydb.8, to document an extra option
	
	I will also send the patches to the author (Daniel Hartmeier),
	if they, luckily, hit the ports tree.
	
--- relaydb.port begins here ---
diff -ruN relaydb.13/Makefile relaydb/Makefile
--- relaydb.13/Makefile	Fri Nov 21 06:04:07 2003
+++ relaydb/Makefile	Sun Dec 14 17:21:52 2003
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	relaydb
-PORTVERSION=	1.3
+PORTVERSION=	1.6
 CATEGORIES=	mail
 MASTER_SITES=	http://www.benzedrine.cx/
 
diff -ruN relaydb.13/distinfo relaydb/distinfo
--- relaydb.13/distinfo	Sun Aug 10 23:50:48 2003
+++ relaydb/distinfo	Sun Dec 14 16:09:56 2003
@@ -1 +1 @@
-MD5 (relaydb-1.3.tar.gz) = 360536437837bb2a67d356282a1a03b0
+MD5 (relaydb-1.6.tar.gz) = 4d5de68c51873fba7c312039e49d30fd
diff -ruN relaydb.13/files/patch-aa relaydb/files/patch-aa
--- relaydb.13/files/patch-aa	Thu Jan  1 07:00:00 1970
+++ relaydb/files/patch-aa	Sun Dec 14 17:22:46 2003
@@ -0,0 +1,146 @@
+--- relaydb.c.orig	Sun Dec 14 15:59:30 2003
++++ relaydb.c	Sun Dec 14 17:22:40 2003
+@@ -47,6 +47,11 @@
+ 	time_t	 mtime;
+ };
+ 
++struct old_data {
++	int	 white;
++	int	 black;
++};
++
+ extern char	*__progname;
+ const int	 bufsiz = 1024;
+ const int	 factor = 3;
+@@ -318,7 +323,7 @@
+ 			if (d.mtime >= mtime)
+ 				continue;
+ 			if (debug)
+-				printf("touching %u %s\n", mtime, address);
++				printf("touching %lu %s\n", mtime, address);
+ 			d.mtime = mtime;
+ 			memset(&dbk, 0, sizeof(dbk));
+ 			dbk.size = strlen(address);
+@@ -364,7 +369,7 @@
+ 			buf[pos] = 0;
+ 			pos = 0;
+ 
+-			r = sscanf(buf, "%127s %d %d %u", address,
++			r = sscanf(buf, "%127s %d %d %lu", address,
+ 			    &d.white, &d.black, &d.mtime);
+ 			if (r == 3)
+ 				d.mtime = time(NULL);
+@@ -379,7 +384,7 @@
+ 			    address_private(address))
+ 				continue;
+ 			if (debug)
+-				printf("adding %s %d %d %u\n",
++				printf("adding %s %d %d %lu\n",
+ 				    address, d.white, d.black, d.mtime);
+ 			memset(&dbk, 0, sizeof(dbk));
+ 			dbk.size = strlen(address);
+@@ -405,7 +410,7 @@
+ void
+ usage()
+ {
+-	fprintf(stderr, "usage: %s [-46bdlnrvw] "
++	fprintf(stderr, "usage: %s [-46bdlnOrvw] "
+ 	    "[-BW [+-]num] [-m [+-]days]\n\t[-f filename] "
+ 	    "[-i filename] [-t filename]\n", __progname);
+ 	exit(1);
+@@ -414,7 +419,7 @@
+ int
+ main(int argc, char *argv[])
+ {
+-	int		 list = 0, delete = 0;
++	int		 list = 0, delete = 0, old_list = 0;
+ 	const char	*filename = NULL, *import = NULL, *syslog = NULL;
+ 	time_t		 mtime = 0;
+ 	int		 mtime_op = 0;
+@@ -423,7 +428,7 @@
+ 	int		 ch;
+ 	unsigned	 count = 0;
+ 
+-	while ((ch = getopt(argc, argv, "46bB:df:i:lm:nrt:vwW:")) != -1) {
++	while ((ch = getopt(argc, argv, "46bB:df:i:lm:nOrt:vwW:")) != -1) {
+ 		switch (ch) {
+ 		case '4':
+ 			use_v4 = 1;
+@@ -482,6 +487,9 @@
+ 		case 'n':
+ 			traverse = 0;
+ 			break;
++		case 'O':
++			old_list = 1;
++			break;
+ 		case 'r':
+ 			reverse = 1;
+ 			break;
+@@ -496,7 +504,7 @@
+ 		}
+ 	}
+ 
+-	if (!list && !delete && !action && import == NULL && syslog == NULL)
++	if (!old_list && !list && !delete && !action && import == NULL && syslog == NULL)
+ 		usage();
+ 
+ 	if (delete && !action && !mtime && black == -1 && white == -1) {
+@@ -583,7 +591,7 @@
+ 				continue;
+ 			if (list) {
+ 				if (debug)
+-					printf("%s %d %d %u\n",
++					printf("%s %d %d %lu\n",
+ 					    a, d.white, d.black, d.mtime);
+ 				else
+ 					printf("%s\n", a);
+@@ -600,6 +608,40 @@
+ 				count++;
+ 			}
+ 		}
++	} else if (old_list) {
++		int		 r;
++		struct old_data	 d;
++		char		 a[128];
++
++		memset(&dbk, 0, sizeof(dbk));
++		memset(&dbd, 0, sizeof(dbd));
++		r = db->seq(db, &dbk, &dbd, R_FIRST);
++		while (!r) {
++			if (dbk.size < 1 || dbk.size >= sizeof(a)||
++			    dbd.size != sizeof(struct old_data)) {
++				fprintf(stderr, "db->seq() invalid data\n");
++				if (db->close(db))
++					fprintf(stderr, "db->close() %s\n",
++					    strerror(errno));
++				return (1);
++			}
++			memcpy(&d, dbd.data, sizeof(d));
++			if (!action ||
++			    (action == 'b' && d.black >  factor * d.white) ||
++			    (action == 'w' && d.black <= factor * d.white)) {
++				memcpy(a, dbk.data, dbk.size);
++				a[dbk.size] = 0;
++				if ((use_v4 && address_valid_v4(a)) ||
++				    (use_v6 && address_valid_v6(a))) {
++					if (debug)
++						printf("%s %d %d\n",
++						    a, d.white, d.black);
++					else
++						printf("%s\n", a);
++				}
++			}
++			r = db->seq(db, &dbk, &dbd, R_NEXT);
++		}
+ 	} else {
+ 		if (debug)
+ 			printf("reading mail headers, considering the mail "
+@@ -609,7 +651,7 @@
+ 	if (delete && !list)
+ 		printf("%u entries deleted\n", count);
+ 
+-	if (!list && db->sync(db, 0))
++	if (!list && !old_list && db->sync(db, 0))
+ 		fprintf(stderr, "db->sync() %s\n", strerror(errno));
+ 	if (db->close(db))
+ 		fprintf(stderr, "db->close() %s\n", strerror(errno));
diff -ruN relaydb.13/files/patch-bb relaydb/files/patch-bb
--- relaydb.13/files/patch-bb	Thu Jan  1 07:00:00 1970
+++ relaydb/files/patch-bb	Sun Dec 14 17:21:23 2003
@@ -0,0 +1,24 @@
+--- relaydb.8.orig	Fri Nov 21 00:41:34 2003
++++ relaydb.8	Sun Dec 14 17:13:01 2003
+@@ -30,7 +30,7 @@
+ .Nd spam relay database
+ .Sh SYNOPSIS
+ .Nm relaydb
+-.Op Fl 46bdlnrvw
++.Op Fl 46bdlnOrvw
+ .Op Fl B Ar [+-]num
+ .Op Fl W Ar [+-]num
+ .Op Fl m Ar [+-]days
+@@ -118,6 +118,12 @@
+ establish a new whitelist entry for a new host, then send spam from the
+ same address, faking further Received: headers, to cause relaydb to blacklist
+ those addresses, causing a denial of service for these addresses.
++.It Fl O
++List (just as
++.Fl l
++does) the IP addresses of a database in pre-1.5 format, necessary
++for upgrading from earlier versions of
++.Nm . 
+ .It Fl r
+ Revert a previously made decision.
+ For instance, if a mail has been run through
diff -ruN relaydb.13/pkg-message relaydb/pkg-message
--- relaydb.13/pkg-message	Thu Jan  1 07:00:00 1970
+++ relaydb/pkg-message	Sun Dec 14 17:25:23 2003
@@ -0,0 +1,6 @@
+*************************************************************************
+* WARNING: the database format has changed in version 1.5,		*
+* so upgrades from earlier versions REQUIRE an export			*
+* with (relaydb -vO >text), deletion of the database			*
+* and re-import with the (relaydb -i text).				*
+*************************************************************************
--- relaydb.port ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list