Set permissions on Clementine's config file to 0600
This commit is contained in:
parent
0df07719e2
commit
d59e21d709
18
src/main.cpp
18
src/main.cpp
|
@ -342,6 +342,24 @@ int main(int argc, char *argv[]) {
|
||||||
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true);
|
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true);
|
||||||
#endif
|
#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
|
||||||
|
|
||||||
// Resources
|
// Resources
|
||||||
Q_INIT_RESOURCE(data);
|
Q_INIT_RESOURCE(data);
|
||||||
Q_INIT_RESOURCE(translations);
|
Q_INIT_RESOURCE(translations);
|
||||||
|
|
Loading…
Reference in New Issue