| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4d255b0 commit 8a7db9d
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3637,6 +3637,8 @@ static void ParseArgs(int* argc, | |||
| 3637 | 3637 | const char** new_v8_argv = new const char*[nargs]; | |
| 3638 | 3638 | const char** new_argv = new const char*[nargs]; | |
| 3639 | 3639 | const char** local_preload_modules = new const char*[nargs]; | |
| 3640 | + bool use_bundled_ca = false; | ||
| 3641 | + bool use_openssl_ca = false; | ||
| 3640 | 3642 | ||
| 3641 | 3643 | for (unsigned int i = 0; i < nargs; ++i) { | |
| 3642 | 3644 | new_exec_argv[i] = nullptr; | |
@@ -3751,7 +3753,9 @@ static void ParseArgs(int* argc, | |||
| 3751 | 3753 | default_cipher_list = arg + 18; | |
| 3752 | 3754 | } else if (strncmp(arg, "--use-openssl-ca", 16) == 0) { | |
| 3753 | 3755 | ssl_openssl_cert_store = true; | |
| 3756 | + use_openssl_ca = true; | ||
| 3754 | 3757 | } else if (strncmp(arg, "--use-bundled-ca", 16) == 0) { | |
| 3758 | + use_bundled_ca = true; | ||
| 3755 | 3759 | ssl_openssl_cert_store = false; | |
| 3756 | 3760 | #if NODE_FIPS_MODE | |
| 3757 | 3761 | } else if (strcmp(arg, "--enable-fips") == 0) { | |
@@ -3786,6 +3790,16 @@ static void ParseArgs(int* argc, | |||
| 3786 | 3790 | index += args_consumed; | |
| 3787 | 3791 | } | |
| 3788 | 3792 | ||
| 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 | + | ||
| 3789 | 3803 | // Copy remaining arguments. | |
| 3790 | 3804 | const unsigned int args_left = nargs - index; | |
| 3791 | 3805 | memcpy(new_argv + new_argc, argv + index, args_left * sizeof(*argv)); | |
| Original file line number | Diff line number | Diff 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); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments