public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Tom spot Callaway <spotaws@amazon.com>
To: git-commits@fedoraproject.org
Subject: [rpms/NetworkManager-openconnect] epel10.3: apply (unmerged) fix from upstream to allow per-user use again
Date: Thu, 12 Nov 2026 20:00:07 GMT	[thread overview]
Message-ID: <179451360751.1.5107355041689209232.rpms-NetworkManager-openconnect-16aebe44a8e2@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/NetworkManager-openconnect
Branch : epel10.3
Commit : 16aebe44a8e2c5b87bf97ea733d0ef9c7c6817b0
Author : Tom spot Callaway <spotaws@amazon.com>
Date   : 2026-10-01T18:37:12-04:00
Stats  : +167/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/NetworkManager-openconnect/c/16aebe44a8e2c5b87bf97ea733d0ef9c7c6817b0?branch=epel10.3

Log:
apply (unmerged) fix from upstream to allow per-user use again

---
diff --git a/88.patch b/88.patch
new file mode 100644
index 0000000..c37861b
--- /dev/null
+++ b/88.patch
@@ -0,0 +1,158 @@
+From 0078c320fc2f8342613b5ea849cc697778e1fa6a Mon Sep 17 00:00:00 2001
+From: Josephine Pfeiffer <josie@redhat.com>
+Date: Thu, 23 Jul 2026 22:27:58 +0200
+Subject: [PATCH] service: support private connections
+
+Since NetworkManager 1.58 the daemon refuses to activate a private VPN
+connection (one with a user in connection.permissions) unless the plugin
+declares supports-safe-private-file-access, so per-user openconnect
+connections broke on upgrade with "The 'openconnect' plugin doesn't
+support private connections."
+
+The service runs as root and passes the CA certificate (--cafile) to the
+openconnect binary. Read it via nm_utils_copy_cert_as_user() (libnm
+1.52.2) so a private connection's file is accessed as the owning user, and
+declare the capability in the .name file.
+
+https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1989
+---
+ configure.ac                   |  2 +-
+ nm-openconnect-service.name.in |  1 +
+ src/nm-openconnect-service.c   | 54 +++++++++++++++++++++++++++++++++-
+ 3 files changed, 55 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b1cc414..c712ec2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -149,7 +149,7 @@ PKG_CHECK_MODULES(WEBKIT, webkit2gtk-4.1
+ 			  [PKG_CHECK_MODULES(WEBKIT, webkit2gtk-4.0,
+ 			  [webkit=4.0], AC_MSG_ERROR(Neither webkit2gtk-4.0 nor wekit2gtk-4.1 found))])
+ 
+-PKG_CHECK_MODULES(LIBNM, libnm >= 1.2.0)
++PKG_CHECK_MODULES(LIBNM, libnm >= 1.52.2)
+ LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
+ LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_4"
+ 
+diff --git a/nm-openconnect-service.name.in b/nm-openconnect-service.name.in
+index 78d8535..bc2c7e2 100644
+--- a/nm-openconnect-service.name.in
++++ b/nm-openconnect-service.name.in
+@@ -3,6 +3,7 @@ name=openconnect
+ service=org.freedesktop.NetworkManager.openconnect
+ program=@LIBEXECDIR@/nm-openconnect-service
+ supports-multiple-connections=true
++supports-safe-private-file-access=true
+ 
+ [libnm]
+ plugin=@PLUGINDIR@/libnm-vpn-plugin-openconnect.so
+diff --git a/src/nm-openconnect-service.c b/src/nm-openconnect-service.c
+index 0005534..ccf3476 100644
+--- a/src/nm-openconnect-service.c
++++ b/src/nm-openconnect-service.c
+@@ -122,6 +122,7 @@ static struct {
+ 	gboolean debug;
+ 	int log_level;
+ 	GMainLoop *loop;
++	GPtrArray *tmp_file_paths;
+ } gl/*obal*/;
+ 
+ /*****************************************************************************/
+@@ -424,6 +425,43 @@ openconnect_watch_cb (GPid pid, gint status, gpointer user_data)
+ 	}
+ }
+ 
++static const char *
++get_connection_permission_user (NMSettingConnection *s_con)
++{
++	const char *ptype;
++	const char *pitem;
++	const char *pdetail;
++	guint num_perms;
++	guint i;
++
++	num_perms = nm_setting_connection_get_num_permissions (s_con);
++	for (i = 0; i < num_perms; i++) {
++		if (!nm_setting_connection_get_permission (s_con, i, &ptype, &pitem, &pdetail))
++			continue;
++		if (nm_streq0 (ptype, "user"))
++			return pitem;
++	}
++	return NULL;
++}
++
++/* On a private connection the daemon runs us as root, but a file the
++ * connection references must be read with the owning user's privileges. */
++static char *
++access_file (const char *filename, const char *user, GError **error)
++{
++	char *tmp;
++
++	if (!user)
++		return g_strdup (filename);
++
++	tmp = nm_utils_copy_cert_as_user (filename, user, error);
++	if (!tmp)
++		return NULL;
++
++	g_ptr_array_add (gl.tmp_file_paths, g_strdup (tmp));
++	return tmp;
++}
++
+ static gint
+ nm_openconnect_start_openconnect_binary (NMOpenconnectPlugin *plugin,
+                                          NMSettingConnection *s_con,
+@@ -442,6 +480,8 @@ nm_openconnect_start_openconnect_binary (NMOpenconnectPlugin *plugin,
+ 	const char *props_disable_udp;
+ 	const char *protocol;
+ 	const char *props_tun_name;
++	const char *user;
++	gs_free char *cafile = NULL;
+ 
+ 	/* Find openconnect */
+ 	openconnect_binary = openconnect_binary_paths;
+@@ -484,6 +524,8 @@ nm_openconnect_start_openconnect_binary (NMOpenconnectPlugin *plugin,
+ 	props_gwcert = nm_setting_vpn_get_secret (s_vpn, NM_OPENCONNECT_KEY_GWCERT);
+ 	props_resolve = nm_setting_vpn_get_secret (s_vpn, NM_OPENCONNECT_KEY_RESOLVE);
+ 
++	user = get_connection_permission_user (s_con);
++
+ 	props_cacert = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_CACERT);
+ 	props_mtu = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_MTU);
+ 
+@@ -507,8 +549,13 @@ nm_openconnect_start_openconnect_binary (NMOpenconnectPlugin *plugin,
+ 		g_ptr_array_add (openconnect_argv, (gpointer) "--servercert");
+ 		g_ptr_array_add (openconnect_argv, (gpointer) props_gwcert);
+ 	} else if (props_cacert && strlen(props_cacert)) {
++		cafile = access_file (props_cacert, user, error);
++		if (!cafile) {
++			g_ptr_array_free (openconnect_argv, TRUE);
++			return -1;
++		}
+ 		g_ptr_array_add (openconnect_argv, (gpointer) "--cafile");
+-		g_ptr_array_add (openconnect_argv, (gpointer) props_cacert);
++		g_ptr_array_add (openconnect_argv, (gpointer) cafile);
+ 	}
+ 
+ 	if (props_mtu && strlen(props_mtu)) {
+@@ -839,6 +886,7 @@ int main (int argc, char *argv[])
+ 		exit (EXIT_FAILURE);
+ 
+ 	gl.loop = g_main_loop_new (NULL, FALSE);
++	gl.tmp_file_paths = g_ptr_array_new_with_free_func (g_free);
+ 
+ 	if (!persist)
+ 		g_signal_connect (plugin, "quit", G_CALLBACK (quit_mainloop), gl.loop);
+@@ -849,5 +897,9 @@ int main (int argc, char *argv[])
+ 	g_clear_pointer (&gl.loop, g_main_loop_unref);
+ 	g_object_unref (plugin);
+ 
++	for (guint i = 0; i < gl.tmp_file_paths->len; i++)
++		unlink ((const char *) gl.tmp_file_paths->pdata[i]);
++	g_ptr_array_unref (gl.tmp_file_paths);
++
+ 	exit (EXIT_SUCCESS);
+ }
+-- 
+GitLab
+

diff --git a/NetworkManager-openconnect.spec b/NetworkManager-openconnect.spec
index 9263aa1..89d1a90 100644
--- a/NetworkManager-openconnect.spec
+++ b/NetworkManager-openconnect.spec
@@ -24,13 +24,15 @@
 Summary:   NetworkManager VPN plugin for openconnect
 Name:      NetworkManager-openconnect
 Version:   1.2.10
-Release:   13%{?dist}
+Release:   14%{?dist}
 License:   GPL-2.0-or-later AND LGPL-2.1-only
 URL:       http://www.gnome.org/projects/NetworkManager/
 Source:    https://download.gnome.org/sources/NetworkManager-openconnect/1.2/%{name}-%{version}.tar.xz
+Patch0:    https://gitlab.gnome.org/GNOME/NetworkManager-openconnect/-/merge_requests/88.patch
 
 BuildRequires: make
 BuildRequires: gcc
+BuildRequires: autoconf, automake, libtool
 BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
 BuildRequires: pkgconfig(libnm) >= %{nm_version}
 BuildRequires: pkgconfig(libnma) >= %{nm_version}
@@ -80,6 +82,8 @@ the OpenConnect client with NetworkManager (GNOME files).
 %prep
 %autosetup -p1
 
+autoreconf -ifv
+
 # Create a sysusers.d config file
 cat >networkmanager-openconnect.sysusers.conf <<EOF
 u nm-openconnect - 'NetworkManager user for OpenConnect' - -
@@ -87,7 +91,7 @@ EOF
 
 %build
 %configure \
-        --enable-more-warnings=yes \
+        --enable-more-warnings=no \
         --disable-static \
 %if %{with libnm_glib}
         --with-libnm-glib \
@@ -152,6 +156,9 @@ fi
 
 
 %changelog
+* Thu Oct  1 2026 Tom Callaway <spot@fedoraproject.org> - 1.2.10-14
+- apply (unmerged) fix from upstream to allow per-user use again
+
 * Thu Sep 10 2026 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.2.10-13
 - Rebuilt for libxml-2.5.4
 

                 reply	other threads:[~2026-11-12 20:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179451360751.1.5107355041689209232.rpms-NetworkManager-openconnect-16aebe44a8e2@fedoraproject.org \
    --to=spotaws@amazon.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox