From effebc3abdfdfbf7374bfb2fb32d9e16e3663f6f Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Fri, 18 Sep 2015 21:27:35 +0100 Subject: [PATCH] Don't use KWallet for MPD password - it's overkill, as MPD password is sent in plain text! --- CMakeLists.txt | 5 ----- ChangeLog | 2 ++ INSTALL | 7 ------ gui/settings.cpp | 56 +----------------------------------------------- gui/settings.h | 12 +---------- 5 files changed, 4 insertions(+), 78 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cec114650..affbd099a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,6 @@ option(ENABLE_TAGLIB_EXTRAS "Enable TagLib-Extras library (used by tag editing, option(ENABLE_HTTP_STREAM_PLAYBACK "Enable playback of MPD HTTP streams (Phonon required for Qt4, QtMultimedia for Qt5)" OFF) option(ENABLE_LIBVLC "Use libVLC for MPD HTTP stream playback (if ENABLE_HTTP_STREAM_PLAYBACK=ON)" OFF) option(ENABLE_KDE "Enable KDE libraries" OFF) -option(ENABLE_KWALLET "Use KWallet in KDE builds" ON) option(ENABLE_QT5 "Build against Qt5" OFF) option(ENABLE_UBUNTU "Build for the Ubuntu SDK" OFF) option(ENABLE_UBUNTU_COMMAND_LINE "Build for the Ubuntu SDK from the command line" OFF) @@ -131,10 +130,6 @@ if (ENABLE_QT5) set(ENABLE_KDE OFF) endif (ENABLE_QT5) -if (NOT ENABLE_KDE) - set(ENABLE_KWALLET OFF) -endif (NOT ENABLE_KDE) - if (NOT WIN32 AND NOT APPLE AND ENABLE_DEVICES_SUPPORT AND ENABLE_UDISKS2) set(WITH_SOLID_UDISKS2 ON) endif (NOT WIN32 AND NOT APPLE AND ENABLE_DEVICES_SUPPORT AND ENABLE_UDISKS2) diff --git a/ChangeLog b/ChangeLog index b59bfba85..0253215d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,6 +71,8 @@ 50. Use Humanity/gnome icons for Windows and Mac builds. 51. Add a uninstall target for Linux builds. 52. Add 'Append Random Album' option to library, jamendo, and magnatune pages. +53. Don't use KWallet for MPD password - it's overkill, as MPD password is sent + in plain text! 1.5.2 ----- diff --git a/INSTALL b/INSTALL index f0c2e79df..462529ab3 100644 --- a/INSTALL +++ b/INSTALL @@ -102,13 +102,6 @@ The following options may be passed to CMake: Default: OFF - KDE specific: - - -DENABLE_KWALLET=ON - Use KWallet to store MPD passwords. - Default: ON - - Linux specific: -DUSE_SYSTEM_MENU_ICON=ON diff --git a/gui/settings.cpp b/gui/settings.cpp index 90df1b798..3630b5fe7 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -29,9 +29,6 @@ #include "support/utils.h" #include "support/globalstatic.h" #include "db/librarydb.h" -#if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET -#include -#endif #include #include #include @@ -135,9 +132,6 @@ static Settings::StartupState getStartupState(const QString &str) Settings::Settings() : state(AP_Configured) , ver(-1) - #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET - , wallet(0) - #endif { // Call 'version' so that it initialises 'ver' and 'state' version(); @@ -150,9 +144,6 @@ Settings::Settings() Settings::~Settings() { save(); - #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET - delete wallet; - #endif } QString Settings::currentConnection() @@ -175,18 +166,7 @@ MPDConnectionDetails Settings::connectionDetails(const QString &name) details.port=grp.get("port", name.isEmpty() ? mpdDefaults.port : 6600); details.dir=grp.getDirPath("dir", name.isEmpty() ? mpdDefaults.dir : "/var/lib/mpd/music"); details.topLevel=grp.get("topLevel", QString()); - #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET - if (KWallet::Wallet::isEnabled()) { - if (grp.get("passwd", false)) { - if (openWallet()) { - wallet->readPassword(name.isEmpty() ? "mpd" : name, details.password); - } - } else if (name.isEmpty()) { - details.password=mpdDefaults.passwd; - } - } else - #endif // ENABLE_KWALLET - details.password=grp.get("passwd", name.isEmpty() ? mpdDefaults.passwd : QString()); + details.password=grp.get("passwd", name.isEmpty() ? mpdDefaults.passwd : QString()); details.coverName=grp.get("coverName", QString()); #ifdef ENABLE_HTTP_STREAM_PLAYBACK details.streamUrl=grp.get("streamUrl", QString()); @@ -226,26 +206,6 @@ QList Settings::allConnections() return connections; } -#if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET -bool Settings::openWallet() -{ - if (wallet) { - return true; - } - - wallet=KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(), QApplication::activeWindow() ? QApplication::activeWindow()->winId() : 0); - if (wallet) { - if (!wallet->hasFolder(PACKAGE_NAME)) { - wallet->createFolder(PACKAGE_NAME); - } - wallet->setFolder(PACKAGE_NAME); - return true; - } - - return false; -} -#endif - #ifndef ENABLE_KDE_SUPPORT QString Settings::iconTheme() { @@ -811,20 +771,6 @@ void Settings::saveConnectionDetails(const MPDConnectionDetails &v) grp.set("port", (int)v.port); grp.setDirPath("dir", v.dir); grp.set("topLevel", v.topLevel); - #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET - if (KWallet::Wallet::isEnabled()) { - grp.set("passwd", !v.password.isEmpty()); - QString walletEntry=v.name.isEmpty() ? "mpd" : v.name; - if (v.password.isEmpty()) { - if (wallet) { - wallet->removeEntry(walletEntry); - } - } - else if (openWallet()) { - wallet->writePassword(walletEntry, v.password); - } - } else - #endif // ENABLE_KWALLET grp.set("passwd", v.password); grp.set("coverName", v.coverName); #ifdef ENABLE_HTTP_STREAM_PLAYBACK diff --git a/gui/settings.h b/gui/settings.h index f716577bd..467d64008 100644 --- a/gui/settings.h +++ b/gui/settings.h @@ -28,11 +28,6 @@ #include "config.h" #include "mpd-interface/mpdconnection.h" #include "mpd-interface/mpdparseutils.h" -#if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET -namespace KWallet { -class Wallet; -} -#endif class Settings { @@ -268,9 +263,7 @@ public: void saveMpris(bool v); void save(); void clearVersion(); - #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET - bool openWallet(); - #else + #ifndef ENABLE_KDE_SUPPORT QString iconTheme(); #endif @@ -288,9 +281,6 @@ private: AppState state; int ver; - #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET - KWallet::Wallet *wallet; - #endif Configuration cfg; };