added handling of weak parameters certificate rejection case

This commit is contained in:
csoler 2023-01-15 15:19:46 +01:00
parent 737a753c2c
commit 03e244a7af

View file

@ -947,30 +947,42 @@ bool Rshare::loadCertificate(const RsPeerId &accountId, bool autoLogin)
} }
std::string lockFile; std::string lockFile;
int retVal = RsInit::LockAndLoadCertificates(autoLogin, lockFile); RsInit::LoadCertificateStatus retVal = RsInit::LockAndLoadCertificates(autoLogin, lockFile);
switch (retVal) {
case 0: break; switch (retVal)
case 1: QMessageBox::warning( 0, {
QObject::tr("Multiple instances"), case RsInit::OK:
QObject::tr("Another RetroShare using the same profile is " break;
"already running on your system. Please close " case RsInit::ERR_ALREADY_RUNNING: QMessageBox::warning( nullptr,
"that instance first\n Lock file:\n") + QObject::tr("Multiple instances"),
QString::fromUtf8(lockFile.c_str())); QObject::tr("Another RetroShare using the same profile is "
return false; "already running on your system. Please close "
case 2: QMessageBox::critical( 0, "that instance first\n Lock file:\n") +
QObject::tr("Multiple instances"), QString::fromUtf8(lockFile.c_str()));
QObject::tr("An unexpected error occurred when Retroshare " return false;
"tried to acquire the single instance lock\n Lock file:\n") + case RsInit::ERR_CANT_ACQUIRE_LOCK: QMessageBox::critical( nullptr,
QString::fromUtf8(lockFile.c_str())); QObject::tr("Multiple instances"),
return false; QObject::tr("An unexpected error occurred when Retroshare "
case 3: "tried to acquire the single instance lock\n Lock file:\n") +
// case 3: QMessageBox::critical( 0, QString::fromUtf8(lockFile.c_str()));
// QObject::tr("Login Failure"), return false;
// QObject::tr("Maybe password is wrong") ); case RsInit::ERR_CERT_CRYPTO_IS_TOO_WEAK: QMessageBox::critical( nullptr,
return false; QObject::tr("Old certificate"),
default: std::cerr << "Rshare::loadCertificate() unexpected switch value " << retVal << std::endl; QObject::tr("This node uses old certificate settings that are considered too "
return false; "weak by your current OpenSSL library version. You need to create a new node "
} "possibly using the same profile."));
return false;
case RsInit::ERR_CANNOT_CONFIGURE_TOR: QMessageBox::critical( nullptr,
QObject::tr("Tor error"),
QObject::tr("Cannot run/configure Tor. Make sure it is installed on your system."));
return false;
// case 3: QMessageBox::critical( 0,
// QObject::tr("Login Failure"),
// QObject::tr("Maybe password is wrong") );
return false;
default: std::cerr << "Rshare::loadCertificate() unexpected switch value " << retVal << std::endl;
return false;
}
return true; return true;
} }