From 4b53361ea47860c196adf7c431d03ac9d139dfc2 Mon Sep 17 00:00:00 2001 From: Jaipaul Cheernam Date: Thu, 27 Aug 2026 20:53:22 +0200 Subject: [PATCH] ntopng: fix build with OpenSSL 4.0 OpenSSL 4.0 returns const X509_NAME* from X509_get_subject_name(). Cast where non-const API (X509_NAME_oneline, X509_NAME_get_text_by_NID) requires it. Upstream-Status: Backport [https://github.com/ntop/ntopng/pull/10830] Signed-off-by: Jaipaul Cheernam Signed-off-by: Khem Raj --- .../0001-Fix-build-with-OpenSSL-4.0.patch | 42 +++++++++++++++++++ .../recipes-support/ntopng/ntopng_6.6.bb | 1 + 2 files changed, 43 insertions(+) create mode 100644 meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch diff --git a/meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch b/meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch new file mode 100644 index 0000000000..4f142092c3 --- /dev/null +++ b/meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch @@ -0,0 +1,42 @@ +From 0c9dcc44df3592d8e08b46f5dfca664de5918bc5 Mon Sep 17 00:00:00 2001 +From: Jaipaul Cheernam +Date: Thu, 27 Aug 2026 09:13:35 +0000 +Subject: [PATCH] HTTPserver: fix const X509_NAME for OpenSSL 4.0 + +OpenSSL 4.0 changed X509_get_subject_name() to return const X509_NAME*. +Update the local variable to match and cast where non-const API requires it. + +Upstream-Status: Backport [https://github.com/ntop/ntopng/pull/10830] +Signed-off-by: Jaipaul Cheernam +--- + src/HTTPserver.cpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/HTTPserver.cpp b/src/HTTPserver.cpp +index 21895bf10e..f7b4164ab4 100644 +--- a/src/HTTPserver.cpp ++++ b/src/HTTPserver.cpp +@@ -403,7 +403,7 @@ static bool ssl_client_x509_auth(const struct mg_connection *const conn, + char *const group, bool *const localuser) { + bool ret = false; + X509 *cert = NULL; +- X509_NAME *subj = NULL; ++ const X509_NAME *subj = NULL; + char subject[256]; + char key[CONST_MAX_LEN_REDIS_KEY]; + +@@ -411,12 +411,12 @@ static bool ssl_client_x509_auth(const struct mg_connection *const conn, + + if ((cert = SSL_get_peer_certificate(conn->ssl))) { + if ((subj = X509_get_subject_name(cert))) { +- X509_NAME_oneline(subj, subject, sizeof(subject)); ++ X509_NAME_oneline((X509_NAME *)subj, subject, sizeof(subject)); + + ntop->getTrace()->traceEvent(TRACE_INFO, "Client X.509 certificate subject name: '%s'", subject); + + if (SSL_get_verify_result(conn->ssl) == X509_V_OK && +- X509_NAME_get_text_by_NID(subj, NID_commonName, username, NTOP_USERNAME_MAXLEN) >= 0) { ++ X509_NAME_get_text_by_NID((X509_NAME *)subj, NID_commonName, username, NTOP_USERNAME_MAXLEN) >= 0) { + snprintf(key, sizeof(key), CONST_STR_USER_GROUP, username); + + ntop->getTrace()->traceEvent(TRACE_INFO, "Client X.509 certificate CN: '%s'", username); diff --git a/meta-networking/recipes-support/ntopng/ntopng_6.6.bb b/meta-networking/recipes-support/ntopng/ntopng_6.6.bb index 3c039781d8..03350f240c 100644 --- a/meta-networking/recipes-support/ntopng/ntopng_6.6.bb +++ b/meta-networking/recipes-support/ntopng/ntopng_6.6.bb @@ -18,6 +18,7 @@ SRC_URI = "gitsm://github.com/ntop/ntopng;protocol=https;branch=6.6-stable \ file://0001-configure.ac.in-Allow-dynamic-linking-against-ndpi-3.patch \ file://0001-luaengine-Use-lua-5.5-API-signature-for-lua_newstate.patch \ file://ntopng.service \ + file://0001-Fix-build-with-OpenSSL-4.0.patch \ " # don't use the lua under thirdparty as it supports cross compiling badly