refactor LoadCheckX509 into safer AuthSSL::parseX509DetailsFromFile

This commit is contained in:
Gioacchino Mazzurco 2019-05-14 22:05:42 +02:00
parent 0c097c2080
commit 16d606b513
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
5 changed files with 65 additions and 49 deletions

View file

@ -686,7 +686,8 @@ static bool checkAccount(const std::string &accountdir, AccountDetails &account,
bool ret = false;
/* check against authmanagers private keys */
if (LoadCheckX509(cert_name.c_str(), account.mPgpId, account.mLocation, account.mSslId))
if(AuthSSL::instance().parseX509DetailsFromFile(
cert_name, account.mSslId, account.mPgpId, account.mLocation ))
{
// new locations store the name in an extra file
if(account.mLocation == "")
@ -1117,8 +1118,11 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
std::string location;
RsPgpId pgpid_retrieved;
if (LoadCheckX509(cert_name.c_str(), pgpid_retrieved, location, sslId) == 0) {
std::cerr << "RsInit::GenerateSSLCertificate() Cannot check own signature, maybe the files are corrupted." << std::endl;
if(!AuthSSL::instance().parseX509DetailsFromFile(
cert_name, sslId, pgpid_retrieved, location ))
{
RsErr() << __PRETTY_FUNCTION__ << " Cannot check own signature, maybe "
<< "the files are corrupted." << std::endl;
return false;
}