Skip to content

Commit

Permalink
Prefer kwallet over libsecret for KDE frankosterfeld#103
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm committed Jun 14, 2018
1 parent f36ace0 commit ed2ff1b
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions keychain_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,19 @@ static DesktopEnvironment detectDesktopEnvironment() {

static KeyringBackend detectKeyringBackend()
{
/* Libsecret unifies access to KDE and GNOME
* password services. */
if (LibSecretKeyring::isAvailable()) {
return Backend_LibSecretKeyring;
}
/* The secret service dbus api, accessible through libsecret, is supposed
* to unify password services.
*
* Unfortunately at the time of Kubuntu 18.04 the secret service backend
* in KDE is gnome-keyring-daemon - using it has several complications:
* - the default collection isn't opened on session start, so users need
* to manually unlock it when the first application uses it
* - it's separate from the kwallet5 keyring, so switching to it means the
* existing keyring data can't be accessed anymore
*
* Thus we still prefer kwallet backends on KDE even if libsecret is
* available.
*/

switch (detectDesktopEnvironment()) {
case DesktopEnv_Kde4:
Expand All @@ -91,13 +99,18 @@ static KeyringBackend detectKeyringBackend()
case DesktopEnv_Plasma5:
return Backend_Kwallet5;
break;
// fall through

// fall through
case DesktopEnv_Gnome:
case DesktopEnv_Unity:
case DesktopEnv_Xfce:
case DesktopEnv_Other:
default:
if ( GnomeKeyring::isAvailable() ) {
if (LibSecretKeyring::isAvailable()) {
return Backend_LibSecretKeyring;
}

if ( GnomeKeyring::isAvailable() ) {
return Backend_GnomeKeyring;
} else {
return Backend_Kwallet4;
Expand Down

0 comments on commit ed2ff1b

Please sign in to comment.