Skip to content

Commit 8979aad

Browse files
nodejs-github-botharamj
authored andcommitted
tools: update nixpkgs-unstable to b3da656039dc7a6240f27b2ef8cc6a3ef3b
PR-URL: #63218 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Signed-off-by: haramjeong <[email protected]>
1 parent 78bbee3 commit 8979aad

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

src/node.cc

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
// ========== global C headers ==========
9797

9898
#include <fcntl.h> // _O_RDWR
99+
#include <sys/stat.h>
99100
#include <sys/types.h>
100101

101102
#if defined(NODE_HAVE_I18N_SUPPORT)
@@ -1215,6 +1216,28 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
12151216
conf_file = per_process::cli_options->openssl_config.c_str();
12161217
}
12171218

1219+
// If the configured OpenSSL config file is actually a directory (for
1220+
// example when an application sets `OPENSSL_CONF` to a directory), OpenSSL
1221+
// may attempt to fopen() it which yields an error and causes startup to
1222+
// fail. Detect and ignore directory paths here and emit a warning so the
1223+
// process can continue using default OpenSSL config instead.
1224+
if (conf_file != nullptr) {
1225+
struct stat st;
1226+
if (stat(conf_file, &st) == 0) {
1227+
#if defined(S_ISDIR)
1228+
if (S_ISDIR(st.st_mode)) {
1229+
#else
1230+
if ((st.st_mode & S_IFMT) == S_IFDIR) {
1231+
#endif
1232+
std::string warning = "Warning: OPENSSL_CONF path is a directory; "
1233+
"ignoring: ";
1234+
warning += conf_file;
1235+
fprintf(stderr, "%s\n", warning.c_str());
1236+
conf_file = nullptr;
1237+
}
1238+
}
1239+
}
1240+
12181241
OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new();
12191242
OPENSSL_INIT_set_config_filename(settings, conf_file);
12201243
OPENSSL_INIT_set_config_appname(settings, conf_section_name);
@@ -1225,14 +1248,11 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
12251248
OPENSSL_INIT_free(settings);
12261249

12271250
if (ERR_peek_error() != 0) {
1228-
// XXX: ERR_GET_REASON does not return something that is
1229-
// useful as an exit code at all.
1230-
result->exit_code_ =
1231-
static_cast<ExitCode>(ERR_GET_REASON(ERR_peek_error()));
1232-
result->early_return_ = true;
1233-
result->errors_.emplace_back("OpenSSL configuration error:\n" +
1234-
GetOpenSSLErrorString());
1235-
return result;
1251+
std::string warning =
1252+
"Warning: OpenSSL configuration error:\n" + GetOpenSSLErrorString();
1253+
fprintf(stderr, "%s\n", warning.c_str());
1254+
1255+
ERR_clear_error();
12361256
}
12371257
#else // OPENSSL_VERSION_MAJOR < 3
12381258
if (FIPS_mode()) {

tools/nix/pkgs.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
arg:
22
let
33
repo = "https://github.com/NixOS/nixpkgs";
4-
rev = "c6d65881c5624c9cae5ea6cedef24699b0c0a4c0";
4+
rev = "b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7";
55
nixpkgs = import (builtins.fetchTarball {
66
url = "${repo}/archive/${rev}.tar.gz";
7-
sha256 = "1yf4qv3scjygdkg67nibrhbddg3154mv9cxffvykmwcrwfcrrlaq";
7+
sha256 = "1hyl221q0c2zw3m1nv8vc39dcyrvxmn4crbn13f8p2pmcmg6x2i3";
88
}) arg;
99
in
1010
nixpkgs

0 commit comments

Comments
 (0)