summaryrefslogtreecommitdiff
path: root/lib/d
diff options
context:
space:
mode:
authormingwugmail <mingwu@gmail.com>2021-05-26 00:38:22 +0200
committerJens Geyer <jensg@apache.org>2021-05-27 23:12:53 +0200
commit4abc5cfb4b3dea54484ca49a584b472a7373f3c5 (patch)
tree2d098a3f7ddc71e89346851a86d3e48e7a6b733c /lib/d
parent9a4802ab411f1f45b58a8eae015707502e36b8ed (diff)
downloadthrift-4abc5cfb4b3dea54484ca49a584b472a7373f3c5.tar.gz
fix D build, with D lang openssl 2.0.3
Client: d Patch: mingwugmail <mingwu@gmail.com> This closes #2397
Diffstat (limited to 'lib/d')
-rw-r--r--lib/d/Makefile.am4
-rw-r--r--lib/d/src/thrift/internal/ssl.d19
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/d/Makefile.am b/lib/d/Makefile.am
index 4787e0a60..013721720 100644
--- a/lib/d/Makefile.am
+++ b/lib/d/Makefile.am
@@ -97,7 +97,7 @@ d_main_modules = $(filter-out $(d_libevent_dependent_modules) \
$(d_openssl_dependent_modules),$(d_modules))
-d_lib_flags = -w -wi -Isrc -lib
+d_lib_flags = -w -wi -Isrc -lib -version=use_openssl_1_0_x
all_targets =
#
@@ -153,7 +153,7 @@ clean-local:
#
# Unit tests (built both in debug and release mode).
#
-d_test_flags = -unittest -w -wi -I$(top_srcdir)/lib/d/src
+d_test_flags = -unittest -w -wi -I$(top_srcdir)/lib/d/src -version=use_openssl_1_0_x
# There just must be some way to reassign a variable without warnings in
# Automake...
diff --git a/lib/d/src/thrift/internal/ssl.d b/lib/d/src/thrift/internal/ssl.d
index 3af54b582..29cc6d079 100644
--- a/lib/d/src/thrift/internal/ssl.d
+++ b/lib/d/src/thrift/internal/ssl.d
@@ -89,6 +89,20 @@ void authorize(SSL* ssl, TAccessManager accessManager,
// Check subjectAltName(s), if present.
auto alternatives = cast(STACK_OF!(GENERAL_NAME)*)
X509_get_ext_d2i(cert, NID_subject_alt_name, null, null);
+
+ version(use_openssl_1_0_x) {
+ enum _GEN_DNS = GENERAL_NAME.GEN_DNS;
+ enum _GEN_IPADD = GENERAL_NAME.GEN_IPADD;
+ } else version(use_openssl_1_1_x) {
+ enum _GEN_DNS = GEN_DNS;
+ enum _GEN_IPADD = GEN_IPADD;
+ } else {
+ static assert(false, `Must have version either use_openssl_1_0_x or use_openssl_1_1_x defined, e.g.
+ "subConfigurations": {
+ "apache-thrift": "use_openssl_1_0"
+ }`);
+ }
+
if (alternatives != null) {
auto count = sk_GENERAL_NAME_num(alternatives);
for (int i = 0; decision == Decision.SKIP && i < count; i++) {
@@ -98,11 +112,12 @@ void authorize(SSL* ssl, TAccessManager accessManager,
}
auto data = ASN1_STRING_data(name.d.ia5);
auto length = ASN1_STRING_length(name.d.ia5);
+
switch (name.type) {
- case GENERAL_NAME.GEN_DNS:
+ case _GEN_DNS:
decision = accessManager.verify(hostName, cast(char[])data[0 .. length]);
break;
- case GENERAL_NAME.GEN_IPADD:
+ case _GEN_IPADD:
decision = accessManager.verify(peerAddress, data[0 .. length]);
break;
default: