Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-06 Thread Jan
Hello Stephan!

Thanks for your message an the great work. I can confirm, that the
commit fixes the bug. Thank a lot.

Regards,
Jan

Am 06.03.2018 um 00:48 schrieb Stephan Bosch:
> The actual fix (for v2.2/v0.4):
> https://github.com/dovecot/pigeonhole/commit/14ec6fe861403aa09a3b5790d113247fc1e1f94d
> 
> Some related changes before and after this change (last commit is
> unrelated), mainly relating to creating a regression test for this
> particular problem.
> https://github.com/dovecot/pigeonhole/commits/master-0.4



Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-05 Thread Stephan Bosch
Op 3/3/2018 om 6:29 PM schreef Stephan Bosch:
> Op 3/3/2018 om 6:17 PM schreef Jan:
> We're looking into it.
 Right, this is not reproducible in the test suite, but I can reproduce
 it when I replicate your setup.
>>> I created a special test suite that reproduces the problem reliably.
>>> This occurs when Sieve editheader, Sieve redirect and LMTP are combined.
>>>
>>> Now to fix it...
>> Hello Stephan!
>>
>> Thank you for your quick reply and the informations.
>> If a fix is available, I will test it.
> There is a fix. Pending internal review, I will submit it here.

The actual fix (for v2.2/v0.4):
https://github.com/dovecot/pigeonhole/commit/14ec6fe861403aa09a3b5790d113247fc1e1f94d

Some related changes before and after this change (last commit is
unrelated), mainly relating to creating a regression test for this
particular problem.
https://github.com/dovecot/pigeonhole/commits/master-0.4

Regards,

Stephan.




Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-03 Thread Stephan Bosch
Op 3/3/2018 om 6:17 PM schreef Jan:
 We're looking into it.
>>> Right, this is not reproducible in the test suite, but I can reproduce
>>> it when I replicate your setup.
>>
>> I created a special test suite that reproduces the problem reliably.
>> This occurs when Sieve editheader, Sieve redirect and LMTP are combined.
>>
>> Now to fix it...
>
> Hello Stephan!
>
> Thank you for your quick reply and the informations.
> If a fix is available, I will test it.

There is a fix. Pending internal review, I will submit it here.

Regards,

Stephan.



Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-03 Thread Jan

We're looking into it.

Right, this is not reproducible in the test suite, but I can reproduce
it when I replicate your setup.


I created a special test suite that reproduces the problem reliably.
This occurs when Sieve editheader, Sieve redirect and LMTP are 
combined.


Now to fix it...


Hello Stephan!

Thank you for your quick reply and the informations.
If a fix is available, I will test it.

Regards,
Jan


Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-03 Thread Stephan Bosch
Op 3/3/2018 om 9:35 AM schreef Stephan Bosch:
> Op 3/3/2018 om 9:15 AM schreef Stephan Bosch:
>> Op 3/3/2018 om 2:57 AM schreef Jan:
>>> Hello!
>>>
>> We're looking into it.
> Right, this is not reproducible in the test suite, but I can reproduce
> it when I replicate your setup.

I created a special test suite that reproduces the problem reliably.
This occurs when Sieve editheader, Sieve redirect and LMTP are combined.

Now to fix it...

Regards,

Stephan.

>>> Dovecot 2.2.34 (874deae)
>>> Pigeonhole version 0.4.22 (22940fb7)
>>>
>>> After the update to pigeonhole version 0.4.22 the following
>>> configuration does not work. With version 0.4.21 it works.
>>>
>>> dovecot.conf (only sieve configuration)
>>> ---
>>> managesieve_notify_capability = mailto
>>> managesieve_sieve_capability = fileinto reject envelope
>>> encoded-character vacation subaddress comparator-i;ascii-numeric
>>> relational regex imap4flags copy include variables body enotify
>>> environment mailbox date index ihave duplicate mime foreverypart
>>> extracttext editheader
>>> sieve = file:~/sieve;active=~/.dovecot.sieve
>>> sieve_before = /etc/dovecot/sieve/filter
>>> sieve_extensions = +editheader
>>> sieve_max_script_size = 1M
>>> service managesieve-login {
>>>   inet_listener sieve {
>>>     port = 4190
>>>   }
>>> }
>>> protocol sieve {
>>>   mail_max_userip_connections = 10
>>>   managesieve_implementation_string = Sieve
>>>   managesieve_logout_format = bytes=%i/%o
>>> }
>>> ---
>>>
>>> sieve_before script for all users (/etc/dovecot/sieve/filter)
>>> ---
>>> require ["editheader"];
>>>
>>> if header :contains "X-Spam-Flag" "YES" {
>>>   addheader "X-Filter-Junk-Flag" "YES";
>>>   addheader "X-Filter-Junk-Type" "SPAM";
>>> }
>>> elsif header :contains "X-Amavis-Alert" "INFECTED" {
>>>   addheader "X-Filter-Junk-Flag" "YES";
>>>   addheader "X-Filter-Junk-Type" "VIRUS";
>>> }
>>> elsif header :contains "X-Amavis-Alert" "BANNED" {
>>>   addheader "X-Filter-Junk-Flag" "YES";
>>>   addheader "X-Filter-Junk-Type" "ATTACHMENT";
>>> }
>>> else {
>>>   addheader "X-Filter-Junk-Flag" "NO";
>>>   addheader "X-Filter-Junk-Type" "NONE";
>>> }
>>> ---
>>>
>>> sieve script for user post...@example.com (.dovecot.sieve)
>>> ---
>>> require ["copy"];
>>> if allof (header :is "X-Filter-Junk-Flag" "NO")
>>> {
>>>   redirect :copy "c...@example.com";
>>> }
>>> ---
>>>
>>> I use LMTP to deliver the mail to the user and the
>>> following error occurs:
>>>
>>> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Panic: file
>>> istream.c: line 197 (i_stream_read): assertion failed:
>>> ((size_t)ret+old_size == _stream->pos - _stream->skip)
>>> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Error: Raw
>>> backtrace: /usr/local/lib/dovecot/libdovecot.so.0(+0x9c7a0)
>>> [0x7f8c015be7a0] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x9c88c)
>>> [0x7f8c015be88c] -> /usr/local/lib/dovecot/libdovecot.so.0(i_fatal+0)
>>> [0x7f8c0155294d] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x2c8)
>>> [0x7f8c015c99d8] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x3d)
>>> [0x7f8c015ca15d] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(message_parse_header_next+0x63)
>>> [0x7f8c015a72e3] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x7efb1)
>>> [0x7f8c015a0fb1] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x53)
>>> [0x7f8c015c9763] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x3d)
>>> [0x7f8c015ca15d] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(io_stream_copy+0x75)
>>> [0x7f8c015df1a5] -> /usr/local/lib/dovecot/libdovecot.so.0(+0xbf5e0)
>>> [0x7f8c015e15e0] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(o_stream_send_istream+0x33)
>>> [0x7f8c015df003] ->
>>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x4dbf4)
>>> [0x7f8bfbb3abf4] ->
>>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x3f22a)
>>> [0x7f8bfbb2c22a] ->
>>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(sieve_result_execute+0x27f)
>>> [0x7f8bfbb2da6f] ->
>>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x502ee)
>>> [0x7f8bfbb3d2ee] ->
>>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(sieve_multiscript_run+0xa6)
>>> [0x7f8bfbb3def6] ->
>>> /usr/local/lib/dovecot/lib90_sieve_plugin.so(+0x379a) [0x7f8bfbda279a]
>>> -> /usr/local/lib/dovecot/libdovecot-lda.so.0(mail_deliver+0xa2)
>>> [0x7f8c01b9d942] -> dovecot/lmtp [DATA 127.0.0.1
>>> post...@example.com]() [0x406c0b] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x52)
>>> [0x7f8c015d3c22] ->
>>> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0xea)
>>> [0x7f8c015d51ca] ->
>>> /usr/local/lib/dov

Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-03 Thread Stephan Bosch
Op 3/3/2018 om 9:15 AM schreef Stephan Bosch:
> Op 3/3/2018 om 2:57 AM schreef Jan:
>> Hello!
>>
> We're looking into it.

Right, this is not reproducible in the test suite, but I can reproduce
it when I replicate your setup.

Regards,

Stephan.

>> Dovecot 2.2.34 (874deae)
>> Pigeonhole version 0.4.22 (22940fb7)
>>
>> After the update to pigeonhole version 0.4.22 the following
>> configuration does not work. With version 0.4.21 it works.
>>
>> dovecot.conf (only sieve configuration)
>> ---
>> managesieve_notify_capability = mailto
>> managesieve_sieve_capability = fileinto reject envelope
>> encoded-character vacation subaddress comparator-i;ascii-numeric
>> relational regex imap4flags copy include variables body enotify
>> environment mailbox date index ihave duplicate mime foreverypart
>> extracttext editheader
>> sieve = file:~/sieve;active=~/.dovecot.sieve
>> sieve_before = /etc/dovecot/sieve/filter
>> sieve_extensions = +editheader
>> sieve_max_script_size = 1M
>> service managesieve-login {
>>   inet_listener sieve {
>>     port = 4190
>>   }
>> }
>> protocol sieve {
>>   mail_max_userip_connections = 10
>>   managesieve_implementation_string = Sieve
>>   managesieve_logout_format = bytes=%i/%o
>> }
>> ---
>>
>> sieve_before script for all users (/etc/dovecot/sieve/filter)
>> ---
>> require ["editheader"];
>>
>> if header :contains "X-Spam-Flag" "YES" {
>>   addheader "X-Filter-Junk-Flag" "YES";
>>   addheader "X-Filter-Junk-Type" "SPAM";
>> }
>> elsif header :contains "X-Amavis-Alert" "INFECTED" {
>>   addheader "X-Filter-Junk-Flag" "YES";
>>   addheader "X-Filter-Junk-Type" "VIRUS";
>> }
>> elsif header :contains "X-Amavis-Alert" "BANNED" {
>>   addheader "X-Filter-Junk-Flag" "YES";
>>   addheader "X-Filter-Junk-Type" "ATTACHMENT";
>> }
>> else {
>>   addheader "X-Filter-Junk-Flag" "NO";
>>   addheader "X-Filter-Junk-Type" "NONE";
>> }
>> ---
>>
>> sieve script for user post...@example.com (.dovecot.sieve)
>> ---
>> require ["copy"];
>> if allof (header :is "X-Filter-Junk-Flag" "NO")
>> {
>>   redirect :copy "c...@example.com";
>> }
>> ---
>>
>> I use LMTP to deliver the mail to the user and the
>> following error occurs:
>>
>> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Panic: file
>> istream.c: line 197 (i_stream_read): assertion failed:
>> ((size_t)ret+old_size == _stream->pos - _stream->skip)
>> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Error: Raw
>> backtrace: /usr/local/lib/dovecot/libdovecot.so.0(+0x9c7a0)
>> [0x7f8c015be7a0] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x9c88c)
>> [0x7f8c015be88c] -> /usr/local/lib/dovecot/libdovecot.so.0(i_fatal+0)
>> [0x7f8c0155294d] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x2c8)
>> [0x7f8c015c99d8] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x3d)
>> [0x7f8c015ca15d] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(message_parse_header_next+0x63)
>> [0x7f8c015a72e3] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x7efb1)
>> [0x7f8c015a0fb1] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x53)
>> [0x7f8c015c9763] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x3d)
>> [0x7f8c015ca15d] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(io_stream_copy+0x75)
>> [0x7f8c015df1a5] -> /usr/local/lib/dovecot/libdovecot.so.0(+0xbf5e0)
>> [0x7f8c015e15e0] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(o_stream_send_istream+0x33)
>> [0x7f8c015df003] ->
>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x4dbf4)
>> [0x7f8bfbb3abf4] ->
>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x3f22a)
>> [0x7f8bfbb2c22a] ->
>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(sieve_result_execute+0x27f)
>> [0x7f8bfbb2da6f] ->
>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x502ee)
>> [0x7f8bfbb3d2ee] ->
>> /usr/local/lib/dovecot/libdovecot-sieve.so.0(sieve_multiscript_run+0xa6)
>> [0x7f8bfbb3def6] ->
>> /usr/local/lib/dovecot/lib90_sieve_plugin.so(+0x379a) [0x7f8bfbda279a]
>> -> /usr/local/lib/dovecot/libdovecot-lda.so.0(mail_deliver+0xa2)
>> [0x7f8c01b9d942] -> dovecot/lmtp [DATA 127.0.0.1
>> post...@example.com]() [0x406c0b] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x52)
>> [0x7f8c015d3c22] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0xea)
>> [0x7f8c015d51ca] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x3c)
>> [0x7f8c015d3cbc] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_run+0x38)
>> [0x7f8c015d3e68] ->
>> /usr/local/lib/dovecot/libdovecot.so.0(master_service_run+0x13)
>> [0x7f8c0155caa3] -> dovecot/lmtp [DATA 127.0.0.1
>> post...@example.com](main+0x18c) [0x404fbc] ->
>

Re: pigeonhole 0.4.22 with sieve_before script crashes

2018-03-03 Thread Stephan Bosch
Op 3/3/2018 om 2:57 AM schreef Jan:
> Hello!
>

We're looking into it.

Regards,

Stephan.

> Dovecot 2.2.34 (874deae)
> Pigeonhole version 0.4.22 (22940fb7)
>
> After the update to pigeonhole version 0.4.22 the following
> configuration does not work. With version 0.4.21 it works.
>
> dovecot.conf (only sieve configuration)
> ---
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope
> encoded-character vacation subaddress comparator-i;ascii-numeric
> relational regex imap4flags copy include variables body enotify
> environment mailbox date index ihave duplicate mime foreverypart
> extracttext editheader
> sieve = file:~/sieve;active=~/.dovecot.sieve
> sieve_before = /etc/dovecot/sieve/filter
> sieve_extensions = +editheader
> sieve_max_script_size = 1M
> service managesieve-login {
>   inet_listener sieve {
>     port = 4190
>   }
> }
> protocol sieve {
>   mail_max_userip_connections = 10
>   managesieve_implementation_string = Sieve
>   managesieve_logout_format = bytes=%i/%o
> }
> ---
>
> sieve_before script for all users (/etc/dovecot/sieve/filter)
> ---
> require ["editheader"];
>
> if header :contains "X-Spam-Flag" "YES" {
>   addheader "X-Filter-Junk-Flag" "YES";
>   addheader "X-Filter-Junk-Type" "SPAM";
> }
> elsif header :contains "X-Amavis-Alert" "INFECTED" {
>   addheader "X-Filter-Junk-Flag" "YES";
>   addheader "X-Filter-Junk-Type" "VIRUS";
> }
> elsif header :contains "X-Amavis-Alert" "BANNED" {
>   addheader "X-Filter-Junk-Flag" "YES";
>   addheader "X-Filter-Junk-Type" "ATTACHMENT";
> }
> else {
>   addheader "X-Filter-Junk-Flag" "NO";
>   addheader "X-Filter-Junk-Type" "NONE";
> }
> ---
>
> sieve script for user post...@example.com (.dovecot.sieve)
> ---
> require ["copy"];
> if allof (header :is "X-Filter-Junk-Flag" "NO")
> {
>   redirect :copy "c...@example.com";
> }
> ---
>
> I use LMTP to deliver the mail to the user and the
> following error occurs:
>
> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Panic: file
> istream.c: line 197 (i_stream_read): assertion failed:
> ((size_t)ret+old_size == _stream->pos - _stream->skip)
> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Error: Raw
> backtrace: /usr/local/lib/dovecot/libdovecot.so.0(+0x9c7a0)
> [0x7f8c015be7a0] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x9c88c)
> [0x7f8c015be88c] -> /usr/local/lib/dovecot/libdovecot.so.0(i_fatal+0)
> [0x7f8c0155294d] ->
> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x2c8)
> [0x7f8c015c99d8] ->
> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x3d)
> [0x7f8c015ca15d] ->
> /usr/local/lib/dovecot/libdovecot.so.0(message_parse_header_next+0x63)
> [0x7f8c015a72e3] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x7efb1)
> [0x7f8c015a0fb1] ->
> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x53)
> [0x7f8c015c9763] ->
> /usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x3d)
> [0x7f8c015ca15d] ->
> /usr/local/lib/dovecot/libdovecot.so.0(io_stream_copy+0x75)
> [0x7f8c015df1a5] -> /usr/local/lib/dovecot/libdovecot.so.0(+0xbf5e0)
> [0x7f8c015e15e0] ->
> /usr/local/lib/dovecot/libdovecot.so.0(o_stream_send_istream+0x33)
> [0x7f8c015df003] ->
> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x4dbf4)
> [0x7f8bfbb3abf4] ->
> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x3f22a)
> [0x7f8bfbb2c22a] ->
> /usr/local/lib/dovecot/libdovecot-sieve.so.0(sieve_result_execute+0x27f)
> [0x7f8bfbb2da6f] ->
> /usr/local/lib/dovecot/libdovecot-sieve.so.0(+0x502ee)
> [0x7f8bfbb3d2ee] ->
> /usr/local/lib/dovecot/libdovecot-sieve.so.0(sieve_multiscript_run+0xa6)
> [0x7f8bfbb3def6] ->
> /usr/local/lib/dovecot/lib90_sieve_plugin.so(+0x379a) [0x7f8bfbda279a]
> -> /usr/local/lib/dovecot/libdovecot-lda.so.0(mail_deliver+0xa2)
> [0x7f8c01b9d942] -> dovecot/lmtp [DATA 127.0.0.1
> post...@example.com]() [0x406c0b] ->
> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x52)
> [0x7f8c015d3c22] ->
> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0xea)
> [0x7f8c015d51ca] ->
> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x3c)
> [0x7f8c015d3cbc] ->
> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_run+0x38)
> [0x7f8c015d3e68] ->
> /usr/local/lib/dovecot/libdovecot.so.0(master_service_run+0x13)
> [0x7f8c0155caa3] -> dovecot/lmtp [DATA 127.0.0.1
> post...@example.com](main+0x18c) [0x404fbc] ->
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)
> [0x7f8c01198b45] -> dovecot/lmtp [DATA 127.0.0.1
> post...@example.com]() [0x405065]
> Mar  3 02:31:34 test dovecot: lmtp(post...@example.com): Fatal:
> master: service(lmtp): child 13445 killed with signal 6