Merge pull request #35 from Sp1l/patch-1

Fix building when OpenSSL was compiled -nossl2  or -noss3
This commit is contained in:
Adrian Chadd 2016-01-24 09:52:57 -08:00
commit 76a1af8fb4

View File

@ -670,10 +670,14 @@ main(int argc, char **argv)
{ {
if (strcasecmp (optarg, "auto") == 0) if (strcasecmp (optarg, "auto") == 0)
param.ssl_protocol = 0; param.ssl_protocol = 0;
#ifndef OPENSSL_NO_SSL2
else if (strcasecmp (optarg, "SSLv2") == 0) else if (strcasecmp (optarg, "SSLv2") == 0)
param.ssl_protocol = 2; param.ssl_protocol = 2;
#endif
#ifndef OPENSSL_NO_SSL3
else if (strcasecmp (optarg, "SSLv3") == 0) else if (strcasecmp (optarg, "SSLv3") == 0)
param.ssl_protocol = 3; param.ssl_protocol = 3;
#endif
else if (strcasecmp (optarg, "TLSv1") == 0) else if (strcasecmp (optarg, "TLSv1") == 0)
param.ssl_protocol = 4; param.ssl_protocol = 4;
else else
@ -1006,10 +1010,14 @@ main(int argc, char **argv)
{ {
/* 0/auto for SSLv23 */ /* 0/auto for SSLv23 */
case 0: ssl_ctx = SSL_CTX_new (SSLv23_client_method ()); break; case 0: ssl_ctx = SSL_CTX_new (SSLv23_client_method ()); break;
#ifndef OPENSSL_NO_SSL2
/* 2/SSLv2 */ /* 2/SSLv2 */
case 2: ssl_ctx = SSL_CTX_new (SSLv2_client_method ()); break; case 2: ssl_ctx = SSL_CTX_new (SSLv2_client_method ()); break;
#endif
#ifndef OPENSSL_NO_SSL3
/* 3/SSLv3 */ /* 3/SSLv3 */
case 3: ssl_ctx = SSL_CTX_new (SSLv3_client_method ()); break; case 3: ssl_ctx = SSL_CTX_new (SSLv3_client_method ()); break;
#endif
/* 4/TLSv1 */ /* 4/TLSv1 */
case 4: ssl_ctx = SSL_CTX_new (TLSv1_client_method ()); break; case 4: ssl_ctx = SSL_CTX_new (TLSv1_client_method ()); break;
} }
@ -1217,8 +1225,12 @@ main(int argc, char **argv)
switch (param.ssl_protocol) switch (param.ssl_protocol)
{ {
case 0: printf (" --ssl-protocol=auto"); break; case 0: printf (" --ssl-protocol=auto"); break;
#ifndef OPENSSL_NO_SSL2
case 2: printf (" --ssl-protocol=SSLv2"); break; case 2: printf (" --ssl-protocol=SSLv2"); break;
#endif
#ifndef OPENSSL_NO_SSL3
case 3: printf (" --ssl-protocol=SSLv3"); break; case 3: printf (" --ssl-protocol=SSLv3"); break;
#endif
case 4: printf (" --ssl-protocol=TLSv1"); break; case 4: printf (" --ssl-protocol=TLSv1"); break;
} }
#endif #endif