summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-16 00:57:33 +0000
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-16 00:57:33 +0000
commitb989c034167c97d393acfd978258dd83abb3d1d2 (patch)
treed365ea7c1c9841e23ed5da17737b4d0cb01d51d0
parent3361b4030b85d1f024d3e096a34a39f5e5ebeab2 (diff)
downloadinfinitytier-b989c034167c97d393acfd978258dd83abb3d1d2.tar.gz
infinitytier-b989c034167c97d393acfd978258dd83abb3d1d2.zip
Fix build on Linux if PR_CAP_AMBIENT is not defined, which is the case for some libc-dev installs.
-rw-r--r--one.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/one.cpp b/one.cpp
index 3b1d6b4a..3649c18c 100644
--- a/one.cpp
+++ b/one.cpp
@@ -882,7 +882,13 @@ static void _sighandlerQuit(int sig)
// Drop privileges on Linux, if supported by libc etc. and "zerotier-one" user exists on system
#ifdef __LINUX__
-#ifdef PR_CAP_AMBIENT
+#ifndef PR_CAP_AMBIENT
+#define PR_CAP_AMBIENT 47
+#define PR_CAP_AMBIENT_IS_SET 1
+#define PR_CAP_AMBIENT_RAISE 2
+#define PR_CAP_AMBIENT_LOWER 3
+#define PR_CAP_AMBIENT_CLEAR_ALL 4
+#endif
#define ZT_LINUX_USER "zerotier-one"
#define ZT_HAVE_DROP_PRIVILEGES 1
namespace {
@@ -1013,7 +1019,6 @@ static void dropPrivileges(const char *procName,const std::string &homeDir)
}
} // anonymous namespace
-#endif // PR_CAP_AMBIENT
#endif // __LINUX__
/****************************************************************************/