diff options
author | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2016-11-08 08:32:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-08 08:32:31 -0800 |
commit | d773ab2806b952c8a85667a9f155943802e21440 (patch) | |
tree | e9ade81c380226740b4034c3ff8db0afcf00fab4 /osdep | |
parent | 360c84e0351728b0c0479ceddba924997acb46e4 (diff) | |
parent | 8e76363ccf2cdc05b691337d07291cd27107e468 (diff) | |
download | infinitytier-d773ab2806b952c8a85667a9f155943802e21440.tar.gz infinitytier-d773ab2806b952c8a85667a9f155943802e21440.zip |
Merge pull request #407 from misuzu/chownfix
Chown fix
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/LinuxDropPrivileges.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/osdep/LinuxDropPrivileges.cpp b/osdep/LinuxDropPrivileges.cpp index dab85bd8..e2688e65 100644 --- a/osdep/LinuxDropPrivileges.cpp +++ b/osdep/LinuxDropPrivileges.cpp @@ -102,6 +102,8 @@ void dropPrivileges(std::string homeDir) { return; } + createOwnedHomedir(homeDir, targetUser); + if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_NET_RAW, 0, 0) < 0) { // Kernel has no support for ambient capabilities. notDropping(homeDir); @@ -113,8 +115,6 @@ void dropPrivileges(std::string homeDir) { return; } - createOwnedHomedir(homeDir, targetUser); - if (setCapabilities((1 << CAP_NET_ADMIN) | (1 << CAP_NET_RAW) | (1 << CAP_SETUID) | (1 << CAP_SETGID)) < 0) { fprintf(stderr, "ERROR: failed to set capabilities (not running as real root?)\n"); exit(1); |