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@8a7db9d

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
@@ -3637,6 +3637,8 @@ static void ParseArgs(int* argc,
36373637
const char** new_v8_argv = new const char*[nargs];
36383638
const char** new_argv = new const char*[nargs];
36393639
const char** local_preload_modules = new const char*[nargs];
3640+
bool use_bundled_ca = false;
3641+
bool use_openssl_ca = false;
36403642

36413643
for (unsigned int i = 0; i < nargs; ++i) {
36423644
new_exec_argv[i] = nullptr;
@@ -3751,7 +3753,9 @@ static void ParseArgs(int* argc,
37513753
default_cipher_list = arg + 18;
37523754
} else if (strncmp(arg, "--use-openssl-ca", 16) == 0) {
37533755
ssl_openssl_cert_store = true;
3756+
use_openssl_ca = true;
37543757
} else if (strncmp(arg, "--use-bundled-ca", 16) == 0) {
3758+
use_bundled_ca = true;
37553759
ssl_openssl_cert_store = false;
37563760
#if NODE_FIPS_MODE
37573761
} else if (strcmp(arg, "--enable-fips") == 0) {
@@ -3786,6 +3790,16 @@ static void ParseArgs(int* argc,
37863790
index += args_consumed;
37873791
}
37883792

3793+
#if HAVE_OPENSSL
3794+
if (use_openssl_ca && use_bundled_ca) {
3795+
fprintf(stderr,
3796+
"%s: either --use-openssl-ca or --use-bundled-ca can be used, "
3797+
"not both\n",
3798+
argv[0]);
3799+
exit(9);
3800+
}
3801+
#endif
3802+
37893803
// Copy remaining arguments.
37903804
const unsigned int args_left = nargs - index;
37913805
memcpy(new_argv + new_argc, argv + index, args_left * sizeof(*argv));
Collapse file

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

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
return;
8+
}
9+
const assert = require('assert');
10+
const os = require('os');
11+
const childProcess = require('child_process');
12+
const result = childProcess.spawnSync(process.execPath, [
13+
'--use-bundled-ca',
14+
'--use-openssl-ca',
15+
'-p', 'process.version'],
16+
{encoding: 'utf8'});
17+
18+
assert.strictEqual(result.stderr,
19+
process.execPath + ': either --use-openssl-ca or ' +
20+
'--use-bundled-ca can be used, not both' + os.EOL);
21+
assert.strictEqual(result.status, 9);
22+
23+
const useBundledCA = childProcess.spawnSync(process.execPath, [
24+
'--use-bundled-ca',
25+
'-p', 'process.version']);
26+
assert.strictEqual(useBundledCA.status, 0);
27+
28+
const useOpenSSLCA = childProcess.spawnSync(process.execPath, [
29+
'--use-openssl-ca',
30+
'-p', 'process.version']);
31+
assert.strictEqual(useOpenSSLCA.status, 0);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.