From 307fbae89c524b8d6a4c591ad85a8c725def79fb Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Mon, 9 Sep 2024 18:42:03 +0200 Subject: [PATCH] Close #359: Symlink to PKCS#11 lib resolved Do not resolve symlinks of PKCS#11 library paths. However the native file dialogs for example on MAC OS do always resolve symbolic links. In this case xca may be started with the --no-native-dialogs commandline option when specifying new libraries. --- widgets/Options.cpp | 5 +++-- widgets/SearchPkcs11.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/widgets/Options.cpp b/widgets/Options.cpp index ebf014fc..99918728 100644 --- a/widgets/Options.cpp +++ b/widgets/Options.cpp @@ -16,6 +16,7 @@ #include #include #include +#include Options::Options(QWidget *parent) :QDialog(parent) @@ -173,14 +174,14 @@ void Options::on_addButton_clicked(void) QString fname; fname = QFileDialog::getOpenFileName(this, l.caption, - getLibDir(), l.filter); + getLibDir(), l.filter, nullptr, QFileDialog::DontResolveSymlinks); addLib(fname); } void Options::addLib(QString fname) { - fname = QFileInfo(fname).canonicalFilePath(); + fname = QDir::cleanPath(fname); pkcs11_lib *l = pkcs11::libraries.add_lib(fname); if (searchP11 && l) diff --git a/widgets/SearchPkcs11.cpp b/widgets/SearchPkcs11.cpp index 848d9e4a..9d2281a4 100644 --- a/widgets/SearchPkcs11.cpp +++ b/widgets/SearchPkcs11.cpp @@ -39,7 +39,8 @@ SearchPkcs11::~SearchPkcs11() void SearchPkcs11::on_fileBut_clicked() { QString s = QFileDialog::getExistingDirectory(this, QString(XCA_TITLE), - filename->text()); + filename->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (!s.isEmpty()) filename->setText(nativeSeparator(s));