Skip to content

Commit

Permalink
Close #359: Symlink to PKCS#11 lib resolved
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chris2511 committed Sep 9, 2024
1 parent 070ad05 commit 307fbae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions widgets/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <openssl/objects.h>
#include <QFileDialog>
#include <QToolTip>
#include <QDir>

Options::Options(QWidget *parent)
:QDialog(parent)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion widgets/SearchPkcs11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 307fbae

Please sign in to comment.