Bug 159296

Summary: kmail unuseable with cyrusIMAP - on reading mail KMail tries to set more flags than just SEEN
Product: [Unmaintained] kmail Reporter: Giuseppe Ravasio <giuseppe_ravasio>
Component: IMAPAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: major CC: bjoern, bruno.leon, bugs, dreamer, kfunk, lemma, roby.secchi, rsecchi
Priority: NOR    
Version: 1.9.9   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Giuseppe Ravasio 2008-03-14 11:36:18 UTC
Version:           1.9.9 and 1.9.6 (Enterprise 20070904.708012) (using KDE 3.5.7)
Installed from:    SuSE RPMs
OS:                Linux

Recently i moved my IMAP server to a newer version of CyrusIMAP (2.3.8), and KMail is now unusable because, every time a select a new email on a shared folder i get an error like:

---- START -----
Error while uploading status of messages to server:
Cannot Write to Resource
This means that although the resource, Changing the flags of message
imaps://user@mbox993/shared_folder/aaa/;UID=31900 failed.,
was able to be opened, an error occurred while writing to the resource.
Details of the request:
URL: (unknown)
Date and time: Friday 14 March 2008 10:47
Additional information: Changing the flags of message
imaps://user@mbox993/shared_folder/aaa/;UID=31900 failed.
Possible causes:
You may not have permissions to write to the resource.
There may have been a problem with your network connection.
Although unlikely, a hardware error may have occurred.
Possible solutions:
Check your access permissions on this resource.
Check your network connection status.
Contact your appropriate computer support system, whether the system
administrator, or technical support group for further assistance.
---- END ----

My ACL on the shared folder are the standard Cyrus Read permissions:
LRS (Read, List, Seen) 

I traced the session with wireshark and it shows that kmail tries to unset other flags than SEEEN!!!

---- WIRESHARK TRACE START ----
11 NOOP
11 OK Completed

12 UID FETCH 110721 (UID RFC822.HEADER RFC822.SIZE FLAGS)
* 6061 FETCH (FLAGS (\Seen) UID 110721 RFC822.SIZE 16493 RFC822.HEADER {2717}
{CUT}
12 OK Completed (0.000 sec)

13 UID FETCH 110721 (BODYSTRUCTURE)
* 6061 FETCH (UID 110721 BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "gb2312") NIL NIL "QUOTED-PRINTABLE" 2008 100 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "gb2312") NIL NIL "QUOTED-PRINTABLE" 11392 361 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_009C_01C885B3.C4179860") NIL NIL))
13 OK Completed (0.000 sec)

14 UID STORE 110721 -FLAGS.SILENT (\SEEN \ANSWERED \FLAGGED \DRAFT)
14 NO Permission denied

15 UID FETCH 110721 (UID RFC822.SIZE FLAGS BODY.PEEK[TEXT])
* 6061 FETCH (FLAGS (\Seen) UID 110721 RFC822.SIZE 16493 BODY[TEXT] {13776}
{CUT}
15 OK Completed (0.000 sec)
---- WIRESHARK TRACE END ----

If I add the W (Write flags other than \SEEN and \DELETED) flag on the folder, kmail stops complaining!

But that's not the solution because i don't want users be able to set other flags on shared folders!

Thunderbird, Outlook, Evolution and so on do not show this "flags problem"

Regards
G.Ravasio
Comment 1 Dirk Theissen 2009-01-19 09:33:33 UTC
I can confirm this bug.

Version: 1.9.9 (KDE 3.5.10)
Installed from: Debian Lenny
Cyrus Imapd Version: 2.2.13
Comment 2 Bruno Léon 2009-01-28 13:45:12 UTC
This bug is also relevant using kmail 1.11.
Comment 3 Michael Leupold 2009-04-05 10:51:00 UTC
This might be a duplicate of bug 159296.
Comment 4 Michael Leupold 2009-04-05 10:51:32 UTC
This might be a duplicate of bug 147792. (ignore the previous comment please)
Comment 5 Michael Leupold 2009-04-05 10:53:01 UTC
Sorry.. utter confusion. I meant:
This is probably a duplicate of bug 147839 (Permissions for allowed flags for IMAP account not obeyed).

c#3 and c#4 are utter nonsense.
Comment 6 Giuseppe Ravasio 2009-04-06 09:05:21 UTC
This bug is more than ONE year old, a serius issue that makes Kmail UNUSABLE in most cases and no one is even taking it in account!

Vey good
Comment 7 Roberto Secchi 2009-04-06 10:04:47 UTC
The same bug is present in the KMail Version 1.11.0 packaged in KDE 4.2.00 (KDE 4.2.0) on Ubuntu 8.10...

Roberto
Comment 8 Roberto Secchi 2009-05-11 09:30:29 UTC
I'm using kmail in conjunction with cyrus imap server.
Again after the last update of kde-pim package on Ubuntu jaunty.
ii  kmail                                      4:4.2.2-0ubuntu1                         
rc  kmail-kde3                                 4:3.5.10-0ubuntu2~intrepid1              
rc  kmailcvt-kde3                              4:3.5.10-0ubuntu2~intrepid1             

the error again from UI is:

"Error while uploading status of messages to server: 

Changing the flags of message imaps://me@mbox.modiano.com:993/sysadmin/sysmdn/;UID=58380 failed with NO."

I've "lrs" permissions on folder "sysmdn" that's mean "list, read, seen".


Quote for Ravasio, the situation is the same as him.
Kmail try to set flags in imap folder. (DRAFT Flag I think).


In our business scenario the resolution of this bug is very important.... ;-)
Comment 9 Giuseppe Ravasio 2010-01-08 11:07:21 UTC
Toc Toc 2010 is here sitting aside this bug.

Two years passed away and I'm starting feeling home with gnome firefox and thunderbird...
I miss my beloved kmail (and kde and konqueror)

Giuseppe
Comment 10 Roberto Secchi 2010-08-23 14:24:44 UTC
Hello guys...
AGAIN... 
in the 4.5.0 Version of Kmail I cannot read emails in a folder shared if I don't have the write permissions...
what a joke... I want only read email ! ...

The strange situation is that we ha 200 thunderbird working in kde enviroment instead of kmail for this problem.

... --- ...

Roberto.
Comment 11 Andrej Krutak 2011-02-04 13:18:57 UTC
Confirming the bug is still present in KMail 1.13.5, that's sad...
Comment 12 Khaymi Pavel 2011-03-30 10:42:34 UTC
kioslave/imap4/imap4.cpp  IMAP4Protocol::special function on change status case
----
01355     // make sure we only touch flags we know
01356     QByteArray knownFlags = "\\SEEN \\ANSWERED \\FLAGGED \\DRAFT";
01357     const imapInfo info = getSelected();
01358     if ( info.permanentFlagsAvailable() && (info.permanentFlags() & imapInfo::User) ) {
01359       knownFlags += " KMAILFORWARDED KMAILTODO KMAILWATCHED KMAILIGNORED $FORWARDED $TODO $WATCHED $IGNORED";
01360     }
01361 
01362     CommandPtr cmd = doCommand (imapCommand::
01363                                 clientStore (aSequence, "-FLAGS.SILENT", knownFlags));
---
Comment 13 Khaymi Pavel 2011-05-17 19:37:14 UTC
How about to remove \\ANSWERED \\FLAGGED \\DRAFT flags ?!?!?!
Comment 14 Andre Heinecke 2013-09-19 16:35:40 UTC
Git commit 81897c5c0a188ff6dc9933ce30c2cc3215f85323 by Andre Heinecke.
Committed on 19/09/2013 at 16:26.
Pushed by aheinecke into branch 'enterprise/e3'.

Only update SEEN flag when it is the only allowed

    If the server says in the select command that a folder
    is read-write Kontact assumes that it can modify a basic
    set of flags. (See the bug for more info) But if we can
    only modify SEEN we can reuse the setSeenFlags functions.

    This is a bit of a workaround for a proper and generic handling
    of the permanentFlags but since this is only relevant for
    the old code I did not want to change more then necessary to
    solve the concrete Problem.

    Fixes:
    kolab/issue4868

M  +5    -1    kmail/kmfolderimap.cpp

http://commits.kde.org/kdepim/81897c5c0a188ff6dc9933ce30c2cc3215f85323
Comment 15 Laurent Montel 2015-04-12 09:48:13 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.