Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/node.cc b/src/node.cc
- index 81e123e..092377d 100644
- --- a/src/node.cc
- +++ b/src/node.cc
- @@ -139,6 +139,8 @@ static bool debug_wait_connect = false;
- static int debug_port=5858;
- static int max_stack_size = 0;
- static bool using_domains = false;
- +static bool using_legacy_cipher_list = false;
- +static bool overriding_cipher_list = false;
- // used by C++ modules as well
- bool no_deprecation = false;
- @@ -2588,7 +2590,6 @@ static void PrintHelp() {
- // Parse node command line arguments.
- static void ParseArgs(int argc, char **argv) {
- int i;
- - bool using_legacy_cipher_list = false;
- // TODO use parse opts
- for (i = 1; i < argc; i++) {
- @@ -2660,15 +2661,24 @@ static void ParseArgs(int argc, char **argv) {
- } else if (strncmp(arg, "--cipher-list=", 14) == 0) {
- if (!using_legacy_cipher_list) {
- DEFAULT_CIPHER_LIST = arg + 14;
- + overriding_cipher_list = true;
- + } else {
- + fprintf(stderr, "--cipher-list cannot be used with --enable-legacy-cipher-list\n");
- + exit(9);
- }
- argv[i] = const_cast<char*>("");
- } else if (strncmp(arg, "--enable-legacy-cipher-list=", 28) == 0) {
- - const char * legacy_list = legacy_cipher_list(arg+28);
- - if (legacy_list != NULL) {
- - using_legacy_cipher_list = true;
- - DEFAULT_CIPHER_LIST = legacy_list;
- + if (!overriding_cipher_list) {
- + const char * legacy_list = legacy_cipher_list(arg+28);
- + if (legacy_list != NULL) {
- + using_legacy_cipher_list = true;
- + DEFAULT_CIPHER_LIST = legacy_list;
- + } else {
- + fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
- + exit(9);
- + }
- } else {
- - fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
- + fprintf(stderr, "--enable-legacy-cipher-list cannot be used with --cipher-list\n");
- exit(9);
- }
- argv[i] = const_cast<char*>("");
- @@ -2968,19 +2978,31 @@ char** Init(int argc, char *argv[]) {
- const char * cipher_list = getenv("NODE_CIPHER_LIST");
- if (cipher_list != NULL) {
- - DEFAULT_CIPHER_LIST = cipher_list;
- + if (!using_legacy_cipher_list && !overriding_cipher_list) {
- + overriding_cipher_list = true;
- + DEFAULT_CIPHER_LIST = cipher_list;
- + } else {
- + fprintf(stderr, "NODE_CIPHER_LIST cannot be set when other cipher lists options are used\n");
- + exit(9);
- + }
- }
- // Allow the NODE_LEGACY_CIPHER_LIST envar to override the other
- // cipher list options. NODE_LEGACY_CIPHER_LIST=v0.10.38 will use
- // the cipher list from v0.10.38
- const char * leg_cipher_id = getenv("NODE_LEGACY_CIPHER_LIST");
- if (leg_cipher_id != NULL) {
- - const char * leg_cipher_list =
- - legacy_cipher_list(leg_cipher_id);
- - if (leg_cipher_list != NULL) {
- - DEFAULT_CIPHER_LIST = leg_cipher_list;
- + if (!overriding_cipher_list && !using_legacy_cipher_list) {
- + using_legacy_cipher_list = true;
- + const char * leg_cipher_list =
- + legacy_cipher_list(leg_cipher_id);
- + if (leg_cipher_list != NULL) {
- + DEFAULT_CIPHER_LIST = leg_cipher_list;
- + } else {
- + fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
- + exit(9);
- + }
- } else {
- - fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
- + fprintf(stderr, "NODE_LEGACY_CIPHER_LIST cannot be set when other cipher lists options are used\n");
- exit(9);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement