Don't use KWallet for MPD password - it's overkill, as MPD password is sent in plain text!

This commit is contained in:
Craig Drummond
2015-09-18 21:27:35 +01:00
committed by Craig Drummond
parent 225169b54d
commit effebc3abd
5 changed files with 4 additions and 78 deletions

View File

@@ -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)

View File

@@ -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
-----

View File

@@ -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

View File

@@ -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 <kwallet.h>
#endif
#include <QFile>
#include <QDir>
#include <qglobal.h>
@@ -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<MPDConnectionDetails> 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

View File

@@ -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;
};