MailScanner stoped working after PERL upgrade (I think so)

[UTF-8] Boris Jordanov / Борис Йорданов boris.jordanov at GMAIL.COM
Tue Dec 6 08:44:56 GMT 2005


    [ The following text is in the "UTF-8" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Julian Field wrote:
> Something is very wrong with your system. Here's what I get with your
> message:
> 

Julian, I've managed to work it out (for the proof of my idea only)

Here is the code, it's not a diff, because it is an ugly PoC. The
problem _is_ in the splitting. I split it my way (again, I'm not into
PERL, excuse my code) and it is OK. One problem - you are looking for
something referenced as $5. With the original code and my split MS says
- corrupted and moves the message to the corrupted directory. If I force:
$message->{PostfixQmgrOpts} = $5+0;

everything goes OK and the message is delivered.

Can you fix it guys? Please? :) TIA

    # Read the initial record.
    # Provides Message content size, data offset and recipient count
    ($rectype, $recdata) = ReadRecord($RQf);
    print "1st $rectype is \"$recdata\"\n";
    MailScanner::Log::WarnLog("Syntax error in Postfix queue file,
didn't " .
                              "start with a C record") unless $rectype
eq 'C';

########################################
    my @splitted = split(/ +/,$recdata);
########################################

    #$recdata =~ /^([0-9 ]{15}) ([0-9 ]{15}) ([0-9 ]{15})( ([0-9 ]{15}))?$/;
    print "recdata is now \"$recdata\"\n";
    print "splitted is now @splitted\n";

    #($MsgContSize, $DataOffset, $NumRecips) = ($1+0, $2+0, $3+0);

##############################################################
    ($MsgContSize, $DataOffset, $NumRecips) = (@splitted[1]+0,
@splitted[2]+0, @splitted[3]+0);
##############################################################

     print STDERR "MsgContSize=$MsgContSize DataOffset=$DataOffset
NumRecips=$NumRecips\n";

    # If $5 is set then we have a new data structure in the file
    $MailScanner::Postfix::DataStructure = 0;
    if ($5 ne "") {
      $MailScanner::Postfix::DataStructure = 1;
      $message->{PostfixQmgrOpts} = $5+0;
    }

#############################################
    $MailScanner::Postfix::DataStructure = 1;
    $message->{PostfixQmgrOpts} = $5+0;
#############################################

    $MsgContSize =~ s/^\s*//;
    $DataOffset  =~ s/^\s*//;
    $NumRecips   =~ s/^\s*//;
    print STDERR "MsgContSize=$MsgContSize DataOffset=$DataOffset
NumRecips=$NumRecips\n";
    push @{$message->{metadata}}, "$rectype$recdata";
    print STDERR "Content size = $MsgContSize\n";
    print STDERR "Data offset  = $DataOffset\n";
    print STDERR "Num Recips   = $NumRecips\n";

    # If the data offset is 0 then Postfix definitely hasn't finished
    # writing the message.
    unless ($DataOffset+0 > 10) { # 10 == arbitrary small number
      $message->DropFromBatch();
      return 0;
      }

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!



More information about the MailScanner mailing list