Remove dStr from OpenSSL code.

This commit is contained in:
2026-05-06 01:42:08 -04:00
parent 566f9dd587
commit 49702e362b
+7 -7
View File
@@ -68,6 +68,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <sstream>
#include <algorithm> #include <algorithm>
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
@@ -615,9 +616,9 @@ static bool Tls_check_cert_hostname(X509 *cert, const char *host,
{ {
/* Test subject alternative names */ /* Test subject alternative names */
Dstr *err = dStr_new(""); std::ostringstream err;
dStr_sprintf(err, "Hostname %s does not match any of certificate's " err << "Hostname " << host << " does not match any of certificate's "
"Subject Alternative Names: ", host); "Subject Alternative Names: ";
/* Do we want to check for dNSNAmes or ipAddresses (see RFC 2818)? /* Do we want to check for dNSNAmes or ipAddresses (see RFC 2818)?
* Signal it by host_in_octet_string. */ * Signal it by host_in_octet_string. */
@@ -642,7 +643,7 @@ static bool Tls_check_cert_hostname(X509 *cert, const char *host,
if (!ASN1_STRING_cmp (host_in_octet_string, if (!ASN1_STRING_cmp (host_in_octet_string,
name->d.iPAddress)) name->d.iPAddress))
break; break;
dStr_sprintfa(err, "%s ", name->d.iPAddress); err << name->d.iPAddress;
} }
} }
else if (name->type == GEN_DNS) else if (name->type == GEN_DNS)
@@ -664,7 +665,7 @@ static bool Tls_check_cert_hostname(X509 *cert, const char *host,
OPENSSL_free (name_in_utf8); OPENSSL_free (name_in_utf8);
break; break;
} }
dStr_sprintfa(err, "%s ", name_in_utf8); err << name_in_utf8;
OPENSSL_free (name_in_utf8); OPENSSL_free (name_in_utf8);
} }
} }
@@ -678,7 +679,7 @@ static bool Tls_check_cert_hostname(X509 *cert, const char *host,
{ {
success = false; success = false;
*choice = a_Dialog_choice("Flenser TLS security warning", *choice = a_Dialog_choice("Flenser TLS security warning",
err->str, "Continue", "Cancel", NULL); err.str().c_str(), "Continue", "Cancel", NULL);
switch (*choice){ switch (*choice){
case 1: case 1:
@@ -690,7 +691,6 @@ static bool Tls_check_cert_hostname(X509 *cert, const char *host,
break; break;
} }
} }
dStr_free(err, 1);
} }
if (alt_name_checked == false) if (alt_name_checked == false)