Bug 303861 - Can't write CalDav items from korganizer
Summary: Can't write CalDav items from korganizer
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: DAV Resource (show other bugs)
Version: 4.8
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-20 18:10 UTC by Jens Westemeier
Modified: 2012-11-14 12:50 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Westemeier 2012-07-20 18:10:48 UTC
I try to sync my calendar and my address book with Exchange via "dav groupware resource" and davmail (http://davmail.sourceforge.net/download.html). Korganizer shows my calendar items, but each of them has a small lock icon at the header and I can' modify, delete or add calendar items.
The address book carddav items, synced in the same way, can be edited. When I use davmail with Thunderbird/Lightning, I also can edit the caldav items.

In akonadiconsole the folder properties of the calendar shows nothing ticked in ACL, the attributes show:
ENTITYDISPLAY      ("" "view-pim-calendar" "" ())
AccessRights
davprotocol               0
The attributes of the contacts show all ACL are ticked and the attributes:
ENTITYDISPLAY   ("" "view-pim-contacts" "" ())
AccessRights          a
davprotocol             1
I can edit the caldav attributes, but I can't make them persistent (a restart shows the old values).

I'm running OpenSuSE 12.1/ 64 bit with KDE 4.8.4 from the OpenSuse repositories
rpm -qa | grep pim
libkdepim4-4.8.4-352.3.x86_64
kdepim4-4.8.4-352.3.x86_64
libkdepimlibs4-4.8.4-289.3.x86_64
kdepimlibs4-4.8.4-289.3.x86_64
kdepim4-runtime-4.8.4-149.4.x86_64

rpm -qa | grep organizer
korganizer-4.8.4-352.3.x86_64



Reproducible: Always
Comment 1 knallio 2012-08-06 10:36:24 UTC
I have exactly the same Problem (both on Ubuntu 12.04 and on Gentoo). It might be connected to (or the same as) https://bugs.kde.org/show_bug.cgi?id=273949
If I remember correctly it used to work with some older ubuntu version (11.10 or 11.04).
Comment 2 lagerimsi 2012-08-07 10:36:53 UTC
I can confirm this bug using a dav-groupware-ressource: 
An empty attribute "AccessRights" is placed for this ressource every time akonadiserver starts. Deleting "AccessRights" using akonadiconsole makes it writeable but after restarting akonadiserver this empty attribute appears again making it read only. 
Also placing the rights "wcdW" (copied from the personal calendar - also making it writeable) are removed after a restart. Again an empty "AccessRights". 
I'm using davmail running locally to connect to my companys' exchange (2010) server calendar. It's working as long as you don't restart akonadiserver.

 KDE 4.9.00 on kubuntu 12.04 Please fix this!
Comment 3 Miroslav Vujicic 2012-09-18 02:38:22 UTC
I can also confirm this bug. Also, deleting empty attribute "AccessRights" fixes the issue temporarily.
Comment 4 Miroslav Vujicic 2012-09-18 02:39:58 UTC
Ah yes, Kubuntu 12.04 here.
Comment 5 Myriam Schweingruber 2012-09-18 13:01:57 UTC
(In reply to comment #4)
> Ah yes, Kubuntu 12.04 here.

We need the KDE version, not the distribution one.
Comment 6 Jens Westemeier 2012-09-18 14:01:59 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Ah yes, Kubuntu 12.04 here.
> 
> We need the KDE version, not the distribution one.

KDE 4.8.x and KDE 4.9.x
Comment 7 Miroslav Vujicic 2012-09-18 21:08:47 UTC
KDE Platform Version 4.8.4 (4.8.4)
Comment 8 Miroslav Vujicic 2012-09-18 21:42:03 UTC
Just updated to Platform Version 4.8.5 (4.8.5) and the behaviour is still the same. 

BTW, I am syncronizing both my Google calendar and local caldav using the DAV groupware resource, and I have write access to my Google calendar, but not to my local caldav.
Comment 9 Miroslav Vujicic 2012-09-18 21:50:51 UTC
Just checked attributes on my Google calendar folder (that I have write access to) and it shows AccessRights with value 'a'.
Comment 10 Myriam Schweingruber 2012-09-19 13:16:53 UTC
Confirmed on 4.8.x, can somebody else than the original reporter confirm on 4.9 as well?
Comment 11 mgualtieri 2012-09-21 19:55:33 UTC
Confirmed on 4.9.1!!!
Comment 12 Allen Winter 2012-09-21 21:43:33 UTC
this will be really hard to fix and test if the problem is specific to Exchange's CalDAV.

is there some free site where I can test?  I use CalDAV with Google Calendar and can write there without any problems.
Comment 13 Jens Westemeier 2012-09-22 10:22:33 UTC
(In reply to comment #12)
> this will be really hard to fix and test if the problem is specific to
> Exchange's CalDAV.
> 
> is there some free site where I can test?  I use CalDAV with Google Calendar
> and can write there without any problems.

The problem can probably been found by Code Inspection. The same setup with Exchange CardDav works.
Another hint is to look into another minor issue: the name of the Calendar also can't be changed in the Calendar Folder Properties, might be the same reason.
I can contribute with some strace logs if that helps.
Comment 14 Hans Meine 2012-10-04 09:45:29 UTC
/me too

I have the same problem (KDE 4.9.0 on KUbuntu 12.04), and I can confirm that removing the AccessRights property is a temporary workaround.

As written in comments 64/65 of bug #273949, this is no duplicate, but a specific problem with this davmail setup.

Therefore, I believe a fix involving some special casing would be in order.

AFAICS, davmail is currently the only way for accessing Exchange servers (in corporate environments), so I would say fixing this should have a high priority.
Comment 15 Hans Meine 2012-10-04 10:30:42 UTC
I just realized that this is not as easy to fix as I originally believed: Of course it would be necessary to get the proper access rights through davmail, since one does not have write permissions on all calendars.  For instance, I have setup three calendars within the "DAV groupware resource", two of which are shared calendars managed by the office staff (i.e. they are effectively read-only for me).
Comment 16 Harry Sinclair 2012-10-09 15:17:48 UTC
I have this issue in KOrganizer 4.8.5 and DavMail 4.0.0-2016. This issues seems to be that when Akonadi (1.7.2) connects to the DavMail resources it creates the calendar directory with modification rights and it also creates a blank "AccessRights" attribute.
Comment 17 Hans Meine 2012-10-10 08:11:31 UTC
Did anybody here look at the relevant code yet?  (Harry?)
Looks to me as if https://projects.kde.org/projects/kde/kdepim-runtime/repository/revisions/master/show/resources/dav is relevant, but only davgroupwareresource.cpp seems to contain code managing access rights.
Comment 18 Grégory Oestreicher 2012-10-17 20:11:18 UTC
Hi,

Without access to an Exchange server this will be hard to debug unfortunately :/

If any of you can do a network capture of a full exchange between the resource and davmail, please send it to me. Try to anonymize it as much as you can, especially the HTTP headers that will contain the authentication data. I'm mostly interested in the XML exchanges, not that much in the events data, so you can scrap it altogether.

Cheers,
Grégory
Comment 19 Harry Sinclair 2012-10-18 20:44:06 UTC
My daily workaround is to bring up akonadiconsole and remove the blank AccessRights attribute from the Calendar folder under the DavMail agent.

(In reply to comment #18)
> Hi,
> 
> Without access to an Exchange server this will be hard to debug
> unfortunately :/
> 
> If any of you can do a network capture of a full exchange between the
> resource and davmail, please send it to me. Try to anonymize it as much as
> you can, especially the HTTP headers that will contain the authentication
> data. I'm mostly interested in the XML exchanges, not that much in the
> events data, so you can scrap it altogether.
> 
> Cheers,
> Grégory
Comment 20 Grégory Oestreicher 2012-10-19 07:07:17 UTC
(In reply to comment #19)
> My daily workaround is to bring up akonadiconsole and remove the blank
> AccessRights attribute from the Calendar folder under the DavMail agent.

Yup, I understand that. The resource is not able to understand the access rights DavMail sends back, so I'd like to see the raw XML exchange between the resource and DavMail. It'd help debug the issue.

Cheers,
Grégory
Comment 21 Hans Meine 2012-10-19 08:38:47 UTC
Grégory, I would be willing to supply that (best by email, I think), but can you advise on the proper way of capturing?  Shall I use dumpcap/wireshark?  Can you give a hint on filters etc. to set up to get a better overview / smaller capture?
Comment 22 Grégory Oestreicher 2012-10-19 16:31:40 UTC
(In reply to comment #21)
> Grégory, I would be willing to supply that (best by email, I think),

Excellent, thanks!

> but can
> you advise on the proper way of capturing?  Shall I use dumpcap/wireshark? 

If you have wireshark then it's the simplest way to go. It has some neat features that'll be helpful.

> Can you give a hint on filters etc. to set up to get a better overview /
> smaller capture?

Well, you should only capture communications on the port used by DavMail (1080 apparently, but adapt to your case as it can be customized). Then once wireshark is started, launch akonadiconsole and, in the first tab, right click on the agent. From the pop-up menu, in the 'Synchronize' entry select 'Synchonize Collection tree', and let the resource do its job.

Once it's done you can stop the capture and begin looking at the packets. The nice feature of Wireshark is that you can get the HTTP conversation decrypted quite easily: right click on a packet of the TCP stream and select 'Follow TCP stream'. Here you'll have to find the one with a XML response from DavMail. If it's not the first one you pick, just close the window that just opened, and clear the filter (it should read 'tcp stream eq X', where X is an integer).

I hope this is all clear, but feel free to ask if that's not the case.

Cheers,
Grégory
Comment 23 Hans Meine 2012-10-22 11:50:51 UTC
After chatting with Grégory by mail, I have opened a davmail bug, too:
https://sourceforge.net/tracker/?func=detail&aid=3579112&group_id=184600&atid=909904
Comment 24 Grégory Oestreicher 2012-10-22 16:37:15 UTC
Git commit 88f3599be25a694bb355710f1631f6e3f6da488a by Grégory Oestreicher.
Committed on 22/10/2012 at 18:34.
Pushed by goestreicher into branch 'KDE/4.9'.

Accomodate more than one privilege at once in <privileges/>

This is needed for at least DavMail, that returns more
than one privilege in the <privileges/> tag in response
to current-user-privilege-set requests. Not sure if
this is RFC3744 compliant, but it's a painless fix.

M  +30   -24   resources/dav/common/davcollectionsfetchjob.cpp

http://commits.kde.org/kdepim-runtime/88f3599be25a694bb355710f1631f6e3f6da488a
Comment 25 Jens Westemeier 2012-10-24 07:12:24 UTC
Thanks for fixing that - I will test 4.9.3 as soon as it is available.
Nevertheless, there was a different behavior between access rights of calendar and contact items. Contacts allway worked with davmail. For me it seems, that there might be an underlying bug in carddav ignoring the access rights at all. I can't test for that since I have write access allways on carddav items.
Grégory, can you please check for the same mechanism in caldav and carddav?

Thanks, Jens.
Comment 26 Grégory Oestreicher 2012-10-24 07:42:57 UTC
(In reply to comment #25)
> Thanks for fixing that - I will test 4.9.3 as soon as it is available.
> Nevertheless, there was a different behavior between access rights of
> calendar and contact items. Contacts allway worked with davmail.

As CalDav and CardDav share a lot of code, including the access rights management, my best guess would be that DavMail replies differently. The only way to be sure would be with a network capture.

> For me it
> seems, that there might be an underlying bug in carddav ignoring the access
> rights at all.

Full access can be granted if the CardDav answer does not contain any privileges specification or explicitly states that all privileges are granted. Without the XML of the exchange it's impossible to tell which is happening.

I'll insist heavily on that: a network capture speeds up the debugging drastically. It only took a couple of minutes to find the problem once Hans sent me one. If you need the process (with Wireshark) I have it at hand :)

Cheers,
Grégory
Comment 27 Harry Sinclair 2012-10-24 15:02:34 UTC
Can you send those wireshark instructions to me as well?

(In reply to comment #26)
> (In reply to comment #25)
> > Thanks for fixing that - I will test 4.9.3 as soon as it is available.
> > Nevertheless, there was a different behavior between access rights of
> > calendar and contact items. Contacts allway worked with davmail.
> 
> As CalDav and CardDav share a lot of code, including the access rights
> management, my best guess would be that DavMail replies differently. The
> only way to be sure would be with a network capture.
> 
> > For me it
> > seems, that there might be an underlying bug in carddav ignoring the access
> > rights at all.
> 
> Full access can be granted if the CardDav answer does not contain any
> privileges specification or explicitly states that all privileges are
> granted. Without the XML of the exchange it's impossible to tell which is
> happening.
> 
> I'll insist heavily on that: a network capture speeds up the debugging
> drastically. It only took a couple of minutes to find the problem once Hans
> sent me one. If you need the process (with Wireshark) I have it at hand :)
> 
> Cheers,
> Grégory
Comment 28 Hans Meine 2012-10-24 15:23:50 UTC
(In reply to comment #27)
> Can you send those wireshark instructions to me as well?
Have a look at comment #22 ...

Actually, I used

  sudo dumpcap -i lo -n -f "port 1080"

for capturing and then started wireshark as normal user with the resulting file as parameter.
Comment 29 Grégory Oestreicher 2012-10-24 17:45:52 UTC
(In reply to comment #27)
> Can you send those wireshark instructions to me as well?

As Hans pointed out I've put the instructions in comment #22. I thought that I gave them in a private mail.

Cheers,
Grégory
Comment 30 knallio 2012-10-25 09:02:33 UTC
(In reply to comment #29)
> (In reply to comment #27)
> > Can you send those wireshark instructions to me as well?
> 
> As Hans pointed out I've put the instructions in comment #22. I thought that
> I gave them in a private mail.
> 
> Cheers,
> Grégory

I have the xml responses ready, but I don't know what I am exactly looking for and which part you need. There is no response like  "<D:privilege><D:read/><D:write/></D:privilege>".
On the other hand (not knowing the specifications) I am not sure if it would make sense for the adressbook. While it is possible to share calendars in Exchange and have different privileges for those, there is no adressbook sharing. At least as far as I know. So I assume one should have always write permissions to the adressbook?

And by the way, thanks for fixing/debugging this.
Comment 31 Grégory Oestreicher 2012-10-25 09:10:49 UTC
(In reply to comment #30)
> I have the xml responses ready, but I don't know what I am exactly looking
> for and which part you need.

One of the resource requests should contain <current-user-privilege-set/>. Look at the server response for a matching tag, and the ones enclosed in it.

> There is no response like 
> "<D:privilege><D:read/><D:write/></D:privilege>".

OK, so this may mean that no ACL is set on the addressbook. In that case the resource gives you all privileges.

> On the other hand (not knowing the specifications) I am not sure if it would
> make sense for the adressbook. While it is possible to share calendars in
> Exchange and have different privileges for those, there is no adressbook
> sharing. At least as far as I know. So I assume one should have always write
> permissions to the adressbook?

I'm not using Exchange so I can't be sure how it works, but with other groupware solutions you can have multiple address books such as a corporate one and a personal one. No one should be able to write to the corporate, so ACLs come in play here.

Cheers,
Grégory
Comment 32 knallio 2012-10-25 10:20:27 UTC
(In reply to comment #31)
> I'm not using Exchange so I can't be sure how it works, but with other
> groupware solutions you can have multiple address books such as a corporate
> one and a personal one. No one should be able to write to the corporate, so
> ACLs come in play here.

I think the corporate adressbook with exchange+davmail is exposed via ldap, but I am not sure about that because I don't use it. So at least for me the carddav part seems to be unproblematic at the moment, because davmail does not send any ACL for the adressbook (I have checked again, there is no <current-user-privilege-set/> in the xml response for carddav). But I don't know if there are exchange+davmail setups out there where this is a problem...
Comment 33 Jens Westemeier 2012-11-08 19:47:37 UTC
I just installed KDE 4.9.3 - the bug is fixed.

Thanks.
Comment 34 Thomas Fischer 2012-11-14 12:50:36 UTC
I can confirm that bug is fixed indeed: Using Kontact 4.9.3 + Davmail, I can add calendar events to a MS Exchange server calendar.