diff -urN hypermail-2.1.4/src/file.c hypermail-2.1.4-1/src/file.c --- hypermail-2.1.4/src/file.c Tue Nov 20 13:51:27 2001 +++ hypermail-2.1.4-1/src/file.c Mon Aug 5 14:49:33 2002 @@ -271,8 +271,7 @@ } void symlink_latest() -{ - char filename[MAXFILELEN]; + { char filename[MAXFILELEN]; char dirname[MAXFILELEN]; struct stat stbuf; diff -urN hypermail-2.1.4/src/getname.c hypermail-2.1.4-1/src/getname.c --- hypermail-2.1.4/src/getname.c Fri Apr 13 02:49:22 2001 +++ hypermail-2.1.4-1/src/getname.c Mon Aug 5 15:07:13 2002 @@ -37,6 +37,40 @@ return input; } +char *spamify_replacedomain(char *input, char *antispamdomain) +{ + /* replace everything after the @-letter in the email address */ + int newlen = strlen(input)+4; + int domainlen = strlen(antispamdomain); + + char *atptr=strchr(input, '@'); + + if (domainlen > 0) { + newlen = newlen + domainlen; + } + + if (atptr) { + char *newbuf = malloc(newlen); + int index = atptr - input; + /* copy the part before the @ */ + memcpy(newbuf, input, index); + /* append _at_ */ + memcpy(newbuf+index, "_at_", 4); + if (domainlen > 0) { + /* append the new domain */ + strcpy(newbuf+index+4, antispamdomain); + } else { + /* append the part after the @ */ + strcpy(newbuf+index+4, input+index+1); + } + /* correct the pointer and free the old */ + free(input); + return newbuf; + } + /* weird email, bail out */ + return input; +} + /* ** Grabs the name and email address from a From: header. ** This could get tricky; I've tried to keep it simple. diff -urN hypermail-2.1.4/src/getname.h hypermail-2.1.4-1/src/getname.h --- hypermail-2.1.4/src/getname.h Thu Jun 8 08:09:07 2000 +++ hypermail-2.1.4-1/src/getname.h Mon Aug 5 14:49:33 2002 @@ -1,2 +1,3 @@ void getname(char *, char **, char **); char *spamify(char *input); +char *spamify_replacedomain(char *input, char *antispamdomain); diff -urN hypermail-2.1.4/src/hypermail.c hypermail-2.1.4-1/src/hypermail.c --- hypermail-2.1.4/src/hypermail.c Sat Nov 24 11:19:30 2001 +++ hypermail-2.1.4-1/src/hypermail.c Mon Aug 5 18:04:51 2002 @@ -44,7 +44,6 @@ /* ** Prints user startup errors stops. */ - void cmderr(char *errorstr) { fprintf(stderr, "\n%s: %s: %s\n", lang[MSG_ERROR], PROGNAME, errorstr); diff -urN hypermail-2.1.4/src/hypermail.h hypermail-2.1.4-1/src/hypermail.h --- hypermail-2.1.4/src/hypermail.h Wed Nov 21 11:25:17 2001 +++ hypermail-2.1.4-1/src/hypermail.h Mon Aug 5 17:36:27 2002 @@ -307,6 +307,8 @@ VAR char *index_name[MAX_DIRECTORY_LEVELS][NO_INDEX]; VAR int show_index[MAX_DIRECTORY_LEVELS][NO_INDEX]; +VAR char *antispamdomain; + VAR int use_mailcommand; VAR int use_mailto; VAR int use_domainaddr; diff -urN hypermail-2.1.4/src/parse.c hypermail-2.1.4-1/src/parse.c --- hypermail-2.1.4/src/parse.c Wed Dec 5 06:59:33 2001 +++ hypermail-2.1.4-1/src/parse.c Mon Aug 5 18:35:29 2002 @@ -1332,11 +1332,18 @@ else if (!strncasecmp(head->line, "From:", 5)) { getname(head->line, &namep, &emailp); head->parsedheader = TRUE; - if(set_spamprotect) { - emailp=spamify(emailp); - /* we need to "fix" the name as well, as sometimes - the email ends up in the name part */ - namep=spamify(namep); + if (set_spamprotect) { + if (set_antispamdomain) { + emailp=spamify_replacedomain(emailp,set_antispamdomain); + /* we need to "fix" the name as well, as sometimes + the email ends up in the name part */ + namep=spamify_replacedomain(namep,set_antispamdomain); + } else { + emailp=spamify(emailp); + /* we need to "fix" the name as well, as sometimes + the email ends up in the name part */ + namep=spamify(namep); + } } } else if (!strncasecmp(head->line, "Message-Id:", 11)) { Binary files hypermail-2.1.4/src/pcre/dftables and hypermail-2.1.4-1/src/pcre/dftables differ diff -urN hypermail-2.1.4/src/setup.c hypermail-2.1.4-1/src/setup.c --- hypermail-2.1.4/src/setup.c Thu Nov 22 11:39:37 2001 +++ hypermail-2.1.4-1/src/setup.c Mon Aug 5 14:49:33 2002 @@ -19,6 +19,7 @@ char *set_defaultindex; char *set_default_top_index; char *set_txtsuffix; +char *set_antispamdomain; bool set_overwrite; bool set_inlinehtml; @@ -433,8 +434,16 @@ {"spamprotect", &set_spamprotect, BFALSE, CFG_SWITCH, "# Set this to On to make hypermail not output real email addresses\n" - "# in the output HTML but instead it will obfuscate them a little.\n"}, + "# in the output HTML but instead it will obfuscate them a little.\n" + "# You can control the obfuscation with set_antispamdomain.\n"}, + {"antispamdomain", &set_antispamdomain, NULL, CFG_STRING, + "# By default hypermail only does a small amount of massaging\n" + "# of email addresses. Use this to completely replace the domain\n" + "# from which a message originates (everything after the @)\n" + "# with some string to confuse screen-scraping programs.\n" + "# It is probably wise to make this an invalid mail domain.\n"}, + {"attachmentsindex", &set_attachmentsindex, BTRUE, CFG_SWITCH, "# Set this to Off to make hypermail not output an index of\n" "# messages with attachments.\n"}, @@ -1005,8 +1014,9 @@ printf("set_folder_by_date = %s\n",set_folder_by_date ? set_folder_by_date : "Not set"); printf("set_describe_folder = %s\n",set_describe_folder ? set_describe_folder : "Not set"); printf("set_latest_folder = %s\n",set_latest_folder ? set_latest_folder : "Not set"); + printf("set_antispamdomain = %s\n",set_antispamdomain ? set_antispamdomain : "Not set"); - /* Boolean or interger */ + /* Boolean or integer */ printf("set_overwrite = %d\n",set_overwrite); printf("set_inlinehtml = %d\n",set_inlinehtml); diff -urN hypermail-2.1.4/src/setup.h hypermail-2.1.4-1/src/setup.h --- hypermail-2.1.4/src/setup.h Thu Nov 22 09:33:27 2001 +++ hypermail-2.1.4-1/src/setup.h Mon Aug 5 18:25:04 2002 @@ -131,6 +131,8 @@ extern char *set_unsafe_chars; extern bool set_linkquotes; +extern char *set_antispamdomain; + extern char *set_folder_by_date; extern char *set_latest_folder; extern int set_msgsperfolder; diff -urN hypermail-2.1.4/tests/test.rc hypermail-2.1.4-1/tests/test.rc --- hypermail-2.1.4/tests/test.rc Thu Nov 22 09:34:22 2001 +++ hypermail-2.1.4-1/tests/test.rc Mon Aug 5 18:39:16 2002 @@ -48,6 +48,13 @@ domainaddr = landfield.com #hmail = hypermail@landfield.com +spamprotect = 1 +# antispamdomain = #correctly ignored +# antispamdomain = "" #leaves quote marks in the url +# antispamdomain = " " #works, leaves a space in the url +# antispamdomain = "email_protected" #works +antispamdomain = "email.domain.hidden" #works + text_types = message/DELIVERY-STATUS inline_types = "image/gif image/jpeg image/png" ignore_types = text/x-vcard