Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: gnome-extra/nm-applet/files/, gnome-extra/nm-applet/
Date: Mon, 30 Apr 2018 17:29:48
Message-Id: 1525109378.5bfcfc6b649b7919173ea465aa1b8576f812e36c.pacho@gentoo
1 commit: 5bfcfc6b649b7919173ea465aa1b8576f812e36c
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Mon Apr 30 17:28:41 2018 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Mon Apr 30 17:29:38 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5bfcfc6b
7
8 gnome-extra/nm-applet: Enable gcr USE by default and fix crashes
9
10 - Enable gcr by default (#642730)
11 - Fix VPN crashes with openconnect (#654412)
12 - Fix crashes when editing certs
13 (https://bugzilla.gnome.org/show_bug.cgi?id=785674)
14
15 Package-Manager: Portage-2.3.31, Repoman-2.3.9
16
17 .../files/nm-applet-1.8.10-cert-chooser.patch | 38 ++++++
18 .../files/nm-applet-1.8.10-vpn-crash.patch | 137 +++++++++++++++++++++
19 gnome-extra/nm-applet/nm-applet-1.8.10-r1.ebuild | 72 +++++++++++
20 3 files changed, 247 insertions(+)
21
22 diff --git a/gnome-extra/nm-applet/files/nm-applet-1.8.10-cert-chooser.patch b/gnome-extra/nm-applet/files/nm-applet-1.8.10-cert-chooser.patch
23 new file mode 100644
24 index 00000000000..9aad2396953
25 --- /dev/null
26 +++ b/gnome-extra/nm-applet/files/nm-applet-1.8.10-cert-chooser.patch
27 @@ -0,0 +1,38 @@
28 +From 4d2523b482ab78134dafc02c9b99bd15f1a9174a Mon Sep 17 00:00:00 2001
29 +From: Ben Wiederhake <BenWiederhake.GitHub@×××.de>
30 +Date: Sun, 14 Jan 2018 23:28:15 +0100
31 +Subject: [PATCH 1/1] libnma/cert-chooser: handle case of no avalable modules
32 +
33 +Cause: Apparently it's perfectly okay if the list of modules is empty
34 +(e.g., NULL). However, the code assume that this indicates an error,
35 +tries to print the NULL error, and crashes.
36 +
37 +[lkundrak@××.sk: cosmetic changes]
38 +
39 +https://bugzilla.gnome.org/show_bug.cgi?id=785674
40 +(cherry picked from commit a37483c1a364ef3cc1cfa29e7ad51ca108d75674)
41 +---
42 + src/libnma/nma-cert-chooser-button.c | 6 +++---
43 + 1 file changed, 3 insertions(+), 3 deletions(-)
44 +
45 +diff --git a/src/libnma/nma-cert-chooser-button.c b/src/libnma/nma-cert-chooser-button.c
46 +index c7089390..00651765 100644
47 +--- a/src/libnma/nma-cert-chooser-button.c
48 ++++ b/src/libnma/nma-cert-chooser-button.c
49 +@@ -93,10 +93,10 @@ modules_initialized (GObject *object, GAsyncResult *res, gpointer user_data)
50 + gchar *label;
51 +
52 + modules = gck_modules_initialize_registered_finish (res, &error);
53 +- if (!modules) {
54 ++ if (error) {
55 + /* The Front Fell Off. */
56 +- g_critical ("Error getting registered modules: %s", error->message);
57 +- g_error_free (error);
58 ++ g_warning ("Error getting registered modules: %s", error->message);
59 ++ g_clear_error (&error);
60 + }
61 +
62 + model = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (self)));
63 +--
64 +2.14.3
65 +
66
67 diff --git a/gnome-extra/nm-applet/files/nm-applet-1.8.10-vpn-crash.patch b/gnome-extra/nm-applet/files/nm-applet-1.8.10-vpn-crash.patch
68 new file mode 100644
69 index 00000000000..8f217af2dac
70 --- /dev/null
71 +++ b/gnome-extra/nm-applet/files/nm-applet-1.8.10-vpn-crash.patch
72 @@ -0,0 +1,137 @@
73 +From 46f99b295e59f44dfde50ec90e7c09627d32431e Mon Sep 17 00:00:00 2001
74 +From: "Jan Alexander Steffens (heftig)" <jan.steffens@×××××.com>
75 +Date: Wed, 20 Dec 2017 13:23:12 +0100
76 +Subject: [PATCH 1/2] shared/compat: fix memory handling of
77 + nm_setting_vpn_get_*_keys
78 +
79 +The compat implementations return a (transfer none) strv instead of a
80 +(transfer container) one. This has caused double frees in nm-applet:
81 +https://bugs.archlinux.org/task/56772
82 +
83 +Don't copy the keys and don't free the container later.
84 +
85 +[thaller@××××××.com: patch adjusted to avoid compiler warning]
86 +
87 +Patch imported from NetworkManager commit 8ac8c01162235c2c198bfaf25fb7d1a57a595ce5.
88 +
89 +Fixes: e93ca7fc129ec0f29f5313a3aa12839914df8fa2
90 +(cherry picked from commit 0c90e08f77b71d2bda699cf032fceec0122bbf82)
91 +---
92 + shared/nm-utils/nm-compat.c | 10 +---------
93 + 1 file changed, 1 insertion(+), 9 deletions(-)
94 +
95 +diff --git a/shared/nm-utils/nm-compat.c b/shared/nm-utils/nm-compat.c
96 +index 22ab675d..47035e62 100644
97 +--- a/shared/nm-utils/nm-compat.c
98 ++++ b/shared/nm-utils/nm-compat.c
99 +@@ -30,7 +30,7 @@ _get_keys_cb (const char *key, const char *val, gpointer user_data)
100 + {
101 + GPtrArray *a = user_data;
102 +
103 +- g_ptr_array_add (a, g_strdup (key));
104 ++ g_ptr_array_add (a, (gpointer) key);
105 + }
106 +
107 + static const char **
108 +@@ -55,14 +55,6 @@ _get_keys (NMSettingVpn *setting,
109 + g_ptr_array_sort (a, nm_strcmp_p);
110 + g_ptr_array_add (a, NULL);
111 + keys = (const char **) g_ptr_array_free (g_steal_pointer (&a), FALSE);
112 +-
113 +- /* we need to cache the keys *somewhere*. */
114 +- g_object_set_qdata_full (G_OBJECT (setting),
115 +- is_secrets
116 +- ? NM_CACHED_QUARK ("libnm._nm_setting_vpn_get_secret_keys")
117 +- : NM_CACHED_QUARK ("libnm._nm_setting_vpn_get_data_keys"),
118 +- keys,
119 +- (GDestroyNotify) g_strfreev);
120 + }
121 +
122 + NM_SET_OUT (out_length, len);
123 +--
124 +2.14.3
125 +
126 +
127 +From 0d13a8b4064c83146714ecee86b69042aca35f9e Mon Sep 17 00:00:00 2001
128 +From: "Jan Alexander Steffens (heftig)" <jan.steffens@×××××.com>
129 +Date: Thu, 21 Dec 2017 20:36:48 +0100
130 +Subject: [PATCH 2/2] shared/compat: fix memory handling of
131 + nm_setting_vpn_get_*_keys()
132 +
133 +The previous fix was bad because the keys do not come from NMSettingVpn's hash
134 +table but are copies that are freed by nm_setting_vpn_foreach_* before
135 +it returns.
136 +
137 +[thaller@××××××.com: import shared code from NetworkManager, merging
138 +three patches together.]
139 +
140 +Fixes: e93ca7fc129ec0f29f5313a3aa12839914df8fa2
141 +Fixes: 0c90e08f77b71d2bda699cf032fceec0122bbf82
142 +
143 +https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00069.html
144 +https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00070.html
145 +(cherry picked from commit a52ccb2fe170558fc0aab4dd1d15ba8808b10951)
146 +---
147 + shared/nm-utils/nm-compat.c | 29 ++++++++++++++++++++++-------
148 + 1 file changed, 22 insertions(+), 7 deletions(-)
149 +
150 +diff --git a/shared/nm-utils/nm-compat.c b/shared/nm-utils/nm-compat.c
151 +index 47035e62..90328c06 100644
152 +--- a/shared/nm-utils/nm-compat.c
153 ++++ b/shared/nm-utils/nm-compat.c
154 +@@ -30,7 +30,7 @@ _get_keys_cb (const char *key, const char *val, gpointer user_data)
155 + {
156 + GPtrArray *a = user_data;
157 +
158 +- g_ptr_array_add (a, (gpointer) key);
159 ++ g_ptr_array_add (a, g_strdup (key));
160 + }
161 +
162 + static const char **
163 +@@ -40,22 +40,37 @@ _get_keys (NMSettingVpn *setting,
164 + {
165 + guint len;
166 + const char **keys = NULL;
167 +- gs_unref_ptrarray GPtrArray *a = NULL;
168 ++ GPtrArray *a;
169 +
170 + nm_assert (NM_IS_SETTING_VPN (setting));
171 +
172 +- a = g_ptr_array_new ();
173 ++ if (is_secrets)
174 ++ len = nm_setting_vpn_get_num_secrets (setting);
175 ++ else
176 ++ len = nm_setting_vpn_get_num_data_items (setting);
177 ++
178 ++ a = g_ptr_array_sized_new (len + 1);
179 ++
180 + if (is_secrets)
181 + nm_setting_vpn_foreach_secret (setting, _get_keys_cb, a);
182 + else
183 + nm_setting_vpn_foreach_data_item (setting, _get_keys_cb, a);
184 +- len = a->len;
185 +
186 +- if (a->len) {
187 ++ len = a->len;
188 ++ if (len) {
189 + g_ptr_array_sort (a, nm_strcmp_p);
190 + g_ptr_array_add (a, NULL);
191 +- keys = (const char **) g_ptr_array_free (g_steal_pointer (&a), FALSE);
192 +- }
193 ++ keys = g_memdup (a->pdata, a->len * sizeof (gpointer));
194 ++
195 ++ /* we need to cache the keys *somewhere*. */
196 ++ g_object_set_qdata_full (G_OBJECT (setting),
197 ++ is_secrets
198 ++ ? NM_CACHED_QUARK ("libnm._nm_setting_vpn_get_secret_keys")
199 ++ : NM_CACHED_QUARK ("libnm._nm_setting_vpn_get_data_keys"),
200 ++ g_ptr_array_free (a, FALSE),
201 ++ (GDestroyNotify) g_strfreev);
202 ++ } else
203 ++ g_ptr_array_free (a, TRUE);
204 +
205 + NM_SET_OUT (out_length, len);
206 + return keys;
207 +--
208 +2.14.3
209 +
210
211 diff --git a/gnome-extra/nm-applet/nm-applet-1.8.10-r1.ebuild b/gnome-extra/nm-applet/nm-applet-1.8.10-r1.ebuild
212 new file mode 100644
213 index 00000000000..651cf34423a
214 --- /dev/null
215 +++ b/gnome-extra/nm-applet/nm-applet-1.8.10-r1.ebuild
216 @@ -0,0 +1,72 @@
217 +# Copyright 1999-2018 Gentoo Foundation
218 +# Distributed under the terms of the GNU General Public License v2
219 +
220 +EAPI=6
221 +GNOME2_LA_PUNT="yes"
222 +GNOME_ORG_MODULE="network-manager-applet"
223 +
224 +inherit gnome2
225 +
226 +DESCRIPTION="GNOME applet for NetworkManager"
227 +HOMEPAGE="https://wiki.gnome.org/Projects/NetworkManager"
228 +
229 +LICENSE="GPL-2+"
230 +SLOT="0"
231 +IUSE="+introspection +gcr +modemmanager selinux teamd"
232 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86"
233 +
234 +RDEPEND="
235 + >=app-crypt/libsecret-0.18
236 + >=dev-libs/glib-2.38:2[dbus]
237 + >=dev-libs/dbus-glib-0.88
238 + >=sys-apps/dbus-1.4.1
239 + >=sys-auth/polkit-0.96-r1
240 + >=x11-libs/gtk+-3.10:3[introspection?]
241 + >=x11-libs/libnotify-0.7.0
242 +
243 + app-text/iso-codes
244 + >=net-misc/networkmanager-1.7:=[introspection?,modemmanager?,teamd?]
245 + net-misc/mobile-broadband-provider-info
246 +
247 + introspection? ( >=dev-libs/gobject-introspection-0.9.6:= )
248 + virtual/freedesktop-icon-theme
249 + virtual/libgudev:=
250 + gcr? ( >=app-crypt/gcr-3.14:=[gtk] )
251 + modemmanager? ( net-misc/modemmanager )
252 + selinux? ( sys-libs/libselinux )
253 + teamd? ( >=dev-libs/jansson-2.7 )
254 +"
255 +DEPEND="${RDEPEND}
256 + >=dev-util/gtk-doc-am-1.0
257 + >=dev-util/intltool-0.50.1
258 + virtual/pkgconfig
259 +"
260 +
261 +PDEPEND="virtual/notification-daemon" #546134
262 +
263 +PATCHES=(
264 + # shared/compat: fix memory handling of nm_setting_vpn_get_*_keys
265 + # (from 'master')
266 + "${FILESDIR}"/${P}-vpn-crash.patch
267 +
268 + # libnma/cert-chooser: handle case of no avalable modules (from
269 + # 'master')
270 + "${FILESDIR}"/${P}-cert-chooser.patch
271 +)
272 +
273 +src_configure() {
274 + local myconf=(
275 + --without-appindicator
276 + --disable-lto
277 + --disable-ld-gc
278 + --disable-more-warnings
279 + --disable-static
280 + --localstatedir=/var
281 + $(use_enable introspection)
282 + $(use_with gcr)
283 + $(use_with modemmanager wwan)
284 + $(use_with selinux)
285 + $(use_with teamd team)
286 + )
287 + gnome2_src_configure "${myconf[@]}"
288 +}