OpenSSL: also try the "1.0.2" soname

Turns out that also Debian patches OpenSSL 1.0, changing its soname to "1.0.2".
Therefore, try also to load that one.

Amends 2708c6c11d685ab25c12d558961d924c9a4533d2.

Task-number: QTBUG-68156
Change-Id: I37cc060e90422779a6c29a324ab900f0fb99cfa7
Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2018-11-28 19:20:52 +01:00
parent 7f6497e623
commit 2a494875b8

View File

@ -771,7 +771,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
// reason, we will search a few common paths (see findAllLibSsl() above) in hopes
// we find one that works.
//
// If that fails, for OpenSSL 1.0 we also try a fallback -- just look up
// If that fails, for OpenSSL 1.0 we also try some fallbacks -- look up
// libssl.so with a hardcoded soname. The reason is QTBUG-68156: the binary
// builds of Qt happen (at the time of this writing) on RHEL machines,
// which change SHLIB_VERSION_NUMBER to a non-portable string. When running
@ -804,15 +804,24 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
}
#if !QT_CONFIG(opensslv11)
// first-and-half attempt: for OpenSSL 1.0 try to load an hardcoded soname.
libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String("1.0.0"));
libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String("1.0.0"));
// first-and-half attempts: for OpenSSL 1.0 try to load some hardcoded sonames:
// - "1.0.0" is the official upstream one
// - "1.0.2" is found on some distributions (e.g. Debian) that patch OpenSSL
static const QLatin1String fallbackSonames[] = {
QLatin1String("1.0.0"),
QLatin1String("1.0.2")
};
for (auto fallbackSoname : fallbackSonames) {
libssl->setFileNameAndVersion(QLatin1String("ssl"), fallbackSoname);
libcrypto->setFileNameAndVersion(QLatin1String("crypto"), fallbackSoname);
if (libcrypto->load() && libssl->load()) {
return pair;
} else {
libssl->unload();
libcrypto->unload();
}
}
#endif
#endif