Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Option to disable SSL v2
Browse files Browse the repository at this point in the history
Fixes #880
  • Loading branch information
kapouer authored and ry committed Jun 3, 2011
1 parent b96ae66 commit f23c45f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,23 @@ Handle<Value> SecureContext::Init(const Arguments& args) {
String::Utf8Value sslmethod(args[0]->ToString());

if (strcmp(*sslmethod, "SSLv2_method") == 0) {
#ifndef OPENSSL_NO_SSL2
method = SSLv2_method();
#else
return ThrowException(Exception::Error(String::New("SSLv2 methods disabled")));
#endif
} else if (strcmp(*sslmethod, "SSLv2_server_method") == 0) {
#ifndef OPENSSL_NO_SSL2
method = SSLv2_server_method();
#else
return ThrowException(Exception::Error(String::New("SSLv2 methods disabled")));
#endif
} else if (strcmp(*sslmethod, "SSLv2_client_method") == 0) {
#ifndef OPENSSL_NO_SSL2
method = SSLv2_client_method();
#else
return ThrowException(Exception::Error(String::New("SSLv2 methods disabled")));
#endif
} else if (strcmp(*sslmethod, "SSLv3_method") == 0) {
method = SSLv3_method();
} else if (strcmp(*sslmethod, "SSLv3_server_method") == 0) {
Expand Down
12 changes: 12 additions & 0 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def set_options(opt):
, dest='openssl_libpath'
)

opt.add_option( '--no-ssl2'
, action='store_true'
, default=False
, help="Disable OpenSSL v2"
, dest='openssl_nov2'
)

opt.add_option( '--gdb'
, action='store_true'
, default=False
Expand Down Expand Up @@ -279,6 +286,11 @@ def configure(conf):
if not Options.options.without_ssl:
# Don't override explicitly supplied openssl paths with pkg-config results.
explicit_openssl = o.openssl_includes or o.openssl_libpath

# Disable ssl v2 methods
if o.openssl_nov2:
conf.env.append_value("CPPFLAGS", "-DOPENSSL_NO_SSL2=1")

if not explicit_openssl and conf.check_cfg(package='openssl',
args='--cflags --libs',
uselib_store='OPENSSL'):
Expand Down

0 comments on commit f23c45f

Please sign in to comment.