diff options
author | Bartosz Sosnowski <bartosz@janeasystems.com> | 2018-03-08 00:09:24 +0100 |
---|---|---|
committer | Bartosz Sosnowski <bartosz@janeasystems.com> | 2018-05-24 11:06:12 +0200 |
commit | 531b4bedcac14044f09129ffb65dab71cc2707d9 (patch) | |
tree | c137e1fe295f477dea78b0e1f6283e3499c36bf6 /src/pipe_wrap.cc | |
parent | 03043e290ab5e4e1773dc1827a57e1acc141fdf6 (diff) | |
download | node-new-531b4bedcac14044f09129ffb65dab71cc2707d9.tar.gz |
net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.
Fixes: https://github.com/nodejs/node/issues/19154
PR-URL: https://github.com/nodejs/node/pull/19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/pipe_wrap.cc')
-rw-r--r-- | src/pipe_wrap.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index f3a88a2ecc..52e3f2730e 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -98,6 +98,8 @@ void PipeWrap::Initialize(Local<Object> target, env->SetProtoMethod(t, "setPendingInstances", SetPendingInstances); #endif + env->SetProtoMethod(t, "fchmod", Fchmod); + target->Set(pipeString, t->GetFunction()); env->set_pipe_constructor_template(t); @@ -114,6 +116,8 @@ void PipeWrap::Initialize(Local<Object> target, NODE_DEFINE_CONSTANT(constants, SOCKET); NODE_DEFINE_CONSTANT(constants, SERVER); NODE_DEFINE_CONSTANT(constants, IPC); + NODE_DEFINE_CONSTANT(constants, UV_READABLE); + NODE_DEFINE_CONSTANT(constants, UV_WRITABLE); target->Set(context, FIXED_ONE_BYTE_STRING(env->isolate(), "constants"), constants).FromJust(); @@ -184,6 +188,17 @@ void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) { #endif +void PipeWrap::Fchmod(const v8::FunctionCallbackInfo<v8::Value>& args) { + PipeWrap* wrap; + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + CHECK(args[0]->IsInt32()); + int mode = args[0].As<Int32>()->Value(); + int err = uv_pipe_chmod(reinterpret_cast<uv_pipe_t*>(&wrap->handle_), + mode); + args.GetReturnValue().Set(err); +} + + void PipeWrap::Listen(const FunctionCallbackInfo<Value>& args) { PipeWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); |