Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F20064519
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
59 KB
Subscribers
None
View Options
diff --git a/.gitignore b/.gitignore
index cfe59ac..a3d4eeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,45 +1,47 @@
*.lo
*.o
.deps/
.libs/
/aclocal.m4
/autom4te.cache
/config.h.in
/config.h
/config.log
/config.status
/configure
/Makefile.in
autom4te.cache/
assuan/Makefile.in
assuan/Makefile
curses/Makefile.in
curses/Makefile
doc/Makefile.in
doc/Makefile
doc/pinentry.info
doc/stamp-vti
doc/version.texi
+efl/Makefile.in
+efl/Makefile
fltk/Makefile.in
fltk/Makefile
gtk+-2/Makefile.in
gtk+-2/Makefile
gnome3/Makefile.in
gnome3/Makefile
pinentry/Makefile.in
pinentry/Makefile
qt/Makefile.in
qt/Makefile
tqt/Makefile.in
tqt/Makefile
secmem/Makefile.in
secmem/Makefile
w32/Makefile.in
w32/Makefile
tty/Makefile.in
tty/Makefile
/qt/pinentryconfirm.moc
/qt/pinentrydialog.moc
/qt/qsecurelineedit.moc
/m4/Makefile.in
/emacs/Makefile.in
diff --git a/Makefile.am b/Makefile.am
index 8c8b8e5..b8fd0e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,130 +1,136 @@
# Makefile.am
# Copyright (C) 2002, 2012, 2015 g10 Code GmbH
#
# This file is part of PINENTRY.
#
# PINENTRY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PINENTRY is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-2.0+
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS = --disable-pinentry-qt --enable-pinentry-emacs
GITLOG_TO_CHANGELOG=gitlog-to-changelog
EXTRA_DIST = autogen.sh autogen.rc README.GIT ChangeLog-old \
build-aux/gitlog-to-changelog \
build-aux/git-log-fix build-aux/git-log-footer
if BUILD_PINENTRY_CURSES
pinentry_curses = curses
else
pinentry_curses =
endif
if BUILD_PINENTRY_TTY
pinentry_tty = tty
else
pinentry_tty =
endif
if BUILD_PINENTRY_EMACS
pinentry_emacs = emacs
else
pinentry_emacs =
endif
if BUILD_PINENTRY_GTK_2
pinentry_gtk_2 = gtk+-2
else
pinentry_gtk_2 =
endif
if BUILD_PINENTRY_GNOME_3
pinentry_gnome_3 = gnome3
else
pinentry_gnome_3 =
endif
if BUILD_PINENTRY_QT
pinentry_qt = qt
else
pinentry_qt =
endif
if BUILD_PINENTRY_TQT
pinentry_tqt = tqt
else
pinentry_tqt =
endif
if BUILD_PINENTRY_W32
pinentry_w32 = w32
else
pinentry_w32 =
endif
if BUILD_PINENTRY_FLTK
pinentry_fltk = fltk
else
pinentry_fltk =
endif
+if BUILD_PINENTRY_EFL
+pinentry_efl = efl
+else
+pinentry_efl =
+endif
+
SUBDIRS = m4 secmem pinentry ${pinentry_curses} ${pinentry_tty} \
${pinentry_emacs} ${pinentry_gtk_2} ${pinentry_gnome_3} \
${pinentry_qt} ${pinentry_tqt} ${pinentry_w32} \
- ${pinentry_fltk} doc
+ ${pinentry_fltk} ${pinentry_efl} doc
install-exec-local:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
echo " $(SETCAP) cap_ipc_lock+p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(SETCAP) cap_ipc_lock+p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'` || true; \
done
(cd $(DESTDIR)$(bindir); \
rm -f pinentry; \
$(LN_S) $(PINENTRY_DEFAULT)$(EXEEXT) pinentry)
dist-hook: gen-ChangeLog
echo "$(VERSION)" > $(distdir)/VERSION
distcheck-hook:
set -e; ( \
pref="#+macro: pinentry_" ;\
reldate="$$(date -u +%Y-%m-%d)" ;\
echo "$${pref}ver $(PACKAGE_VERSION)" ;\
echo "$${pref}date $${reldate}" ;\
list='$(DIST_ARCHIVES)'; for i in $$list; do \
case "$$i" in *.tar.bz2) \
echo "$${pref}size $$(wc -c <$$i|awk '{print int($$1/1024)}')k" ;\
echo "$${pref}sha1 $$(sha1sum <$$i|cut -d' ' -f1)" ;\
echo "$${pref}sha2 $$(sha256sum <$$i|cut -d' ' -f1)" ;;\
esac;\
done ) | tee $(distdir).swdb
gen_start_date = 2012-08-08T00:00:00
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d $(top_srcdir)/.git; then \
(cd $(top_srcdir) && \
$(GITLOG_TO_CHANGELOG) --append-dot --tear-off \
--amend=build-aux/git-log-fix \
--since=$(gen_start_date) ) > $(distdir)/cl-t; \
cat $(top_srcdir)/build-aux/git-log-footer >> $(distdir)/cl-t;\
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
diff --git a/NEWS b/NEWS
index 3e32d49..bc1745b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,376 +1,379 @@
Noteworthy changes in version 1.1.1 (unreleased)
------------------------------------------------
+ * A EFL-based pinentry has been contributed.
+
+
Noteworthy changes in version 1.1.0 (2017-12-03)
------------------------------------------------
* A FLTK1.3-based pinentry has been contributed.
* A TQt3-based pinentry has been contributed.
* New option --ttyalert for pinentry-curses to alert the user.
* Don't show "save passphrase" checkbox if secret service is
unavailable.
* The GTK Pinentry shows on Linux some information anout the process
which invoked the Pinentry.
* The GTK Pinentry does not anymore show tooltips when keyboard
grabbing is enabled.
* Fixed various minor problems.
Noteworthy changes in version 1.0.0 (2016-11-22)
------------------------------------------------
* Qt pinentry now supports repeat mode in one dialog.
* Qt and GTK pinentries now make it possible to show the entered
value.
* Qt pinentry now only grabs the keyboard if an entry field is
focused.
* Fixed foreground handling in pinentry-qt if compiled with Qt5 for
Windows.
* Fixed potential crash in Qt qualitybar calculation.
* GTK keyboard grabbing is now a bit more robust. The cursor is
changed to a big dot as a visual indication that a pinentry has
popped up and is waiting for input.
* The GNOME pinentry now falls back to curses if it can't use the
GCR system prompter or a screenlock is active.
* Fixed error output for cached passwords.
* A show/hide passphrase button or checkbox is now available with
some pinentry flavors.
* Improved diagnostics and error codes.
Noteworthy changes in version 0.9.7 (2015-12-07)
------------------------------------------------
* Fix regressions in the Qt pinentry.
* Fix minor problems pinnetyr-tty.
* New option --invisible-char.
Noteworthy changes in version 0.9.6 (2015-09-10)
------------------------------------------------
* Many improvements for the dump tty pinentry.
* Use the standard GTK+-2 text entry widget instead of our outdated
and back-then-it-was-more-secure text widget.
* Use the standard Qt text widget.
* Allow for building a static Qt variant.
* Fix regression in w32 pinentry.
Noteworthy changes in version 0.9.5 (2015-07-01)
------------------------------------------------
* Replaced the internal Assuan and gpg-error code by the standard
libassuan and libgpg-error libraries.
* Add a new Emacs pinentry and use as fallback for GUI programs.
* gnome3: The use-password-manager checkbox does now work.
* Gtk: Improved fallback to curses feature.
* curses: Recognize DEL as backspace.
Noteworthy changes in version 0.9.4 (2015-06-05)
------------------------------------------------
* Fix regression in GTK+ and curses pinentries.
Noteworthy changes in version 0.9.3 (2015-06-01)
------------------------------------------------
* Improved documentation
* New pinentry-gnome3
* More improvements for pinentry-tty.
* Fixes for pinentry-curses including support for Ctrl-W, Ctrl-U,
Ctrl-H, Ctrl-L, and Alt-Backspace
* New Assuan command to request clearing an external cache.
* Fixed problems linking to ncursesw.
* All kind of other minor fixes.
Noteworthy changes in version 0.9.2 (2015-05-11)
------------------------------------------------
* Support for saving the passphrase with libsecret.
* Escape key works in the Gtk+ pinentry.
* Improvements for pinentry-tty.
* Minor cleanups for the native Windows pinentry.
Noteworthy changes in version 0.9.1 (2015-03-18)
------------------------------------------------
* Fixed build problems for systems without ncurses.
* Reworked the option parser to allow building on systems without
getopt_long.
* Fixed Qt4 build problems.
Noteworthy changes in version 0.9.0 (2014-10-26)
------------------------------------------------
* New command SETREPEAT. Currently only supported for Gtk+-2.
* Gtk+-2: Pasting using the mouse is now supported.
* curses: Check that it is actually connected to a tty.
* Removed the old qt-3 and gtk+-1 pinentries.
Noteworthy changes in version 0.8.4 (2014-09-18)
------------------------------------------------
* New pinentry-tty version for dumb terminals.
* Qt4: New option to enable pasting the passphrase from clipboard
* Qt4: Improved accessiblity
* Qt4: Raise confirm message windows into foreground
* Qt4 (Windows): Improve the way pinentry-qt raises itself in the
foreground.
* Improved the build system.
Noteworthy changes in version 0.8.3 (2013-04-26)
------------------------------------------------
* Build fixes for newer mingw32 toolchains.
* Add SETTIMEOUT command for the gtk+-2 pinentry.
Noteworthy changes in version 0.8.2 (2012-08-08)
------------------------------------------------
* New SETTIMEOUT command for the qt4 pinentry.
* Wide character support for the curses pinentry.
* Various bug fixes.
Noteworthy changes in version 0.8.1 (2010-12-16)
------------------------------------------------
* The W32 pinentry now supports WindowsCE.
* The GTK pinentry now always sticks to the top and properly grabs
the keyboard.
* The protocol options default-cancel and default-ok now work for the
pinentry-gtk2 and pinentry-qt (that is QT3).
Noteworthy changes in version 0.8.0 (2010-03-03)
------------------------------------------------
* Beautified the qt4 pinentry
* Minor enhancements.
Noteworthy changes in version 0.7.6 (2009-06-19)
------------------------------------------------
* Make Gtk+-2 pinentry transient to the root window.
* Add Qt4 pinentry.
* Add native W32 pinentry.
* Fix utf-8 problem in Qt pinentries.
* Return GPG_ERR_CANCELED if during a "CONFIRM" command the user
closed the window.
* Add quality bar.
Noteworthy changes in version 0.7.5 (2008-02-15)
------------------------------------------------
* Fix cross compilation for Gtk+-2 pinentry.
* New Assuan command GETINFO with subcommands "version" and "pid".
Noteworthy changes in version 0.7.4 (2007-11-29)
------------------------------------------------
* Pinentry-gtk-2 and pinentry-qt now support a simple passphrase
quality indicator.
Noteworthy changes in version 0.7.3 (2007-07-06)
------------------------------------------------
* New command MESSAGE and --one-button compatibility option to
CONFIRM.
* New Assuan option touch-file to set a file which will be touched
after ncurses does not need the display anymore.
* New option --colors=FG,BG,SO to set the colors for the curses
pinentry.
* Pinentry-w32 does now basically work. It needs some finishing
though. For example the buttons should resize themself according
to the size of the text.
Noteworthy changes in version 0.7.2 (2005-01-27)
------------------------------------------------
* Remove bug in configure script that would use installed version of
Qt even if another path was explicitely specified with QTDIR.
* Honor the rpath setting for Qt.
* Add GTK+-2 pinentry.
* Install a symbolic link under the name "pinentry" that defaults to
pinentry-gtk, pinentry-qt, pinentry-gtk-2, or pinentry-curses, in
that order.
Noteworthy changes in version 0.7.1 (2004-04-21)
------------------------------------------------
* Removed unneeded Assuan cruft.
* Fixes for *BSD.
Noteworthy changes in version 0.7.0 (2003-12-23)
------------------------------------------------
* Make UTF8 description (prompt, error message, button texts) work.
* Make sure that secmem_term is called before program termination.
* Make assuan in Gtk and Curses pinentry use secure memory for
storage.
* Fixed a bug that would occur if a canceled GETPIN was immediately
followed by a CONFIRM.
* Disabled undo/redo in Qt pinentry.
* Print diagnostics for locale problems and return a new error code
in that case.
Noteworthy changes in version 0.6.8 (2003-02-07)
------------------------------------------------
* Bug fix in pinentry-qt.
Noteworthy changes in version 0.6.7 (2002-11-20)
------------------------------------------------
* Workaround for a bug in the curses version which led to an infinite
loop.
Noteworthy changes in version 0.6.6 (2002-11-09)
------------------------------------------------
* Fixed handling of DISPLAY and --display for the sake of the curses
fallback.
* UTF-8 conversion does now work for the GTK+ and CURSES version.
Noteworthy changes in version 0.6.5 (2002-09-30)
------------------------------------------------
* Handle Assuan options in the qt version.
Noteworthy changes in version 0.6.4 (2002-08-19)
------------------------------------------------
* Handle CONFIRM command in the qt version.
Noteworthy changes in version 0.6.3 (2002-06-26)
------------------------------------------------
* Minor bug fixes to the qt version.
Noteworthy changes in version 0.6.2 (2002-05-13)
------------------------------------------------
* Error texts can now be percent-escaped.
* The Curses pinentry supports multi-line error texts.
* The GTK+ and Qt pinentry can fall back to curses if no display is
available.
Noteworthy changes in version 0.6.1 (2002-04-25)
------------------------------------------------
* The Curses pinentry supports user-provided button texts via the
new SETOK and SETCANCEL commands.
* The Curses pinentry supports setting the desired character set
locale with --lc-ctype and correctly translates the UTF-8 strings
into that.
Noteworthy changes in version 0.6.0 (2002-04-05)
------------------------------------------------
* Merged all pinentry frontends into a single module.
* There is now a Curses frontend.
* The curses pinentry supports --ttyname and --ttytype options to
set the desired input/output terminal and its type.
Noteworthy changes in version 0.5.1 (2002-02-18)
------------------------------------------------
* CONFIRM command works
Noteworthy changes in version 0.5.0 (2002-01-04)
------------------------------------------------
* Window layout is somewhat nicer
* percent escape sequences do now work for SETDESC and SETERROR
diff --git a/configure.ac b/configure.ac
index ff6c2e0..e305e44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,760 +1,802 @@
# configure.ac
# Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
# Copyright (C) 2001, 2002, 2003, 2004, 2007, 2015, 2016 g10 Code GmbH
#
# This file is part of PINENTRY.
#
# PINENTRY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PINENTRY is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-2.0+
# (Process this file with autoconf to produce a configure script.)
AC_PREREQ(2.69)
min_automake_version="1.14"
# To build a release you need to create a tag with the version number
# (git tag -s pinentry-n.m.k) and run "./autogen.sh --force". Please
# bump the version number immediately after the release, do another
# commit, and a push so that the git magic is able to work.
m4_define(mym4_version, [1.1.1])
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
# flag indicating a development version (mym4_isgit). Note that the
# m4 processing is done by autoconf and not during the configure run.
m4_define([mym4_revision], m4_esyscmd([git branch -v 2>/dev/null \
| awk '/^\* / {printf "%s",$3}']))
m4_define([mym4_revision_dec],
m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
m4_define([mym4_betastring],
m4_esyscmd_s([git describe --match 'pinentry-[0-9].[0-9].*[0-9]' \
--long| awk -F- '$3!=0{print"-beta"$3}']))
m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
AC_INIT([pinentry],[mym4_full_version], [https://bugs.gnupg.org])
AC_CONFIG_AUX_DIR([build-aux])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR(pinentry/pinentry.h)
AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
AC_GNU_SOURCE
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AH_TOP([
#ifndef PINENTRY_CONFIG_H_INCLUDED
#define PINENTRY_CONFIG_H_INCLUDED
/* Enable gpg-error's strerror macro under W32CE. */
#define GPG_ERR_ENABLE_ERRNO_MACROS 1
])
AH_BOTTOM([
#endif /*PINENTRY_CONFIG_H_INCLUDED*/
])
dnl Checks for programs.
AC_PROG_MAKE_SET
AM_SANITY_CHECK
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
# We need to check for cplusplus here because we may not do the test
# for Qt and autoconf does does not allow that.
AC_PROG_CXX
AC_PROG_LN_S
PKG_PROG_PKG_CONFIG
AC_CHECK_TOOL(WINDRES, windres, :)
AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog,
[build-aux/gitlog-to-changelog])
have_dosish_system=no
have_w32_system=no
have_w32ce_system=no
case "${host}" in
*-mingw32*)
AC_DEFINE(USE_ONLY_8DOT3,1,
[Set this to limit filenames to the 8.3 format])
have_dosish_system=yes
have_w32_system=yes
case "${host}" in
*-mingw32ce*)
have_w32ce_system=yes
;;
*)
AC_DEFINE(HAVE_DRIVE_LETTERS,1,
[Defined if the OS supports drive letters.])
;;
esac
;;
i?86-emx-os2 | i?86-*-os2*emx )
# OS/2 with the EMX environment
AC_DEFINE(HAVE_DRIVE_LETTERS)
have_dosish_system=yes
;;
i?86-*-msdosdjgpp*)
# DOS with the DJGPP environment
AC_DEFINE(HAVE_DRIVE_LETTERS)
have_dosish_system=yes
;;
esac
if test "$have_dosish_system" = yes; then
AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
[Defined if we run on some of the PCDOS like systems
(DOS, Windoze. OS/2) with special properties like
no file modes])
fi
AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
if test "$have_w32ce_system" = yes; then
AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
fi
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
dnl Checks for compiler features.
if test "$GCC" = yes; then
# Check whether gcc does not emit a diagnositc for unknown -Wno-*
# options. This is the case for gcc >= 4.6
AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
#kickerror
#endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
AC_MSG_RESULT($_gcc_silent_wno)
if test "$USE_MAINTAINER_MODE" = "yes"; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
if test x"$_gcc_silent_wno" = xyes ; then
_gcc_warn=yes
else
AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wno-missing-field-initializers"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[_gcc_warn=yes],[_gcc_warn=no])
AC_MSG_RESULT($_gcc_warn)
CFLAGS=$_gcc_cflags_save;
fi
if test x"$_gcc_warn" = xyes ; then
CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
fi
AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wdeclaration-after-statement"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_warn=yes,_gcc_warn=no)
AC_MSG_RESULT($_gcc_warn)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_warn" = xyes ; then
CFLAGS="$CFLAGS -Wdeclaration-after-statement"
fi
else
# Not in maintainer mode: Use standard warnings.
CFLAGS="$CFLAGS -Wall"
fi
CPPFLAGS="$CPPFLAGS -Wall"
if test x"$_gcc_silent_wno" = xyes ; then
_gcc_warn=yes
else
AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[_gcc_warn=yes],[_gcc_warn=no])
AC_MSG_RESULT($_gcc_warn)
CFLAGS=$_gcc_cflags_save;
fi
if test x"$_gcc_warn" = xyes ; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wpointer-arith"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_warn=yes,_gcc_warn=no)
AC_MSG_RESULT($_gcc_warn)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_warn" = xyes ; then
CFLAGS="$CFLAGS -Wpointer-arith"
fi
fi
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h utime.h wchar.h)
dnl Checks for library functions.
AC_CHECK_FUNCS(seteuid stpcpy mmap)
GNUPG_CHECK_MLOCK
dnl Checks for standard types.
AC_TYPE_UINT32_T
# Common libraries and cflags.
COMMON_CFLAGS=
COMMON_LIBS=
AC_SUBST(COMMON_CFLAGS)
AC_SUBST(COMMON_LIBS)
dnl Checks for libgpg-error
#
# libgpg-error is a library with error codes shared between GnuPG
# related projects.
#
NEED_GPG_ERROR_VERSION=1.16
have_gpg_error=no
AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
have_gpg_error=yes,have_gpg_error=no)
COMMON_CFLAGS="$GPG_ERROR_CFLAGS $COMMON_CFLAGS"
COMMON_LIBS="$GPG_ERROR_LIBS $COMMON_LIBS"
AC_DEFINE_UNQUOTED(GPG_ERR_ENABLE_GETTEXT_MACROS, 1,
[Under Windows we use the gettext code from libgpg-error])
AC_DEFINE_UNQUOTED(GPG_ERR_ENABLE_ERRNO_MACROS, 1,
[Under WindowsCE we use the strerror replacement from libgpg-error.])
dnl Checks for libassuan.
#
# libassuan is used for IPC
#
NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.1.0
have_libassuan=no
AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
have_libassuan=yes,have_libassuan=no)
if test "$have_libassuan" = "yes"; then
AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
[version of the libassuan library])
fi
COMMON_CFLAGS="$LIBASSUAN_CFLAGS $COMMON_CFLAGS"
COMMON_LIBS="$LIBASSUAN_LIBS $COMMON_LIBS"
dnl Checks for libsecmem.
GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
dnl Check for libcap
AC_ARG_WITH([libcap], AC_HELP_STRING([--without-libcap],
[Disable support for capabilities library]))
if test "x$with_libcap" != "xno"; then
AC_PATH_PROG(SETCAP, setcap, :, "$PATH:/sbin:/usr/sbin")
AC_CHECK_LIB(cap, cap_set_proc, [
AC_DEFINE(USE_CAPABILITIES,1,[The capabilities support library is installed])
LIBCAP=-lcap
])
fi
AC_SUBST(LIBCAP)
dnl
dnl Check for curses pinentry program.
dnl
AC_ARG_ENABLE(pinentry-curses,
AC_HELP_STRING([--enable-pinentry-curses], [build curses pinentry]),
pinentry_curses=$enableval, pinentry_curses=maybe)
AC_ARG_ENABLE(fallback-curses,
AC_HELP_STRING([--enable-fallback-curses], [include curses fallback]),
fallback_curses=$enableval, fallback_curses=maybe)
dnl
dnl Checks for curses libraries. Deal correctly with $pinentry_curses = maybe
dnl and $fallback_curses = maybe.
dnl
if test "$pinentry_curses" != "no" -o "$fallback_curses" != "no"; then
IU_LIB_CURSES
fi
if test "$LIBCURSES"; then
if test "$pinentry_curses" != "no"; then
pinentry_curses=yes
fi
if test "$fallback_curses" != "no"; then
fallback_curses=yes
AC_DEFINE(FALLBACK_CURSES, 1,
[The GUI pinentries should fall back to curses if X is not available.])
fi
else
if test "$pinentry_curses" = "yes" -o "$fallback_curses" = "yes"; then
AC_MSG_ERROR([[
***
*** The curses library is required. The latest version of
*** ncurses is always available from ftp://ftp.gnu.org/gnu/ncurses/.
***]])
fi
pinentry_curses=no
fallback_curses=no
fi
AM_CONDITIONAL(BUILD_LIBPINENTRY_CURSES,
test "$pinentry_curses" = "yes" -o "$fallback_curses" = "yes")
AM_CONDITIONAL(BUILD_PINENTRY_CURSES, test "$pinentry_curses" = "yes")
AM_CONDITIONAL(FALLBACK_CURSES, test "$fallback_curses" = "yes")
if test "$pinentry_curses" = "yes"; then
AC_DEFINE(PINENTRY_CURSES, 1,
[The Curses version of Pinentry is to be build])
fi
dnl
dnl Check for tty pinentry program.
dnl
AC_ARG_ENABLE(pinentry-tty,
AC_HELP_STRING([--enable-pinentry-tty], [build tty pinentry]),
pinentry_tty=$enableval, pinentry_tty=maybe)
AM_CONDITIONAL(BUILD_PINENTRY_TTY, test "$pinentry_tty" = "yes")
if test "$pinentry_tty" = "yes"; then
AC_DEFINE(PINENTRY_TTY, 1,
[The TTY version of Pinentry is to be build])
fi
dnl
dnl Additional checks pinentry Curses.
dnl
if test "$pinentry_curses" = "yes" \
-o "$fallback_curses" = "yes" ; then
AM_ICONV
if test "$am_cv_func_iconv" != "yes"; then
AC_MSG_ERROR([[
***
*** The iconv function is required. You can specify its location
*** using the --with-libiconv-prefix=PREFIX option to configure.
***]])
fi
fi
dnl
dnl Check for emacs pinentry program.
dnl
AC_ARG_ENABLE(pinentry-emacs,
AC_HELP_STRING([--enable-pinentry-emacs], [build emacs pinentry]),
pinentry_emacs=$enableval, pinentry_emacs=no)
AC_ARG_ENABLE(inside-emacs,
AC_HELP_STRING([--enable-inside-emacs], [include emacs hack]),
inside_emacs=$enableval, inside_emacs=maybe)
if test "$pinentry_emacs" != "no" -o "$inside_emacs" != "no"; then
AC_MSG_CHECKING([if Unix domain socket is supported])
AC_TRY_COMPILE([
#include <sys/socket.h>
#include <sys/un.h>
],
[int s = socket (AF_UNIX, SOCK_STREAM, 0);],
[_unixsock_works=yes],
[_unixsock_works=no])
AC_MSG_RESULT($_unixsock_works)
if test "$_unixsock_works" = "yes"; then
if test "$pinentry_emacs" != "no"; then
pinentry_emacs=yes
fi
if test "$inside_emacs" != "no"; then
inside_emacs=yes
AC_DEFINE(INSIDE_EMACS, 1,
[The GUI pinentries should respect INSIDE_EMACS envvar.])
fi
else
if test "$pinentry_emacs" = "yes" -o "$inside_emacs" = "yes"; then
AC_MSG_ERROR([[
***
*** Support for Unix domain sockets is required.
***]])
fi
pinentry_emacs=no
inside_emacs=no
fi
fi
AM_CONDITIONAL(BUILD_LIBPINENTRY_EMACS,
test "$pinentry_emacs" = "yes" -o "$inside_emacs" = "yes")
AM_CONDITIONAL(BUILD_PINENTRY_EMACS, test "$pinentry_emacs" = "yes")
AM_CONDITIONAL(INSIDE_EMACS, test "$inside_emacs" = "yes")
if test "$pinentry_emacs" = "yes"; then
AC_DEFINE(PINENTRY_EMACS, 1,
[The Emacs version of Pinentry is to be build])
fi
+dnl
+dnl Check for EFL pinentry programs.
+dnl
+AC_ARG_ENABLE(pinentry-efl,
+ AC_HELP_STRING([--enable-pinentry-efl], [build EFL pinentry]),
+ pinentry_efl=$enableval, pinentry_efl=maybe)
+
+dnl check for pkg-config
+if test "$pinentry_efl" != "no"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ if test x"${PKG_CONFIG}" = xno ; then
+ pinentry_efl=no
+ fi
+fi
+
+if test "$pinentry_efl" != "no"; then
+ AC_MSG_CHECKING([for efl])
+ "${PKG_CONFIG}" --exists 'elementary >= 1.18'
+ if test $? -ne 0 ; then
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([efl >= 1.18 is required for efl pinentry])
+ pinentry_efl=no
+ else
+ AC_MSG_RESULT([yes])
+ EFL_CFLAGS=`"${PKG_CONFIG}" --cflags ecore-x elementary`
+ EFL_LIBS=`"${PKG_CONFIG}" --libs ecore-x elementary`
+ AC_SUBST(EFL_CFLAGS)
+ AC_SUBST(EFL_LIBS)
+ if test "$pinentry_efl" != "no"
+ then
+ pinentry_efl=yes
+ fi
+ fi
+fi
+AM_CONDITIONAL(BUILD_PINENTRY_EFL, test "$pinentry_efl" = "yes")
+
dnl
dnl Check for GTK+-2 / GNOME3 pinentry programs.
dnl
AC_ARG_ENABLE(pinentry-gtk2,
AC_HELP_STRING([--enable-pinentry-gtk2], [build GTK+-2 pinentry]),
pinentry_gtk_2=$enableval, pinentry_gtk_2=maybe)
AC_ARG_ENABLE(pinentry-gnome3,
AC_HELP_STRING([--enable-pinentry-gnome3], [build GNOME 3 pinentry]),
pinentry_gnome_3=$enableval, pinentry_gnome_3=maybe)
dnl check if the module gtk+-2.0 exists
if test "$pinentry_gtk_2" != "no"; then
PKG_CHECK_MODULES(
GTK2,
[gtk+-2.0 >= 2.4.0],
[
test "$pinentry_gtk_2" != "no" && pinentry_gtk_2=yes
test "$pinentry_gnome_3" != "no" && pinentry_gnome_3=yes
],
[
AC_MSG_WARN([pkg-config could not find the module gtk+-2.0])
pinentry_gtk_2=no
]
)
fi
AM_CONDITIONAL(BUILD_PINENTRY_GTK_2, test "$pinentry_gtk_2" = "yes")
if test "$pinentry_gnome_3" != "no"; then
PKG_CHECK_MODULES(
GNOME3,
[gcr-3,gcr-base-3],
[
pinentry_gnome_3=yes
AC_DEFINE(GCR_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
],
[
AC_MSG_WARN([pkg-config could not find the module gcr-3,gcr-base-3])
pinentry_gnome_3=no
]
)
fi
AM_CONDITIONAL(BUILD_PINENTRY_GNOME_3, test "$pinentry_gnome_3" = "yes")
dnl
dnl Check for libsecret.
dnl
AC_ARG_ENABLE(libsecret,
AC_HELP_STRING([--enable-libsecret],
[optionally cache passphrases using libsecret]),
libsecret=$enableval, libsecret=maybe)
dnl check if the module libsecret exists
if test "$libsecret" != "no"; then
PKG_CHECK_MODULES(
LIBSECRET,
[libsecret-1],
[libsecret=yes],
[
AC_MSG_WARN([pkg-config could not find the module libsecret-1])
libsecret=no
]
)
fi
AM_CONDITIONAL(BUILD_WITH_LIBSECRET, test "$libsecret" = "yes")
if test "$libsecret" = "yes"; then
AC_DEFINE(HAVE_LIBSECRET, 1,
[The pinentries should optionally cache the passphrase using libsecret.])
COMMON_CFLAGS="$LIBSECRET_CFLAGS $COMMON_CFLAGS"
COMMON_LIBS="$LIBSECRET_LIBS $COMMON_LIBS"
fi
dnl
dnl Check for Qt pinentry program.
dnl
AC_ARG_ENABLE(pinentry-qt,
AC_HELP_STRING([--enable-pinentry-qt], [build qt pinentry]),
pinentry_qt=$enableval, pinentry_qt=maybe)
dnl
dnl Checks for qt libraries. Deal correctly with $pinentry_qt = maybe.
dnl Tries to find Qt5, falls back on Qt4
dnl
if test "$pinentry_qt" != "no"; then
FIND_QT
if test "$have_qt4_libs" != "yes" -a "$have_qt5_libs" != "yes"; then
if test "$pinentry_qt" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt4 (QtCore, QtGui) or Qt5 (Qt5Core, Qt5Gui, Qt5Widgets) is required.
***]])
else
pinentry_qt=no
fi
fi
fi
AC_SUBST(PINENTRY_QT_CFLAGS)
AC_SUBST(PINENTRY_QT_LIBS)
AC_SUBST(MOC)
dnl If we have come so far, qt pinentry can be build.
if test "$pinentry_qt" != "no"; then
pinentry_qt=yes
fi
AM_CONDITIONAL(BUILD_PINENTRY_QT, test "$pinentry_qt" = "yes")
if test "$pinentry_qt" = "yes"; then
AC_DEFINE(PINENTRY_QT, 1, [The qt version of Pinentry is to be build])
if test "$have_qt4_libs" = "yes"; then
pinentry_qt_lib_version="(Qt4)"
else
pinentry_qt_lib_version="(Qt5)"
fi
fi
dnl
dnl Check for TQt pinentry program.
dnl
AC_ARG_ENABLE(pinentry-tqt,
AC_HELP_STRING([--enable-pinentry-tqt], [build tqt pinentry]),
pinentry_tqt=$enableval, pinentry_tqt=no)
if test "$pinentry_tqt" != "no"; then
if test "$pinentry_qt" = "yes"; then
AC_MSG_ERROR([[
***
*** Building both Qt and TQt pinentries is not supported.
*** Use --disable-pinentry-qt if you want the TQt pinentry.
***]])
fi
PKG_CHECK_MODULES(PINENTRY_TQT, tqt,
have_tqt_libs=yes,
[PKG_CHECK_MODULES(PINENTRY_TQT, tqt-mt,
have_tqt_libs=yes, have_tqt_libs=no)])
if test "$have_tqt_libs" = "yes"; then
AC_CHECK_TOOL([TQT_MOC], tqmoc, "no")
fi
if test "$have_tqt_libs" = "yes" -a "$TQT_MOC" != "no"; then
pinentry_tqt=yes
else
AC_MSG_WARN([TQt is not found])
pinentry_tqt=no
fi
fi
AM_CONDITIONAL(BUILD_PINENTRY_TQT, test "$pinentry_tqt" = "yes")
#
# Check whether we should build the W32 pinentry. This is actually
# the simplest check as we do this only for that platform.
#
pinentry_w32=no
test $have_w32_system = yes && pinentry_w32=yes
AM_CONDITIONAL(BUILD_PINENTRY_W32, test "$pinentry_w32" = "yes")
dnl
dnl Check for FLTK pinentry program.
dnl
AC_ARG_ENABLE(pinentry-fltk,
AC_HELP_STRING([--enable-pinentry-fltk], [build FLTK 1.3 pinentry]),
pinentry_fltk=$enableval, pinentry_fltk=maybe)
dnl check for fltk-config
if test "$pinentry_fltk" != "no"; then
AC_PATH_PROG(FLTK_CONFIG, fltk-config, no)
if test x"${FLTK_CONFIG}" = xno ; then
AC_MSG_WARN([fltk-config is not found])
pinentry_fltk=no
fi
fi
dnl check for FLTK libraries and set flags
if test "$pinentry_fltk" != "no"; then
AC_MSG_CHECKING([for FLTK 1.3])
FLTK_VERSION=`${FLTK_CONFIG} --api-version`
if test ${FLTK_VERSION} != "1.3" ; then
AC_MSG_RESULT([no])
AC_MSG_WARN([FLTK 1.3 not found (available $FLTK_VERSION)])
pinentry_fltk=no
else
AC_MSG_RESULT([yes])
FLTKCFLAGS=`${FLTK_CONFIG} --cflags`
FLTKCXXFLAGS=`${FLTK_CONFIG} --cxxflags`
FLTKLIBS=`${FLTK_CONFIG} --ldflags`
AC_SUBST(FLTKCFLAGS)
AC_SUBST(FLTKCXXFLAGS)
AC_SUBST(FLTKLIBS)
pinentry_fltk=yes
fi
fi
AM_CONDITIONAL(BUILD_PINENTRY_FLTK, test "$pinentry_fltk" = "yes")
# Figure out the default pinentry. We are very conservative here.
# Please change the order only after verifying that the preferred
# pinentry really is better (more feature-complete and more secure).
if test "$pinentry_gtk_2" = "yes"; then
PINENTRY_DEFAULT=pinentry-gtk-2
else
if test "$pinentry_qt" = "yes"; then
PINENTRY_DEFAULT=pinentry-qt
else
if test "$pinentry_gnome_3" = "yes"; then
PINENTRY_DEFAULT=pinentry-gnome3
else
if test "$pinentry_curses" = "yes"; then
PINENTRY_DEFAULT=pinentry-curses
else
if test "$pinentry_tty" = "yes"; then
PINENTRY_DEFAULT=pinentry-tty
else
if test "$pinentry_w32" = "yes"; then
PINENTRY_DEFAULT=pinentry-w32
else
if test "$pinentry_fltk" = "yes"; then
PINENTRY_DEFAULT=pinentry-fltk
else
if test "$pinentry_tqt" = "yes"; then
PINENTRY_DEFAULT=pinentry-tqt
else
- AC_MSG_ERROR([[No pinentry enabled.]])
+ if test "$pinentry_efl" = "yes"; then
+ PINENTRY_DEFAULT=pinentry-efl
+ else
+ AC_MSG_ERROR([[No pinentry enabled.]])
+ fi
fi
fi
fi
fi
fi
fi
fi
fi
AC_SUBST(PINENTRY_DEFAULT)
#
# Print errors here so that they are visible all
# together and the user can acquire them all together.
#
die=no
if test "$have_gpg_error" = "no"; then
die=yes
AC_MSG_NOTICE([[
***
*** You need libgpg-error to build this program.
** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libgpg-error
*** (at least version $NEED_GPG_ERROR_VERSION is required.)
***]])
fi
if test "$have_libassuan" = "no"; then
die=yes
AC_MSG_NOTICE([[
***
*** You need libassuan to build this program.
*** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libassuan/
*** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
***]])
fi
if test "$die" = "yes"; then
AC_MSG_ERROR([[
***
*** Required libraries not found. Please consult the above messages
*** and install them before running configure again.
***]])
fi
#
# To avoid double inclusion of config.h which might happen at some
# places, we add the usual double inclusion protection at the top of
# config.h.
#
AH_TOP([
#ifndef GNUPG_CONFIG_H_INCLUDED
#define GNUPG_CONFIG_H_INCLUDED
])
#
# Stuff which goes at the bottom of config.h.
#
AH_BOTTOM([
#ifdef GPG_ERR_SOURCE_DEFAULT
# error GPG_ERR_SOURCE_DEFAULT already defined
#endif
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_PINENTRY
#endif /*GNUPG_CONFIG_H_INCLUDED*/
])
AC_CONFIG_FILES([
m4/Makefile
secmem/Makefile
pinentry/Makefile
curses/Makefile
tty/Makefile
+efl/Makefile
emacs/Makefile
gtk+-2/Makefile
gnome3/Makefile
qt/Makefile
tqt/Makefile
w32/Makefile
fltk/Makefile
doc/Makefile
Makefile
])
AC_OUTPUT
AC_MSG_NOTICE([
Pinentry v${VERSION} has been configured as follows:
Revision: mym4_revision (mym4_revision_dec)
Platform: $host
Curses Pinentry ..: $pinentry_curses
TTY Pinentry .....: $pinentry_tty
Emacs Pinentry ...: $pinentry_emacs
+ EFL Pinentry .....: $pinentry_efl
GTK+-2 Pinentry ..: $pinentry_gtk_2
GNOME 3 Pinentry .: $pinentry_gnome_3
Qt Pinentry ......: $pinentry_qt $pinentry_qt_lib_version
TQt Pinentry .....: $pinentry_tqt
W32 Pinentry .....: $pinentry_w32
FLTK Pinentry ....: $pinentry_fltk
Fallback to Curses: $fallback_curses
Emacs integration : $inside_emacs
libsecret ........: $libsecret
Default Pinentry .: $PINENTRY_DEFAULT
])
diff --git a/efl/Makefile.am b/efl/Makefile.am
new file mode 100644
index 0000000..b986a04
--- /dev/null
+++ b/efl/Makefile.am
@@ -0,0 +1,38 @@
+# Makefile.am - PIN entry EFL frontend.
+# Copyright (C) 2017 Obsidian-Studios, Inc.
+# Author William L. Thomson Jr. <wlt@o-sinc.com>
+#
+# This file is part of PINENTRY.
+#
+# PINENTRY is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PINENTRY is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+## Process this file with automake to produce Makefile.in
+
+bin_PROGRAMS = pinentry-efl
+
+if FALLBACK_CURSES
+ncurses_include = $(NCURSES_INCLUDE)
+libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV)
+else
+ncurses_include =
+libcurses =
+endif
+
+AM_CPPFLAGS = $(COMMON_CFLAGS) $(EFL_CFLAGS) $(ncurses_include) \
+ -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
+LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \
+ $(COMMON_LIBS) $(LIBCAP) $(EFL_LIBS) $(libcurses)
+
+pinentry_efl_SOURCES = pinentry-efl.c
diff --git a/efl/pinentry-efl.c b/efl/pinentry-efl.c
new file mode 100644
index 0000000..ca99693
--- /dev/null
+++ b/efl/pinentry-efl.c
@@ -0,0 +1,623 @@
+/* pinentry-efl.c
+ Copyright (C) 2017 Obsidian-Studios, Inc.
+ Author William L. Thomson Jr. <wlt@o-sinc.com>
+
+ Based on pinentry-gtk2.c
+ Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
+ Copyright (C) 2001, 2002, 2007, 2015 g10 Code GmbH
+ Copyright (C) 2004 by Albrecht Dreß <albrecht.dress@arcor.de>
+
+ pinentry-efl is a pinentry application for the EFL widget set.
+ It tries to follow the Gnome Human Interface Guide as close as
+ possible.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <gpg-error.h>
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+#pragma GCC diagnostic pop
+#endif
+
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+#include "getopt.h"
+#endif /* HAVE_GETOPT_H */
+
+#include "pinentry.h"
+
+#ifdef FALLBACK_CURSES
+#include "pinentry-curses.h"
+#endif
+
+#define PGMNAME "pinentry-efl"
+
+#ifndef VERSION
+#define VERSION
+#endif
+
+#define ENTRY_HIDE "Hide entry"
+#define ENTRY_SHOW "Show entry"
+
+typedef enum { CONFIRM_CANCEL, CONFIRM_OK, CONFIRM_NOTOK } confirm_value_t;
+
+static const int WIDTH = 480;
+static const int BUTTON_HEIGHT = 27;
+static const int BUTTON_WIDTH = 70;
+static const int BUTTON_ICON_SIZE = 13;
+static const int PADDING = 5;
+
+static Eina_Bool got_input;
+static Ecore_Timer *timer;
+static Evas_Object *check_label;
+static Evas_Object *error_label;
+static Evas_Object *entry;
+static Evas_Object *repeat_entry;
+static Evas_Object *qualitybar;
+static Evas_Object *win;
+static char **pargv;
+static int grab_failed;
+static int passphrase_ok;
+static int confirm_mode;
+static int pargc;
+static confirm_value_t confirm_value;
+static pinentry_t pinentry;
+
+pinentry_cmd_handler_t pinentry_cmd_handler;
+
+static void
+quit (void)
+{
+ evas_object_del(win);
+ elm_exit();
+ ecore_main_loop_quit ();
+}
+
+static void
+delete_event (void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event EINA_UNUSED)
+{
+ pinentry->close_button = 1;
+ quit ();
+}
+
+static void
+changed_text_handler (void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event EINA_UNUSED)
+{
+ const char *s;
+ int length;
+ int percent;
+
+ got_input = EINA_TRUE;
+
+ if (pinentry->repeat_passphrase && repeat_entry)
+ {
+ elm_object_text_set (repeat_entry, "");
+ elm_object_text_set (error_label, "");
+ }
+
+ if (!qualitybar || !pinentry->quality_bar)
+ return;
+
+ s = elm_object_text_get (obj);
+ if (!s)
+ s = "";
+ length = strlen (s);
+ percent = length? pinentry_inq_quality (pinentry, s, length) : 0;
+ evas_object_color_set(qualitybar,
+ 255 - ( 2.55 * percent ),
+ 2.55 * percent, 0, 255);
+ elm_progressbar_value_set (qualitybar, (double) percent / 100.0);
+}
+
+static void
+on_check (void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ if(elm_check_state_get(obj))
+ {
+ elm_entry_password_set(entry, EINA_FALSE);
+ elm_object_text_set(check_label,ENTRY_HIDE);
+ }
+ else
+ {
+ elm_entry_password_set(entry, EINA_TRUE);
+ elm_object_text_set(check_label,ENTRY_SHOW);
+ }
+ evas_object_size_hint_min_set(check_label,
+ ELM_SCALE_SIZE(BUTTON_WIDTH),
+ ELM_SCALE_SIZE(BUTTON_HEIGHT));
+ evas_object_size_hint_align_set(check_label, 0, 1);
+}
+
+static void
+on_click (void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
+{
+ if (confirm_mode)
+ {
+ confirm_value = (confirm_value_t) data;
+ quit ();
+ return;
+ }
+
+ if (data)
+ {
+ const char *s;
+ const char *s2;
+
+ s = elm_entry_entry_get (entry);
+ if (!s)
+ s = "";
+
+ if (pinentry->repeat_passphrase && repeat_entry)
+ {
+ s2 = elm_entry_entry_get (repeat_entry);
+ if (!s2)
+ s2 = "";
+ if (strcmp (s, s2))
+ {
+ elm_object_text_set(error_label,
+ pinentry->repeat_error_string?
+ pinentry->repeat_error_string:
+ "not correctly repeated");
+ elm_object_focus_set(entry,EINA_TRUE);
+ return;
+ }
+ pinentry->repeat_okay = 1;
+ }
+
+ passphrase_ok = 1;
+ pinentry_setbufferlen (pinentry, strlen (s) + 1);
+ if (pinentry->pin)
+ strncpy (pinentry->pin, s, strlen(s) + 1);
+ }
+ quit ();
+}
+
+static void
+enter_callback (void *data, Evas_Object * obj, void *event_info EINA_UNUSED)
+{
+ if (data)
+ elm_object_focus_set (data, 1);
+ else
+ on_click ((void *) CONFIRM_OK, obj, NULL);
+}
+
+static Eina_Bool
+timeout_cb (const void * data)
+{
+ pinentry_t pe = (pinentry_t)data;
+ if (!got_input)
+ {
+ ecore_main_loop_quit();
+ if (pe)
+ pe->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+ }
+
+ timer = NULL;
+ return ECORE_CALLBACK_DONE;
+}
+
+static void
+create_window (void)
+{
+ char *txt;
+ Evas_Object *icon;
+ Evas_Object *obj;
+ Evas_Object *table;
+ int btn_txt_len = 0;
+ int row = 0;
+ int ok_len = 0;
+
+ win = elm_win_util_dialog_add(NULL,"pinentry","enter pin");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_center(win,EINA_TRUE,EINA_TRUE);
+ evas_object_smart_callback_add(win, "delete,request", delete_event, NULL);
+
+ table = elm_table_add(win);
+ elm_table_padding_set(table,ELM_SCALE_SIZE(PADDING),0);
+ evas_object_size_hint_padding_set (table,
+ ELM_SCALE_SIZE(PADDING),
+ ELM_SCALE_SIZE(PADDING),
+ ELM_SCALE_SIZE(PADDING),
+ ELM_SCALE_SIZE(PADDING));
+ evas_object_show(table);
+
+ if (pinentry->title)
+ {
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+ pinentry->title);
+ elm_win_title_set ( win, txt );
+ free (txt);
+ }
+
+ /* Description Label */
+ if (pinentry->description)
+ {
+ char* aligned;
+ int len;
+
+ obj = elm_label_add(table);
+ elm_label_line_wrap_set (obj, ELM_WRAP_WORD);
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->description);
+ len = strlen(txt)+20; // 20 chars for align tag
+ aligned = calloc(len+1,sizeof(char));
+ if(aligned)
+ {
+ snprintf(aligned,len, "<align=left>%s</align>",txt);
+ elm_object_text_set(obj,aligned);
+ free (aligned);
+ } else
+ elm_object_text_set(obj,txt);
+ free (txt);
+ evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0);
+ elm_table_pack(table, obj, 1, row, 5, 1);
+ evas_object_show(obj);
+ row++;
+ }
+ if (!confirm_mode && (pinentry->error || pinentry->repeat_passphrase))
+ {
+ /* Error Label */
+ if (pinentry->error)
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->error);
+ else
+ txt = "";
+ obj = elm_label_add(table);
+ evas_object_color_set(obj, 255, 0, 0, 255);
+ elm_object_text_set(obj,txt);
+ elm_object_style_set(obj,"slide_bounce");
+ elm_label_slide_duration_set(obj, 10);
+ elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
+ elm_label_slide_go(obj);
+ evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0);
+ elm_table_pack(table, obj, 1, row, 5, 1);
+ evas_object_show(obj);
+ if (pinentry->error)
+ free (txt);
+ row++;
+ }
+
+ qualitybar = NULL;
+
+ if (!confirm_mode)
+ {
+
+ if (pinentry->prompt)
+ {
+ /* Entry/Prompt Label */
+ obj = elm_label_add(table);
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->prompt);
+ elm_object_text_set(obj,txt);
+ free (txt);
+ evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+ elm_table_pack(table, obj, 1, row, 1, 1);
+ evas_object_show(obj);
+ }
+
+ entry = elm_entry_add(table);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_scroller_policy_set(entry,
+ ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+ elm_entry_password_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ evas_object_size_hint_weight_set(entry, 0, 0);
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0);
+ elm_table_pack(table, entry, 2, row, 4, 1);
+ evas_object_smart_callback_add(entry,
+ "changed",
+ changed_text_handler,
+ NULL);
+ evas_object_show(entry);
+ row++;
+
+ /* Check box */
+ obj = elm_check_add(table);
+ evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+ elm_table_pack(table, obj, 1, row, 1, 1);
+ evas_object_smart_callback_add(obj, "changed", on_check, NULL);
+ evas_object_show(obj);
+
+ /* Check Label */
+ check_label = elm_label_add(table);
+ on_check((void *)NULL, obj, (void *)NULL);
+ elm_table_pack(table, check_label, 2, row, 4, 1);
+ evas_object_show(check_label);
+ row++;
+
+ if (pinentry->quality_bar)
+ {
+ /* Quality Bar Label */
+ obj = elm_label_add(table);
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+ pinentry->quality_bar);
+ elm_object_text_set(obj,txt);
+ free (txt);
+ evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+ elm_table_pack(table, obj, 1, row, 1, 1);
+ evas_object_show(obj);
+
+ qualitybar = elm_progressbar_add(table);
+ evas_object_color_set(qualitybar, 255, 0, 0, 255);
+ evas_object_show(qualitybar);
+ if (pinentry->quality_bar_tt)
+ elm_object_tooltip_text_set (qualitybar,
+ pinentry->quality_bar_tt);
+ evas_object_size_hint_weight_set(qualitybar, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(qualitybar, EVAS_HINT_FILL, 0);
+ elm_table_pack(table, qualitybar, 2, row, 4, 1);
+ row++;
+ }
+
+ if (pinentry->repeat_passphrase)
+ {
+ /* Repeat Label */
+ obj = elm_label_add(table);
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+ pinentry->repeat_passphrase);
+ elm_object_text_set(obj,txt);
+ free (txt);
+ evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+ elm_table_pack(table, obj, 1, row, 1, 1);
+ evas_object_show(obj);
+
+ repeat_entry = elm_entry_add(table);
+ elm_entry_scrollable_set(repeat_entry, EINA_TRUE);
+ elm_scroller_policy_set(repeat_entry,
+ ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+ elm_entry_password_set(repeat_entry, EINA_TRUE);
+ elm_entry_single_line_set(repeat_entry, EINA_TRUE);
+ evas_object_size_hint_weight_set(repeat_entry, 0, 0);
+ evas_object_size_hint_align_set(repeat_entry, EVAS_HINT_FILL, 0);
+ elm_table_pack(table, repeat_entry, 2, row, 4, 1);
+ evas_object_smart_callback_add (repeat_entry, "activated",
+ enter_callback, NULL);
+ evas_object_show(repeat_entry);
+ evas_object_smart_callback_add (entry,
+ "activated",
+ enter_callback,
+ repeat_entry);
+ evas_object_smart_callback_add(repeat_entry,
+ "activated",
+ on_click,
+ (void *) CONFIRM_OK);
+ row++;
+ }
+ else
+ evas_object_smart_callback_add(entry,
+ "activated",
+ on_click,
+ (void *) CONFIRM_OK);
+ }
+
+ /* Cancel Button */
+ if (!pinentry->one_button)
+ {
+ obj = elm_button_add(table);
+ icon = elm_icon_add (table);
+ evas_object_size_hint_aspect_set (icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+ if (elm_icon_standard_set (icon, "dialog-cancel") ||
+ elm_icon_standard_set (icon, "window-close"))
+ {
+ evas_object_size_hint_min_set(icon,
+ ELM_SCALE_SIZE(BUTTON_ICON_SIZE),
+ ELM_SCALE_SIZE(BUTTON_ICON_SIZE));
+ elm_object_part_content_set(obj, "icon", icon);
+ evas_object_show (icon);
+ }
+ else
+ evas_object_del(icon);
+ if (pinentry->cancel || pinentry->default_cancel)
+ {
+ if(pinentry->cancel)
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->cancel);
+ else
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+ pinentry->default_cancel);
+ if(txt[0]=='_')
+ elm_object_text_set(obj,txt+1);
+ else
+ elm_object_text_set(obj,txt);
+ btn_txt_len = ELM_SCALE_SIZE(strlen(txt) * (PADDING * 1.5));
+ free (txt);
+ }
+ else
+ elm_object_text_set(obj, "Cancel"); //STOCK_CANCEL
+ evas_object_size_hint_align_set(obj, 0, 0);
+ if(btn_txt_len>ELM_SCALE_SIZE(BUTTON_WIDTH))
+ evas_object_size_hint_min_set(obj,
+ btn_txt_len,
+ ELM_SCALE_SIZE(BUTTON_HEIGHT));
+ else
+ evas_object_size_hint_min_set(obj,
+ ELM_SCALE_SIZE(BUTTON_WIDTH),
+ ELM_SCALE_SIZE(BUTTON_HEIGHT));
+ elm_table_pack(table, obj, 4, row, 1, 1);
+ evas_object_smart_callback_add(obj,
+ "clicked",
+ on_click,
+ (void *) CONFIRM_CANCEL);
+ evas_object_show(obj);
+ }
+
+ /* OK Button */
+ obj = elm_button_add(table);
+ icon = elm_icon_add (table);
+ evas_object_size_hint_aspect_set (icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+ if (elm_icon_standard_set (icon, "dialog-ok") ||
+ elm_icon_standard_set (icon, "list-add"))
+ {
+ evas_object_size_hint_min_set(icon,
+ ELM_SCALE_SIZE(BUTTON_ICON_SIZE),
+ ELM_SCALE_SIZE(BUTTON_ICON_SIZE));
+ elm_object_part_content_set(obj, "icon", icon);
+ evas_object_show (icon);
+ }
+ else
+ evas_object_del(icon);
+ if (pinentry->ok || pinentry->default_ok)
+ {
+ if(pinentry->ok)
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->ok);
+ else
+ txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->default_ok);
+ if(txt[0]=='_')
+ elm_object_text_set(obj,txt+1);
+ else
+ elm_object_text_set(obj,txt);
+ ok_len = ELM_SCALE_SIZE(strlen(txt) * (PADDING * 1.5));
+ if(ok_len>btn_txt_len)
+ btn_txt_len = ok_len;
+ free (txt);
+ }
+ else
+ elm_object_text_set(obj,"OK"); //STOCK_OK
+ evas_object_size_hint_align_set(obj, 0, 0);
+ if(btn_txt_len>ELM_SCALE_SIZE(BUTTON_WIDTH))
+ evas_object_size_hint_min_set(obj,
+ btn_txt_len,
+ ELM_SCALE_SIZE(BUTTON_HEIGHT));
+ else
+ evas_object_size_hint_min_set(obj,
+ ELM_SCALE_SIZE(BUTTON_WIDTH),
+ ELM_SCALE_SIZE(BUTTON_HEIGHT));
+ elm_table_pack(table, obj, 5, row, 1, 1);
+ evas_object_smart_callback_add(obj, "clicked", on_click, (void *) CONFIRM_OK);
+ evas_object_show(obj);
+
+ /* Key/Lock Icon */
+ obj = elm_icon_add (win);
+ evas_object_size_hint_aspect_set (obj, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+ if (elm_icon_standard_set (obj, "dialog-password"))
+ {
+ double ic_size = WIDTH/5;
+ if(row==0)
+ ic_size = ic_size/3.5;
+ else if(row<4)
+ ic_size = ic_size - ic_size/row;
+ evas_object_size_hint_min_set(obj,
+ ELM_SCALE_SIZE(ic_size),
+ ELM_SCALE_SIZE(ic_size));
+ evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0.5);
+ elm_table_pack(table, obj, 0, 0, 1, row? row:1);
+ evas_object_show (obj);
+ }
+ else
+ evas_object_del(obj);
+
+ /* Box for padding */
+ obj = elm_box_add (win);
+ elm_box_pack_end (obj, table);
+ evas_object_show (obj);
+
+ elm_win_resize_object_add(win,obj);
+ evas_object_show(win);
+
+ if(entry)
+ elm_object_focus_set (entry, EINA_TRUE);
+
+ if (pinentry->timeout > 0)
+ timer = ecore_timer_add (pinentry->timeout,
+ (Ecore_Task_Cb)timeout_cb,
+ pinentry);
+}
+
+static int
+efl_cmd_handler (pinentry_t pe)
+{
+ int want_pass = !!pe->pin;
+
+ got_input = EINA_FALSE;
+ pinentry = pe;
+ confirm_value = CONFIRM_CANCEL;
+ passphrase_ok = 0;
+ confirm_mode = want_pass ? 0 : 1;
+ /* init ecore-x explicitly using DISPLAY since this can launch
+ * from console
+ */
+ if (pe->display)
+ ecore_x_init (pe->display);
+ elm_init (pargc, pargv);
+ create_window ();
+ ecore_main_loop_begin ();
+
+ if (timer)
+ {
+ ecore_timer_del (timer);
+ timer = NULL;
+ }
+
+ if (confirm_value == CONFIRM_CANCEL || grab_failed)
+ pe->canceled = 1;
+
+ pinentry = NULL;
+ if (want_pass)
+ {
+ if (passphrase_ok && pe->pin)
+ return strlen (pe->pin);
+ else
+ return -1;
+ }
+ else
+ return (confirm_value == CONFIRM_OK) ? 1 : 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ pinentry_init (PGMNAME);
+
+#ifdef FALLBACK_CURSES
+ if (pinentry_have_display (argc, argv))
+ {
+#endif
+
+ pinentry_cmd_handler = efl_cmd_handler;
+ pargc = argc;
+ pargv = argv;
+
+#ifdef FALLBACK_CURSES
+ }
+ else
+ {
+ pinentry_cmd_handler = curses_cmd_handler;
+ }
+#endif
+
+ pinentry_parse_opts (argc, argv);
+ if (pinentry_loop ())
+ return 1;
+
+ return 0;
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Feb 23, 7:17 PM (1 h, 29 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
66/c2/a0e6a71532ae9163b8c94bba5a8d
Attached To
rP Pinentry
Event Timeline
Log In to Comment