pinentry.git
2 years agoRelease 1.0.0 pinentry-1.0.0
Werner Koch [Tue, 22 Nov 2016 07:51:41 +0000 (08:51 +0100)]
Release 1.0.0

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoemacs: Add curses handler stub.
Werner Koch [Tue, 22 Nov 2016 07:59:41 +0000 (08:59 +0100)]
emacs: Add curses handler stub.

* emacs/pinentry-emacs.c (curses_cmd_handler): New stub.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoUpdate config.{sub,guess} .
Werner Koch [Tue, 22 Nov 2016 07:44:16 +0000 (08:44 +0100)]
Update config.{sub,guess} .

--

2 years agognome3: Tighten up error messages when GNOME screensaver is absent.
Daniel Kahn Gillmor [Tue, 8 Nov 2016 20:37:25 +0000 (14:37 -0600)]
gnome3: Tighten up error messages when GNOME screensaver is absent.

* gnome3/pinentry-gnome3.c (pe_gnome_screen_locked): clean up error
messages when GNOME screensaver is absent or misbehaving.

--
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoAdd fail-safe string termination for snprintf.
Werner Koch [Mon, 7 Nov 2016 07:37:11 +0000 (08:37 +0100)]
Add fail-safe string termination for snprintf.

* gtk+-2/pinentry-gtk-2.c (changed_text_handler): Make sure an
 snprintf buffer is always ternminated.
* pinentry/pinentry.c (my_strusage): Ditto.
(write_status_error): Ditto.
(cmd_getinfo): Ditto.
* w32/main.c (w32_strerror): Ditto.
--

This is to fix the surprising implementation of snprintf on Windows.
Note that we don't need this in GnuPG because there we use our own
snprintf.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agognome3: Avoid risk of uinitialized memory access.
Daniel Kahn Gillmor [Sat, 5 Nov 2016 21:53:47 +0000 (17:53 -0400)]
gnome3: Avoid risk of uinitialized memory access.

* gnome3/pinentry-gnome3.c (_propagate_g_error_to_pinentry): Ensure
that pinentry->specific_err_info is null-terminated.

--

It's possible that "%d: %s" ends up producing more than 20 additional
characters.  A 64-bit signed int at its minimum is
"-9223372036854775808", which is 20 characters.  On any platform where
gint is 128-bit (i don't know whether they exist), it could be
significantly more.

snprintf doesn't write the final NUL byte if the string exceeds the
buffer, so anyone reading specific_err_info as a NUL-terminated string
in such a case would go on to read uninitialized memory after the
buffer.  So we should force there to always be a NUL char after the
written buffer.  It would be simpler to use asprintf, but i suspect
that's not portable enough for use in pinentry.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2 years agotty: Declare dummy curses_cmd_handler.
Daniel Kahn Gillmor [Sun, 6 Nov 2016 03:26:35 +0000 (23:26 -0400)]
tty: Declare dummy curses_cmd_handler.

* tty/pinentry-tty.c: Declare a dummy handler for the
curses_cmd_handler for fallback.

--

This is needed for building pinentry-tty, which links to a copy of the
pinentry object which doesn't have curses (it makes no sense to
fallback from tty to curses).  But the new cmd_info in
pinentry/pinentry.c needs some sort of value to test against when
reporting the flavor.

You can replicate this linker error from git with:

     ./autogen.sh
     ./configure --enable-maintainer-mode \
       --enable-{fallback-curses,pinentry-tty} \
       --disable-{inside-emacs,libsecret} && make

Which produces:

    gcc  -g -O2 -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wformat -Wno-format-y2k -Wformat-security -W -Wno-sign-compare -Wno-missing-field-initializers -Wdeclaration-after-statement -Wno-pointer-sign -Wpointer-arith   -o pinentry-tty pinentry-tty.o ../pinentry/libpinentry.a ../secmem/libsecmem.a -lassuan -L/usr/lib/x86_64-linux-gnu -lgpg-error -L/usr/lib/x86_64-linux-gnu -lgpg-error  -lcap
    ../pinentry/libpinentry.a(pinentry.o): In function `cmd_getinfo':
    «BUILDDIR»/pinentry/pinentry.c:1457: undefined reference to `curses_cmd_handler'
    collect2: error: ld returned 1 exit status
    Makefile:410: recipe for target 'pinentry-tty' failed
    make[2]: *** [pinentry-tty] Error 1
    make[2]: Leaving directory '«BUILDDIR»/tty'

One could argue that developers who --enable-tty then must also
--disable-fallback-curses, but that would just mean that it's
impossible to't build one of the graphical pinentries at the same time
(with curses fallback) as you are actually building pinentry-tty.
Arguably, though, the ./configure script should figure out the right
thing to do in this case and the build each variant sensibly.

This patch is a hack to ensure that pinentry-tty continues to link
properly even when other pinentries are being built concurrently with
a curses fallback.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agognome3: Fall back to curses if screensaver is locked.
Daniel Kahn Gillmor [Sun, 6 Nov 2016 07:17:04 +0000 (02:17 -0500)]
gnome3: Fall back to curses if screensaver is locked.

* gnome3/pinentry-gnome3.c (pe_gnome_screen_locked): New Function.
Returns true only if we can talk to a GNOME screensaver over D-Bus and
it assures us that it is locked.
(main): If GNOME screensaver is locked, fall back to curses.

--

We assume that if pinentry is triggered while the screensaver is
locked, then it is likely being done by some sort of remote connection
(e.g. ssh), and isn't being done directly from the graphical console.
In that case, prompting at the graphical console won't be able to get
the attention of the user, so we should fall back to curses if
possible.

GnuPG-bug-id: 2818

2 years agognome3: Test if Gcr System Prompter is available at startup.
Daniel Kahn Gillmor [Thu, 3 Nov 2016 16:31:40 +0000 (12:31 -0400)]
gnome3: Test if Gcr System Prompter is available at startup.

* gnome3/pinentry-gnome3.c (gcr_system_prompt_available): New. Tests
whether it is possible to create a GcrSystemPrompt.
(main): Use gcr_system_prompt_available() to decide whether to fall
back to curses or not.

--
Debian-bug-id: 842015
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agobuild: Avoid unnecessary dependency on gtk+-2 for GNOME3 development.
Daniel Kahn Gillmor [Sat, 5 Nov 2016 04:44:53 +0000 (00:44 -0400)]
build: Avoid unnecessary dependency on gtk+-2 for GNOME3 development.

* configure.ac: There is no reason to reject building the GNOME3
pinentry if GTK+-2 development libraries are not present.  GNOME3 does
not require GTK+-2.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoall: Prefer https:// over http:// in source where possible.
Daniel Kahn Gillmor [Sat, 5 Nov 2016 04:25:12 +0000 (00:25 -0400)]
all: Prefer https:// over  in source where possible.

--
This change cleans up as many internal web references as possible, to
make them use https.  In some cases, the canonical references had
slightly different URLs in addition to the change in schema.

Sadly, git.savannah.gnu.org is still http-only.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agognome3: Avoid using gnome and gcr symbol namespace.
Werner Koch [Sat, 5 Nov 2016 10:42:24 +0000 (11:42 +0100)]
gnome3: Avoid using gnome and gcr symbol namespace.

* gnome3/pinentry-gnome3.c (struct _gnome3_run): Rename to
pe_gnome3_run_s.
(_gcr_prompt_password_done): Rename to pe_gcr_prompt_password_done.
(_gcr_prompt_confirm_done): Rename to pe_gcr_prompt_confirm_done.
(_gcr_timeout_done): Rename to pe_gcr_timeout_done.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agognome3: Honor timeout.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:52 +0000 (18:57 -0400)]
gnome3: Honor timeout.

* gnome3/pinentry-gnome3.c (create_prompt): Use timeout to determine
how long to wait for Gcr to provide a system prompt before giving up.
(_gcr_timeout_done): New.  Record that a timeout has elapsed.
(gnome3_cmd_handler): Set up a timeout before launching the prompt,
and tear it down afterward.
(_gcr_prompt_password_done): Report timeout differently from normal
cancellation.
(_gcr_prompt_confirm_done): Report timeout differently from normal
cancellation.

--

Without this change, pinentry-gnome3 does not respect the timeout
parameter at all, and can hang indefinitely in the event that the
system prompter is locked or the user is ignoring the session.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agognome3: Convert password/confirmation to asynchronous model.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:51 +0000 (18:57 -0400)]
gnome3: Convert password/confirmation to asynchronous model.

* gnome3/pinentry-gnome3.c (gnome3_cmd_handler): Convert main part of
password or confirmation fetching into asynchronous code by moving
completion into...
(_gcr_prompt_password_done): ... here and...
(_gcr_prompt_confirm_done): ... here.

--

The async programming interface to gcr is necessary if we want to be
able to enforce a timeout, which will happen in the next patch in this
series.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Did not apply cleanluy due to me comment reformatting in a former
patch. Fixed.  -wk

2 years agoqt: Report timeout.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:50 +0000 (18:57 -0400)]
qt: Report timeout.

* qt/pinentryconfirm.h (PinentryConfirm): Add _timed_out, timedOut().
* qt/pinentrydialog.h (PinentryDialog): Add _timed_out, timedOut().
* qt/pinentryconfirm.cpp (slotTimeout): Record elapsed timeout.
(PinentryConfirm): Initialize _timed_out to false.
(timedOut): New. Returns value of _timed_out.
* qt/pinentryDialog.cpp (slotTimeout): Record elapsed timeout.
(PinentryDialog): Initialize _timed_out to false.
(timedOut): New. Returns value of _timed_out.
* qt/main.cpp (qt_cmd_handler): Report if canceled due to timeout.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agocurses: Report timeout.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:49 +0000 (18:57 -0400)]
curses: Report timeout.

* pinentry/pinentry-curses.c (dialog_run): Report if canceled due to
timeout.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agogtk2: Report timeout.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:48 +0000 (18:57 -0400)]
gtk2: Report timeout.

* gtk+-2/pinentry-gtk-2.c (create_window): Send pointer to pinentry
into timeout_cb.
(timeout_cb): Report if canceled due to timeout.
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Fixed a shadowed variable in timeout_cb.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotty: Report timeout.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:47 +0000 (18:57 -0400)]
tty: Report timeout.

* tty/pinentry-tty.c (confirm): Report if canceled due to timeout.
(password): Report if canceled due to timeout.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agognome3: Propagate GError messages to pinentry.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:46 +0000 (18:57 -0400)]
gnome3: Propagate GError messages to pinentry.

* gnome3/pinentry-gnome3.c (_propagate_g_error_to_pinentry): New. Send
GError messages back out to pinentry error reporting.
(create_prompt): Use _propagate_g_error_to_pinentry on error.
(gnome3_cmd_handler): Use _propagate_g_error_to_pinentry on error.
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Modified to take care of malloc failure.  Also fixed alignment of some
old comments.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agognome3: Set parent window.
Daniel Kahn Gillmor [Fri, 4 Nov 2016 22:57:45 +0000 (18:57 -0400)]
gnome3: Set parent window.

* gnome3/pinentry-gnome3.c (create_prompt): Tell Gcr about the caller
window, if we know it.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agocore: Add command getinfo/flavor.
Werner Koch [Sat, 5 Nov 2016 09:55:46 +0000 (10:55 +0100)]
core: Add command getinfo/flavor.

* pinentry/pinentry.c: Inlcude pinentry-curses.h.
(cmd_getinfo): Add sub-command "flavor"

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoConvert to UTF-8.
Daniel Kahn Gillmor [Thu, 3 Nov 2016 16:59:18 +0000 (12:59 -0400)]
Convert to UTF-8.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoFix spelling errors.
Daniel Kahn Gillmor [Thu, 3 Nov 2016 16:59:17 +0000 (12:59 -0400)]
Fix spelling errors.

--
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Note that this also updates
     \texinfoversion to 2016-11-03.12

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Don't report error on setting option 'allow-emacs-pinentry'.
Daiki Ueno [Mon, 10 Oct 2016 08:33:36 +0000 (10:33 +0200)]
core: Don't report error on setting option 'allow-emacs-pinentry'.

Previously "OPTION allow-emacs-pinentry" returned an error if the Emacs
pinentry is not compiled in.  Since it is merely an option, it would
make more sense to just return OK.

Suggested-by: Werner Koch <wk@gnupg.org>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognome3: Drop unnecessary use of gtk
Werner Koch [Tue, 4 Oct 2016 08:35:52 +0000 (10:35 +0200)]
gnome3: Drop unnecessary use of gtk

* configure.ac: pinentry-gnome3 only needs gcr-base, not gcr.
* gnome3/pinentry-gnome3.c (main): Instead of testing whether GTK can
be loaded, check for DBUS_SESSION_BUS_ADDRESS.
(create_prompt): Use fprintf (stderr, ...) instead of g_warning (...),
to align with the rest of pinentry.c.
--

pinentry-gnome3 really just uses gcr and libsecret -- there is no
direct use of gtk at all.  By linking only to the minimal gcr-base-3
and avoiding gcr-3 itself, we remove many unnecessary library
dependencies from pinentry-gnome3.

Specifically, "ldd $(which pinentry-gnome3) | wc -l" goes from 69 to
23 on debian testing.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Added missing LF.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Add a way to print ERROR status lines.
Werner Koch [Tue, 4 Oct 2016 07:36:39 +0000 (09:36 +0200)]
core: Add a way to print ERROR status lines.

* pinentry/pinentry.h (struct pinentry): New fields SPECIFIC_ERR_LOC
and SPECIFIC_ERR_INFO.
* pinentry/pinentry.c (pinentry_reset): Free the new field.
(write_status_error): New.
(cmd_getpin): Use new fields.
(cmd_confirm): Ditto.
* gnome3/pinentry-gnome3.c (create_prompt): Set error for failed
GCR_PROMPT.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotty: Provide default text for "notok".
Ineiev [Fri, 8 Apr 2016 12:33:05 +0000 (15:33 +0300)]
tty: Provide default text for "notok".

* tty/pinentry-tty.c (confirm): Provide default text for "notok".

--

gniibe changed the commit message.

2 years agotty: Fix underscore processing in accelerators.
Ineiev [Fri, 8 Apr 2016 12:26:33 +0000 (15:26 +0300)]
tty: Fix underscore processing in accelerators.

* tty/pinentry-tty.c (button): Fix underscore processing in
accelerators.

2 years agotty: Refactor usage of tolower.
Ineiev [Fri, 8 Apr 2016 12:17:59 +0000 (15:17 +0300)]
tty: Refactor usage of tolower.

* tty/pinentry-tty.c (button): Apply tolower to the result.
* tty/pinentry-tty.c (confirm): Compare lowercased character instead of
converting them every time.

--

gniibe changed the original patch to keep output to TTY.

2 years agocurses: Return better error codes for bad ttynames
Werner Koch [Thu, 1 Sep 2016 08:03:22 +0000 (10:03 +0200)]
curses: Return better error codes for bad ttynames

* pinentry/pinentry-curses.c (dialog_create): Return better error
codes.
--

With this change the error message is now

  $ MYTTY=$(tty)
  $ echo getpin | env -i pinentry-curses -d  --ttyname "$MYTTY"
  OK Pleased to meet you
  pinentry-curses: no LC_CTYPE known - assuming UTF-8
  ERR 83886383 Required environment variable not set <Pinentry>

Note that with the current released libgcrypt an unknown error code
will be printed.

GnuPG-bug-id: 2452
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoQt: Add SetWindowPos based foreground hack for Win
Andre Heinecke [Thu, 18 Aug 2016 12:55:27 +0000 (14:55 +0200)]
Qt: Add SetWindowPos based foreground hack for Win

* qt/pinentrydialog.cpp(raiseWindow): Add another fallback for
our foreground window hacks.

--
Even if SetForegroundWindow or SetForegroundWindowEx do not report
failures we are not always brought to front. So additionally
afterwards we also set our Window Position to be absolutely
in foreground and afterards remove that (so that a user
may still but us in the background).

This fixes the weird behavior that repeated pinentries for
symmetric encryption open in background.

2 years agoQt: Disable automatic wrap for desc and errors
Andre Heinecke [Fri, 12 Aug 2016 11:07:54 +0000 (13:07 +0200)]
Qt: Disable automatic wrap for desc and errors

* qt/pinentrydialog.cpp (PinEntryDialog): Disable WordWrap.

--
The agent already sends line breaks which should be respected.
This fixes the problem that pinentry-qt would break ssh fingerprints
because it treated the colon as a breakable character.

GnuPG's translators and GnuPG itself should take care how descriptions
and errors should be formatted.

2 years agoUpdate NEWS
Andre Heinecke [Wed, 1 Jun 2016 13:15:41 +0000 (15:15 +0200)]
Update NEWS

--

2 years agoQt: Append -std=c++11 if building against Qt 5.7
Kristian Fiskerstrand [Thu, 11 Aug 2016 12:44:37 +0000 (14:44 +0200)]
Qt: Append -std=c++11 if building against Qt 5.7

 * m4/qt.m4: Append -std=c++11 to CFLAGS if building against Qt 5.7

--
Qt 5.7 enables C++11 for Qt modules, and any app relying on it require to be
compiled with at least this standard.

This patch adds detection for Qt 5.7 and make sure -std=c++11 is passed if
building against Qt 5.7 or higher.

2 years agoFix ncurses build.
Ben Kibbey [Tue, 2 Aug 2016 01:25:32 +0000 (21:25 -0400)]
Fix ncurses build.

* pinentry/Makefile.am: Add NCURSES_CFLAGS.

Signed-off-by: Ben Kibbey <bjk@luxsci.net>
2 years agogtk2: Also grab the pointer.
Justus Winter [Tue, 2 Aug 2016 10:34:07 +0000 (12:34 +0200)]
gtk2: Also grab the pointer.

* gtk+-2/pinentry-gtk-2.c (grab_pointer): New function.
(ungrab_keyboard): Rename to 'ungrab_inputs' and also release the
pointer grab.
(create_window): Also grab the pointer.

GnuPG-bug-id: 2430
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogtk2: Be more persistent trying to grab the keyboard.
Justus Winter [Mon, 1 Aug 2016 15:49:50 +0000 (17:49 +0200)]
gtk2: Be more persistent trying to grab the keyboard.

We seem to get the 'visibility-notify' event before X is willing to
let us grab the keyboard, insisting that the target window is not
viewable (sic).

* gtk+-2/pinentry-gtk-2.c (grab_keyboard): Retry grabbing the
keyboard.

GnuPG-bug-id: 2375
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogtk2: Print keyboard grabbing errors.
Justus Winter [Mon, 1 Aug 2016 15:18:32 +0000 (17:18 +0200)]
gtk2: Print keyboard grabbing errors.

* gtk+-2/pinentry-gtk-2.c (grab_strerror): New function.
(grab_keyboard): Use the new function to print the error.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agogtk2: Avoid possible format string troubles.
Justus Winter [Mon, 1 Aug 2016 13:01:21 +0000 (15:01 +0200)]
gtk2: Avoid possible format string troubles.

* gtk+-2/pinentry-gtk-2.c (confirm_unhiding): Do not use message as
format string.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoQt: Only use one line action for visibility
Andre Heinecke [Mon, 25 Apr 2016 10:08:03 +0000 (12:08 +0200)]
Qt: Only use one line action for visibility

* qt/pinentrydialog.cpp (PinEntryDialog::toggleVisibility): Toggle
both lines in repeat mode.
(PinEntryDialog::PinEntryDialog): Remove repeat line action.

--
It does not appear sensible to show / hide only one edit in
repeat mode this should make the usage of the visibility action
a bit more intutive.

2 years agoQt: Move qualitybar below repeat
Andre Heinecke [Mon, 25 Apr 2016 10:05:35 +0000 (12:05 +0200)]
Qt: Move qualitybar below repeat

* qt/pinentrydialog.cpp (PinEntryDialog::PinEntryDialog): Move
quality bar below repeat.

--
Havin the repeat directly below the entry field looks better and
adds more connection between the entries.

2 years agoQt: Do not take icon from theme
Andre Heinecke [Mon, 25 Apr 2016 09:11:51 +0000 (11:11 +0200)]
Qt: Do not take icon from theme

* qt/main.cpp (main): Revert changes to take icon from theme.

--
Feedback was that pinentry should be recognisable and use it's
own Icon.

2 years agoQt: Change qualitybar position back to below
Andre Heinecke [Fri, 15 Apr 2016 08:32:06 +0000 (10:32 +0200)]
Qt: Change qualitybar position back to below

* qt/pinentrydialog.cpp (PinEntryDialog::PinEntryDialog): Change
position back to below the entry. Fix label alignment.

--
While I find it more pleasing to have it at the top
the string for the tooltip mentions that the quality bar is
related to "above" entry.

2 years agogtk2: Add a button to show/hide the passphrase.
Andre Heinecke [Fri, 15 Apr 2016 07:51:24 +0000 (09:51 +0200)]
gtk2: Add a button to show/hide the passphrase.

* gtk+-2/pinentry-gtk-2.c (HIG_TINY): New.
 (confirm_unhiding): New.
 (show_hide_button_toggled): New.
 (create_show_hide_button): New.
 (create_window): Add a show/hide button.

--
This is an alternative implementation to the checkbox
reverted with rev. 71b51e0.
The patch is based on a patch by Werner Koch <wk@gnupg.org>
modifications done by aheinecke are:
- Use of strings provided by the gpg-agent
- Switching the visibility state of the edit.
- Using a monospace font for the label to avoid size
  changes when toggling the button.
- Use of a default button label for cancel in the confirm dialog
  as the agent only sends a string that is useful for show.

2 years agoRevert "GTK: Add visibility toggle button"
Andre Heinecke [Thu, 14 Apr 2016 14:34:36 +0000 (16:34 +0200)]
Revert "GTK: Add visibility toggle button"

This reverts commit 71b51e02cf20174ba7144765e985f7e889eaa429.

2 years agoGTK: Add visibility toggle button
Andre Heinecke [Thu, 14 Apr 2016 13:56:09 +0000 (15:56 +0200)]
GTK: Add visibility toggle button

* gtk+-2/pinentry-gtk-2.c (create_window): Create checkbox.
 (show_passphrase_toggled): New. Do the toggling.

--
GnuPG-Bug-ID: 2139

2 years agoQt: Restrict list of icon themes to try
Andre Heinecke [Thu, 14 Apr 2016 13:21:13 +0000 (15:21 +0200)]
Qt: Restrict list of icon themes to try

* qt/main.cpp (main): Only search in select icon themes.

--
Gnome Icon theme does not use a lock for document-encrypt icon
and this looks strange. Mainly the goal is not to show the Oxygen
Icon built into pinentry on a breeze Desktop.

2 years agoQt: Add actions to make passphrase visible
Andre Heinecke [Thu, 14 Apr 2016 13:01:47 +0000 (15:01 +0200)]
Qt: Add actions to make passphrase visible

* qt/main.cpp (qt_cmd_handler): Support visibility tooltips.
* qt/pinentrydialog.cpp (PinEntryDialog::PinEntryDialog):
 Add a checkbox or line actions.
 (PinEntryDialog::checkRepeat): Renabed to textChanged.
 (PinEntryDialog::toggleVisibility): New. Toggle echo mode.
* qt/pinentrydialog.h: Update accordingly.

--
The Action comes in two flavors to avoid having to include new
icons in pinentry (and thus have a text-only fallback) and also
because Qt4 does not support direct line edit actions and I don't
want to raise the requirement to Qt 5.2 yet.

GnuPG-Bug-ID: 2139

2 years agoAdd support for visibility string options
Andre Heinecke [Thu, 14 Apr 2016 12:58:46 +0000 (14:58 +0200)]
Add support for visibility string options

* doc/pinentry.texi: Note new values.
* pinentry/pinentry.c (pinentry): Add default_cf_visi,
 default_tt_visi and default_tt_hide.
 (option_handler): Parse new values.
* pinentry/pinentry.h (pinentry_t): Add new values.

2 years agoQt: Implement repeat and improve grabbing
Andre Heinecke [Thu, 14 Apr 2016 10:00:51 +0000 (12:00 +0200)]
Qt: Implement repeat and improve grabbing

The keyboard is now only grabbed if an edit has input focus.

* qt/main.cpp (qt_cmd_handler): Parse repeat values. Set repeat_okay.
* qt/pinentrydialog.cpp (PinentryDialog::PinentryDialog): Update
 layout. Add repeat label and edit. Connect focusChanged.
 (PinEntryDialog::hideEvent): Remove grabbing hack.
 (PinEntryDialog::focusChanged): New. Properly handle grabbing.
 (PinEntryDialog::checkRepeat): New. Enable Ok if repeat matches.
 (PinEntryDialog::repeatedPin): New. Getter for repeated pin.
 (PinEntryDialog::setRepeatErrorText): Setter for error.
* qt/pinentrydialog.h: Update accordingly.

--
Adding repeat mode made it neccessary to fix the grabbing
which globally grabbed the keyboard for the line edit
as long as the window was shown.

Now we only grab when a line edit has focus. This has the
advantage that you can still work with other windows while
pinentry is open but not focused.

The new grabbing should improve security a bit as it reduces
the need for a global no-grab setting. I've verified with xev
that keyboard grabbing still works when one of the lineedits
in pinentry has focus.

2 years agoQt: Respect icon themes and only fallback to own
Andre Heinecke [Thu, 14 Apr 2016 07:53:37 +0000 (09:53 +0200)]
Qt: Respect icon themes and only fallback to own

* m4/qt.m4: Raise version requirement.
* qt/main.cpp (main): Use QIcon::fromTheme to get the icon.

2 years agoQt: Unify coding style and encoding
Andre Heinecke [Thu, 14 Apr 2016 07:32:21 +0000 (09:32 +0200)]
Qt: Unify coding style and encoding

* qt/main.cpp, qt/pinentryconfirm.cpp, qt/pinentryconfirm.h,
  qt/pinentrydialog.cpp, qt/pinentrydialog.h: Use KDE coding style.
  Encode as UTF-8.

--
Code reformatted using kde-dev-scripts/astyle-kdelibs.
Use git blame -w to show authorship as it was before this commit.

2 years agoQt: Fix Windows foreground window hacks for Qt5
Andre Heinecke [Fri, 4 Mar 2016 14:44:26 +0000 (15:44 +0100)]
Qt: Fix Windows foreground window hacks for Qt5

* qt/pinentrydialog.cpp: Use Q_OS_WIN instead of Q_WS_WIN
 (SetForegroundWindowEx): Handle new Wid type with casts.

--
Q_WS_WIN is no longer defined by Qt5

2 years agopinentry: Use stderr to print failures in password-cache.c
Stef Walter [Sun, 14 Feb 2016 17:06:52 +0000 (18:06 +0100)]
pinentry: Use stderr to print failures in password-cache.c

Otherwise this interferes with the assuan protocol expected
on stdout.

GnuPG-bug-id: 2243

2 years agoQt: Fix use after free in quality calculation
Andre Heinecke [Tue, 5 Jan 2016 11:44:32 +0000 (12:44 +0100)]
Qt: Fix use after free in quality calculation

* qt/pinentrydialog.cpp (PinEntryDialog::updateQuality): Keep UTF8
 byte array alive after conversion.

--
Same problem pattern as in Bug 2133 / commit f143d216

3 years agoPost release updates
Werner Koch [Mon, 7 Dec 2015 09:38:55 +0000 (10:38 +0100)]
Post release updates

--

3 years agoRelease 0.9.7 pinentry-0.9.7
Werner Koch [Mon, 7 Dec 2015 09:33:14 +0000 (10:33 +0100)]
Release 0.9.7

3 years agodoc: Add a note about translated strings in Pinentry.
Werner Koch [Tue, 1 Dec 2015 12:01:29 +0000 (13:01 +0100)]
doc: Add a note about translated strings in Pinentry.

--
Suggested-by: Daniel Kahn Gillmor
3 years agoRemove unused code.
Werner Koch [Tue, 1 Dec 2015 11:54:38 +0000 (12:54 +0100)]
Remove unused code.

* secmem/util.c (lower_privs, raise_privs): Remove commented
functions.

3 years agotty: Fix formatting.
Neal H. Walfield [Fri, 27 Nov 2015 09:26:46 +0000 (10:26 +0100)]
tty: Fix formatting.

* tty/pinentry-tty.c (password): Remove trailing space.

3 years agotty: Flush output. Show an error if an invalid option is selected.
Neal H. Walfield [Wed, 18 Nov 2015 12:40:47 +0000 (13:40 +0100)]
tty: Flush output.  Show an error if an invalid option is selected.

* tty/pinentry-tty.c (confirm): Flush the output after printing the
prompt.  Echo what the user typed.  If the user's selection is
invalid, indicate as much.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agoQt: Do not use temporary reference to utf8 pin
Dirk Mueller [Wed, 21 Oct 2015 12:41:53 +0000 (14:41 +0200)]
Qt: Do not use temporary reference to utf8 pin

* qt/main.cpp (qt_cmd_handler): Keep utf8 pin byte array.

--
The pin pointer was invalid after the UTF8 conversion
as the converted byte array only was temporary in that
call and the data pointer becomes invalid after it's
destruction.

Commit message amended by Andre Heinecke. The original
commit message was:

const char* does not keep the temporary string returned
from toUtf8() active, since it doesn't keep the reference counter
set. So you usually just copy out garbage instead of the
pin that was entered. Just keep the QByteArray which keeps
the reference active.

GnuPG-bug-id: 2133

3 years agoQt: Fix assignment of have_qt5_libs variable.
Andre Heinecke [Fri, 2 Oct 2015 08:21:55 +0000 (10:21 +0200)]
Qt: Fix assignment of have_qt5_libs variable.

* m4/qt.m4 (FIND_QT): Remove spaces in variable assignment.

--
GnuPG-bug-id: 2105

3 years agoQt: Fix quoting of have_qt5_libs init in FIND_QT
Andre Heinecke [Fri, 2 Oct 2015 07:47:21 +0000 (09:47 +0200)]
Qt: Fix quoting of have_qt5_libs init in FIND_QT

* m4/qt.m4 (FIND_QT): Quote initialization of have_qt5_libs var.

--

Problem reported by Kristian F.

GnuPG-bug-id: 2105

3 years agoAdd option to disable looking for qt5
Andre Heinecke [Fri, 25 Sep 2015 13:56:55 +0000 (15:56 +0200)]
Add option to disable looking for qt5

* m4/qt.m4 (FIND_QT): Add --disable-pinentry-qt5 option to
disable qt5 support even if it is available.

--
As requested by Kristan F.

GnuPG-bug-id: 2105

3 years agoAdd option "invisible-char".
Werner Koch [Wed, 16 Sep 2015 18:56:47 +0000 (20:56 +0200)]
Add option "invisible-char".

* pinentry/pinentry.h (struct pinentry): Add field invisible_char.
* pinentry/pinentry.c (pinentry_reset): Restore that.
(option_handler): Add option "invisible-char".
* gtk+-2/pinentry-gtk-2.c (create_window): Set the invisible char if
given.
--

The default GTK+ invisible character is pretty wide so that only ~16
characters show up in the smalles pinentry.  This is a bit annoying if
the passphrase is a longer due to the missing visual feedback.  By
using #x2022 ("•") this allows for ~23 characters and a plain "*" even
3 more characters.  Tastes are different so we allow to change that
character at runtime.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoPost release updates
Werner Koch [Thu, 10 Sep 2015 18:38:29 +0000 (20:38 +0200)]
Post release updates

--

3 years agoRelease 0.9.6 pinentry-0.9.6
Werner Koch [Thu, 10 Sep 2015 18:31:00 +0000 (20:31 +0200)]
Release 0.9.6

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agotty: When reading the password, print any supplied error message.
Neal H. Walfield [Mon, 24 Aug 2015 08:43:33 +0000 (10:43 +0200)]
tty: When reading the password, print any supplied error message.

* tty/pinentry-tty.c (password): Print any supplied error message.

3 years agotty: Refactor the code for printing error messages.
Neal H. Walfield [Mon, 24 Aug 2015 08:42:40 +0000 (10:42 +0200)]
tty: Refactor the code for printing error messages.

* tty/pinentry-tty.c (dump_error_text): New function to display error
messages.
(confirm): Use it.
(password): Likewise.

3 years agoClarify comment about fds in pinentry_loop2
Andre Heinecke [Tue, 18 Aug 2015 18:15:08 +0000 (20:15 +0200)]
Clarify comment about fds in pinentry_loop2

* pinentry/pinentry.h (pinetry_loop2): Clarify comment.

3 years agoQt: Make it possible to build qt5 variant static
Andre Heinecke [Tue, 18 Aug 2015 17:54:04 +0000 (19:54 +0200)]
Qt: Make it possible to build qt5 variant static

* qt/main.cpp: Import static platform plugins when necessary.

--
As pkg-config does not expose all libraries needed to link
qt5 statically with this patch it is possible to get a
static build by setting the LIBS variable correctly.

3 years agoRespect SYSROOT variable when looking for assuan
Andre Heinecke [Tue, 18 Aug 2015 17:47:42 +0000 (19:47 +0200)]
Respect SYSROOT variable when looking for assuan

* m4/libassuan.m4: Respect SYSROOT Variable.

--
This change makes the libassuan lookup work similar
to the libgpg-error lookup simplifying cross-compiling
a bit.

3 years agoFix pinentry for Windows
Andre Heinecke [Tue, 18 Aug 2015 17:24:25 +0000 (19:24 +0200)]
Fix pinentry for Windows

* pinentry/pinentry.c (pinentry_loop2): Use assuan_fdopen for pipe fds.
* pinentry/pinentry.h (pinentry_loop2): Mention this in the comment.

--
For Windows calling assuan_fdopen is neccessary as this does
some internal platform specific stuff (get_osfilehandle).

This issue was introduced by using the real libassuan instead
of the built in variant.

3 years agotty: Correctly implement the repeat passphrase functionality.
Neal H. Walfield [Tue, 11 Aug 2015 12:26:26 +0000 (14:26 +0200)]
tty: Correctly implement the repeat passphrase functionality.

* tty/pinentry-tty.c (password): If the user repeated the passphrase
and they matched, then set PINENTRY->REPEAT_OKAY.

3 years agotty: Fix buffer resizing bug.
Neal H. Walfield [Tue, 11 Aug 2015 12:25:05 +0000 (14:25 +0200)]
tty: Fix buffer resizing bug.

* tty/pinentry-tty.c (read_password): Fix buffer resizing bug.

3 years agoQt4: Rename to pinentry-qt and add Qt5 Support
Andre Heinecke [Tue, 28 Jul 2015 12:45:45 +0000 (14:45 +0200)]
Qt4: Rename to pinentry-qt and add Qt5 Support

* qt4: Moved to qt.
* Makefile.am: Change qt4 suffix to qt.
* m4/qt.m4: Remove old qt lookup functions.
  (FIND_QT): New. Use pkg-config to find either Qt5 or Qt4
* configure.ac: Change qt4 suffix to qt. Use new FIND_QT function.
* qt/Makefile.am: Change qt4 suffix to qt. Use new FLAGS / LIBS.
* qt/pinentrydialog.cpp, qt/qrc_pinentry.cpp: Fix whitespace.
* .gitignore: Change qt4 paths to qt.
* README: Update accordingly.
* autogen.rc: Change qt4 to qt.
* qt/main.cpp (qt_cmd_handler, main): Change qt4 to qt.
--

Now if Qt5 is found with pkg-config Qt5 is used. Qt4 is still
supported as a fallback in case Qt5 is not found.

GnuPG-bug-id: 1806

3 years agodoc: Describe the frontends and their security implications.
Neal H. Walfield [Tue, 28 Jul 2015 09:53:25 +0000 (11:53 +0200)]
doc: Describe the frontends and their security implications.

* doc/pinentry.texi: Describe the frontends and their security
implications.

GnuPG-bug-id: 2034

3 years agoqt4: Replace the custom, secure entry widget with the standard widget.
Andre Heinecke [Tue, 28 Jul 2015 09:32:36 +0000 (11:32 +0200)]
qt4: Replace the custom, secure entry widget with the standard widget.

* configure.ac: Remove enable-pinentry-qt4-clipboard option.
* qt4/qsecurelineedit.cpp, qt4/qsecurelineedit.h,
  qt4/qsecurelineedit_p.h, qt4/secstring.cpp,
  qt4/secstring.h: Removed.
* qt4/Makefile.am: Update accordingly.
* qt4/main.cpp (qt_cmd_handler): Use QString instead of secqstring.
* qt4/pinentrydialog.cpp (PinentryDialog::PinentryDialog),
  (PinEntryDialog::error, PinEntryDialog::pin),
  (PinEntryDialog::updateQuality): Use QLineEdit and QString
  instead of secmem variants.
* qt4/pinentrydialog.cpp (PinentryDialog::PinentryDialog):
  Set echo mode to password.
* qt4/pinentrydialog.h: Update accordingly.

3 years agogtk2: Use gtk_widget_get_window instead of accessing the struct.
Neal H. Walfield [Sun, 26 Jul 2015 18:04:47 +0000 (20:04 +0200)]
gtk2: Use gtk_widget_get_window instead of accessing the struct.

* gtk+-2/pinentry-gtk-2.c (make_transient): Don't directly access the
window field of WIN.  Use gtk_widget_get_window instead.
(grab_keyboard): Likewise.
(ungrab_keyboard): Likewise.

Patch-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>.
3 years agogtk2: Use newer tooltips functions, if available.
Neal H. Walfield [Sun, 26 Jul 2015 18:03:14 +0000 (20:03 +0200)]
gtk2: Use newer tooltips functions, if available.

* gtk+-2/pinentry-gtk-2.c (tooltips): Don't declare for Gtk+ >=2.12.0.
(create_window): Gtk+ >=2.12.0, use gtk_widget_set_tooltip_text
instead of gtk_tooltips_set_tip.

Patch-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>.
3 years agoDon't build the emacs pinentry program by default.
Neal H. Walfield [Sun, 26 Jul 2015 17:45:45 +0000 (19:45 +0200)]
Don't build the emacs pinentry program by default.

3 years agogtk2: Replace the custom, secure entry widget with the standard widget.
Neal H. Walfield [Sun, 26 Jul 2015 17:36:38 +0000 (19:36 +0200)]
gtk2: Replace the custom, secure entry widget with the standard widget.

* gtk+-2/Makefile.am (pinentry_gtk_2_SOURCES): Remove gtksecentry.c,
gtksecentry.h and gseal-gtk-compat.h.
* gtk+-2/gseal-gtk-compat.h: Remove file.
* gtk+-2/gtksecentry.c: Remove file.
* gtk+-2/gtksecentry.h: Remove file.
* gtk+-2/pinentry-gtk-2.c: Don't include "gtksecentry.h".
(button_clicked): Use gtk_entry_get_text instead of
gtk_secure_entry_get_text.
(changed_text_handler): Use gtk_entry_get_text instead of
gtk_secure_entry_get_text and use gtk_entry_set_text instead of
gtk_secure_entry_set_text.
(create_window): Use gtk_entry_new instead of gtk_secure_entry_new.
Disable text visibility on ENTRY and REPEAT_ENTRY.
(main): Don't override the memory allocation functions.

3 years agogtk2: Simplify focus / default entry management.
Neal H. Walfield [Sun, 26 Jul 2015 17:29:49 +0000 (19:29 +0200)]
gtk2: Simplify focus / default entry management.

* gtk+-2/pinentry-gtk-2.c (create_window): Don't have ENTRY or
REPEAT_ENTRY explicitly grab the focus.  The default is fine.  Don't
add the GDK_ENTER_NOTIFY_MASK and GDK_LEAVE_NOTIFY_MASK events to
QUALITYBAR.  Only set GTK_CAN_DEFAULT on the ok button.  In pin entry
mode, make the ok button the default.

3 years agogtk2: Have enter in the text entry, send the focus to the repeat entry.
Neal H. Walfield [Sun, 26 Jul 2015 17:23:53 +0000 (19:23 +0200)]
gtk2: Have enter in the text entry, send the focus to the repeat entry.

* gtk+-2/pinentry-gtk-2.c (enter_callback): Rename anentry to
next_widget.  If NEXT_WIDGET is not NULL, send the focus to it.
Otherwise, call button_clicked.
(create_window): Initialize repeat_entry to NULL.  When connecting the
enter_callback entry to REPEAT_ENTRY, set the user data paramter to
NULL.  Connect the entry_callback entry to ENTRY after initializing
REPEAT_ENTRY (if applicable) and set the user data parameter to
REPEAT_ENTRY.

3 years agogtk2: Simplify: combine confirm_button_clicked and button_clicked.
Neal H. Walfield [Sun, 26 Jul 2015 16:54:14 +0000 (18:54 +0200)]
gtk2: Simplify: combine confirm_button_clicked and button_clicked.

* gtk+-2/pinentry-gtk-2.c (confirm_mode): New global static.
(confirm_button_clicked): Fold this function...
(button_clicked): ... into this one.  Update all callers.
(create_window): Remove argument confirm_mode.
(gtk_cmd_handler): Set confirm_mode.

3 years agoPost release updates
Werner Koch [Wed, 1 Jul 2015 15:14:01 +0000 (17:14 +0200)]
Post release updates

--

3 years agoRelease 0.9.5 pinentry-0.9.5
Werner Koch [Wed, 1 Jul 2015 15:09:25 +0000 (17:09 +0200)]
Release 0.9.5

3 years agow32: Adjust for use of standard libassuan.
Werner Koch [Wed, 1 Jul 2015 15:00:41 +0000 (17:00 +0200)]
w32: Adjust for use of standard libassuan.

* autogen.rc: Add gpg-error and libassuan prefix options.
* w32/Makefile.am (AM_CPPFLAGS): Use COMMON_FLAGS.
(pinentry_w32_LDADD): Use COMMON_LIBS.

3 years agoDistribute files in m4/
Werner Koch [Wed, 1 Jul 2015 14:45:27 +0000 (16:45 +0200)]
Distribute files in m4/

3 years agocurses: remove hard-wired ncursesw include path
Gergely Imreh [Wed, 24 Jun 2015 09:52:56 +0000 (09:52 +0000)]
curses: remove hard-wired ncursesw include path

* pinentry/pinentry-curses.c: pkg-config finds the correct include
paths so should not hard-wire the path for the ncursesw header file.

3 years agoemacs: Don't link against ../assuan/libassuan.a.
Neal H. Walfield [Tue, 23 Jun 2015 18:59:19 +0000 (20:59 +0200)]
emacs: Don't link against ../assuan/libassuan.a.

* emacs/Makefile.am (LDADD): Don't link against ../assuan/libassuan.a.
We now use the system libassuan.

3 years agocurses: Recognize ASCII DEL as backspace.
Neal H. Walfield [Tue, 23 Jun 2015 17:57:11 +0000 (19:57 +0200)]
curses: Recognize ASCII DEL as backspace.

* pinentry/pinentry-curses.c (dialog_input): Recognize ASCII DEL as
backspace.

--
Reported-by chdiza
GnuPG-bug-id: 2020

3 years agoAdd inside-Emacs mode to GUI pinentry programs
Daiki Ueno [Wed, 17 Jun 2015 01:32:22 +0000 (10:32 +0900)]
Add inside-Emacs mode to GUI pinentry programs

* configure.ac: Add --enable-pinentry-emacs and
--enable-inside-emacs option.
(BUILD_LIBPINENTRY_EMACS): New conditional.
(BUILD_PINENTRY_EMACS): New conditional.
(INSIDE_EMACS): New conditional.
* Makefile.am (pinentry_emacs): New.
(SUBDIRS): Add "emacs" subdir if PINENTRY_EMACS is set.

* pinentry/pinentry-emacs.h: New file.
* pinentry/pinentry-emacs.c: New file.
* pinentry/Makefile.am: New file.
* pinentry/pinentry.c (option_handler): Handle the allow-emacs-prompt
Assuan option.

* emacs/pinentry-emacs.c: New file.
* emacs/Makefile.am: New file.

3 years agoIf we fail to initialize gtk, fallback to the curses frontend.
Neal H. Walfield [Tue, 16 Jun 2015 10:52:46 +0000 (12:52 +0200)]
If we fail to initialize gtk, fallback to the curses frontend.

* gnome3/pinentry-gnome3.c (main): Use gtk_init_check instead of
gtk_init.  If it fails, fallback to the curses frontend.

3 years agoFix comment for pinentry_cmd_handler_t.
Neal H. Walfield [Tue, 16 Jun 2015 10:18:06 +0000 (12:18 +0200)]
Fix comment for pinentry_cmd_handler_t.

* pinentry/pinentry.h (pinentry_cmd_handler_t): Fix comment.

3 years agoDescribe default-prompt in the implementation section of the manual.
Neal H. Walfield [Tue, 16 Jun 2015 10:17:32 +0000 (12:17 +0200)]
Describe default-prompt in the implementation section of the manual.

* doc/pinentry.texi (Implementation Details): Describe default-prompt.

3 years agoRemove internal mini-libassuan implementation and link to libassuan.
Neal H. Walfield [Sat, 13 Jun 2015 19:43:33 +0000 (21:43 +0200)]
Remove internal mini-libassuan implementation and link to libassuan.

* assuan/ChangeLog-old: Remove file.
* assuan/Makefile.am: Remove file.
* assuan/README.1st: Remove file.
* assuan/assuan-buffer.c: Remove file.
* assuan/assuan-defs.h: Remove file.
* assuan/assuan-handler.c: Remove file.
* assuan/assuan-listen.c: Remove file.
* assuan/assuan-pipe-server.c: Remove file.
* assuan/assuan-util.c: Remove file.
* assuan/assuan.h: Remove file.
* assuan/mkerrors: Remove file.

* configure.ac: Check for libgpg-error and libassuan.
(COMMON_CFLAGS): Add $GPG_ERROR_CFLAGS and $LIBASSUAN_CFLAGS.
(COMMAND_LIBS): Add $GPG_ERROR_LIBS and $LIBASSUAN_LIBS.
(GPG_ERR_ENABLE_GETTEXT_MACROS): Define this macro.
(GPG_ERR_ENABLE_ERRNO_MACROS): Likewise.
(GNUPG_LIBASSUAN_VERSION): Likewise.
(AC_CONFIG_FILES): Don't generate assuan/Makefile.
(config.h): Define GPG_ERR_SOURCE_DEFAULT.
* Makefile.am (SUBDIRS): Remove assuan.
* curses/Makefile.am (LDADD): Remove ../assuan/libassuan.a.
* gnome3/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/assuan.
(LDADD): Remove ../assuan/libassuan.a.
* gtk+-2/Makefile.am (LDADD): Remove ../assuan/libassuan.a.
* pinentry/Makefile.am: Remove -I$(top_srcdir)/assuan.
* qt4/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/assuan.
(pinentry_qt4_LDADD): Remove $(top_builddir)/assuan/libassuan.a.
* tty/Makefile.am (LDADD): Remove ../assuan/libassuan.a.

* gnome3/pinentry-gnome3.c: Include <assuan.h>, not "assuan.h".
Replace ASSUAN_General_Error, etc. with gpg_error or
gpg_error_from_syserror.
* pinentry/pinentry-curses.c: Likewise.
* pinentry/pinentry.c: Likewise.
(pinentry_assuan_reset_handler): Change return type to gpg_error_t.
Change type of argument CTX from ASSUAN_CONTEXT to assuan_context_t.
Return 0.
(pinentry_inq_quality): Change variable CTX's type from ASSUAN_CONTEXT
to assuan_context_t.
(assuan_malloc_hooks): New variable.
(pinentry_init): Call gpgrt_check_version.  Change use of
assuan_set_malloc_hooks to match libassuan's semantics.
(option_handler): Return a gpg_error_t, not an int.  Replace use of
ASSUAN_Out_Of_Core, etc. with gpg_error or gpg_error_from_syserror.
(cmd_setdesc): Return a gpg_error_t, not an int.  Change argument
CTX's type from ASSUAN_CONTEXT to assuan_context_t.  Replace use of
ASSUAN_Out_Of_Core, etc. with gpg_error or gpg_error_from_syserror.
GPG_ERR_ENOMEM), etc.
(cmd_setprompt): Likewise.
(cmd_setkeyinfo): Likewise.
(cmd_setrepeat): Likewise.
(cmd_setrepeaterror): Likewise.
(cmd_seterror): Likewise.
(cmd_setok): Likewise.
(cmd_setnotok): Likewise.
(cmd_setcancel): Likewise.
(cmd_settimeout): Likewise.
(cmd_settitle): Likewise.
(cmd_setqualitybar): Likewise.
(cmd_setqualitybar_tt): Likewise.
(cmd_getpin): Likewise.
(cmd_confirm): Likewise.
(cmd_message): Likewise.
(cmd_getinfo): Likewise.
(cmd_clear_passphrase): Likewise.
(register_commands): Likewise.  Change use of assuan_register_command
to match libassuan's semantics.
(pinentry_loop2): Change variable RC's type from int to gpg_error_t.
Change variable CTX's type from ASSUAN_CONTEXT to assuan_context_t.
Use assuan_new to initialize CTX.  Change use of
assuan_init_pipe_server to match libassuan's semantics.  Replace use
of assuan_strerror with gpg_strerror.  Call assuan_release instead of
assuan_deinit_server.

3 years agoQt4: Fix GCC compile warnings
Andre Heinecke [Tue, 19 May 2015 15:19:48 +0000 (17:19 +0200)]
Qt4: Fix GCC compile warnings

* qt4/qsecurelineedit.cpp (QSecureLineEdit::sizeHint),
(QSecureLineEdit::minimumSizeHint): Remove unused Q_D macros.
(QSecureLineEdit::setCursorPosition, QSecureLineEditPrivate::setText),
(QSecureLineEditPrivate::hasAcceptableInput): Explicitly cast length to int.
(QSecureLineEditPrivate::maskString): Use unsigned type for strIndex.
(QSecureLineEditPrivate::maskString): Remove uneccesary casts.
* qt4/secstring.cpp (toUtf8): Remove unused variable.

3 years agognome3: Actually respect the user's choice of using a password manager.
Neal H. Walfield [Sun, 7 Jun 2015 12:36:39 +0000 (14:36 +0200)]
gnome3: Actually respect the user's choice of using a password manager.

* gnome3/pinentry-gnome3.c (create_prompt) [HAVE_LIBSECRET]: Only show
the libsecret prompt in this case.
(gnome3_cmd_handler) [HAVE_LIBSECRET]: Set PE->MAY_CACHE_PASSWORD
according to the user's choice.