Sieve: vacation from: parameter with display-name

2016-03-08 Thread Edda via Info-cyrus

Hi,

I’m referring back to a post from 2009 for which I can’t find an answer:

https://lists.andrew.cmu.edu/pipermail/info-cyrus/2009-March/030707.html

According to sieve/vacation RFCs 5228/5230 it is possible to add a 
display-name in the :from parameter, for example:


vacation :from "My Name "

This entry in a cyrus sieve script results in the following From: header 
in the auto-reply (via sendmail):


From: "

Please see the first unbalanced „<„ in the display-name.

In cyrus source code  (2.4.18 in our case but the same in 2.5.7), file 
../imap/lmtp_sieve.c, function send_response we have:


[…]
static int send_response(void *ac,
 void *ic __attribute__((unused)),
 void *sc, void *mc, const char **errmsg)
{
[…]
fprintf(sm, "X-Sieve: %s\r\n", SIEVE_VERSION);
fprintf(sm, "From: <%s>\r\n", src->fromaddr);
fprintf(sm, "To: <%s>\r\n", src->addr);
[…]

cyrus always adds <> to the fromaddr, even if the vacation :from 
parameter contains a display-name like in the example above:


vacation :from "My Name "

In this case cyrus provides the following From: header to the mta:

From: >

To my understanding of RFC 5322 this is not a valid „mailbox“, because 
of the outer angle brackets around. sendmail rewrites it internally to 
the resulting valid but ugly form:


From: "

Looks like a bug in cyrus to me or am I missing something, maybe an 
answer to the original post ;-) ?


Best regards,
Edda


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

Re: Sieve: vacation from: parameter with display-name

2016-03-10 Thread Edda via Info-cyrus

Am 08.03.16 um 14:19 schrieb Edda via Info-cyrus:
[...]


From: >

To my understanding of RFC 5322 this is not a valid „mailbox“, because 
of the outer angle brackets around. sendmail rewrites it internally to 
the resulting valid but ugly form:


From: "

I looked at RFC 5322 a bit further. It states that address header fields 
are (finally) of the form "mailbox":


   mailbox =   name-addr / addr-spec

where

   name-addr   =   [display-name] angle-addr

(addr-spec has no angle brackets around).

MTAs mostly tolerate the forms with angle brackets, but they are not 
compliant to RFC... as far as I see...


Sieve vacation already uses name-addr or addr-spec, so I would suggest 
this simple patch:


diff -Naur cyrus-imapd-2.4.18.orig/imap/lmtp_sieve.c 
cyrus-imapd-2.4.18/imap/lmtp_sieve.c
--- cyrus-imapd-2.4.18.orig/imap/lmtp_sieve.c2015-07-06 
05:38:29.0 +0200
+++ cyrus-imapd-2.4.18/imap/lmtp_sieve.c2016-03-10 
13:44:04.173224594 +0100

@@ -650,8 +650,8 @@
 fprintf(sm, "Date: %s\r\n", datestr);

 fprintf(sm, "X-Sieve: %s\r\n", SIEVE_VERSION);
-fprintf(sm, "From: <%s>\r\n", src->fromaddr);
-fprintf(sm, "To: <%s>\r\n", src->addr);
+fprintf(sm, "From: %s\r\n", src->fromaddr);
+fprintf(sm, "To: %s\r\n", src->addr);
 /* check that subject is sane */
 sl = strlen(src->subj);
 for (i = 0; i < sl; i++)



Best regards,
Edda






Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

Re: sieve runtime error Fileinto: Permission denied

2016-05-24 Thread Edda via Info-cyrus
Interesting ;-) Looks like fileinto wants to deliver to an existent 
(existent for the user) but different folder as you expect, not the ones 
you listed below.


What's your sieve script?
And what sees the user in the IMAP LIST command?

I can reproduce this issue with a test user (mailtest) and an 
additionally created shared folder:


localhost> cm user/mailtest
localhost> cm user/mailtest/Drafts
localholocalhost> cm Drafts
localhost> lam Drafts
anyone lrs

Test user logs in and sees:

[root@popc ~]# telnet localhost 143
[...]
. login mailtest xxx
[...]
. LIST "" "*"
* LIST (\HasChildren) "/" "INBOX"
* LIST (\HasNoChildren) "/" "INBOX/Drafts"
* LIST (\HasNoChildren) "/" "Drafts"
. OK Completed (0.000 secs 4 calls)

If the test user wants to deliver mails directly to the shared Drafts 
folder via sieve script:


if anyof (header :contains "to" "mailtest")
{
fileinto "Drafts";
stop;
}

I get the error:

May 24 13:23:24 popc lmtpunix[6959]: sieve runtime error for mailtest id 
<201605241123.u4OBMqJK006976@popc.localdomain>: Fileinto: Permission denied


For delivering to the folder either the owner or "anyone" needs the "p" 
right on it. Fortunately, nobody has, as the folder was created with ACL 
"anyone lrs".


I think you created something similar but I admit, it's a bit 
guessing... But iff this is the issue, you have unexpected folders and 
selected the wrong folder in the sieve script.


Edda

Am 23.05.16 um 13:52 schrieb Sunny via Info-cyrus:

Hi,

I'm seeing the following error logs with some users sieve filtering
May 23 11:41:31 imap02 lmtpunix[26005]: sieve runtime error for test2 
id <5742de5a.3040...@org.ac.uk>: Fileinto: Permission denied


Essentially emails are not being put into the specific folders.

Their cyrus:mail permissions are in place

[root@imap02 test2]# ls -ls /var/spool/imap/t/user/test2/
 4 -rw--- 1 cyrus mail  1663 May 23 10:36 747.
 4 -rw--- 1 cyrus mail  1904 May 23 10:53 748.
 4 -rw--- 1 cyrus mail  1661 May 23 10:54 749.
 4 -rw--- 1 cyrus mail  1666 May 23 10:56 750.
 4 -rw--- 2 cyrus mail  1613 May 23 11:00 751.
 4 -rw--- 1 cyrus mail  1541 May 23 11:12 752.
 4 -rw--- 1 cyrus mail  1541 May 23 11:20 753.
 4 -rw--- 1 cyrus mail  1537 May 23 11:22 754.
 4 -rw--- 1 cyrus mail  1537 May 23 11:23 755.
 4 -rw--- 1 cyrus mail  1539 May 23 11:40 756.
 4 -rw--- 1 cyrus mail  1541 May 23 11:41 757.
20 -rw--- 1 cyrus mail 16424 May 23 11:41 cyrus.cache
 4 -rw--- 1 cyrus mail   184 May 23 11:41 cyrus.header
 4 -rw--- 1 cyrus mail  1768 May 23 11:41 cyrus.index
 4 drwx-- 2 cyrus mail  4096 May 23 11:41 Drafts
 4 drwx-- 2 cyrus mail  4096 May 23 11:41 for-sale
 4 drwx-- 2 cyrus mail  4096 May 23 11:41 hello
 4 drwx-- 2 cyrus mail  4096 May 23 12:11 Sent
12 drwx-- 2 cyrus mail 12288 May 23 11:41 Trash


cyrus permissions - (I changed user cyrus permission to full to see if 
it worked - but it didn't)


localhost.localdomain> lam user.test2*
user.test2:
  test2 lrswipkxtea
  cyrus lrswipkxtecda
user.test2.Drafts:
  test2 lrswipkxtea
  cyrus lrswipkxtecda
user.test2.Sent:
  test2 lrswipkxtea
  cyrus lrswipkxtecda
user.test2.Trash:
  test2 lrswipkxtea
  cyrus lrswipkxtecda
user.test2.for-sale:
  test2 lrswipkxtea
  cyrus lrswipkxtecda
user.test2.hello:
  test2 lrswipkxtea
  cyrus lrswipkxtecda
user.test2.ssn:
  test2 lrswipkxtea
  cyrus lrswipkxtecda

cyrus.conf
SERVICES {
  # add or remove based on preferences
  imapcmd="imapd" listen="imap" prefork=5
  imapscmd="imapd -s" listen="imaps" prefork=1
  pop3cmd="pop3d" listen="pop3" prefork=3
  pop3scmd="pop3d -s" listen="pop3s" prefork=1
  sievecmd="timsieved" listen="sieve" prefork=0
  oldsieve  cmd="timsieved" listen="2000" prefork=0


Other sieve functions work like "reject" "vacation" but not fileinto.

Are there any other suggestions?

Regards

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus




Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Re: imapd 2.5.7-8 with virtual domains and sendmail config

2016-06-15 Thread Edda via Info-cyrus

Hi Mogens,

Am 15.06.16 um 17:06 schrieb Mogens Melander via Info-cyrus:



# echo "3,0 dom...@example.com " | sendmail 
-v -bt

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter  
> 3,0 dom...@example.com 
[...]
Parse1 input: joe < @ example . com . >
Parse1   returns: $# cyrusv2 $: joe
parsereturns: $# cyrusv2 $: joe
Recurse  returns: $# cyrusv2 $: joe
Parse1   returns: $# cyrusv2 $: joe
parsereturns: $# cyrusv2 $: joe

as you see ruleset Parse1 strips the domain. That's because Parse1 
strips the domain from everything sendmail considers as local. If you 
like, you may look at sendmail.cf and you'll find something like


SParse1
[...]
R$+ < @ $=w . > $#local $: $1 regular local name


For cyrus virtdomains it's better to treat all virtdomains as NON local 
in sendmail. Only the default domain (do you have one?) should also be 
local in sendmail.


The following sendmail configuration (mail routing only) should work:

sendmail.mc:

VIRTUSER_DOMAIN(`example.com')dnl
FEATURE(`virtusertable')dnl

MAILER_DEFINITIONS
Mcyrusv2,   P=[IPC], F=lsDFMnqXzA@/:|m,
S=EnvFromSMTP/HdrFromL, R=EnvToSMTP, E=\r\n,
T=DNS/RFC822/SMTP,
A=FILE /var/imap/socket/lmtp


mailertable:

example.comcyrusv2:/var/imap/socket/lmtp

virtusertable as you already have.

That's all.

Remove your cyrus virtdomains from local-host-names (class w)!
Delete your LOCAL_RULE_0, if you havn't already.

You must declare your cyrus virtdomains as virtuserdomains in sendmail, 
because you've deleted them from class w.
Instead of VIRTUSER_DOMAIN, you can use also VIRTUSER_DOMAIN_FILE. 
Insert all cyrus virtdomains there.


If you want your local domain also to be delivered to cyrus, use
define(`confLOCAL_MAILER',`cyrusv2')dnl

Mailer cyrusv2 provides local delivery. You need to define it explicitly 
to get rid of the default setting "R=EnvToL/HdrToL" which strips the 
domain from everything it sees.
As you defined cyrusv2 in the MAILER_DEFINITIONS section, remove all 
other instances (except LOCAL_MAILER, if you want to use cyrusv2) of 
cyrusv2 from your sendmail.mc, like:

define(`CYRUSV2_MAILER_FLAGS',`Ah5@/:|w')dnl
MAILER(`cyrusv2')dnl


Now you should have a clear routing setup in sendmail that should work. 
If not, don't hesitate to let me know.


Edda



Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

imapd dumps core on APPEND URL with invalid section

2016-07-30 Thread Edda via Info-cyrus

Hi,

we get core dumps of imapd on commands like this:

A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE 
(URL "/INBOX/;uid=44335/;section=TEXT.MIME" URL 
"/INBOX/;uid=44335/;section=TEXT")

Connection closed by foreign host.

Tested with:
Cyrus 2.4.18 on Solaris 11
Cyrus 2.4.17 on CentOS 7

section=MIME instead of section=TEXT.MIME (which I think is not a valid 
section) works for the message:


A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE 
(URL "/INBOX/;uid=44335/;section=MIME" URL 
"/INBOX/;uid=44335/;section=TEXT")

A7 OK [APPENDUID 1469792687 169] Completed

To illustrate the issue we produced core dumps with some nonsense 
sections, example:


A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE 
(URL "/INBOX/;uid=44335/;section=CATS_AND_DOGS" URL 
"/INBOX/;uid=44335/;section=TEXT")

Connection closed by foreign host.


This is the stacktrace of the corresponding core file (produced with 
Cyrus 2.4.17):


(gdb) bt full
#0  __bswap_32 (__bsx=address 0x7f6211818650>) at /usr/include/bits/byteswap.h:47

No locals.
#1  index_urlfetch (state=, msgno=, 
params=0, section=, start_octet=0, octet_count=0,

pout=0x7f612b939610, outsize=0x7fff44d3ce80) at index.c:2785
num_parts = 2
p = 0x7f612b9292fb "CATS_AND_DOGS"
data = 0x7f6129f41000 
msg_base = 0x7f6129f41000 
msg_size = 4812
cacheitem = 0x7f6211818650 
fetchmime = 1
domain = 0
size = 4812
skip = 1697477688
n = 
r = 
decbuf = 0x0
mailbox = 0x7f612b929878
im = 0x7f612b92a7b0
[…]
(gdb) where
#0  __bswap_32 (__bsx=address 0x7f62a7ebe650>) at /usr/include/bits/byteswap.h:47
#1  index_urlfetch (state=, msgno=, 
params=0, section=, start_octet=0, octet_count=0, 
pout=0x7f61c12d4600, outsize=0x7ffcec9b1fc0)

at index.c:2785
#2  0x7f61c06d0277 in cmd_append (tag=, 
name=, cur_name=) at imapd.c:3121

#3  0x7f61c06d5f2c in cmdloop () at imapd.c:1279
#4  0x7f61c06d7759 in service_main (argc=, 
argv=, envp=) at imapd.c:946
#5  0x7f61c06c0875 in main (argc=, argv=out>, envp=0x7ffcec9b7a88) at service.c:582



I don’t know where to fix it best in order to get BADURL or something 
instead of a core dump, so any help would be highly appreciated.


Regards,
Edda


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

Re: imapd dumps core on APPEND URL with invalid section

2016-08-01 Thread Edda via Info-cyrus

Hi Ellie,

Am 01.08.16 um 07:41 schrieb ellie timoney via Info-cyrus:

The master branch has a commit to address this exact (like, literally
"TEXT.MIME") issue:

https://github.com/cyrusimap/cyrus-imapd/commit/f7b95b93

I've just cherry-picked it onto the cyrus-imapd-2.4 branch and it
applied cleanly first time, so it's upstream now.  (It's already in 2.5,
and has been since the 2.5.0 release.)
Thank you very much for pointing me to the patch and for applying it to 
the 2.4. branch and for helping so quickly

Just tried it, works well for us.



Though your email raises another question -- what do we want to do about
other junk section values?
For non existing sections names I would suggest to reply with NO, BADURL 
("No such message part") as cyrus-imapd does already for sections out of 
range:


A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE 
(URL "/INBOX/;uid=44335/;section=15" URL "/INBOX/;uid=44335/;section=TEXT")

A7 NO [BADURL "/INBOX/;uid=44335/;section=15"] No such message part

If index_urlfetch (./imap/index.c) would return with BADURL on non 
existing section names too, catenate_url (./imap/imapd.c) would catch it 
already as "No such message part“.


Regards,
Edda

On Sat, Jul 30, 2016, at 11:18 PM, Edda via Info-cyrus wrote:

Hi,

we get core dumps of imapd on commands like this:

A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE
(URL "/INBOX/;uid=44335/;section=TEXT.MIME" URL
"/INBOX/;uid=44335/;section=TEXT")
Connection closed by foreign host.

Tested with:
Cyrus 2.4.18 on Solaris 11
Cyrus 2.4.17 on CentOS 7

section=MIME instead of section=TEXT.MIME (which I think is not a valid
section) works for the message:

A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE
(URL "/INBOX/;uid=44335/;section=MIME" URL
"/INBOX/;uid=44335/;section=TEXT")
A7 OK [APPENDUID 1469792687 169] Completed

To illustrate the issue we produced core dumps with some nonsense
sections, example:

A7 APPEND "INBOX/Junk E-mail" () "29-Jul-2016 07:17:38 +" CATENATE
(URL "/INBOX/;uid=44335/;section=CATS_AND_DOGS" URL
"/INBOX/;uid=44335/;section=TEXT")
Connection closed by foreign host.


This is the stacktrace of the corresponding core file (produced with
Cyrus 2.4.17):

(gdb) bt full
#0  __bswap_32 (__bsx=) at /usr/include/bits/byteswap.h:47
No locals.
#1  index_urlfetch (state=, msgno=,
params=0, section=, start_octet=0, octet_count=0,
  pout=0x7f612b939610, outsize=0x7fff44d3ce80) at index.c:2785
  num_parts = 2
  p = 0x7f612b9292fb "CATS_AND_DOGS"
  data = 0x7f6129f41000 
  msg_base = 0x7f6129f41000 
  msg_size = 4812
  cacheitem = 0x7f6211818650 
  fetchmime = 1
  domain = 0
  size = 4812
  skip = 1697477688
  n = 
  r = 
  decbuf = 0x0
  mailbox = 0x7f612b929878
  im = 0x7f612b92a7b0
[…]
(gdb) where
#0  __bswap_32 (__bsx=) at /usr/include/bits/byteswap.h:47
#1  index_urlfetch (state=, msgno=,
params=0, section=, start_octet=0, octet_count=0,
pout=0x7f61c12d4600, outsize=0x7ffcec9b1fc0)
  at index.c:2785
#2  0x7f61c06d0277 in cmd_append (tag=,
name=, cur_name=) at imapd.c:3121
#3  0x7f61c06d5f2c in cmdloop () at imapd.c:1279
#4  0x7f61c06d7759 in service_main (argc=,
argv=, envp=) at imapd.c:946
#5  0x7f61c06c0875 in main (argc=, argv=, envp=0x7ffcec9b7a88) at service.c:582


I don’t know where to fix it best in order to get BADURL or something
instead of a core dump, so any help would be highly appreciated.

Regards,
Edda


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus




Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus