On Thu, Aug 11, 2016 at 10:33 AM, David Sommerseth <dav...@openvpn.net> wrote:
> In systemd after version 216, systemd-ask-password will support --echo > which > will avoid masking the user input. As OpenVPN uses this mechanism > collecting > usernames when systemd is available, this will avoid the input of > usernames to > be masked. > > This patch also adds the --icon argument, which is aimed at graphical > inputs. > For example when OpenVPN is started at system boot-time using a graphical > boot > interface such as Plymouth. > > [v2 - Avoid pkg.m4 hacks and use pkgconfig/autoconf methods to flag > if systemd is recent enough for --echo support] > > Signed-off-by: David Sommerseth <dav...@openvpn.net> > --- > configure.ac | 6 ++++++ > src/openvpn/console_systemd.c | 8 ++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/configure.ac b/configure.ac > index c3088fd..b2fa41c 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1012,6 +1012,12 @@ if test "$enable_systemd" = "yes" ; then > [], > [PKG_CHECK_MODULES([libsystemd], > [libsystemd-daemon])] > ) > + > + PKG_CHECK_EXISTS( [libsystemd > 216], > + [AC_DEFINE([SYSTEMD_NEWER_THAN_216], [1], > + [systemd is newer than v216])] > + ) > + > AC_CHECK_HEADERS(systemd/sd-daemon.h, > , > [ > diff --git a/src/openvpn/console_systemd.c b/src/openvpn/console_systemd.c > index bf0f99d..f385c0c 100644 > --- a/src/openvpn/console_systemd.c > +++ b/src/openvpn/console_systemd.c > @@ -64,6 +64,14 @@ get_console_input_systemd (const char *prompt, const > bool echo, char *input, con > > argv_init (&argv); > argv_printf (&argv, SYSTEMD_ASK_PASSWORD_PATH); > +#ifdef SYSTEMD_NEWER_THAN_216 > + /* the --echo support arrived in upstream systemd 217 */ > + if( echo ) > + { > + argv_printf_cat(&argv, "--echo"); > + } > +#endif > + argv_printf_cat (&argv, "--icon network-vpn"); > argv_printf_cat (&argv, "%s", prompt); > > if ((std_out = openvpn_popen (&argv, NULL)) < 0) { > <http://sdm.link/zohodev2dev> This looks much better now and works fine (tested without applying patches 1/4 and 2/4). ACK from me. Selva