diff -ur hypermail-2b25.orig/src/print.c hypermail-2b25/src/print.c --- hypermail-2b25.orig/src/print.c Thu Sep 30 22:35:10 1999 +++ hypermail-2b25/src/print.c Sun Nov 7 20:17:30 1999 @@ -428,6 +429,7 @@ int insig, inblank; int inhtml; char inheader=FALSE; /* we always start in a mail header */ + char *spm; int pre=FALSE; if (set_showhr) @@ -568,18 +573,22 @@ fprintf(fp, "

"); else { if (insig) { - ConvURLs(fp, bp->line, id, subject); + spm = spamprotect(bp->line, 1); + ConvURLs(fp, spm, id, subject); + free(spm); } else if (isquote(bp->line)) { fprintf(fp, "%s", - (set_iquotes)?"":""); - - ConvURLs(fp, bp->line, id, subject); - - fprintf(fp, "%s
\n", (set_iquotes)?"
":""); - - /* Daniel changed this 17th of November 1998 - We're gonna make this deal with infinite buffer sizes! */ + (set_iquotes)?"":""); + + spm = spamprotect(bp->line, 0); + ConvURLs(fp, spm, id, subject); + free(spm); + + fprintf(fp, "%s
\n", (set_iquotes)?"
":""); + + /* Daniel changed this 17th of November 1998 + We're gonna make this deal with infinite buffer sizes! */ } else if ((bp->line)[0] != '\0') { @@ -588,19 +597,21 @@ sp = bp->line; while (*sp && (*sp == ' ' || *sp == '\t')) { if (*sp == '\t') - fprintf(fp, "        "); + fprintf(fp, "        "); else - fprintf(fp, " "); + fprintf(fp, " "); sp++; } - ConvURLs(fp, sp, id, subject); + spm = spamprotect(sp, 0); + ConvURLs(fp, spm, id, subject); + free(spm); #else int sp; for (sp = 0;isspace(bp->line[sp]);sp++){ if (bp->line[sp] == '\t') - fprintf(fp, "        "); + fprintf(fp, "        "); else - fprintf(fp, " "); + fprintf(fp, " "); } fprintf(fp, "%s",convurls(&bp->line[sp],id,subject)); #endif @@ -617,14 +628,15 @@ ((bp->next != NULL) && !isalnum(bp->next->line[0]))) fprintf(fp, "
"); if(!bp->header) { - fprintf(fp, "\n"); + fprintf(fp, "\n"); } } - } } else if ((bp->line)[0] != '\0') { - ConvURLs(fp, bp->line, id, subject); + spm = spamprotect(bp->line, 0); + ConvURLs(fp, spm, id, subject); + free(spm); } bp = bp->next; diff -ur hypermail-2b25.orig/src/proto.h hypermail-2b25/src/proto.h --- hypermail-2b25.orig/src/proto.h Thu Sep 30 22:35:12 1999 +++ hypermail-2b25/src/proto.h Sun Nov 7 20:15:07 1999 @@ -87,6 +87,7 @@ char *convchars(char *line); char *unconvchars(char *line); char *makemailcommand(char *mailcommand, char *email, char *id, char *subject); +char *spamprotect(char *input, int fixedwidth); char *parseemail(char *input, char *mid, char *msubject); char *parseurl(char *input); diff -ur hypermail-2b25.orig/src/setup.c hypermail-2b25/src/setup.c --- hypermail-2b25.orig/src/setup.c Thu Sep 30 22:35:12 1999 +++ hypermail-2b25/src/setup.c Sun Nov 7 20:23:21 1999 @@ -41,6 +41,7 @@ bool set_discard_dup_msgids; bool set_usemeta; bool set_uselock; +bool set_spamprotect; int set_thrdlevels; int set_dirmode; @@ -276,6 +278,10 @@ {"dateformat", &set_dateformat, NULL, CFG_STRING, "# Format (see strftime(3)) for displaying dates.\n"}, + + {"spamprotect", &set_spamprotect, BFALSE, CFG_SWITCH, + "# Set this to On to mangle email addresses in all output HTML, to\n" + "# protect list members from spambots (address collectors).\n"}, {"attachmentlink", &set_attachmentlink, NULL, CFG_STRING, "# Format of the attachment links.\n" diff -ur hypermail-2b25.orig/src/setup.h hypermail-2b25/src/setup.h --- hypermail-2b25.orig/src/setup.h Thu Sep 30 22:35:12 1999 +++ hypermail-2b25/src/setup.h Sun Nov 7 20:22:56 1999 @@ -59,6 +59,7 @@ extern bool set_discard_dup_msgids; extern bool set_usemeta; extern bool set_uselock; +extern bool set_spamprotect; extern int set_thrdlevels; extern int set_dirmode; diff -ur hypermail-2b25.orig/src/string.c hypermail-2b25/src/string.c --- hypermail-2b25.orig/src/string.c Thu Sep 30 22:35:13 1999 +++ hypermail-2b25/src/string.c Sun Nov 7 20:22:32 1999 @@ -596,6 +596,55 @@ } +/* +** This function performs some obfustication on anything that has an @ in +** it (might be an email address), hopefully protecting it from automatic +** email harvestors. +** +** Returns an allocated string. +*/ + +char *spamprotect(char *input, int fixedwidth) +{ + char *fat_[] = { "^", "~", "_", "/", "\\", "|", ")", "(" }; + char *at_[] = { " @ ", "@nos.pam.", " (at) ", "_*_", " nospam@", " :: ", + ")@(", "(@)", " _@", "@_ ", "@_@", " at ", " (a) ", + " no@spam.", "(sp@m)", "@ ~", " * ", " AT ", "(-)", + "(:)", " :~ ", " 00 ", " ##", " #", " # ", ")#(", + " || ", " ^a^ ", " {a}", "{a} ", " {a} " }; + char *c; + int rnd = 0; + struct Push buff; + + /* It's better if email addresses are always mangled the same way. + * This may mean someone gets stuck with an ugly mangling, but.. so? + */ + for (c = input; *c != '\0'; c++) rnd += *c; + + INIT_PUSH(buff); + + /* Obfusticate any @ chars. This is a rather crude method, we should + * probably be more choosy about which @s we mess with... + */ + if (set_spamprotect) + while (NULL != (c = strchr(input, '@'))) + { + *c = '\0'; + PushString(&buff, input); + *c = '@'; + + if (fixedwidth) + PushString(&buff, fat_[rnd % (sizeof(fat_)/sizeof(fat_[0]))]); + else + PushString(&buff, at_[rnd % (sizeof(at_)/sizeof(at_[0]))]); + + input = c+1; + } + PushString(&buff, input); + + RETURN_PUSH(buff); +} + /* ** RFC 1738 diff -ur hypermail-2b25.orig/src/struct.c hypermail-2b25/src/struct.c --- hypermail-2b25.orig/src/struct.c Thu Sep 30 22:35:14 1999 +++ hypermail-2b25/src/struct.c Sun Nov 7 20:21:29 1999 @@ -78,8 +78,7 @@ bool msgid_dup = 0; bool msgid_missing = 0; static int freedummy = 0; - char *newmsgid; - + char *newmsgid, *tmp; if(!msgid) { /* this is a severe error, all mails MUST have a Message-ID, ignore it! */ @@ -145,6 +144,10 @@ } } + name = spamprotect(name, 0); + email = spamprotect(email, 0); + subject = spamprotect(subject, 0); + e = (struct emailinfo *) emalloc(sizeof(struct emailinfo)); e->msgnum = num; e->emailaddr = strsav(email); @@ -266,6 +269,10 @@ h->data = e; etable[hashval] = h; + free(subject); + free(email); + free(name); + return e; /* the actual mail struct pointer */ }