Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Matt Sergeant
On Sat, 12 Apr 2008, Radu Greab wrote: I found a case where qpsmtpd-async detects the end of data marker incorrectly: the previous packet did not end with CRLF and the current packet starts with .CRLF. The code assumes that the previous packet ended with CRLF. Attached are a test script and a

Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Matt Sergeant
On Mon, 14 Apr 2008, Matt Sergeant wrote: On Sat, 12 Apr 2008, Radu Greab wrote: I found a case where qpsmtpd-async detects the end of data marker incorrectly: the previous packet did not end with CRLF and the current packet starts with .CRLF. The code assumes that the previous packet ended w

Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Matt Sergeant
On Sat, 12 Apr 2008, Radu Greab wrote: I found a case where qpsmtpd-async detects the end of data marker incorrectly: the previous packet did not end with CRLF and the current packet starts with .CRLF. The code assumes that the previous packet ended with CRLF. Attached are a test script and a

Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Guy Hulbert
On Mon, 2008-14-04 at 12:54 +, Matt Sergeant wrote: > > Attached are a test script and a suggested patch. > > I committed the patch 95% the same as yours. > > I can't help feeling there's a better way to do it - I hate applying > two > regexps every time a DATA packet comes in... I'll have a

Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Matt Sergeant
On Mon, 14 Apr 2008, Guy Hulbert wrote: On Mon, 2008-14-04 at 12:54 +, Matt Sergeant wrote: Attached are a test script and a suggested patch. I committed the patch 95% the same as yours. I can't help feeling there's a better way to do it - I hate applying two regexps every time a DATA pa

Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Radu Greab
Matt Sergeant wrote: > > >> I can't help feeling there's a better way to do it - I hate applying > >> two > >> regexps every time a DATA packet comes in... I'll have a think on > >> it. One option could be to keep this regexp $data =~ s/\r\n\.\r\n(.*)\z/\r\n/ms and, if it is not matched, the

Re: qpsmtpd-async: premature end of data problem

2008-04-14 Thread Juerd Waalboer
Radu Greab skribis 2008-04-14 22:19 (+0300): > $data =~ s/\r\n\.\r\n(.*)\z/\r\n/ms If you don't want to use the regex engine (and indeed, especially regexes with .* are often inefficient), you could use good old index and substr to achieve the same: # untested code my $data_end = index(