[git] Pinentry - branch, master, updated. pinentry-1.1.0-12-gd0eaec8
by Damien Goutte-Gattat via Gnupg-devel
cvs at cvs.gnupg.org
Wed Aug 22 23:31:15 CEST 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".
The branch, master has been updated
via d0eaec8ef60be9b4d1aa5993c11d261a35202a2e (commit)
from 0fb3392f61569cb93e52c81465bc8e4636bca3b7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d0eaec8ef60be9b4d1aa5993c11d261a35202a2e
Author: Damien Goutte-Gattat via Gnupg-devel <gnupg-devel at gnupg.org>
Date: Tue Aug 21 20:31:53 2018 +0100
Disallow echo disabling when prompting for a PIN.
* gtk+-2/pinentry-gtk-2.c (create_window): Do not setup
the backspace handler when prompting for a PIN.
callback only when not prompting for a PIN.
* qt/pinentrydialog.h (_got_input): Rename field to
_disable_echo_allowed.
* qt/pinentrydialog.cpp (PinEntryDialog::setPrompt): Disallow
echo disabling when prompting for a PIN.
* tqt/pinentrydialog.h (_got_input): Rename field to
_disable_echo_allowed.
* tqt/pinentrydialog.cpp (PinEntryDialog::setPrompt): Disallow
echo disabling when prompting for a PIN.
Signed-off-by: Damien Goutte-Gattat <dgouttegattat at incenp.org>
diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 1e07fdc..a4522e4 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -729,8 +729,14 @@ create_window (pinentry_t ctx)
gtk_widget_set_size_request (entry, 200, -1);
g_signal_connect (G_OBJECT (entry), "changed",
G_CALLBACK (changed_text_handler), entry);
- g_signal_connect (G_OBJECT (entry), "backspace",
- G_CALLBACK (backspace_handler), entry);
+
+ /* Enable disabling echo if we're not asking for a PIN. */
+ if (pinentry->prompt && !strstr (pinentry->prompt, "PIN"))
+ {
+ g_signal_connect (G_OBJECT (entry), "backspace",
+ G_CALLBACK (backspace_handler), entry);
+ }
+
hbox = gtk_hbox_new (FALSE, HIG_TINY);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
/* There was a wish in issue #2139 that this button should not
diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp
index b7f2e53..a58e636 100644
--- a/qt/pinentrydialog.cpp
+++ b/qt/pinentrydialog.cpp
@@ -138,7 +138,7 @@ PinEntryDialog::PinEntryDialog(QWidget *parent, const char *name,
: QDialog(parent),
mRepeat(NULL),
_grabbed(false),
- _got_input(false),
+ _disable_echo_allowed(true),
mVisibilityTT(visibilityTT),
mHideTT(hideTT),
mVisiActionEdit(NULL),
@@ -318,6 +318,8 @@ void PinEntryDialog::setPrompt(const QString &txt)
{
_prompt->setText(txt);
_prompt->setVisible(!txt.isEmpty());
+ if (txt.contains("PIN"))
+ _disable_echo_allowed = false;
}
QString PinEntryDialog::prompt() const
@@ -362,7 +364,7 @@ void PinEntryDialog::setQualityBarTT(const QString &txt)
void PinEntryDialog::onBackspace()
{
- if (!_got_input) {
+ if (_disable_echo_allowed) {
_edit->setEchoMode(QLineEdit::NoEcho);
if (mRepeat) {
mRepeat->setEchoMode(QLineEdit::NoEcho);
@@ -380,7 +382,7 @@ void PinEntryDialog::updateQuality(const QString &txt)
_timer->stop();
}
- _got_input = true;
+ _disable_echo_allowed = false;
if (!_have_quality_bar || !_pinentry_info) {
return;
diff --git a/qt/pinentrydialog.h b/qt/pinentrydialog.h
index 396f03b..d5e6963 100644
--- a/qt/pinentrydialog.h
+++ b/qt/pinentrydialog.h
@@ -109,7 +109,7 @@ private:
bool _grabbed;
bool _have_quality_bar;
bool _timed_out;
- bool _got_input;
+ bool _disable_echo_allowed;
pinentry_t _pinentry_info;
QTimer *_timer;
QString mRepeatError,
diff --git a/tqt/pinentrydialog.cpp b/tqt/pinentrydialog.cpp
index 6a2ae12..b7aa309 100644
--- a/tqt/pinentrydialog.cpp
+++ b/tqt/pinentrydialog.cpp
@@ -33,7 +33,7 @@
PinEntryDialog::PinEntryDialog( TQWidget* parent, const char* name,
bool modal, bool enable_quality_bar )
: TQDialog( parent, name, modal, TQt::WStyle_StaysOnTop ), _grabbed( false ),
- _got_input( false )
+ _disable_echo_allowed ( true )
{
TQBoxLayout* top = new TQVBoxLayout( this, 6 );
TQBoxLayout* upperLayout = new TQHBoxLayout( top );
@@ -134,7 +134,7 @@ void PinEntryDialog::updateQuality( const SecTQString & txt )
int percent;
TQPalette pal;
- _got_input = true;
+ _disable_echo_allowed = false;
if (!_have_quality_bar || !_pinentry_info)
return;
@@ -166,7 +166,7 @@ void PinEntryDialog::updateQuality( const SecTQString & txt )
void PinEntryDialog::onBackspace()
{
- if (!_got_input)
+ if (_disable_echo_allowed)
_edit->setEchoMode( SecTQLineEdit::NoEcho );
}
@@ -208,6 +208,8 @@ SecTQString PinEntryDialog::text() const
void PinEntryDialog::setPrompt( const TQString& txt )
{
_prompt->setText( txt );
+ if (txt.contains("PIN"))
+ _disable_echo_allowed = false;
}
TQString PinEntryDialog::prompt() const
diff --git a/tqt/pinentrydialog.h b/tqt/pinentrydialog.h
index eb4d332..8ec3fd5 100644
--- a/tqt/pinentrydialog.h
+++ b/tqt/pinentrydialog.h
@@ -87,7 +87,7 @@ private:
bool _grabbed;
bool _have_quality_bar;
pinentry_t _pinentry_info;
- bool _got_input;
+ bool _disable_echo_allowed;
};
-----------------------------------------------------------------------
Summary of changes:
gtk+-2/pinentry-gtk-2.c | 10 ++++++++--
qt/pinentrydialog.cpp | 8 +++++---
qt/pinentrydialog.h | 2 +-
tqt/pinentrydialog.cpp | 8 +++++---
tqt/pinentrydialog.h | 2 +-
5 files changed, 20 insertions(+), 10 deletions(-)
hooks/post-receive
--
The standard pinentry collection
http://git.gnupg.org
More information about the Gnupg-commits
mailing list