summaryrefslogtreecommitdiffstats
path: root/tests/auto/network-settings.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-02-07 09:47:24 -0800
committerThiago Macieira <thiago.macieira@intel.com>2020-02-13 15:11:21 -0800
commit210fd52e0d5e77105c676c064e7c3a69a00e2122 (patch)
treea4fff628a924fef706930f1cc08565ba99a01cfb /tests/auto/network-settings.h
parent5ff37f13ee577c006f0b99307d0afa1cf991db08 (diff)
Autotest: adapt to certain OSes always allowing binding to low ports
Apple changed on macOS 10.14 (Mojave). Windows has always allowed. Fixes: QTBUG-81905 Change-Id: I572733186b73423b89e5fffd15f12fee3f03c055 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/network-settings.h')
-rw-r--r--tests/auto/network-settings.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 77298342af..4dd6ce897b 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -134,6 +134,22 @@ public:
return true;
}
+ static bool canBindToLowPorts()
+ {
+#ifdef Q_OS_UNIX
+ if (geteuid() == 0)
+ return true;
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave)
+ return true;
+ // ### Which versions of iOS, watchOS and such does Apple's opening of
+ // all ports apply to?
+ return false;
+#else
+ // Windows
+ return true;
+#endif
+ }
+
#ifdef QT_NETWORK_LIB
static bool verifyTestNetworkSettings()