[PATCH] Re: ["PATCH"] Re: Mailfs date problem

Hello Pavel,

On Fri, 2006-05-26 at 15:46 +0300, Pavel Tsekov wrote:
> There is another problem with mail messages which contain in their bodies 
> the word From at the start of a line.

The impact of this problem can be reduced by making the match for the
header start line more strict. Still doesn't fix all cases (where there
is a line in the mail body which represent a mail header start line),
but such cases should be escaped by the mail client (by adding a
backslash in front of "From" or by inserting a space in the empty line
before the line starting with "From).

Please test the attached patch for it's impact on execution time. The
match string could be still shortened (to something like
/From\s+\w+(\.\w+)*@/ which still matches most cases).


mount -t life -o ro /dev/dna /genetic/research

--- mailfs.006	2006-05-26 17:30:51.000000000 +0200
+++ mailfs	2006-05-26 18:20:36.000000000 +0200
@@ -135,7 +135,7 @@ sub mailfs_list {
     while(<IN>) {
-	if($blank && /^From /) { # Start of header
+	if($blank && /^From\s+\w+(\.\w+)* \w+(\.\w+)*\s+\w{3}/) { # Start of header
 	    print_dir_line unless (!$msg_nr);
@@ -160,7 +160,7 @@ sub mailfs_copyout {
     my $blank = 1;
     while(<IN>) {
-	if($blank && /^From /) {
+	if($blank && /^From\s+\w+(\.\w+)* \w+(\.\w+)*\s+\w{3}/) {
 	    exit(0) if ($msg_nr > $nr);
 	    $blank= 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]