From a18596c9b5cf32eb99152c56428d73dca7fad6d2 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 9 Aug 2015 15:24:20 +0200 Subject: [PATCH] Nowadays OpenSSL is using the following official binary compatbility policy: for version A.B.Cd as long as A.B is the same for both runtime & compiled time then it's compatible. --- src/ircd.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/ircd.c b/src/ircd.c index 42835c7ab..331c4ca05 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -718,17 +718,34 @@ char buf[1024]; */ static void do_version_check() { -const char *compiledfor, *runtime; -int error = 0; + const char *compiledfor, *runtime; + int error = 0; + char *p; + /* OPENSSL: + * Nowadays (since openssl 1.0.0) they retain binary compatibility + * when the first two version numbers are the same: eg 1.0.0 and 1.0.2 + */ compiledfor = OPENSSL_VERSION_TEXT; runtime = SSLeay_version(SSLEAY_VERSION); - if (strcasecmp(compiledfor, runtime)) + p = strchr(compiledfor, '.'); + if (p) { - version_check_logerror("OpenSSL version mismatch: compiled for '%s', library is '%s'", - compiledfor, runtime); - error=1; + p = strchr(p+1, '.'); + if (p) + { + int versionlen = p - compiledfor + 1; + + if (strncasecmp(compiledfor, runtime, versionlen)) + { + version_check_logerror("OpenSSL version mismatch: compiled for '%s', library is '%s'", + compiledfor, runtime); + error=1; + } + } } + + #ifdef USE_LIBCURL /* Perhaps someone should tell them to do this a bit more easy ;) * problem is runtime output is like: 'libcurl/7.11.1 c-ares/1.2.0'