[hypermail] [hypermail-dev] patch for anti-spam flexibility

From: Philip Brown <phil_at_bolthole.com_at_hypermail-project.org>
Date: Fri, 22 Nov 2002 22:11:26 -0800
Message-ID: <20021122221126.A71110_at_bolthole.com>


This is a patch set to files in the src directory of hypermail 2.1.5.

It must be applied AFTER configure has been done. The reason being that one of the files patched in defaults.h I'm not sure how to patch the defaults.h.in file in the best way.

What this does is make the "_at_" antispam bit configurable by config file, using

antispam_at = __somestring__ (does not have to have __ in it)

Anything hardcoded by default, can be figured out and used by spammers. Particularly something like "_at_".

 #define DOMAINADDR "NONE"  

+#define ANTISPAM_AT "_at_"
+
 #endif

--- getname.c.orig	2002-11-22 20:50:47.982702000 -0800
+++ getname.c	2002-11-22 22:04:06.212713000 -0800

_at_@ -16,19 +16,20 @@
 

 char *spamify(char *input)
 {
+ int insertlen=strlen(set_antispam_at);

   /* we should replace the _at_-letter in the email

      address */
- int newlen=strlen(input)+4;
+ int newlen=strlen(input)+insertlen;

   char *atptr=strchr(input, '_at_');
   if(atptr) {

     char *newbuf = malloc(newlen);
     int index=atptr-input;
     /* copy the part before the _at_ */
     memcpy(newbuf, input, index);

- /* append _at_ */
- memcpy(newbuf+index, "_at_", 4);
+
+ memcpy(newbuf+index, set_antispam_at, insertlen);

     /* append the part after the _at_ */ - strcpy(newbuf+index+4, input+index+1); + strcpy(newbuf+index+insertlen, input+index+1);

     /* correct the pointer and free the old */
     free(input);
     return newbuf;
--- print.c.orig	2002-11-22 20:50:47.992702000 -0800
+++ print.c	2002-11-22 20:52:38.682737000 -0800

_at_@ -583,7 +583,7 @@
struct Push retbuf; INIT_PUSH(retbuf); PushNString(&retbuf, value, ptr - value); - PushNString(&retbuf, "_at_", 4); + PushNString(&retbuf, set_antispam_at, strlen(set_antispam_at)); PushString(&retbuf, ptr + 1); ext_value = PUSH_STRING(retbuf); } --- setup.c.orig 2002-11-22 20:37:56.792702000 -0800 +++ setup.c 2002-11-22 20:50:00.192711000 -0800

_at_@ -9,6 +9,7 @@

 #include "setup.h"
 #include "print.h"  
+char *set_antispam_at;
 char *set_language;
 char *set_htmlsuffix;
 char *set_mbox;

_at_@ -121,6 +122,9 @@

 int set_delete_level;  

 struct Config cfg[] = {

+    {"antispam_at", &set_antispam_at, ANTISPAM_AT, CFG_STRING,
+     "# replace any _at_ sign with this string, if spam flags enabled\n"},
+     
     {"language", &set_language, LANGUAGE, CFG_STRING,
      "# A two-letter string specifying the language to use!\n"
      "# For example 'en' for English\n"},
--- setup.h.orig	2002-11-22 20:49:12.122702000 -0800
+++ setup.h	2002-11-22 20:49:24.812704000 -0800

_at_@ -34,6 +34,7 @@

 void PreConfig(void);
 void PostConfig(void);  
+extern char *set_antispam_at;
 extern char *set_language;
 extern char *set_htmlsuffix;
 extern char *set_mbox;
--- string.c.orig	2002-11-22 20:50:48.002702000 -0800
+++ string.c	2002-11-22 22:04:29.472704000 -0800

_at_@ -773,12 +773,12 @@
char *p; if (!s) return s;

- if (!strchr(s, '_at_') && ((p = strstr(s, "_at_")) != NULL)) { + if (!strchr(s, '_at_') && ((p = strstr(s, set_antispam_at)) != NULL)) {
 	struct Push buff;
 	INIT_PUSH(buff);
 	PushNString(&buff, s, p - s);
 	PushByte(&buff, '_at_');
-	PushString(&buff, p + 4);
+	PushString(&buff, p + strlen(set_antispam_at));
 	return PUSH_STRING(buff);
     }
     return strsav(s);

_at_@ -816,7 +816,7 @@
int in_ascii = TRUE, esclen = 0; if(set_spamprotect) - at="_at_"; + at=set_antispam_at; else at="_at_";
Received on Mon 25 Nov 2002 02:15:13 AM GMT

This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:54 PM GMT GMT