GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: add --use-bundled-ca --use-openssl-ca check · nodejs/node@758dc81

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node.cc
  • test/parallel
    • test-openssl-ca-options.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,6 +3887,8 @@ static void ParseArgs(int* argc,
38873887
const char** new_exec_argv = new const char*[nargs];
38883888
const char** new_v8_argv = new const char*[nargs];
38893889
const char** new_argv = new const char*[nargs];
3890+
bool use_bundled_ca = false;
3891+
bool use_openssl_ca = false;
38903892

38913893
for (unsigned int i = 0; i < nargs; ++i) {
38923894
new_exec_argv[i] = nullptr;
@@ -3992,7 +3994,9 @@ static void ParseArgs(int* argc,
39923994
default_cipher_list = arg + 18;
39933995
} else if (strncmp(arg, "--use-openssl-ca", 16) == 0) {
39943996
ssl_openssl_cert_store = true;
3997+
use_openssl_ca = true;
39953998
} else if (strncmp(arg, "--use-bundled-ca", 16) == 0) {
3999+
use_bundled_ca = true;
39964000
ssl_openssl_cert_store = false;
39974001
#if NODE_FIPS_MODE
39984002
} else if (strcmp(arg, "--enable-fips") == 0) {
@@ -4027,6 +4031,16 @@ static void ParseArgs(int* argc,
40274031
index += args_consumed;
40284032
}
40294033

4034+
#if HAVE_OPENSSL
4035+
if (use_openssl_ca && use_bundled_ca) {
4036+
fprintf(stderr,
4037+
"%s: either --use-openssl-ca or --use-bundled-ca can be used, "
4038+
"not both\n",
4039+
argv[0]);
4040+
exit(9);
4041+
}
4042+
#endif
4043+
40304044
// Copy remaining arguments.
40314045
const unsigned int args_left = nargs - index;
40324046

Collapse file

‎test/parallel/test-openssl-ca-options.js‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use strict';
2+
// This test checks the usage of --use-bundled-ca and --use-openssl-ca arguments
3+
// to verify that both are not used at the same time.
4+
const common = require('../common');
5+
if (!common.hasCrypto)
6+
common.skip('missing crypto');
7+
8+
const assert = require('assert');
9+
const os = require('os');
10+
const childProcess = require('child_process');
11+
const result = childProcess.spawnSync(
12+
process.execPath,
13+
[ '--use-bundled-ca', '--use-openssl-ca', '-p', 'process.version' ],
14+
{ encoding: 'utf8' }
15+
);
16+
17+
assert.strictEqual(result.stderr, `${process.execPath
18+
}: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}`
19+
);
20+
assert.strictEqual(result.status, 9);
21+
22+
const useBundledCA = childProcess.spawnSync(process.execPath, [
23+
'--use-bundled-ca',
24+
'-p', 'process.version']);
25+
assert.strictEqual(useBundledCA.status, 0);
26+
27+
const useOpenSSLCA = childProcess.spawnSync(process.execPath, [
28+
'--use-openssl-ca',
29+
'-p', 'process.version']);
30+
assert.strictEqual(useOpenSSLCA.status, 0);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.