hashcash addition for qmail scanner

"JHolder" <[email protected]>
Newsgroups gmane.mail.qmail.scanner
Message-ID <[email protected]>
Hello all,

First of all, I would like to extend thanks to Jason Haar and the
community for such wonderful software.

I have been running qmail scanner for a while, and I had the idea of using
it to add hashcash headers to outgoing emails.  I got most of the way
through creating the code to do this when I realized spamassassin (with
some configuration) might already have a means of doing this.  Is this
indeed possible?  If it is not, is anyone interested in this
functionality?

I am just going to throw the additional function I added to
qmail-scanner-queue.pl here at the bottom of the email to invite comment,
as I don't want to create a patch if I someone is going to tell me I don't
need to.

This function is activated by adding "hashcash" to the @scanner_array
variable.

sub hashcash {
  my $dohashcash = "1";
  my $addhashcashheader = "1";
  my $hashcashcmd = "/usr/bin/hashcash -m -X ";

  if ($dohashcash) {
     &debug("Starting HASHCASH creation function");

     #Don't bother if this is going to be quarantined
     return if ($quarantine_event);

     #grab all addresses that are not bound for this server
     my ($hashaddr,$addr,$dom) = "";
     # is this a safe way to split?  It works so far for my testcases...
     my @addrlist = split(/,/, $recips);
     foreach $addr (@addrlist) {
        foreach $dom (@local_domains_array) {
         if (!($addr =~ /$dom$/i)) {
           $hashaddr .= $addr . " ";
         }
       }
     }

     # only run hashcash if we have (an) address(es) not bound for this
server
     if ($hashaddr && $addhashcashheader) {
        &debug("HASHCASH addresses: $hashaddr");
        my $hashheaders = `$hashcashcmd $hashaddr`;
        &debug("HASHCASH headers: $hashheaders");
     }

     # insert hash headers into email...
  }
}



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.