Bug 393002

Summary: Akonadi-ews does not save password in kwallet
Product: [Frameworks and Libraries] Akonadi Reporter: 4z1kk0
Component: EWS ResourceAssignee: Krzysztof Nowicki <krissn>
Status: RESOLVED FIXED    
Severity: normal CC: aaronw, ace, anders, benni.buch, contact, Erbureth, erenoglu, jscott, k, kdepim-bugs, kleagg, krissn, michele.mazza, nlcomputerservice, t.kijas, xeno
Priority: NOR    
Version: GIT (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: akonadi logs

Description 4z1kk0 2018-04-11 09:13:32 UTC
Created attachment 111952 [details]
akonadi logs

I try to create EWS account, and save password but it does not arrives at kwallet. Meanwhile if I delete in kwallet a root instance "akonadi-ews" it will appear again, but with no password. If I try to change created account by typing password there are no changes. I tried to remove all akonadi and kmail settings, even tried new system account - no changes. My system is openSUSE Thumbleweed, kmail (kde frameworks) 17.12. I tried to have more logs with this in console:
export QT_LOGGING_RULES="org.kde.pim.* = true"
akonadictl restart
This showed me such logs when I have changed ews account(in attach).
Comment 1 Anders Bolager 2018-04-25 19:22:21 UTC
It seems I have the same issue. After I examined the kwallet at work (with an older version of akonadi and the ews client), I found that if I entered an entry "akonadi_ews_resourceXrc"* to the akonadi-ews main entry in kwallet, the password field in the configuration is filled out. I still get an 401 error when trying to fetch the folder list.

* Where X is the resource number
Comment 2 Christian 2018-05-01 08:56:25 UTC
*** Bug 389369 has been marked as a duplicate of this bug. ***
Comment 3 Christian 2018-05-05 05:08:59 UTC
Bug still present in version 17.12.3 - can't find this version number in the version dropdown though.
Comment 4 Krzysztof Nowicki 2018-05-20 07:42:10 UTC
Reproduced, investigating.
Comment 5 Krzysztof Nowicki 2018-05-29 18:07:05 UTC
Git commit b5ee6ff11cd3a7e0c28305b351d28c5f244f101e by Krzysztof Nowicki.
Committed on 29/05/2018 at 10:02.
Pushed by nowicki into branch 'Applications/18.04'.

resources/ews: Fix saving passwords to KWallet

This is a regression after switching to asynchronous wallet
opening. When saving the password the wallet is opened and a callback is
registered to write the password once the wallet is ready. Unfortunately
all this is done in an instance of the EwsSettings class that is local
to the configuration dialog class. This means that this instance is
destroyed once the configuration dialog is dismissed, so when opening
the wallet takes a split second too long the object dies before the
callback has a chance to do its job.

The fix is not to use a local instance of the EwsSettings class in the
configuration dialog and instead work on a pointer to this object kept
by the root resource class, which is alive at all times.

M  +3    -2    resources/ews/ewsconfigdialog.cpp
M  +4    -2    resources/ews/ewsconfigdialog.h
M  +1    -1    resources/ews/ewsresource.cpp

https://commits.kde.org/kdepim-runtime/b5ee6ff11cd3a7e0c28305b351d28c5f244f101e
Comment 6 Jan Kriho 2019-01-02 09:46:37 UTC
After upgrading to KDE PIM 18.12 I recreated the EWS account, however storing password into KWallet no longer works.
Comment 7 Benjamin Buch 2019-01-04 11:12:31 UTC
Same here, I use KDE neon git stable branch.
Comment 8 nlcomputerservice 2019-01-08 19:02:08 UTC
I can confirm the exact same issue, KDE neon stable
Comment 9 Tom Kijas 2019-01-17 09:35:23 UTC
I created account in KMail (EWS), opened kwallet manager, added password into "passwords" in "akonadi-ews" and nothing changed.

In terminal it says Service 'org.freedesktop.Akonadi.Resource.akonadi_ews_resource_5/' is not a valid name.

KMail is totally useless now for work/corporate.
Comment 10 Alexander Olofsson 2019-01-17 10:15:52 UTC
Ran into the same issue here as well after doing system upgrades. PIM 18.12.0

I tried creating a password manually in kwalletmanager as well, but didn't realize that the title was the resource id followed by 'rc', so of course it didn't read that one either.

I was able to set a new password as mentioned in https://bugs.kde.org/show_bug.cgi?id=389369#c5 though, which is what revealed the naming difference to me.
Comment 11 Aaron Williams 2019-02-02 01:38:02 UTC
I just ran into the same issue again. I'm using the latest OpenSUSE release. I don't know if it's due to special characters in my password or not, but I have to manually add it to kwallet.
Comment 12 Gaël de Chalendar (aka Kleag) 2019-02-12 09:24:58 UTC
I had the same problem after having to change my password due to timeout policy.

I was able to set my password with this dbus call:
qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_4 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"

I think that this bug is a real blocker for people in organizations that are depending on a MS IS architecture.
Comment 13 Gaël de Chalendar (aka Kleag) 2019-07-29 09:49:46 UTC
Same problem today after expiration of my password. And same solution using the dbus call.
Comment 14 Gaël de Chalendar (aka Kleag) 2019-09-05 07:51:29 UTC
Configuring today a new laptop with KDE Neon, same problem, same solution.
Comment 15 S.Trzmiel 2019-11-05 10:23:53 UTC
Same here, Fedora 31 with Plasma 5.16.5-1/KF5 5.61.0-1/Qt 5.12.5-1.
D-Buss call from console used as workaround.
Comment 16 Gaël de Chalendar (aka Kleag) 2020-01-20 15:23:15 UTC
I used again the workaround I explained above, but this time, the akonadi resource name changed. I used akonadiconsole to find the new name.
Comment 17 John Scott 2020-01-27 20:09:17 UTC
Affects Akonadi 19.08.3 on Debian unstable. I worked around by making the appropriate entry with KWalletManager, though this would surely not be useful for anyone using OAuth2.
Comment 18 Igor Poboiko 2020-03-20 16:10:46 UTC
Git commit 7afd99abbfa141f6e6dfbe69b01827af8f16ba27 by Igor Poboiko.
Committed on 20/03/2020 at 16:10.
Pushed by poboiko into branch 'master'.

[resources/ews] Save password to wallet

Summary:
Seems like the password entered via the UI actually never gets saved anywhere.
Just do it explicitly.
Related: bug 390798, bug 402780, bug 414789

Test Plan:
1) Try to setup EWS account using autodiscovery, using Username/Password auth
2) Set Username, Password, hit "Try connect" -> it works fine
3) Hit "OK" -> observe "Authentication failure" resource error
4) Browse `akonadi-ews` via `KWalletManager` -> it's empty
5) Apply the patch, repeat 1-4 - authentication succeeds, password entry inside wallet appears

Reviewers: dvratil, nowicki

Reviewed By: dvratil

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D27813

M  +1    -0    resources/ews/ewsconfigdialog.cpp

https://commits.kde.org/kdepim-runtime/7afd99abbfa141f6e6dfbe69b01827af8f16ba27