Bug 322964 - KWallet::Walled::openWallet( "name", 0, Asynchronous ) returns null if KWallet is disabled, contrary to the documentation
Summary: KWallet::Walled::openWallet( "name", 0, Asynchronous ) returns null if KWalle...
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kwallet (show other bugs)
Version: 4.10.5
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Valentin Rusu
Depends on: 332931
  Show dependency treegraph
Reported: 2013-07-29 20:38 UTC by Matěj Laitl
Modified: 2014-04-01 22:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Matěj Laitl 2013-07-29 20:38:48 UTC
The docs say:
		 *  Open the wallet @p name.  The user will be prompted to
		 *  allow your application to open the wallet, and may be
		 *  prompted for a password.  You are responsible for deleting
		 *  this object when you are done with it.
		 *  @param name The name of the wallet to open.
		 *  @param ot    If Asynchronous, the call will return
		 *               immediately with a non-null pointer to an
		 *               invalid wallet.  You must immediately connect
		 *               the walletOpened() signal to a slot so that
		 *               you will know when it is opened, or when it
		 *               fails.
		 *  @param w The window id to associate any dialogs with. You can pass
		 *           0 if you don't have a window the password dialog should
		 *           associate with.
		 *  @return Returns a pointer to the wallet if successful,
		 *          or a null pointer on error or if rejected.
		static Wallet* openWallet(const QString& name, WId w, OpenType ot = Synchronous);

We in Amarok do (LastFmServiceConfig.cpp):
m_wallet = Wallet::openWallet( Wallet::NetworkWallet(), 0, Wallet::Asynchronous );
connect( m_wallet, SIGNAL(walletOpened(bool)), SLOT(slotWalletOpenedToWrite(bool)) );

Expecting that all failures would be covered in slotWalletOpenedToWrite(false). However, only the "access denied" failure is covered there, when KWallet is disabled, the openWallet() call returns null here, despite the docs saying the contrary for the Wallet::Asynchronous case. See bug 315306 comment 23.

Either the behaviour or the documentation should be changed.

Reproducible: Always
Comment 1 Matěj Laitl 2013-07-29 20:57:14 UTC
Git commit fe9628d596e7546b5526aed9d1dac81d350f75a5 by Matěj Laitl.
Committed on 29/07/2013 at 20:46.
Pushed by laitl into branch 'master'.

LastFmServiceConfig: prompt to save credentials in ASCII even if KWallet is disabled

I believe there is inconsistency in KWallet documentation/behaviour that
lead to assumptions not being fulfilled in credential-saving code. Lessen
the assumptions.

 * Definitely fix a bug where storing Last.fm credentials in plain-text
   isn't offered when KWallet is disabled. (BR 315306)

@Vedant, you might need to incorporate this fix to your
Related: bug 315306
CCMAIL: Vedant Agarwala <vedant.kota@gmail.com>

M  +2    -0    ChangeLog
M  +20   -4    src/services/lastfm/LastFmServiceConfig.cpp