Merge lp:~tj/ubuntu/trusty/network-manager-openvpn/lp1252832 into lp:ubuntu/trusty/network-manager-openvpn

Proposed by TJ
Status: Needs review
Proposed branch: lp:~tj/ubuntu/trusty/network-manager-openvpn/lp1252832
Merge into: lp:ubuntu/trusty/network-manager-openvpn
Diff against target: 176 lines (+100/-6)
6 files modified
.pc/applied-patches (+1/-0)
debian/changelog (+6/-0)
debian/patches/series (+1/-0)
properties/nm-openvpn-dialog.ui (+1/-1)
properties/nm-openvpn.c (+53/-1)
src/nm-openvpn-service.c (+38/-4)
To merge this branch: bzr merge lp:~tj/ubuntu/trusty/network-manager-openvpn/lp1252832
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Needs Resubmitting
Bin Li (community) Approve
Review via email: mp+230248@code.launchpad.net

Description of the change

SRU to fix broken multiple gateway entry, taken from unreleased upstream commit (details in DEP-3 header of the patch)

To post a comment you must log in.
Revision history for this message
Bin Li (binli) wrote :

I found the upstream already accepted the change.

c55ba4e core/ui: allow specifying port and protocol for gateways (bgo #712710)

And the patch looks good, hope we could apply it into ubuntu.

review: Approve
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

It seems to me like you forgot to bzr add the patch file when preparing this merge.

Also, this should also be landing in utopic before landing in trusty; would you please prepare a similar merge for that release?

Thanks!

review: Needs Fixing
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

This is still missing a patch file rather than changing the files directly.

However, disregard my previous comment about landing in utopic -- it's no longer a supported release.

review: Needs Resubmitting

Unmerged revisions

20. By TJ

core/ui: allow specifying port and protocol for gateways (bgo #712710)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2014-03-06 16:43:05 +0000
+++ .pc/applied-patches 2014-08-11 03:15:24 +0000
@@ -3,3 +3,4 @@
3gtk_table_to_gtk_grid.patch3gtk_table_to_gtk_grid.patch
4enable_ipv6.patch4enable_ipv6.patch
5support-ipv6-dns5support-ipv6-dns
6lp1252832_fix_multiple_gateways_entry.patch
67
=== modified file 'debian/changelog'
--- debian/changelog 2014-03-06 16:43:05 +0000
+++ debian/changelog 2014-08-11 03:15:24 +0000
@@ -1,3 +1,9 @@
1network-manager-openvpn (0.9.8.2-1ubuntu5) trusty; urgency=medium
2
3 * Fix entry of multiple gateways (LP: #1252832).
4
5 -- TJ <ubuntu@iam.tj> Mon, 11 Aug 2014 04:04:43 +0100
6
1network-manager-openvpn (0.9.8.2-1ubuntu4) trusty; urgency=medium7network-manager-openvpn (0.9.8.2-1ubuntu4) trusty; urgency=medium
28
3 * Fix IPv6 DNS support. Return IPv6 DNS servers are now passed to9 * Fix IPv6 DNS support. Return IPv6 DNS servers are now passed to
410
=== modified file 'debian/patches/series'
--- debian/patches/series 2014-03-06 16:43:05 +0000
+++ debian/patches/series 2014-08-11 03:15:24 +0000
@@ -4,3 +4,4 @@
4gtk_table_to_gtk_grid.patch4gtk_table_to_gtk_grid.patch
5enable_ipv6.patch5enable_ipv6.patch
6support-ipv6-dns6support-ipv6-dns
7lp1252832_fix_multiple_gateways_entry.patch
78
=== modified file 'properties/nm-openvpn-dialog.ui'
--- properties/nm-openvpn-dialog.ui 2013-05-06 18:03:37 +0000
+++ properties/nm-openvpn-dialog.ui 2014-08-11 03:15:24 +0000
@@ -1234,7 +1234,7 @@
1234 <object class="GtkEntry" id="gateway_entry">1234 <object class="GtkEntry" id="gateway_entry">
1235 <property name="visible">True</property>1235 <property name="visible">True</property>
1236 <property name="can_focus">True</property>1236 <property name="can_focus">True</property>
1237 <property name="tooltip_text" translatable="yes">Remote host name or IP address. You can specify multiple items for redundancy (use commas to separate the entries).1237 <property name="tooltip_text" translatable="yes">Remote gateway(s), with optional port and protocol (e.g. ovpn.corp.com:1234:tcp). You can specify multiple hosts for redundancy (use commas or spaces as delimiters).
1238config: remote</property>1238config: remote</property>
1239 </object>1239 </object>
1240 </child>1240 </child>
12411241
=== modified file 'properties/nm-openvpn.c'
--- properties/nm-openvpn.c 2014-03-06 11:58:16 +0000
+++ properties/nm-openvpn.c 2014-08-11 03:15:24 +0000
@@ -127,6 +127,51 @@
127 return etype;127 return etype;
128}128}
129129
130/* Example: abc.com:1234:udp, ovpnserver.company.com:443, vpn.example.com::tcp */
131static gboolean
132check_gateway_entry (const char *str)
133{
134 char **list, **iter;
135 char *host, *port, *proto;
136 long int port_int;
137 gboolean success = FALSE;
138
139 if (!str || !*str)
140 return FALSE;
141
142 list = g_strsplit_set (str, " \t,", -1);
143 for (iter = list; iter && *iter; iter++) {
144 if (!**iter)
145 continue;
146 host = g_strstrip (*iter);
147 port = strchr (host, ':');
148 proto = port ? strchr (port + 1, ':') : NULL;
149 if (port)
150 *port++ = '\0';
151 if (proto)
152 *proto++ = '\0';
153
154 /* check hostname */
155 if (!host || !*host)
156 goto out;
157 /* check port */
158 if (port && *port) {
159 char *end;
160 errno = 0;
161 port_int = strtol (port, &end, 10);
162 if (errno != 0 || *end != '\0' || port_int < 1 || port_int > 65535)
163 goto out;
164 }
165 /* check proto */
166 if (proto && strcmp (proto, "udp") && strcmp (proto, "tcp"))
167 goto out;
168 }
169 success = TRUE;
170out:
171 g_strfreev (list);
172 return success;
173}
174
130static gboolean175static gboolean
131check_validity (OpenvpnPluginUiWidget *self, GError **error)176check_validity (OpenvpnPluginUiWidget *self, GError **error)
132{177{
@@ -136,10 +181,17 @@
136 GtkTreeModel *model;181 GtkTreeModel *model;
137 GtkTreeIter iter;182 GtkTreeIter iter;
138 const char *contype = NULL;183 const char *contype = NULL;
184 GdkRGBA rgba;
185 gboolean gateway_valid;
139186
140 widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));187 widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
141 str = gtk_entry_get_text (GTK_ENTRY (widget));188 str = gtk_entry_get_text (GTK_ENTRY (widget));
142 if (!str || !strlen (str)) {189 gateway_valid = check_gateway_entry (str);
190 /* Change entry background colour while editing */
191 if (!gateway_valid)
192 gdk_rgba_parse (&rgba, "red3");
193 gtk_widget_override_background_color (widget, GTK_STATE_NORMAL, !gateway_valid ? &rgba : NULL);
194 if (!gateway_valid) {
143 g_set_error (error,195 g_set_error (error,
144 OPENVPN_PLUGIN_UI_ERROR,196 OPENVPN_PLUGIN_UI_ERROR,
145 OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY,197 OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY,
146198
=== modified file 'src/nm-openvpn-service.c'
--- src/nm-openvpn-service.c 2013-05-06 18:03:37 +0000
+++ src/nm-openvpn-service.c 2014-08-11 03:15:24 +0000
@@ -777,14 +777,48 @@
777 add_openvpn_arg (args, openvpn_binary);777 add_openvpn_arg (args, openvpn_binary);
778778
779 tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);779 tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
780 if (tmp && strlen (tmp)) {780 if (tmp && *tmp) {
781 char *tok;781 char *tok, *port, *proto;
782 while ((tok = strsep((char**)&tmp, " ,")) != NULL) {782 char *tmp_dup = strdup (tmp);
783 if (strlen(tok)) {783 while ((tok = strsep (&tmp_dup, " \t,")) != NULL) {
784 if (*tok) {
785 port = strchr (tok, ':');
786 proto = port ? strchr (port + 1, ':') : NULL;
787 if (port)
788 *port++ = '\0';
789 if (proto)
790 *proto++ = '\0';
791
784 add_openvpn_arg (args, "--remote");792 add_openvpn_arg (args, "--remote");
785 add_openvpn_arg (args, tok);793 add_openvpn_arg (args, tok);
794 if (port) {
795 if (!add_openvpn_arg_int (args, port)) {
796 g_set_error (error,
797 NM_VPN_PLUGIN_ERROR,
798 NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
799 _("Invalid port number '%s'."), port);
800 free_openvpn_args (args);
801 g_free (tmp_dup);
802 return FALSE;
803 }
804 } else
805 add_openvpn_arg (args, "1194"); /* use default IANA port */
806 if (proto) {
807 if (!strcmp (proto, "udp") || !strcmp (proto, "tcp"))
808 add_openvpn_arg (args, proto);
809 else {
810 g_set_error (error,
811 NM_VPN_PLUGIN_ERROR,
812 NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
813 _("Invalid proto '%s'."), proto);
814 free_openvpn_args (args);
815 g_free (tmp_dup);
816 return FALSE;
817 }
818 }
786 }819 }
787 }820 }
821 g_free (tmp_dup);
788 }822 }
789823
790 /* Remote random */824 /* Remote random */

Subscribers

People subscribed via source and target branches

to all changes: