Debian Codegraph @

debian/patches/openssl-4-compat.patch

raw
1 Description: Fix OpenSSL 4.x compat FTBFS
2 Author: Thomas Goirand <[email protected]>
3 Bug-Debian: https://bugs.debian.org/1138394
4 Forwarded: https://github.com/apache/qpid-proton/pull/447
5 Last-Update: 2026-06-17
6
7 Index: qpid-proton/c/src/ssl/openssl.c
8 ===================================================================
9 --- qpid-proton.orig/c/src/ssl/openssl.c
10 +++ qpid-proton/c/src/ssl/openssl.c
11 @@ -311,7 +311,7 @@ static int verify_callback(int preverify
12 GENERAL_NAME *name = sk_GENERAL_NAME_value( sans, i );
13 if (name->type == GEN_DNS) {
14 ASN1_STRING *asn1 = name->d.dNSName;
15 - if (asn1 && asn1->data && asn1->length) {
16 + if (asn1 && ASN1_STRING_get0_data(asn1) && ASN1_STRING_length(asn1) > 0){
17 unsigned char *str;
18 int len = ASN1_STRING_to_UTF8( &str, asn1 );
19 if (len >= 0) {
20 @@ -326,11 +326,11 @@ static int verify_callback(int preverify
21 }
22
23 /* if no general names match, try the CommonName from the subject */
24 - X509_NAME *name = X509_get_subject_name(cert);
25 + const X509_NAME *name = X509_get_subject_name(cert);
26 int i = -1;
27 while (!matched && (i = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0) {
28 - X509_NAME_ENTRY *ne = X509_NAME_get_entry(name, i);
29 - ASN1_STRING *name_asn1 = X509_NAME_ENTRY_get_data(ne);
30 + const X509_NAME_ENTRY *ne = X509_NAME_get_entry(name, i);
31 + const ASN1_STRING *name_asn1 = X509_NAME_ENTRY_get_data(ne);
32 if (name_asn1) {
33 unsigned char *str;
34 int len = ASN1_STRING_to_UTF8( &str, name_asn1);
35 @@ -1412,7 +1412,7 @@ const char* pn_ssl_get_remote_subject(pn
36 if (!ssl->subject) {
37 X509 *cert = get_peer_certificate(ssl);
38 if (!cert) return NULL;
39 - X509_NAME *subject = X509_get_subject_name(cert);
40 + const X509_NAME *subject = X509_get_subject_name(cert);
41 if (!subject) return NULL;
42
43 BIO *out = BIO_new(BIO_s_mem());
44 @@ -1531,17 +1531,17 @@ const char* pn_ssl_get_remote_subject_su
45 X509 *cert = get_peer_certificate(ssl);
46 if (!cert) return NULL;
47
48 - X509_NAME *subject_name = X509_get_subject_name(cert);
49 + const X509_NAME *subject_name = X509_get_subject_name(cert);
50
51 // TODO (gmurthy) - A server side cert subject field can have more than one common name like this - Subject: CN=www.domain1.com, CN=www.domain2.com, see https://bugzilla.mozilla.org/show_bug.cgi?id=380656
52 // For now, we will only return the first common name if there is more than one common name in the cert
53 int index = X509_NAME_get_index_by_NID(subject_name, openssl_field, -1);
54
55 if (index > -1) {
56 - X509_NAME_ENTRY *ne = X509_NAME_get_entry(subject_name, index);
57 + const X509_NAME_ENTRY *ne = X509_NAME_get_entry(subject_name, index);
58 if(ne) {
59 - ASN1_STRING *name_asn1 = X509_NAME_ENTRY_get_data(ne);
60 - return (char *) name_asn1->data;
61 + const ASN1_STRING *name_asn1 = X509_NAME_ENTRY_get_data(ne);
62 + return (const char *)ASN1_STRING_get0_data(name_asn1);
63 }
64 }
65