4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-06 15:59:34 +00:00

Add infrastructure for alternative certificate locations.

svn path=/trunk/kdesupport/qca/; revision=382599
This commit is contained in:
Brad Hards 2005-01-26 10:44:16 +00:00
parent ca4a3a543d
commit 426fb2f35e
3 changed files with 56 additions and 2 deletions

53
certstore.qcm Normal file

@ -0,0 +1,53 @@
#include <qprocess.h>
#include <qstringlist.h>
/*
-----BEGIN QCMOD-----
name: certstore
arg: certstore-path=[path],Path to the SSL Certificate store
-----END QCMOD-----
*/
class qc_certstore : public ConfObj
{
public:
qc_certstore(Conf *c) : ConfObj(c) {}
QString name() const { return "certstore"; }
QString shortname() const { return "certstore"; }
bool exec()
{
QStringList pathsToTry;
pathsToTry.append(conf->getenv("QC_CERTSTORE_PATH"));
// This is from Debian
pathsToTry.append( QString("/etc/ssl/certs/ca-certificates.crt") );
// Fedora Core 2 uses these
pathsToTry.append( QString("/usr/share/ssl/cert.pem") );
pathsToTry.append( QString("/usr/share/ssl/certs/ca-bundle.crt") );
for ( QStringList::Iterator path = pathsToTry.begin(); path != pathsToTry.end(); ++path ) {
if ( QFile::exists( *path ) ) {
m_firstGoodPath = *path;
break;
}
}
QString certPathString = "QCA_SYSTEMSTORE_PATH='\"" + m_firstGoodPath + "\"'";
conf->addDefine(certPathString);
if ( m_firstGoodPath.isEmpty() )
return false;
else
return true;
}
QString resultString() const
{
return m_firstGoodPath;
}
private:
QString m_firstGoodPath;
};

@ -57,8 +57,6 @@ SOURCES += \
DEFINES += QCA_NO_SYSTEMSTORE
unix:!mac: {
# debian cert store
DEFINES += QCA_SYSTEMSTORE_PATH='"/etc/ssl/certs/ca-certificates.crt"'
SOURCES += $$QCA_CPP/qca_systemstore_flatfile.cpp
}
win: {

3
qca.qc

@ -2,4 +2,7 @@
<name>Qt Cryptographic Architecture (QCA)</name>
<profile>qca.pro</profile>
<nobindir/>
<moddir>.</moddir>
<dep type='certstore'>
</dep>
</qconf>