osdir.com
mailing list archive

Subject: [SACVS] CVS: spamassassin/pop3/examples hostmap.txt,1.1,1.2 - msg#00107

List: mail.spam.spamassassin.cvs

Date: Prev Next Index Thread: Prev Next Index
Update of /cvsroot/spamassassin/spamassassin/pop3/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv31651/examples

Modified Files:
hostmap.txt
Log Message:
use \r\n as end of line (for Win32)


Index: hostmap.txt
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/pop3/examples/hostmap.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -w -u -d -r1.1 -r1.2
--- hostmap.txt 19 Nov 2002 00:48:51 -0000 1.1
+++ hostmap.txt 23 Nov 2002 02:45:37 -0000 1.2
@@ -13,4 +13,4 @@

# Connections on localhost port 818 will be proxy'd to
# mail.yet-another.tld, also port 110
-818 = mail.yet-another.tld:110
+#818 = mail.yet-another.tld:110



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

[SACVS] CVS: spamassassin/pop3 pop3proxy.pl,1.1,1.2

Update of /cvsroot/spamassassin/spamassassin/pop3 In directory sc8-pr-cvs1:/tmp/cvs-serv31226 Modified Files: pop3proxy.pl Log Message: add GUI support [Johan Lindstrom] Index: pop3proxy.pl =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/pop3/pop3proxy.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -b -w -u -d -r1.1 -r1.2 --- pop3proxy.pl 19 Nov 2002 00:45:36 -0000 1.1 +++ pop3proxy.pl 23 Nov 2002 02:43:51 -0000 1.2 @@ -45,6 +45,9 @@ # A BUNCH OF EVIL GLOBALS ######################### +# The user preferences file +my $file_user_prefs = './user_prefs'; + # Set this to be a file that will contain the debug log. Set to an # empty string to debug to STDOUT. --logfile command line arg sets. my $logfile = 'pop3proxy.log'; @@ -278,12 +281,7 @@ die "No proxy host! Use --host or hostmap.txt\n" unless keys %hostmap; # Prevent concurrent proxies - kill any previous instance -if (IO::Socket::INET->new(PeerAddr => 'localhost', - PeerPort => $exit_port, - Proto => "tcp", - Type => SOCK_STREAM)) { - warn "WARNING: Existing proxy killed\n"; -} +warn "WARNING: Existing proxy killed\n" if kill_current_server(); if ($logfile) { # Redirect stdout and stderr to logfile if specified. @@ -299,6 +297,19 @@ $| = 1; +# User Interface stuff +use UI::None; +my $gui = UI::None->new(); +if($^O =~ /MSWin32/i) { + eval { + eval "use UI::Win32"; $@ and die($@); + $gui = UI::Win32->new($file_user_prefs); # may die, in which case we go with the UI::None + }; $@ and warn "WARNING: $@\n"; +} + +# Delay between UI updates (i.e., yield to a GUI main event loop) +my $timeout_seconds = 0.05; + # The SpamAssassin scanner. # # We tell it to use ./user_prefs, and not to try to copy in a default @@ -310,11 +321,8 @@ # whatever. In theory, you could get away with DNS RBL checks, but # I've had a hard time making Net::DNS work on my Win32 setup. # Hackers welcome, best of luck. See notes at end of file. -my $spamtest = Mail::SpamAssassin->new({ - userprefs_filename => './user_prefs', - dont_copy_prefs => 1, - local_tests_only => 1, -}); +my $spamtest; +new_spamassassin(); my $readable = IO::Select->new; my $writeable = IO::Select->new; @@ -344,9 +352,11 @@ while(1) { - my ($toread, $towrite) = IO::Select->select($readable, $writeable); + my ($toread, $towrite) = IO::Select->select($readable, $writeable, undef, $timeout_seconds); + $gui->idle(); foreach my $socket (@$toread) { + $gui->working(); if ($socket == $exit_socket) { all_done($socket); @@ -566,7 +576,7 @@ # run_hooks() session. if (exists $peer{$socket}) { my $proxy = $peer{$socket}; - $writing_buf{$proxy} .= $message{$proxy} if exists ($message{$proxy}); + $writing_buf{$proxy} .= $message{$proxy} || "" if exists ($message{$proxy}); $writing_buf{$proxy} .= $reading_buf{$proxy}; $reading_buf{$proxy} = ''; $message{$proxy} = ''; @@ -702,7 +712,7 @@ # Right here, $message{$socket} is ripe for # scanning. - scan_mail(\$message{$socket}); + $gui->reportNewSpam(1) if(scan_mail(\$message{$socket})); $writing_buf{$socket} .= $message{$socket}; } elsif ($snarfing{$socket} == TOP) { @@ -724,6 +734,7 @@ $writing_buf{$socket} .= $message{$socket}; } $message{$socket} = ''; + undef $message{$socket}; # be certain that string buffer is released $snarfing{$socket} = 0; } } else { @@ -837,6 +848,9 @@ # to do so, it creates a big ol' scalar on the stack to return. # Simple, but it costs a THIRD chunk of memory the size of the # message. +# +# Return true if it's a spam message, else false +# my @mail; sub scan_mail { @@ -902,8 +916,11 @@ $$mailref =~ s|(?<!\015)\012|\015\012|g; } } + my $is_spam = $status->is_spam; $status->finish(); $$mailref =~ s/\012\./\012\.\./g; # byte-stuff + + return($is_spam); } @@ -934,6 +951,21 @@ } } +sub new_spamassassin { + # load/reload the config by start using a new SA object + $spamtest = Mail::SpamAssassin->new({ + userprefs_filename => $file_user_prefs, + dont_copy_prefs => 1, + local_tests_only => 1, + }); +} + +sub kill_current_server { + return(IO::Socket::INET->new(PeerAddr => 'localhost', + PeerPort => $exit_port, + Proto => "tcp", + Type => SOCK_STREAM)); +} sub usage { print <<EOT; ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf

Next Message by Date: click to view message preview

[SACVS] CVS: spamassassin/pop3/lib/resource - New directory

Update of /cvsroot/spamassassin/spamassassin/pop3/lib/resource In directory sc8-pr-cvs1:/tmp/cvs-serv582/lib/resource Log Message: Directory /cvsroot/spamassassin/spamassassin/pop3/lib/resource added to the repository ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf

Previous Message by Thread: click to view message preview

[SACVS] CVS: spamassassin/pop3 pop3proxy.pl,1.1,1.2

Update of /cvsroot/spamassassin/spamassassin/pop3 In directory sc8-pr-cvs1:/tmp/cvs-serv31226 Modified Files: pop3proxy.pl Log Message: add GUI support [Johan Lindstrom] Index: pop3proxy.pl =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/pop3/pop3proxy.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -b -w -u -d -r1.1 -r1.2 --- pop3proxy.pl 19 Nov 2002 00:45:36 -0000 1.1 +++ pop3proxy.pl 23 Nov 2002 02:43:51 -0000 1.2 @@ -45,6 +45,9 @@ # A BUNCH OF EVIL GLOBALS ######################### +# The user preferences file +my $file_user_prefs = './user_prefs'; + # Set this to be a file that will contain the debug log. Set to an # empty string to debug to STDOUT. --logfile command line arg sets. my $logfile = 'pop3proxy.log'; @@ -278,12 +281,7 @@ die "No proxy host! Use --host or hostmap.txt\n" unless keys %hostmap; # Prevent concurrent proxies - kill any previous instance -if (IO::Socket::INET->new(PeerAddr => 'localhost', - PeerPort => $exit_port, - Proto => "tcp", - Type => SOCK_STREAM)) { - warn "WARNING: Existing proxy killed\n"; -} +warn "WARNING: Existing proxy killed\n" if kill_current_server(); if ($logfile) { # Redirect stdout and stderr to logfile if specified. @@ -299,6 +297,19 @@ $| = 1; +# User Interface stuff +use UI::None; +my $gui = UI::None->new(); +if($^O =~ /MSWin32/i) { + eval { + eval "use UI::Win32"; $@ and die($@); + $gui = UI::Win32->new($file_user_prefs); # may die, in which case we go with the UI::None + }; $@ and warn "WARNING: $@\n"; +} + +# Delay between UI updates (i.e., yield to a GUI main event loop) +my $timeout_seconds = 0.05; + # The SpamAssassin scanner. # # We tell it to use ./user_prefs, and not to try to copy in a default @@ -310,11 +321,8 @@ # whatever. In theory, you could get away with DNS RBL checks, but # I've had a hard time making Net::DNS work on my Win32 setup. # Hackers welcome, best of luck. See notes at end of file. -my $spamtest = Mail::SpamAssassin->new({ - userprefs_filename => './user_prefs', - dont_copy_prefs => 1, - local_tests_only => 1, -}); +my $spamtest; +new_spamassassin(); my $readable = IO::Select->new; my $writeable = IO::Select->new; @@ -344,9 +352,11 @@ while(1) { - my ($toread, $towrite) = IO::Select->select($readable, $writeable); + my ($toread, $towrite) = IO::Select->select($readable, $writeable, undef, $timeout_seconds); + $gui->idle(); foreach my $socket (@$toread) { + $gui->working(); if ($socket == $exit_socket) { all_done($socket); @@ -566,7 +576,7 @@ # run_hooks() session. if (exists $peer{$socket}) { my $proxy = $peer{$socket}; - $writing_buf{$proxy} .= $message{$proxy} if exists ($message{$proxy}); + $writing_buf{$proxy} .= $message{$proxy} || "" if exists ($message{$proxy}); $writing_buf{$proxy} .= $reading_buf{$proxy}; $reading_buf{$proxy} = ''; $message{$proxy} = ''; @@ -702,7 +712,7 @@ # Right here, $message{$socket} is ripe for # scanning. - scan_mail(\$message{$socket}); + $gui->reportNewSpam(1) if(scan_mail(\$message{$socket})); $writing_buf{$socket} .= $message{$socket}; } elsif ($snarfing{$socket} == TOP) { @@ -724,6 +734,7 @@ $writing_buf{$socket} .= $message{$socket}; } $message{$socket} = ''; + undef $message{$socket}; # be certain that string buffer is released $snarfing{$socket} = 0; } } else { @@ -837,6 +848,9 @@ # to do so, it creates a big ol' scalar on the stack to return. # Simple, but it costs a THIRD chunk of memory the size of the # message. +# +# Return true if it's a spam message, else false +# my @mail; sub scan_mail { @@ -902,8 +916,11 @@ $$mailref =~ s|(?<!\015)\012|\015\012|g; } } + my $is_spam = $status->is_spam; $status->finish(); $$mailref =~ s/\012\./\012\.\./g; # byte-stuff + + return($is_spam); } @@ -934,6 +951,21 @@ } } +sub new_spamassassin { + # load/reload the config by start using a new SA object + $spamtest = Mail::SpamAssassin->new({ + userprefs_filename => $file_user_prefs, + dont_copy_prefs => 1, + local_tests_only => 1, + }); +} + +sub kill_current_server { + return(IO::Socket::INET->new(PeerAddr => 'localhost', + PeerPort => $exit_port, + Proto => "tcp", + Type => SOCK_STREAM)); +} sub usage { print <<EOT; ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf

Next Message by Thread: click to view message preview

[SACVS] CVS: spamassassin/pop3/lib/resource - New directory

Update of /cvsroot/spamassassin/spamassassin/pop3/lib/resource In directory sc8-pr-cvs1:/tmp/cvs-serv582/lib/resource Log Message: Directory /cvsroot/spamassassin/spamassassin/pop3/lib/resource added to the repository ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by