[NetworkManager-openconnect] Use return count from openconnect_get_supported_protocols()
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openconnect] Use return count from openconnect_get_supported_protocols()
- Date: Tue, 21 Apr 2020 19:37:47 +0000 (UTC)
commit 0348852e5b0a37034833b8fac93f1cf3074f951c
Author: David Woodhouse <dwmw2 infradead org>
Date: Tue Apr 21 20:12:55 2020 +0100
Use return count from openconnect_get_supported_protocols()
From OpenConnect v8.05 to v8.08 this stopped returning the NULL
sentinel at the end of the array, on the flawed assumption that
users would all be using the count that it returns.
That was an error, which will be fixed in the next release. In
the meantime fix up NetworkManager-openconnect to cope with
those versions too.
properties/nm-openconnect-editor.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/properties/nm-openconnect-editor.c b/properties/nm-openconnect-editor.c
index 2d22e74..3df57a5 100644
--- a/properties/nm-openconnect-editor.c
+++ b/properties/nm-openconnect-editor.c
@@ -221,13 +221,14 @@ init_protocol_combo_options (GtkComboBox *protocol_combo)
GtkTreeIter iter;
#if OPENCONNECT_CHECK_VER(5,5)
- struct oc_vpn_proto *protos, *p;
- openconnect_get_supported_protocols(&protos);
- for (p=protos; p && p->name; p++) {
+ struct oc_vpn_proto *protos;
+ int i, n;
+ n = openconnect_get_supported_protocols(&protos);
+ for (i = 0; i < n; i++) {
gtk_list_store_append(protocol_combo_list, &iter);
gtk_list_store_set(protocol_combo_list, &iter,
- 0, p->pretty_name,
- 1, p->name,
+ 0, protos[i].pretty_name,
+ 1, protos[i].name,
-1);
}
openconnect_free_supported_protocols(protos);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]