Skip to content

Commit c680e2c

Browse files
authored
Do not allow cancel in PinPad view and clean PIN memory (#1384)
IB-7082 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 36da39c commit c680e2c

File tree

8 files changed

+221
-192
lines changed

8 files changed

+221
-192
lines changed

client/QPCSC.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,13 @@ QPCSCReader::QPCSCReader( const QString &reader, QPCSC *parent )
210210
SC(GetStatusChange, d->d->context, 0, &d->state, 1U);
211211
}
212212

213-
QPCSCReader::~QPCSCReader()
213+
QPCSCReader::QPCSCReader(QPCSCReader &&other) noexcept
214+
: d(other.d)
215+
{
216+
other.d = new Private;
217+
}
218+
219+
QPCSCReader::~QPCSCReader() noexcept
214220
{
215221
if(d->isTransacted)
216222
SC(EndTransaction, d->card, SCARD_LEAVE_CARD);

client/QPCSC.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class QPCSCReader final: public QObject
9797
};
9898

9999
explicit QPCSCReader( const QString &reader, QPCSC *parent );
100-
~QPCSCReader() final;
100+
QPCSCReader(QPCSCReader &&) noexcept;
101+
~QPCSCReader() noexcept final;
101102

102103
QByteArray atr() const;
103104
bool isPinPad() const;

client/QPKCS11.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
#include "QPCSC.h"
2525
#include "SslCertificate.h"
2626
#include "TokenData.h"
27+
#include "Utils.h"
2728
#include "dialogs/PinPopup.h"
2829

2930
#include <QtCore/QDebug>
3031

3132
#include <array>
32-
#include <thread>
3333

3434
template<class Container>
3535
static QString toQString(const Container &c)
@@ -222,12 +222,10 @@ QPKCS11::PinStatus QPKCS11::login(const TokenData &t)
222222
{
223223
f |= PinPopup::PinpadFlag;
224224
PinPopup p(isSign ? QSmartCardData::Pin2Type : QSmartCardData::Pin1Type, f, cert, Application::mainWindow());
225-
std::thread([&err, &p, this] {
226-
emit p.startTimer();
227-
err = d->f->C_Login(d->session, CKU_USER, nullptr, 0);
228-
p.accept();
229-
}).detach();
230-
p.exec();
225+
p.open();
226+
p.startTimer();
227+
err = waitFor(d->f->C_Login, d->session, CKU_USER, nullptr, 0);
228+
p.accept();
231229
}
232230
else
233231
{

0 commit comments

Comments
 (0)