bulk_mailer port

This commit is contained in:
angelos 1998-05-17 04:20:30 +00:00
parent 9aec48add7
commit ef2dc57fb0
8 changed files with 279 additions and 0 deletions

19
mail/bulk_mailer/Makefile Normal file
View File

@ -0,0 +1,19 @@
# OpenBSD makefile for: bulk_mailer
# Version required: 1.5
# Date created: May 16 1998
# Whom: Angelos D. Keromytis
#
# $OpenBSD: Makefile,v 1.1.1.1 1998/05/17 04:20:30 angelos Exp $
#
DISTNAME= bulk_mailer-1.5
CATEGORIES= mail
MASTER_SITES= ftp://cs.utk.edu/pub/moore/bulk_mailer/
EXTRACT_SUFX= .tar
MAINTAINER= angelos@openbsd.org
EXTRACT_BEFORE_ARGS= -C ${WRKDIR} -xf
NO_WRKSUBDIR= YES
.include <bsd.port.mk>

View File

@ -0,0 +1 @@
MD5 (bulk_mailer-1.5.tar) = 610cb591f1476f60f937c33c6639704d

View File

@ -0,0 +1,57 @@
*** Makefile.orig Sun Jan 28 17:53:14 1996
--- Makefile Fri Mar 22 19:39:36 1996
***************
*** 5,28 ****
# HASSTRERROR - whether system has strerror() call
# LIBS - local libraries to link in (e.g. -lresolv)
! HASSTRDUP = # -DHAS_STRDUP
! HASSTRERROR = # -DHAS_STRERROR
LIBS = # -lresolv
! DEFINES = $(HASSTRDUP) $(HASSTRERROR) $(DEFAULT_DOMAIN)
! CFLAGS = $(DEFINES)
FILES = bulk_mailer.README INSTALL bulk_mailer.c patchlevel.h Makefile
bulk_mailer: bulk_mailer.o
$(CC) $(CFLAGS) -o bulk_mailer bulk_mailer.o $(LIBS)
bulk_mailer.o: bulk_mailer.c patchlevel.h
$(CC) -c $(CFLAGS) bulk_mailer.c
install: bulk_mailer
! cp bulk_mailer /usr/local/bin
clean:
rm -f bulk_mailer bulk_mailer.o
--- 5,32 ----
# HASSTRERROR - whether system has strerror() call
# LIBS - local libraries to link in (e.g. -lresolv)
! HASSTRDUP = -DHAS_STRDUP
! HASSTRERROR = -DHAS_STRERROR
LIBS = # -lresolv
! DEFINES = $(HASSTRDUP) $(HASSTRERROR) $(DEFAULT_DOMAIN) -DPIPECOMMAND='"/usr/sbin/sendmail -bs %s"'
! CFLAGS = -O2 -Wall $(DEFINES)
FILES = bulk_mailer.README INSTALL bulk_mailer.c patchlevel.h Makefile
+ all: bulk_mailer
+
bulk_mailer: bulk_mailer.o
$(CC) $(CFLAGS) -o bulk_mailer bulk_mailer.o $(LIBS)
+ strip bulk_mailer
bulk_mailer.o: bulk_mailer.c patchlevel.h
$(CC) -c $(CFLAGS) bulk_mailer.c
install: bulk_mailer
! install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} bulk_mailer ${PREFIX}/bin/bulk_mailer
! install -c -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} bulk_mailer.README ${PREFIX}/share/doc/bulk_mailer.README
clean:
rm -f bulk_mailer bulk_mailer.o

View File

@ -0,0 +1,184 @@
*** bulk_mailer.c.orig Sun Feb 11 12:49:32 1996
--- bulk_mailer.c Sun May 17 00:20:56 1998
***************
*** 87,92 ****
--- 87,95 ----
#include <sysexits.h>
#include <errno.h>
#include <time.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
#include "patchlevel.h"
#ifndef PIPECOMMAND
***************
*** 260,274 ****
* memory, appending a NUL to the copy.
*/
! static char *
! strndup (str, len)
! {
! char *result = malloc_or_else (len + 1);
!
! strncpy (result, str, len);
! result[len] = '\0';
! return result;
! }
/*
* sort by case-folded reversed domain
--- 263,277 ----
* memory, appending a NUL to the copy.
*/
! /* static char * */
! /* strndup (str, len) */
! /* { */
! /* char *result = malloc_or_else (len + 1); */
!
! /* strncpy (result, str, len); */
! /* result[len] = '\0'; */
! /* return result; */
! /* } */
/*
* sort by case-folded reversed domain
***************
*** 299,313 ****
{
char *at;
char *ptr;
! char *domain;
char tempbuf[1024];
! char c;
/*
* make sure there's room in the buffer.
*/
if (num_addrs >= num_addr_slots) {
! struct address *new;
num_addr_slots += 1000;
if (address_list == NULL)
--- 302,316 ----
{
char *at;
char *ptr;
! /* char *domain; */
char tempbuf[1024];
! /* char c; */
/*
* make sure there's room in the buffer.
*/
if (num_addrs >= num_addr_slots) {
! /* struct address *new; */
num_addr_slots += 1000;
if (address_list == NULL)
***************
*** 903,909 ****
copy_message (out, in)
FILE *out, *in;
{
! int c;
char linebuf[32*1024];
int has_valid_approved_hdr = 0;
int has_resent_to_hdr = 0;
--- 906,912 ----
copy_message (out, in)
FILE *out, *in;
{
! /* int c; */
char linebuf[32*1024];
int has_valid_approved_hdr = 0;
int has_resent_to_hdr = 0;
***************
*** 1077,1090 ****
*/
lines = 0;
while (fgets (linebuf, sizeof (linebuf), in) != NULL) {
! if (lines < 5 &&
/*
* these often occur in English-text unsubscribe requests
*/
contains (linebuf, "delete me") ||
contains (linebuf, "remove me") ||
contains (linebuf, "subscribe") ||
! contains (linebuf, "unsubscribe"))
saw_command = 1;
++lines;
fputs (linebuf, out);
--- 1080,1093 ----
*/
lines = 0;
while (fgets (linebuf, sizeof (linebuf), in) != NULL) {
! if (lines < 5 && (
/*
* these often occur in English-text unsubscribe requests
*/
contains (linebuf, "delete me") ||
contains (linebuf, "remove me") ||
contains (linebuf, "subscribe") ||
! contains (linebuf, "unsubscribe")))
saw_command = 1;
++lines;
fputs (linebuf, out);
***************
*** 1181,1193 ****
int argc;
char *argv[];
{
! int i;
FILE *fp;
FILE *tmp;
static char template[] = "/tmp/blkXXXXXX";
char *tempname;
! int c;
! char buf[1024];
while (argc > 1 && (*argv[1] == '-' || *argv[1] == '+')) {
if (strcmp (argv[1], "-debug") == 0)
--- 1184,1196 ----
int argc;
char *argv[];
{
! /* int i; */
FILE *fp;
FILE *tmp;
static char template[] = "/tmp/blkXXXXXX";
char *tempname;
! /* int c; */
! /* char buf[1024]; */
while (argc > 1 && (*argv[1] == '-' || *argv[1] == '+')) {
if (strcmp (argv[1], "-debug") == 0)
***************
*** 1287,1294 ****
exit (EX_OSFILE);
}
! tempname = mktemp (template);
! tmp = fopen (template, "w");
switch (copy_message (tmp, stdin)) {
case HAS_EMBEDDED_COMMAND:
--- 1290,1297 ----
exit (EX_OSFILE);
}
! tmp = fdopen (mkstemp(template), "w");
! tempname = strdup(template);
switch (copy_message (tmp, stdin)) {
case HAS_EMBEDDED_COMMAND:
***************
*** 1338,1341 ****
--- 1341,1345 ----
exit (EX_OK);
}
+ exit (EX_OK);
}

View File

@ -0,0 +1,7 @@
*** patchlevel.h.original Mon Feb 12 11:38:56 1996
--- patchlevel.h Fri Mar 22 18:55:49 1996
***************
*** 1 ****
! #define PATCHLEVEL 5
--- 1 ----
! #define PATCHLEVEL 6

View File

@ -0,0 +1 @@
Speeds delivery to large mailing lists by sorting & batching addresses.

View File

@ -0,0 +1,8 @@
This is a C program to do "bulk" mailing. For input, it takes a file
of recipient addresses (one address per line) and a message (with
headers already attached) to be sent to the recipients. It sorts the
recipient list by reversed domain (so similar ones sort together),
splits up the recipients into several groups containing no more than N
domains each, creates an SMTP envelope for each group of recipients,
and feeds that envelope to "/usr/sbin/sendmail -bs".

View File

@ -0,0 +1,2 @@
bin/bulk_mailer
share/doc/bulk_mailer.README