initial commit
This commit is contained in:
commit
9d20827c46
2469 changed files with 470994 additions and 0 deletions
117
qcm/certstore.qcm
Normal file
117
qcm/certstore.qcm
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: certstore
|
||||
section: project
|
||||
arg: certstore-path=[path],Path to the SSL/X509 Certificate store file (bundled QCA only)
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
|
||||
class qc_certstore : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_certstore(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "certstore"; }
|
||||
QString shortname() const { return "certstore"; }
|
||||
|
||||
QString checkString() const {
|
||||
if (!QFile::exists("third-party/qca/qca") || !conf->getenv("QC_DISABLE_bundled_qca").isEmpty())
|
||||
return "";
|
||||
else
|
||||
return ConfObj::checkString();
|
||||
}
|
||||
|
||||
bool exec()
|
||||
{
|
||||
if (!QFile::exists("third-party/qca/qca") || !conf->getenv("QC_DISABLE_bundled_qca").isEmpty() || !QFile::exists("third-party/qca/qca-ossl")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bundled = false;
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
// use built-in
|
||||
return true;
|
||||
#else
|
||||
QStringList pathsToTry;
|
||||
|
||||
path = conf->getenv("QC_CERTSTORE_PATH");
|
||||
if(!path.isEmpty())
|
||||
{
|
||||
if(QFile::exists(path))
|
||||
{
|
||||
QString certPathString =
|
||||
"QCA_SYSTEMSTORE_PATH=\\\\\\\\\\\\\"" + path + "\\\\\\\\\\\\\"";
|
||||
conf->addDefine(certPathString);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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") );
|
||||
|
||||
// Fedora Core 5 changes to this
|
||||
pathsToTry.append( QString("/etc/pki/tls/cert.pem") );
|
||||
|
||||
for(int n = 0; n < pathsToTry.count(); ++n)
|
||||
{
|
||||
if(QFile::exists(pathsToTry[n]))
|
||||
{
|
||||
path = pathsToTry[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// fall back to bundled
|
||||
if(path.isEmpty())
|
||||
{
|
||||
// --prefix=$pwd ?
|
||||
if(QFile::exists(conf->getenv("PREFIX") + "/certs/rootcerts.pem"))
|
||||
path = "$$PREFIX/certs/rootcerts.pem";
|
||||
else
|
||||
path = "$$DATADIR/yachat/certs/rootcerts.pem";
|
||||
|
||||
QString extra =
|
||||
"qcasharedfiles.path = $$DATADIR/yachat\n"
|
||||
"qcasharedfiles.files = third-party/qca/qca/certs\n"
|
||||
"INSTALLS += qcasharedfiles\n";
|
||||
conf->addExtra(extra);
|
||||
bundled = true;
|
||||
}
|
||||
|
||||
// Qt<4.2 workaround
|
||||
QString certPathString =
|
||||
"QCA_SYSTEMSTORE_PATH=\\\\\\\\\\\\\"" + path + "\\\\\\\\\\\\\"";
|
||||
conf->addDefine(certPathString);
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString resultString() const
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return "using Windows built-in";
|
||||
#elif defined(Q_OS_MAC)
|
||||
return "using Mac built-in";
|
||||
#else
|
||||
if(success)
|
||||
{
|
||||
if(bundled)
|
||||
return "using bundled";
|
||||
else
|
||||
return path;
|
||||
}
|
||||
else
|
||||
return ConfObj::resultString();
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
QString path;
|
||||
bool bundled;
|
||||
};
|
||||
Reference in a new issue