For Qt-only Linux builds, set file permissions of config file so that others cannot read the file - as MPD, Magnatune, or DigitallyImported passwords will be saved here.
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
1. Fix crash in settings dialog if current connection name is removed from
|
||||
config file.
|
||||
2. Fix starting of per-user MPD instance.
|
||||
3. For Qt-only Linux builds, set file permissions of config file so that others
|
||||
cannot read the file - as MPD, Magnatune, or DigitallyImported passwords
|
||||
will be saved here.
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
|
||||
19
gui/main.cpp
19
gui/main.cpp
@@ -33,6 +33,8 @@
|
||||
#include <QTextCodec>
|
||||
#include <QLibraryInfo>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
#endif
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
@@ -205,6 +207,23 @@ int main(int argc, char *argv[])
|
||||
loadTranslation("cantata", INSTALL_PREFIX"/share/cantata/translations/", langEnv);
|
||||
#endif
|
||||
|
||||
// Set the permissions on the config file on Unix - it can contain passwords
|
||||
// for internet services so it's important that other users can't read it.
|
||||
// On Windows these are stored in the registry instead.
|
||||
#ifdef Q_OS_UNIX
|
||||
QSettings s;
|
||||
|
||||
// Create the file if it doesn't exist already
|
||||
if (!QFile::exists(s.fileName())) {
|
||||
QFile file(s.fileName());
|
||||
file.open(QIODevice::WriteOnly);
|
||||
}
|
||||
|
||||
// Set -rw-------
|
||||
QFile::setPermissions(s.fileName(), QFile::ReadOwner | QFile::WriteOwner);
|
||||
#endif
|
||||
|
||||
|
||||
if (Settings::self()->firstRun()) {
|
||||
InitialSettingsWizard wz;
|
||||
if (QDialog::Rejected==wz.exec()) {
|
||||
|
||||
Reference in New Issue
Block a user