[Pkg-owncloud-commits] [owncloud-client] 13/175: Updater on OS X: Only allow if in /Applications #2931
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Aug 8 10:36:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit f07d3d069ebe7da44878cfb020f4c93581c7c4ba
Author: Markus Goetz <markus at woboq.com>
Date: Tue May 5 18:48:57 2015 +0200
Updater on OS X: Only allow if in /Applications #2931
---
src/gui/updater/sparkleupdater_mac.mm | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/gui/updater/sparkleupdater_mac.mm b/src/gui/updater/sparkleupdater_mac.mm
index 038275e..74079f0 100644
--- a/src/gui/updater/sparkleupdater_mac.mm
+++ b/src/gui/updater/sparkleupdater_mac.mm
@@ -111,15 +111,33 @@ SparkleUpdater::~SparkleUpdater()
delete d;
}
+
+bool autoUpdaterAllowed()
+{
+ // See https://github.com/owncloud/client/issues/2931
+ NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
+ NSString *expectedPath = [NSString stringWithFormat:@"/Applications/%@", [bundlePath lastPathComponent]];
+ if ([expectedPath isEqualTo:bundlePath]) {
+ return true;
+ }
+ qWarning() << "ERROR: We are not in /Applications, won't check for update!";
+ return false;
+}
+
+
void SparkleUpdater::checkForUpdate()
{
- [d->updater checkForUpdates: NSApp];
+ if (autoUpdaterAllowed()) {
+ [d->updater checkForUpdates: NSApp];
+ }
}
void SparkleUpdater::backgroundCheckForUpdate()
{
qDebug() << Q_FUNC_INFO << "launching background check";
- [d->updater checkForUpdatesInBackground];
+ if (autoUpdaterAllowed()) {
+ [d->updater checkForUpdatesInBackground];
+ }
}
} // namespace OCC
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list