mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
DTLS crash : Use writable location for ZRTP and DTLS certificates paths
This commit is contained in:
parent
a4ad9a5965
commit
744798dc4a
3 changed files with 17 additions and 12 deletions
|
|
@ -40,11 +40,12 @@ static inline bool dirPathExists (const QString &path) {
|
|||
return dir.exists();
|
||||
}
|
||||
|
||||
static inline bool filePathExists (const QString &path) {
|
||||
static inline bool filePathExists (const QString &path, const bool& isWritable) {
|
||||
QFileInfo info(path);
|
||||
if (!dirPathExists(info.path()))
|
||||
return false;
|
||||
|
||||
if( isWritable && !info.isWritable())
|
||||
return false;
|
||||
QFile file(path);
|
||||
return file.exists();
|
||||
}
|
||||
|
|
@ -177,10 +178,11 @@ static inline QString getAppPluginsDirPath () {
|
|||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool Paths::filePathExists (const string &path) {
|
||||
return filePathExists(Utils::coreStringToAppString(path));
|
||||
bool Paths::filePathExists (const string &path, const bool isWritable) {
|
||||
return filePathExists(Utils::coreStringToAppString(path), isWritable);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
string Paths::getAssistantConfigDirPath () {
|
||||
|
|
@ -319,7 +321,7 @@ static void migrateConfigurationFile (const QString &oldPath, const QString &new
|
|||
}
|
||||
void migrateFlatpakVersionFiles(){
|
||||
#ifdef Q_OS_LINUX
|
||||
if(!filePathExists(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/linphone.db")){
|
||||
if(!filePathExists(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/linphone.db", true)){
|
||||
// Copy all files if linphone.db doesn't exist
|
||||
QString flatpakPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.var/app/com.belledonnecommunications.linphone/data/linphone";
|
||||
if( QDir().exists(flatpakPath)){
|
||||
|
|
@ -336,25 +338,25 @@ void migrateGTKVersionFiles(){
|
|||
: QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
QString oldPath = oldBaseDir + "/.linphonerc";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!filePathExists(newPath, false) && filePathExists(oldPath, false))
|
||||
migrateConfigurationFile(oldPath, newPath);
|
||||
|
||||
newPath = getAppCallHistoryFilePath();
|
||||
oldPath = oldBaseDir + "/.linphone-call-history.db";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!filePathExists(newPath, false) && filePathExists(oldPath, false))
|
||||
migrateFile(oldPath, newPath);
|
||||
|
||||
newPath = getAppFriendsFilePath();
|
||||
oldPath = oldBaseDir + "/.linphone-friends.db";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!filePathExists(newPath, false) && filePathExists(oldPath, false))
|
||||
migrateFile(oldPath, newPath);
|
||||
|
||||
newPath = getAppMessageHistoryFilePath();
|
||||
oldPath = oldBaseDir + "/.linphone-history.db";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!filePathExists(newPath, false) && filePathExists(oldPath, false))
|
||||
migrateFile(oldPath, newPath);
|
||||
}
|
||||
void Paths::migrate () {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
// =============================================================================
|
||||
|
||||
namespace Paths {
|
||||
bool filePathExists (const std::string &path);
|
||||
bool filePathExists (const std::string &path, const bool isWritable = false);
|
||||
|
||||
|
||||
std::string getAssistantConfigDirPath ();
|
||||
|
|
|
|||
|
|
@ -208,12 +208,15 @@ void CoreManager::setDatabasesPaths () {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CoreManager::setOtherPaths () {
|
||||
if (mCore->getZrtpSecretsFile().empty() || !Paths::filePathExists(mCore->getZrtpSecretsFile()))
|
||||
if (mCore->getZrtpSecretsFile().empty() || !Paths::filePathExists(mCore->getZrtpSecretsFile(), true))
|
||||
mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath());
|
||||
if (mCore->getUserCertificatesPath().empty() || !Paths::filePathExists(mCore->getUserCertificatesPath()))
|
||||
qInfo() << "Using ZrtpSecrets path : " << QString::fromStdString(mCore->getZrtpSecretsFile());
|
||||
if (mCore->getUserCertificatesPath().empty() || !Paths::filePathExists(mCore->getUserCertificatesPath(), true))
|
||||
mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath());
|
||||
qInfo() << "Using UserCertificate path : " << QString::fromStdString(mCore->getUserCertificatesPath());
|
||||
if (mCore->getRootCa().empty() || !Paths::filePathExists(mCore->getRootCa()))
|
||||
mCore->setRootCa(Paths::getRootCaFilePath());
|
||||
qInfo() << "Using RootCa path : " << QString::fromStdString(mCore->getRootCa());
|
||||
}
|
||||
|
||||
void CoreManager::setResourcesPaths () {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue