Skip to content

Commit f76c6b0

Browse files
committed
Revert "squash! src: allow CAP_NET_BIND_SERVICE in SafeGetenv"
This reverts commit bf3f873.
1 parent bf3f873 commit f76c6b0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/node_credentials.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
#if !defined(_MSC_VER)
1212
#include <unistd.h> // setuid, getuid
13-
#include <linux/capability.h>
14-
#include <sys/syscall.h>
13+
#include <sys/capability.h>
1514
#endif
1615

1716
namespace node {
@@ -45,7 +44,7 @@ bool HasCapability(int capability) {
4544
};
4645
struct __user_cap_data_struct cap_data;
4746

48-
if (syscall(SYS_capget, &cap_header_data, &cap_data) == -1) {
47+
if (capget(&cap_header_data, &cap_data) == -1) {
4948
return false;
5049
}
5150

@@ -59,8 +58,8 @@ bool HasCapability(int capability) {
5958
// then lookup will not be allowed.
6059
bool SafeGetenv(const char* key, std::string* text, Environment* env) {
6160
#if !defined(__CloudABI__) && !defined(_WIN32)
62-
if (!HasCapability(CAP_NET_BIND_SERVICE) && (per_process::linux_at_secure ||
63-
getuid() != geteuid() || getgid() != getegid()))
61+
if (!HasCapability(CAP_NET_BIND_SERVICE) && per_process::linux_at_secure ||
62+
getuid() != geteuid() || getgid() != getegid())
6463
goto fail;
6564
#endif
6665

0 commit comments

Comments
 (0)