NetworkManager: fix openconnect for console tools

This patch allows `nmcli` and `nmtui to work correctly with
openconnect.  This is dony by hard-coding the openconnect binary location.

see #25915
This commit is contained in:
timor 2017-05-29 17:56:52 +02:00 committed by obadz
parent a49c2366ef
commit 1d56c2fa43
2 changed files with 33 additions and 1 deletions

View File

@ -3,7 +3,7 @@
, libgcrypt, dnsmasq, bluez5, readline , libgcrypt, dnsmasq, bluez5, readline
, gobjectIntrospection, modemmanager, openresolv, libndp, newt, libsoup , gobjectIntrospection, modemmanager, openresolv, libndp, newt, libsoup
, ethtool, iputils, gnused, coreutils, file, inetutils, kmod, jansson, libxslt , ethtool, iputils, gnused, coreutils, file, inetutils, kmod, jansson, libxslt
, python3Packages, docbook_xsl, fetchpatch }: , python3Packages, docbook_xsl, fetchpatch, openconnect }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "network-manager-${version}"; name = "network-manager-${version}";
@ -41,6 +41,8 @@ stdenv.mkDerivation rec {
--replace /bin/sed ${gnused}/bin/sed --replace /bin/sed ${gnused}/bin/sed
substituteInPlace data/NetworkManager.service.in \ substituteInPlace data/NetworkManager.service.in \
--replace /bin/kill ${coreutils}/bin/kill --replace /bin/kill ${coreutils}/bin/kill
substituteInPlace clients/common/nm-vpn-helpers.c \
--subst-var-by openconnect ${openconnect}
# to enable link-local connections # to enable link-local connections
configureFlags="$configureFlags --with-udev-dir=$out/lib/udev" configureFlags="$configureFlags --with-udev-dir=$out/lib/udev"
''; '';
@ -76,6 +78,7 @@ stdenv.mkDerivation rec {
name = "null-dereference.patch"; name = "null-dereference.patch";
url = "https://github.com/NetworkManager/NetworkManager/commit/4e8eddd100bbc8429806a70620c90b72cfd29cb1.patch"; url = "https://github.com/NetworkManager/NetworkManager/commit/4e8eddd100bbc8429806a70620c90b72cfd29cb1.patch";
}) })
./openconnect_helper_path.patch
]; ];
buildInputs = [ systemd libgudev libnl libuuid polkit ppp libndp buildInputs = [ systemd libgudev libnl libuuid polkit ppp libndp

View File

@ -0,0 +1,29 @@
diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c
index 15611c45c..4a7444d3a 100644
--- a/clients/common/nm-vpn-helpers.c
+++ b/clients/common/nm-vpn-helpers.c
@@ -203,23 +203,8 @@ nm_vpn_openconnect_authenticate_helper (const char *host,
gboolean ret;
char **strv = NULL, **iter;
char *argv[4];
- const char *path;
- const char *const DEFAULT_PATHS[] = {
- "/sbin/",
- "/usr/sbin/",
- "/usr/local/sbin/",
- "/bin/",
- "/usr/bin/",
- "/usr/local/bin/",
- NULL,
- };
-
- path = nm_utils_file_search_in_paths ("openconnect", "/usr/sbin/openconnect", DEFAULT_PATHS,
- G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, error);
- if (!path)
- return FALSE;
- argv[0] = (char *) path;
+ argv[0] = "@openconnect@/bin/openconnect";
argv[1] = "--authenticate";
argv[2] = (char *) host;
argv[3] = NULL;