Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026

Diff for scripts/perl/postfix/spf.pl between version 1.1 and 1.2

version 1.1, 2005/12/02 17:56:50 version 1.2, 2005/12/02 20:56:12
Line 14 
Line 14 
 use Fcntl;  use Fcntl;
 use Carp;  use Carp;
 use Sys::Syslog qw(:DEFAULT setlogsock);  use Sys::Syslog qw(:DEFAULT setlogsock);
   use Time::HiRes qw(gettimeofday tv_interval usleep sleep);
 use strict;  use strict;
   
 # ----------------------------------------------------------  # ----------------------------------------------------------
Line 28  use strict;
Line 29  use strict;
  push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query;   push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query;
   
 my $VERBOSE = 1;  my $VERBOSE = 1;
   #my $VERBOSE = 0;
   
 my $DEFAULT_RESPONSE = "DUNNO";  my $DEFAULT_RESPONSE = "DUNNO";
   
Line 159  while (<STDIN>) {
Line 161  while (<STDIN>) {
   if (/=/)       { my ($k, $v) = split (/=/, $_, 2); $attr{$k} = $v; next }    if (/=/)       { my ($k, $v) = split (/=/, $_, 2); $attr{$k} = $v; next }
   elsif (length) { syslog('warning', "warning: ignoring garbage: %.100s", $_); next; }    elsif (length) { syslog('warning', "warning: ignoring garbage: %.100s", $_); next; }
   
   if ($VERBOSE) {    if (0 && $VERBOSE) {
     for (sort keys %attr) {      for (sort keys %attr) {
       syslog('debug', "Attribute: %s=%s", $_, $attr{$_});        syslog('debug', "Attribute: %s=%s", $_, $attr{$_});
     }      }
Line 169  while (<STDIN>) {
Line 171  while (<STDIN>) {
   
   my $action = $DEFAULT_RESPONSE;    my $action = $DEFAULT_RESPONSE;
   my %responses;    my %responses;
     my $ts0 = [gettimeofday];
   foreach my $handler (@HANDLERS) {    foreach my $handler (@HANDLERS) {
     no strict 'refs';      no strict 'refs';
     my $response = $handler->(attr=>\%attr);      my $response = $handler->(attr=>\%attr);
     syslog('debug', "handler %s: %s", $handler, $response);          #syslog('debug', "handler %s: %s", $handler, $response);
     if ($response and $response !~ /^dunno/i) {      if ($response and $response !~ /^dunno/i) {
       syslog('info', "handler %s: %s is decisive.", $handler, $response);        syslog('info', "handler %s: %s is decisive.", $handler, $response);
       $action = $response; last;        $action = $response; last;
     }      }
   }    }
     if ($VERBOSE) {
             syslog('debug', "SPF-REQUIRED-TIME: %s seconds", tv_interval($ts0, [gettimeofday]));
     }
   
   syslog('info', "decided action=%s", $action);    syslog('info', "decided action=%s", $action);
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top