]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
systemd: Do not mask usernames when querying for it via systemd-ask-password
authorDavid Sommerseth <davids@openvpn.net>
Thu, 11 Aug 2016 14:33:55 +0000 (16:33 +0200)
committerDavid Sommerseth <davids@openvpn.net>
Tue, 11 Oct 2016 10:28:21 +0000 (12:28 +0200)
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 <davids@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: 1470926035-434-1-git-send-email-davids@openvpn.net
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12405.html

configure.ac
src/openvpn/console_systemd.c

index 770c24da4327e3090304940323c625d70a7b2c62..357ba29e83d478787ba2da89992e391228adff31 100644 (file)
@@ -1023,6 +1023,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,
        ,
        [
index 67cb51bfd07f6ee1e7fc34074e61b09fcf1155b9..9cd7575b147054e929345f4af90cd01baa24d3a1 100644 (file)
@@ -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) {