summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-06-12 14:28:18 +0200
committerKai Koehne <kai.koehne@digia.com>2014-06-13 13:02:03 +0200
commit25f2239412b0431d3ff9762ce802c97f4a4b81e1 (patch)
tree90f2ef3e78cf1ab69014c6503336a1f75e006f39
parent27cc89eb4a1e157c68793718602416448547de20 (diff)
downloadqt-creator-25f2239412b0431d3ff9762ce802c97f4a4b81e1.tar.gz
Allow sdktool to run in an elevated context
This fixes an issue with installation on Mac: We run sdktool with 'elevated' rights if we e.g. install in a global directory, forcing the effective user id to be 0. However, since Qt 5.3.0 QCoreApplication aborts if geteuid() != getuid(). Change-Id: I678f405fc0cb31dbf9c0487f674bb8dbe5e2e95e Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
-rw-r--r--src/tools/sdktool/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/sdktool/main.cpp b/src/tools/sdktool/main.cpp
index 92d9326846..5f6e62682d 100644
--- a/src/tools/sdktool/main.cpp
+++ b/src/tools/sdktool/main.cpp
@@ -159,6 +159,15 @@ int parseArguments(const QStringList &args, Settings *s, const QList<Operation *
int main(int argc, char *argv[])
{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
+ // Since 5.3, Qt by default aborts if the effective user id is different than the
+ // real user id. However, in IFW on Mac we use setuid to 'elevate'
+ // permissions if needed. This is considered safe because the user has to provide
+ // the credentials manually - an attack would require at least access to the
+ // user's environment.
+ QCoreApplication::setSetuidAllowed(true);
+#endif
+
QCoreApplication a(argc, argv);
Settings settings;