From 321e296371383fd63131d21c1121e22163ddeb86 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 16 Dec 2018 03:13:12 +0800 Subject: process: move POSIX credential accessors into node_credentials.cc Expose the POSIX credential accessors through `internalBinding('credentials')` instead of setting them on the process or bootstrapper object from C++ directly. Also moves `SafeGetEnv` from `internalBinding('util')` to `internalBinding('credentials')` since it's closely related to the credentials. In the JS land, instead of wrapping the bindings then writing to the process object directly in main_thread_only.js, return the wrapped functions back to bootstrap/node.js where they get written to the process object conditionally for clarity. Refs: https://github.com/nodejs/node/issues/24961 PR-URL: https://github.com/nodejs/node/pull/25066 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/node_main.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/node_main.cc') diff --git a/src/node_main.cc b/src/node_main.cc index bea1af7bdd..7107aea8c1 100644 --- a/src/node_main.cc +++ b/src/node_main.cc @@ -88,7 +88,9 @@ extern char** environ; #endif namespace node { - extern bool linux_at_secure; +namespace per_process { +extern bool linux_at_secure; +} // namespace per_process } // namespace node int main(int argc, char* argv[]) { @@ -112,7 +114,7 @@ int main(int argc, char* argv[]) { Elf_auxv_t* auxv = reinterpret_cast(envp); for (; auxv->a_type != AT_NULL; auxv++) { if (auxv->a_type == AT_SECURE) { - node::linux_at_secure = auxv->a_un.a_val; + node::per_process::linux_at_secure = auxv->a_un.a_val; break; } } -- cgit v1.2.3