Correct patch to detect most recent libcrypto/libssl
This commit is contained in:
parent
fa759efd73
commit
a73b3cf436
@ -1,28 +1,99 @@
|
|||||||
$OpenBSD: patch-kssl_kopenssl_cc,v 1.1 2001/08/20 23:40:18 espie Exp $
|
$OpenBSD: patch-kssl_kopenssl_cc,v 1.2 2001/08/21 14:20:08 espie Exp $
|
||||||
--- kssl/kopenssl.cc.orig Mon Aug 20 01:49:42 2001
|
--- kssl/kopenssl.cc.orig Sun Jul 29 06:55:41 2001
|
||||||
+++ kssl/kopenssl.cc Mon Aug 20 01:50:16 2001
|
+++ kssl/kopenssl.cc Tue Aug 21 16:11:26 2001
|
||||||
@@ -135,21 +135,12 @@ KConfig *cfg;
|
@@ -117,6 +117,51 @@ void KOpenSSLProxy::destroy() {
|
||||||
|
_me = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef __OpenBSD__
|
||||||
|
+#include <qdir.h>
|
||||||
|
+#include <qstring.h>
|
||||||
|
+#include <qstringlist.h>
|
||||||
|
+
|
||||||
|
+static QString findMostRecentLib(QString dir, QString name)
|
||||||
|
+{
|
||||||
|
+ // Grab all shared libraries in the directory
|
||||||
|
+ QString filter = "lib"+name+".so.*";
|
||||||
|
+ QDir d(dir, filter);
|
||||||
|
+ if (!d.exists())
|
||||||
|
+ return NULL;
|
||||||
|
+ QStringList l = d.entryList();
|
||||||
|
+
|
||||||
|
+ // Find the best one
|
||||||
|
+ int bestmaj = -1;
|
||||||
|
+ int bestmin = -1;
|
||||||
|
+ QString best = NULL;
|
||||||
|
+ // where do we start
|
||||||
|
+ uint s = filter.length()-1;
|
||||||
|
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
|
||||||
|
+ QString numberpart = (*it).mid(s);
|
||||||
|
+ uint endmaj = numberpart.find('.');
|
||||||
|
+ if (endmaj == -1)
|
||||||
|
+ continue;
|
||||||
|
+ bool ok;
|
||||||
|
+ int maj = numberpart.left(endmaj).toInt(&ok);
|
||||||
|
+ if (!ok)
|
||||||
|
+ continue;
|
||||||
|
+ int min = numberpart.mid(endmaj+1).toInt(&ok);
|
||||||
|
+ if (!ok)
|
||||||
|
+ continue;
|
||||||
|
+ if (maj > bestmaj || (maj == bestmaj && min > bestmin)) {
|
||||||
|
+ bestmaj = maj;
|
||||||
|
+ bestmin = min;
|
||||||
|
+ best = (*it);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (best.isNull())
|
||||||
|
+ return NULL;
|
||||||
|
+ else
|
||||||
|
+ return dir+"/"+best;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
|
||||||
|
KOpenSSLProxy::KOpenSSLProxy() {
|
||||||
|
KLibLoader *ll = KLibLoader::self();
|
||||||
|
@@ -135,6 +180,13 @@ KConfig *cfg;
|
||||||
|
|
||||||
delete cfg;
|
delete cfg;
|
||||||
|
|
||||||
- libpaths << "/usr/lib/"
|
+#ifdef __OpenBSD__
|
||||||
- << "/usr/local/lib/"
|
+ {
|
||||||
- << "/usr/local/openssl/lib/"
|
+ QString libname = findMostRecentLib("/usr/lib", "crypto");
|
||||||
- << "/usr/local/ssl/lib/"
|
+ if (!libname.isNull())
|
||||||
- << "/opt/openssl/lib/"
|
+ _cryptoLib = ll->globalLibrary(libname.latin1());
|
||||||
- << "";
|
+ }
|
||||||
+ libpaths << "/usr/lib/";
|
+#else
|
||||||
|
libpaths << "/usr/lib/"
|
||||||
|
<< "/usr/local/lib/"
|
||||||
|
<< "/usr/local/openssl/lib/"
|
||||||
|
@@ -163,6 +215,7 @@ KConfig *cfg;
|
||||||
|
}
|
||||||
|
if (_cryptoLib) break;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
// FIXME: #define here for the various OS types to optimize
|
if (_cryptoLib) {
|
||||||
- libnamess << "libssl.so.0"
|
#ifdef HAVE_SSL
|
||||||
- << "libssl.so"
|
@@ -210,6 +263,13 @@ KConfig *cfg;
|
||||||
- << "libssl.sl";
|
#endif
|
||||||
+ libnamess << "libssl.so.5.1";
|
}
|
||||||
|
|
||||||
- libnamesc << "libcrypto.so.0"
|
|
||||||
- << "libcrypto.so"
|
|
||||||
- << "libcrypto.sl";
|
|
||||||
+ libnamesc << "libcrypto.so.5.1";
|
|
||||||
|
|
||||||
|
+#ifdef __OpenBSD__
|
||||||
|
+ {
|
||||||
|
+ QString libname = findMostRecentLib("/usr/lib", "ssl");
|
||||||
|
+ if (!libname.isNull())
|
||||||
|
+ _sslLib = ll->globalLibrary(libname.latin1());
|
||||||
|
+ }
|
||||||
|
+#else
|
||||||
for (QStringList::Iterator it = libpaths.begin();
|
for (QStringList::Iterator it = libpaths.begin();
|
||||||
it != libpaths.end();
|
it != libpaths.end();
|
||||||
|
++it) {
|
||||||
|
@@ -222,6 +282,7 @@ KConfig *cfg;
|
||||||
|
}
|
||||||
|
if (_sslLib) break;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (_sslLib) {
|
||||||
|
#ifdef HAVE_SSL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user