Advertisement
Guest User

Untitled

a guest
May 27th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. diff --git a/src/node.cc b/src/node.cc
  2. index 81e123e..092377d 100644
  3. --- a/src/node.cc
  4. +++ b/src/node.cc
  5. @@ -139,6 +139,8 @@ static bool debug_wait_connect = false;
  6. static int debug_port=5858;
  7. static int max_stack_size = 0;
  8. static bool using_domains = false;
  9. +static bool using_legacy_cipher_list = false;
  10. +static bool overriding_cipher_list = false;
  11.  
  12. // used by C++ modules as well
  13. bool no_deprecation = false;
  14. @@ -2588,7 +2590,6 @@ static void PrintHelp() {
  15. // Parse node command line arguments.
  16. static void ParseArgs(int argc, char **argv) {
  17. int i;
  18. - bool using_legacy_cipher_list = false;
  19.  
  20. // TODO use parse opts
  21. for (i = 1; i < argc; i++) {
  22. @@ -2660,15 +2661,24 @@ static void ParseArgs(int argc, char **argv) {
  23. } else if (strncmp(arg, "--cipher-list=", 14) == 0) {
  24. if (!using_legacy_cipher_list) {
  25. DEFAULT_CIPHER_LIST = arg + 14;
  26. + overriding_cipher_list = true;
  27. + } else {
  28. + fprintf(stderr, "--cipher-list cannot be used with --enable-legacy-cipher-list\n");
  29. + exit(9);
  30. }
  31. argv[i] = const_cast<char*>("");
  32. } else if (strncmp(arg, "--enable-legacy-cipher-list=", 28) == 0) {
  33. - const char * legacy_list = legacy_cipher_list(arg+28);
  34. - if (legacy_list != NULL) {
  35. - using_legacy_cipher_list = true;
  36. - DEFAULT_CIPHER_LIST = legacy_list;
  37. + if (!overriding_cipher_list) {
  38. + const char * legacy_list = legacy_cipher_list(arg+28);
  39. + if (legacy_list != NULL) {
  40. + using_legacy_cipher_list = true;
  41. + DEFAULT_CIPHER_LIST = legacy_list;
  42. + } else {
  43. + fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
  44. + exit(9);
  45. + }
  46. } else {
  47. - fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
  48. + fprintf(stderr, "--enable-legacy-cipher-list cannot be used with --cipher-list\n");
  49. exit(9);
  50. }
  51. argv[i] = const_cast<char*>("");
  52. @@ -2968,19 +2978,31 @@ char** Init(int argc, char *argv[]) {
  53.  
  54. const char * cipher_list = getenv("NODE_CIPHER_LIST");
  55. if (cipher_list != NULL) {
  56. - DEFAULT_CIPHER_LIST = cipher_list;
  57. + if (!using_legacy_cipher_list && !overriding_cipher_list) {
  58. + overriding_cipher_list = true;
  59. + DEFAULT_CIPHER_LIST = cipher_list;
  60. + } else {
  61. + fprintf(stderr, "NODE_CIPHER_LIST cannot be set when other cipher lists options are used\n");
  62. + exit(9);
  63. + }
  64. }
  65. // Allow the NODE_LEGACY_CIPHER_LIST envar to override the other
  66. // cipher list options. NODE_LEGACY_CIPHER_LIST=v0.10.38 will use
  67. // the cipher list from v0.10.38
  68. const char * leg_cipher_id = getenv("NODE_LEGACY_CIPHER_LIST");
  69. if (leg_cipher_id != NULL) {
  70. - const char * leg_cipher_list =
  71. - legacy_cipher_list(leg_cipher_id);
  72. - if (leg_cipher_list != NULL) {
  73. - DEFAULT_CIPHER_LIST = leg_cipher_list;
  74. + if (!overriding_cipher_list && !using_legacy_cipher_list) {
  75. + using_legacy_cipher_list = true;
  76. + const char * leg_cipher_list =
  77. + legacy_cipher_list(leg_cipher_id);
  78. + if (leg_cipher_list != NULL) {
  79. + DEFAULT_CIPHER_LIST = leg_cipher_list;
  80. + } else {
  81. + fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
  82. + exit(9);
  83. + }
  84. } else {
  85. - fprintf(stderr, "Error: An unknown legacy cipher list was specified\n");
  86. + fprintf(stderr, "NODE_LEGACY_CIPHER_LIST cannot be set when other cipher lists options are used\n");
  87. exit(9);
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement