aboutsummaryrefslogtreecommitdiff
path: root/mail/relaydb
diff options
context:
space:
mode:
authorSergei Kolobov <sergei@FreeBSD.org>2003-12-14 14:47:11 +0000
committerSergei Kolobov <sergei@FreeBSD.org>2003-12-14 14:47:11 +0000
commitc223d45de4ef9df76d753d04e542ce8bdc79c372 (patch)
tree96c0cc9806adc76d99e18c78b02d02b76cddc6ea /mail/relaydb
parent3b495664f7e140af1d4917c789769e155809fb50 (diff)
downloadports-c223d45de4ef9df76d753d04e542ce8bdc79c372.tar.gz
ports-c223d45de4ef9df76d753d04e542ce8bdc79c372.zip
Notes
Diffstat (limited to 'mail/relaydb')
-rw-r--r--mail/relaydb/Makefile5
-rw-r--r--mail/relaydb/distinfo2
-rw-r--r--mail/relaydb/files/patch-Makefile10
-rw-r--r--mail/relaydb/files/patch-relaydb.824
-rw-r--r--mail/relaydb/files/patch-relaydb.c146
-rw-r--r--mail/relaydb/pkg-message6
6 files changed, 190 insertions, 3 deletions
diff --git a/mail/relaydb/Makefile b/mail/relaydb/Makefile
index f9640be9ad1f..cddc2c76c921 100644
--- a/mail/relaydb/Makefile
+++ b/mail/relaydb/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= relaydb
-PORTVERSION= 1.3
+PORTVERSION= 1.6
CATEGORIES= mail
MASTER_SITES= http://www.benzedrine.cx/
@@ -18,6 +18,7 @@ MANCOMPRESSED= yes
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/relaydb ${PREFIX}/bin
- ${INSTALL_MAN} ${WRKSRC}/relaydb.8.gz ${PREFIX}/man/man8
+ ${INSTALL_MAN} ${WRKSRC}/relaydb.8.gz ${MAN8PREFIX}/man/man8
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/mail/relaydb/distinfo b/mail/relaydb/distinfo
index 1bab42304a03..2fde816e166f 100644
--- a/mail/relaydb/distinfo
+++ b/mail/relaydb/distinfo
@@ -1 +1 @@
-MD5 (relaydb-1.3.tar.gz) = 360536437837bb2a67d356282a1a03b0
+MD5 (relaydb-1.6.tar.gz) = 4d5de68c51873fba7c312039e49d30fd
diff --git a/mail/relaydb/files/patch-Makefile b/mail/relaydb/files/patch-Makefile
new file mode 100644
index 000000000000..7b6f4b59f675
--- /dev/null
+++ b/mail/relaydb/files/patch-Makefile
@@ -0,0 +1,10 @@
+--- Makefile.orig Sun Dec 14 17:39:34 2003
++++ Makefile Sun Dec 14 17:39:41 2003
+@@ -4,6 +4,6 @@ PROG= relaydb
+ SRCS= relaydb.c
+ MAN= relaydb.8
+
+-CFLAGS+= -Wall -Werror -Wstrict-prototypes -ansi
++CFLAGS+= -Wall -Wstrict-prototypes -ansi
+
+ .include <bsd.prog.mk>
diff --git a/mail/relaydb/files/patch-relaydb.8 b/mail/relaydb/files/patch-relaydb.8
new file mode 100644
index 000000000000..3db2378c40a9
--- /dev/null
+++ b/mail/relaydb/files/patch-relaydb.8
@@ -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 --git a/mail/relaydb/files/patch-relaydb.c b/mail/relaydb/files/patch-relaydb.c
new file mode 100644
index 000000000000..02918d1669ed
--- /dev/null
+++ b/mail/relaydb/files/patch-relaydb.c
@@ -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 --git a/mail/relaydb/pkg-message b/mail/relaydb/pkg-message
new file mode 100644
index 000000000000..ffe3738e8a68
--- /dev/null
+++ b/mail/relaydb/pkg-message
@@ -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). *
+*************************************************************************