118 lines
2.6 KiB
Plaintext
118 lines
2.6 KiB
Plaintext
$OpenBSD: patch-bulk_mailer_c,v 1.2 2010/05/23 15:57:34 espie Exp $
|
|
--- bulk_mailer.c.orig Wed May 24 21:34:33 2000
|
|
+++ bulk_mailer.c Sun May 23 17:56:30 2010
|
|
@@ -95,6 +95,8 @@
|
|
#include <sysexits.h>
|
|
#include <errno.h>
|
|
#include <time.h>
|
|
+#include <stdlib.h>
|
|
+#include <unistd.h>
|
|
#ifdef HAVE_STRING_H
|
|
#include <string.h>
|
|
#endif
|
|
@@ -122,9 +124,6 @@ char *strdup();
|
|
char *strchr();
|
|
char *strrchr();
|
|
#endif
|
|
-char *malloc ();
|
|
-char *realloc ();
|
|
-char *mktemp ();
|
|
|
|
/*
|
|
* (default) max different domains per envelope.
|
|
@@ -296,6 +295,7 @@ char *str;
|
|
* memory, appending a NUL to the copy.
|
|
*/
|
|
|
|
+/*
|
|
static char *
|
|
strndup (str, len)
|
|
char *str;
|
|
@@ -307,6 +307,7 @@ int len;
|
|
result[len] = '\0';
|
|
return result;
|
|
}
|
|
+*/
|
|
|
|
/*
|
|
* sort by case-folded reversed domain
|
|
@@ -337,15 +338,15 @@ char *addr;
|
|
{
|
|
char *at;
|
|
char *ptr;
|
|
- char *domain;
|
|
+ /* char *domain; */
|
|
char tempbuf[1024];
|
|
- char c;
|
|
+ /* char c; */
|
|
|
|
/*
|
|
* make sure there's room in the buffer.
|
|
*/
|
|
if (num_addrs >= num_addr_slots) {
|
|
- struct address *new;
|
|
+ /* struct address *new; */
|
|
|
|
num_addr_slots += 1000;
|
|
if (address_list == NULL)
|
|
@@ -985,7 +986,7 @@ static int
|
|
copy_message (out, in)
|
|
FILE *out, *in;
|
|
{
|
|
- int c;
|
|
+ /* int c; */
|
|
char linebuf[32*1024];
|
|
int has_valid_approved_hdr = 0;
|
|
int has_resent_to_hdr = 0;
|
|
@@ -1218,14 +1219,14 @@ FILE *out, *in;
|
|
*/
|
|
lines = 0;
|
|
while (fgets (linebuf, sizeof (linebuf), in) != NULL) {
|
|
- if (lines < 5 &&
|
|
+ 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"))
|
|
+ contains (linebuf, "unsubscribe")))
|
|
saw_command = 1;
|
|
++lines;
|
|
fputs (linebuf, out);
|
|
@@ -1326,13 +1327,13 @@ main (argc, argv)
|
|
int argc;
|
|
char *argv[];
|
|
{
|
|
- int i;
|
|
+ /* int i; */
|
|
FILE *fp;
|
|
FILE *tmp;
|
|
static char template[] = "/tmp/blkXXXXXX";
|
|
char *tempname;
|
|
- int c;
|
|
- char buf[1024];
|
|
+ /* int c; */
|
|
+ /* char buf[1024]; */
|
|
|
|
while (argc > 1 && (*argv[1] == '-' || *argv[1] == '+')) {
|
|
if (strcmp (argv[1], "-comment") == 0 && argc > 2) {
|
|
@@ -1513,8 +1514,8 @@ char *argv[];
|
|
exit (EX_OSFILE);
|
|
}
|
|
|
|
- tempname = mktemp (template);
|
|
- tmp = fopen (template, "w");
|
|
+ tmp = fdopen (mkstemp(template), "w");
|
|
+ tempname = strdup(template);
|
|
switch (copy_message (tmp, stdin)) {
|
|
|
|
case HAS_EMBEDDED_COMMAND:
|
|
@@ -1592,4 +1593,5 @@ char *argv[];
|
|
|
|
exit (EX_OK);
|
|
}
|
|
+ exit (EX_OK);
|
|
}
|