- Add openvpn-2.1-systemd-passwd.patch / modify openvpn.init to

support systemd password query (bnc#675406)

OBS-URL: https://build.opensuse.org/package/show/network:vpn/openvpn?expand=0&rev=28
This commit is contained in:
Marius Tomaschewski 2011-08-29 15:49:55 +00:00 committed by Git OBS Bridge
parent cf5fd5ad67
commit eb0a721f28
3 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,61 @@
Index: openvpn-2.2.1/misc.c
===================================================================
--- openvpn-2.2.1.orig/misc.c
+++ openvpn-2.2.1/misc.c
@@ -1333,26 +1333,49 @@ get_console_input (const char *prompt, c
ASSERT (input);
ASSERT (capacity > 0);
input[0] = '\0';
+ bool is_systemd_running;
+ struct stat a, b;
+
+ /* We simply test whether the systemd cgroup hierarchy is
+ * mounted */
+
+ is_systemd_running = (lstat("/sys/fs/cgroup", &a) == 0)
+ && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
+ && (a.st_dev != b.st_dev);
#if defined(WIN32)
return get_console_input_win32 (prompt, echo, input, capacity);
#elif defined(HAVE_GETPASS)
- if (echo)
+ if (echo || is_systemd_running)
{
FILE *fp;
- fp = open_tty (true);
- fprintf (fp, "%s", prompt);
- fflush (fp);
- close_tty (fp);
+ if (is_systemd_running)
+ {
+ char *cmd;
+
+ asprintf(&cmd, "/bin/systemd-ask-password \"%s\"", prompt);
+ fp = popen (cmd, "re");
+ free (cmd);
+ }
+ else
+ {
+ fp = open_tty (true);
+ fprintf (fp, "%s", prompt);
+ fflush (fp);
+ close_tty (fp);
- fp = open_tty (false);
+ fp = open_tty (false);
+ }
if (fgets (input, capacity, fp) != NULL)
{
chomp (input);
ret = true;
}
- close_tty (fp);
+ if (is_systemd_running)
+ fclose (fp);
+ else
+ close_tty (fp);
}
else
{

View File

@ -5,6 +5,12 @@ Tue Aug 23 15:41:00 UTC 2011 - crrodriguez@opensuse.org
- Use SSL_MODE_RELEASE_BUFFERS to keep memory usage low, sent
upstream as https://community.openvpn.net/openvpn/ticket/157
-------------------------------------------------------------------
Mon Aug 22 09:55:44 UTC 2011 - fcrozat@novell.com
- Add openvpn-2.1-systemd-passwd.patch / modify openvpn.init to
support systemd password query (bnc#675406)
-------------------------------------------------------------------
Mon Jul 11 14:38:45 UTC 2011 - mt@suse.de

View File

@ -38,7 +38,8 @@ Source4: client-netconfig.up
Source5: client-netconfig.down
Patch1: %{name}-2.1-plugin-man.dif
Patch2: %{name}-2.1-plugin-build.dif
Patch3: 0001-Use-SSL_MODE_RELEASE_BUFFERS-if-available.patch
Patch3: openvpn-2.1-systemd-passwd.patch
Patch4: 0001-Use-SSL_MODE_RELEASE_BUFFERS-if-available.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: lzo-devel openssl-devel
BuildRequires: iproute2 pam-devel
@ -132,6 +133,7 @@ Authors:
%patch1 -p0
%patch2 -p0
%patch3 -p1
%patch4 -p1
sed -e "s|@PLUGIN_DIR@|%{plugin_dir}|g" \
-e "s|@PLUGIN_LIBDIR@|%{plugin_libdir}|g" \
-e "s|@PLUGIN_DOCDIR@|%{_defaultdocdir}/%{name}|g" \