From 5632c35d6759f5e13a7dfe78e4ee6403ff6a8e3e Mon Sep 17 00:00:00 2001 From: Thorvald Natvig Date: Fri, 27 May 2011 16:59:15 -0700 Subject: [PATCH] Explicitly remove file permissions for settings and DB --- src/mumble/Database.cpp | 5 +++++ src/mumble/Settings.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp index 5449fbe..8c3854f 100644 --- a/src/mumble/Database.cpp +++ b/src/mumble/Database.cpp @@ -94,6 +94,11 @@ qWarning("Database: Database is read-only"); } + { + QFile f(db.databaseName()); + f.setPermissions(f.permissions() & ~(QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup | QFile::ReadOther | QFile::WriteOther | QFile::ExeOther)); + } + QSqlQuery query; query.exec(QLatin1String("CREATE TABLE IF NOT EXISTS `servers` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT, `hostname` TEXT, `port` INTEGER DEFAULT " MUMTEXT(DEFAULT_MUMBLE_PORT) ", `username` TEXT, `password` TEXT)")); diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index 404692b..b5e9202 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -716,6 +716,17 @@ void OverlaySettings::save() { void OverlaySettings::save(QSettings* settings_ptr) { OverlaySettings def; + settings_ptr->setValue(QLatin1String("version"), QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING))); + settings_ptr->sync(); + +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) + if (settings_ptr->format() == QSettings::IniFormat) +#endif + { + QFile f(settings_ptr->fileName()); + f.setPermissions(f.permissions() & ~(QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup | QFile::ReadOther | QFile::WriteOther | QFile::ExeOther)); + } + SAVELOAD(bEnable, "enable"); SAVELOAD(osShow, "show"); -- 1.7.5.4