MailScanner stoped working after PERL upgrade (I think so)

Julian Field MailScanner at ecs.soton.ac.uk
Tue Dec 6 08:38:04 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. ]

-----BEGIN PGP SIGNED MESSAGE-----


On 6 Dec 2005, at 07:55, Boris Jordanov / Ð^ÑоÑ^ÀиÑ^Á Ð^ÙоÑ^Àданов  
wrote:

> Julian Field wrote:
>> Something is very wrong with your system. Here's what I get with your
>> message:
>>
>> MsgContSize=635 DataOffset=346 NumRecips=1
>> Content size = 635
>> Data offset  = 346
>> Num Recips   = 1
>>
>> which looks fine to me.
>>
> I've touched the code:
>
>     # 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';
>     $recdata =~ /^([0-9 ]{15}) ([0-9 ]{15}) ([0-9 ]{15})( ([0-9 ] 
> {15}))?$/;
>     print "recdata is now \"$recdata\"\n";
>     ($MsgContSize, $DataOffset, $NumRecips) = ($1+0, $2+0, $3+0);

Try changing that last line to

($MsgContSize, $DataOffset, $NumRecips) = ($1, $2, $3);
$MsgContSize =~ /^\D+//;
$DataOffset =~ /^\D+//;
$NumRecips =~ /^\D+//;
$MsgContSize = $MsgContSize + 0;
$DataOffset = $DataOffset + 0;
$NumRecips = $NumRecips + 0;

and let me know what happens.

>      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;
>     }
>
>     $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;
>     }
>
>
>
> And here's the result:
>
> [root at im ~]# MailScanner
> In Debugging mode, not forking...
> In ReadQf
> hdpath = /var/spool/postfix/hold/459D616FBD
> inhdhandle = FileHandle=GLOB(0xac65e98)
> size = 985
> 1st C is "            635             346                
> 1               0"
> recdata is now "            635             346               1
>       0"
> MsgContSize=459 DataOffset=0 NumRecips=0
> MsgContSize=459 DataOffset=0 NumRecips=0
> Content size = 459
> Data offset  = 0
> Num Recips   = 0
> Can't call method "DropFromBatch" on unblessed reference at
> /usr/lib/MailScanner/MailScanner/Postfix.pm line 334.
>
> It looks OK _until_
>
> ($MsgContSize, $DataOffset, $NumRecips) = ($1+0, $2+0, $3+0);
>
> after that line  print STDERR "MsgContSize=$MsgContSize
> DataOffset=$DataOffset NumRecips=$NumRecips\n"; returns:
> MsgContSize=459 DataOffset=0 NumRecips=0
>
> I'm not into PERL so what's wrong here?:
> $recdata =~ /^([0-9 ]{15}) ([0-9 ]{15}) ([0-9 ]{15})( ([0-9 ]{15}))? 
> $/;
>
> I believe the ($MsgContSize, $DataOffset, $NumRecips) = ($1+0, $2+0,
> $3+0); line is OK, so I blame $recdata =~ /^([0-9 ]{15}) ([0-9 ]{15})
> ([0-9 ]{15})( ([0-9 ]{15}))?$/;
>
> ------------------------ 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!

- -- 
Julian Field
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654


-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.0.3 (Build 2932)

iQEVAwUBQ5VN7vw32o+k+q+hAQG00Qf9F05wZzJ6e/2TK/rYUPDz3m/kZvP0ulC2
YANu6ZA+59hyk+UFHYdATvn81snz0Uj/UyMa570CBe0PfyFhkxoQSLCLgbA+n+UD
ExMQ7H8x6Lse8CDdOv/6MLT2qShcwfkgQVHO09ItlVD3GoXFt6JsCzq5oeidmmsQ
HDgzveYK1VGw++zDKrVKARFASyqdamWbs9n0DB0u5PHCPhYOLaDJM5Ng/H+705dP
iht880QUNxCxaIS7KHjfXBgEgtMqSnUkoYuCrD5Qbwh7cF5lIeo4Cqf2j+osRGhn
2FwFZxaY2EErjQUge60iIqSrlWnxAmMAKC5j2Ir6U0I9feeYWLMhTw==
=P+GZ
-----END PGP SIGNATURE-----

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

------------------------ 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