Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 200951 Details for
Bug 244274
NetworkManager creates empty resolv.conf with networkmanager-openvpn
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Custom DNS Patch
openvpn_custom_dns.patch (text/plain), 40.24 KB, created by
Tim Niemueller
on 2007-09-20 16:56:23 UTC
(
hide
)
Description:
Custom DNS Patch
Filename:
MIME Type:
Creator:
Tim Niemueller
Created:
2007-09-20 16:56:23 UTC
Size:
40.24 KB
patch
obsolete
>Index: src/Makefile.am >=================================================================== >--- src/Makefile.am (Revision 2834) >+++ src/Makefile.am (Arbeitskopie) >@@ -32,7 +32,8 @@ > > > nm_openvpn_service_openvpn_helper_SOURCES = \ >- nm-openvpn-service-openvpn-helper.c >+ nm-openvpn-service-openvpn-helper.c \ >+ nm-utils.c > > nm_openvpn_service_openvpn_helper_LDADD = \ > $(DBUS_LIBS) \ >Index: src/nm-utils.c >=================================================================== >--- src/nm-utils.c (Revision 2834) >+++ src/nm-utils.c (Arbeitskopie) >@@ -25,8 +25,53 @@ > > #include <glib.h> > >+#include <sys/socket.h> >+#include <netinet/in.h> >+#include <arpa/inet.h> >+ > #include "nm-utils.h" > >+ /* >+ * gpa_to_uint32arr >+ * >+ * Convert GPtrArray of uint32 to a uint32* array >+ * >+ */ >+void gpa_to_uint32arr (const GPtrArray *gpa, guint32 **uia, guint32 *uia_len) >+{ >+ >+ guint32 num_valid = 0, i = 0; >+ struct in_addr temp_addr; >+ >+ *uia = NULL; >+ >+ if ( gpa->len > 0 ) { >+ /* Pass over the array first to determine how many valid entries there are */ >+ num_valid = 0; >+ for (i = 0; i < gpa->len; ++i) { >+ if (inet_aton ((char *)gpa->pdata[i], &temp_addr)) { >+ num_valid++; >+ } >+ } >+ >+ /* Do the actual string->int conversion and assign to the array. */ >+ if (num_valid > 0) { >+ *uia = g_new0 (guint32, num_valid); >+ for (i = 0; i < gpa->len; ++i) { >+ if (inet_aton ((char *)gpa->pdata[i], &temp_addr)) { >+ (*uia)[i] = temp_addr.s_addr; >+ } >+ } >+ } >+ >+ *uia_len = num_valid; >+ } >+ if (*uia == NULL) { >+ *uia = g_malloc0 (sizeof (guint32)); >+ *uia_len = 1; >+ } >+} >+ > gchar *nm_dbus_escape_object_path (const gchar *utf8_string) > { > const gchar *p; >Index: src/nm-openvpn-service-openvpn-helper.c >=================================================================== >--- src/nm-openvpn-service-openvpn-helper.c (Revision 2834) >+++ src/nm-openvpn-service-openvpn-helper.c (Arbeitskopie) >@@ -130,51 +130,6 @@ > dbus_message_unref (message); > } > >- >- /* >- * gpa_to_uint32arr >- * >- * Convert GPtrArray of uint32 to a uint32* array >- * >- */ >-static void >-gpa_to_uint32arr (const GPtrArray *gpa, >- guint32 **uia, >- guint32 *uia_len) >-{ >- >- guint32 num_valid = 0, i = 0; >- struct in_addr temp_addr; >- >- *uia = NULL; >- >- if ( gpa->len > 0 ) { >- /* Pass over the array first to determine how many valid entries there are */ >- num_valid = 0; >- for (i = 0; i < gpa->len; ++i) { >- if (inet_aton ((char *)gpa->pdata[i], &temp_addr)) { >- num_valid++; >- } >- } >- >- /* Do the actual string->int conversion and assign to the array. */ >- if (num_valid > 0) { >- *uia = g_new0 (guint32, num_valid); >- for (i = 0; i < gpa->len; ++i) { >- if (inet_aton ((char *)gpa->pdata[i], &temp_addr)) { >- (*uia)[i] = temp_addr.s_addr; >- } >- } >- } >- >- *uia_len = num_valid; >- } >- if (*uia == NULL) { >- *uia = g_malloc0 (sizeof (guint32)); >- *uia_len = 1; >- } >-} >- > static gboolean > ipstr_to_uint32 (const char *ip_str, guint32 *ip) > { >Index: src/nm-openvpn-service.c >=================================================================== >--- src/nm-openvpn-service.c (Revision 2834) >+++ src/nm-openvpn-service.c (Arbeitskopie) >@@ -76,11 +76,12 @@ > guint connect_timer; > guint connect_count; > NmOpenVPN_IOData *io_data; >+ gboolean use_custom_dns; >+ gchar* custom_dns; > } NmOpenVPNData; > > static gboolean nm_openvpn_dbus_handle_stop_vpn (NmOpenVPNData *data); > >- > /* > * nm_dbus_create_error_message > * >@@ -615,6 +616,8 @@ > nm_info ("Could not find openvpn binary."); > return -1; > } >+ else >+ nm_info("Found openvpn binary."); > > // First check in which mode we are operating. Since NM does not > // guarantee any particular order we search this parameter >@@ -663,8 +666,14 @@ > ta = data_items[++i]; > } else if ( (strcmp( data_items[i], "ta-dir") == 0) ) { > ta_dir = data_items[++i]; >- } >+ } else if ( (strcmp( data_items[i], "use-custom-dns") == 0) ) { >+ /* do we have a custom DNS? */ >+ data->use_custom_dns = (strcmp(data_items[++i], "yes") == 0); >+ } else if ( (strcmp( data_items[i], "custom-dns") == 0) ) { >+ data->custom_dns = g_strdup(data_items[++i]); >+ } > } >+ > g_ptr_array_add (openvpn_argv, (gpointer) "--nobind"); > > // Device, either tun or tap >@@ -927,6 +936,8 @@ > { "cipher", OPT_TYPE_ASCII }, > { "ta", OPT_TYPE_ASCII }, > { "ta-dir", OPT_TYPE_ASCII }, >+ { "use-custom-dns", OPT_TYPE_ASCII}, >+ { "custom-dns", OPT_TYPE_ADDRESS}, > { NULL, OPT_TYPE_UNKNOWN } }; > > unsigned int i; >@@ -1267,7 +1278,8 @@ > guint32 ip4_nbns_len; > guint32 mss; > gboolean success = FALSE; >- char * empty = ""; >+ char * empty = ""; >+ GPtrArray *gpa_ip4_dns = NULL; > > g_return_if_fail (data != NULL); > g_return_if_fail (con != NULL); >@@ -1301,7 +1313,15 @@ > /* OpenVPN does not care about the MSS */ > mss = 0; > >- dbus_message_append_args (signal, >+ /* We got a custom DNS server, send it */ >+ if ( data->use_custom_dns ) >+ { >+ gpa_ip4_dns = g_ptr_array_new(); >+ g_ptr_array_add(gpa_ip4_dns, data->custom_dns); >+ //transcode our String array to an UINT array >+ gpa_to_uint32arr(gpa_ip4_dns, &ip4_dns, &ip4_dns_len); >+ >+ dbus_message_append_args (signal, > DBUS_TYPE_UINT32, &ip4_vpn_gateway, > DBUS_TYPE_STRING, &tundev, > DBUS_TYPE_UINT32, &ip4_address, >@@ -1313,8 +1333,28 @@ > DBUS_TYPE_STRING, &empty, > DBUS_TYPE_STRING, &empty, > DBUS_TYPE_INVALID); >+ >+ g_ptr_array_free( gpa_ip4_dns, TRUE ); >+ g_free( ip4_dns ); >+ } >+ else >+ { >+ /* send DNS server we got from VPN gateway (may be none) */ >+ dbus_message_append_args (signal, >+ DBUS_TYPE_UINT32, &ip4_vpn_gateway, >+ DBUS_TYPE_STRING, &tundev, >+ DBUS_TYPE_UINT32, &ip4_address, >+ DBUS_TYPE_UINT32, &ip4_ptpaddr, >+ DBUS_TYPE_UINT32, &ip4_netmask, >+ DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_dns, ip4_dns_len, >+ DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &ip4_nbns, ip4_nbns_len, >+ DBUS_TYPE_UINT32, &mss, >+ DBUS_TYPE_STRING, &empty, >+ DBUS_TYPE_STRING, &empty, >+ DBUS_TYPE_INVALID); >+ } > >- if (!dbus_connection_send (data->con, signal, NULL)) >+ if (!dbus_connection_send (data->con, signal, NULL)) > { > nm_warning ("Could not raise the "NM_DBUS_VPN_SIGNAL_IP4_CONFIG" signal!"); > goto out; >Index: src/nm-utils.h >=================================================================== >--- src/nm-utils.h (Revision 2834) >+++ src/nm-utils.h (Arbeitskopie) >@@ -128,6 +128,8 @@ > gchar *nm_dbus_escape_object_path (const gchar *utf8_string); > gchar *nm_dbus_unescape_object_path (const gchar *object_path); > >+void gpa_to_uint32arr (const GPtrArray *gpa, guint32 **uia, guint32 *uia_len); >+ > static inline const char *nm_find_openvpn (void) > { > static const char *openvpn_binary_paths[] = >Index: properties/nm-openvpn-dialog.glade >=================================================================== >--- properties/nm-openvpn-dialog.glade (Revision 2834) >+++ properties/nm-openvpn-dialog.glade (Arbeitskopie) >@@ -2118,6 +2118,58 @@ > <property name="spacing">6</property> > > <child> >+ <widget class="GtkCheckButton" id="openvpn-use-custom-dns"> >+ <property name="visible">True</property> >+ <property name="can_focus">True</property> >+ <property name="label" translatable="yes">Use custom DNS server</property> >+ <property name="use_underline">True</property> >+ <property name="relief">GTK_RELIEF_NORMAL</property> >+ <property name="focus_on_click">True</property> >+ <property name="active">False</property> >+ <property name="inconsistent">False</property> >+ <property name="draw_indicator">True</property> >+ </widget> >+ <packing> >+ <property name="padding">0</property> >+ <property name="expand">False</property> >+ <property name="fill">False</property> >+ </packing> >+ </child> >+ >+ <child> >+ <widget class="GtkAlignment" id="alignment25"> >+ <property name="visible">True</property> >+ <property name="xalign">0.5</property> >+ <property name="yalign">0.5</property> >+ <property name="xscale">1</property> >+ <property name="yscale">1</property> >+ <property name="top_padding">0</property> >+ <property name="bottom_padding">0</property> >+ <property name="left_padding">12</property> >+ <property name="right_padding">0</property> >+ >+ <child> >+ <widget class="GtkEntry" id="openvpn-custom-dns"> >+ <property name="visible">True</property> >+ <property name="can_focus">True</property> >+ <property name="editable">True</property> >+ <property name="visibility">True</property> >+ <property name="max_length">0</property> >+ <property name="text" translatable="yes"></property> >+ <property name="has_frame">True</property> >+ <property name="invisible_char">â¢</property> >+ <property name="activates_default">False</property> >+ </widget> >+ </child> >+ </widget> >+ <packing> >+ <property name="padding">0</property> >+ <property name="expand">False</property> >+ <property name="fill">False</property> >+ </packing> >+ </child> >+ >+ <child> > <widget class="GtkCheckButton" id="openvpn-use-routes"> > <property name="visible">True</property> > <property name="can_focus">True</property> >@@ -2329,7 +2381,7 @@ > <property name="editable">True</property> > <property name="visibility">True</property> > <property name="max_length">0</property> >- <property name="text" translatable="yes">65536</property> >+ <property name="text" translatable="yes">1194</property> > <property name="has_frame">True</property> > <property name="invisible_char">â¢</property> > <property name="activates_default">False</property> >@@ -2426,40 +2478,40 @@ > <property name="spacing">6</property> > > <child> >- <widget class="GtkHBox" id="hbox23"> >+ <widget class="GtkCheckButton" id="openvpn-use-cipher"> > <property name="visible">True</property> >+ <property name="can_focus">True</property> >+ <property name="label" translatable="yes">Use custom cipher</property> >+ <property name="use_underline">True</property> >+ <property name="relief">GTK_RELIEF_NORMAL</property> >+ <property name="focus_on_click">True</property> >+ <property name="active">False</property> >+ <property name="inconsistent">False</property> >+ <property name="draw_indicator">True</property> >+ </widget> >+ <packing> >+ <property name="padding">0</property> >+ <property name="expand">False</property> >+ <property name="fill">False</property> >+ </packing> >+ </child> >+ >+ <child> >+ <widget class="GtkHBox" id="hbox24"> >+ <property name="visible">True</property> > <property name="homogeneous">False</property> >- <property name="spacing">0</property> >+ <property name="spacing">10</property> > > <child> >- <widget class="GtkCheckButton" id="openvpn-use-cipher"> >+ <widget class="GtkAlignment" id="alignment26"> > <property name="visible">True</property> >- <property name="can_focus">True</property> >- <property name="label" translatable="yes">Use cipher:</property> >- <property name="use_underline">True</property> >- <property name="relief">GTK_RELIEF_NORMAL</property> >- <property name="focus_on_click">True</property> >- <property name="active">False</property> >- <property name="inconsistent">False</property> >- <property name="draw_indicator">True</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkAlignment" id="alignment18"> >- <property name="visible">True</property> > <property name="xalign">0.5</property> > <property name="yalign">0.5</property> > <property name="xscale">1</property> > <property name="yscale">1</property> > <property name="top_padding">0</property> > <property name="bottom_padding">0</property> >- <property name="left_padding">11</property> >+ <property name="left_padding">12</property> > <property name="right_padding">0</property> > > <child> >@@ -2472,7 +2524,7 @@ > </child> > </widget> > <packing> >- <property name="padding">3</property> >+ <property name="padding">0</property> > <property name="expand">True</property> > <property name="fill">True</property> > </packing> >@@ -2486,32 +2538,88 @@ > </child> > > <child> >- <widget class="GtkHBox" id="hbox24"> >+ <widget class="GtkCheckButton" id="openvpn-use-ta"> > <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">10</property> >+ <property name="can_focus">True</property> >+ <property name="label" translatable="yes">Use TLS authentication</property> >+ <property name="use_underline">True</property> >+ <property name="relief">GTK_RELIEF_NORMAL</property> >+ <property name="focus_on_click">True</property> >+ <property name="active">False</property> >+ <property name="inconsistent">False</property> >+ <property name="draw_indicator">True</property> >+ </widget> >+ <packing> >+ <property name="padding">0</property> >+ <property name="expand">False</property> >+ <property name="fill">False</property> >+ </packing> >+ </child> > >+ <child> >+ <widget class="GtkAlignment" id="alignment27"> >+ <property name="visible">True</property> >+ <property name="xalign">0.5</property> >+ <property name="yalign">0.5</property> >+ <property name="xscale">1</property> >+ <property name="yscale">1</property> >+ <property name="top_padding">0</property> >+ <property name="bottom_padding">0</property> >+ <property name="left_padding">12</property> >+ <property name="right_padding">0</property> >+ > <child> >- <widget class="GtkVBox" id="vbox13"> >+ <widget class="GtkTable" id="table6"> > <property name="visible">True</property> >+ <property name="n_rows">2</property> >+ <property name="n_columns">2</property> > <property name="homogeneous">False</property> >- <property name="spacing">0</property> >+ <property name="row_spacing">6</property> >+ <property name="column_spacing">6</property> > > <child> >- <widget class="GtkHBox" id="hbox25"> >+ <widget class="GtkLabel" id="openvpn-ta-dir-label"> > <property name="visible">True</property> >+ <property name="label" translatable="yes">Direction:</property> >+ <property name="use_underline">False</property> >+ <property name="use_markup">False</property> >+ <property name="justify">GTK_JUSTIFY_LEFT</property> >+ <property name="wrap">False</property> >+ <property name="selectable">False</property> >+ <property name="xalign">0</property> >+ <property name="yalign">0.5</property> >+ <property name="xpad">0</property> >+ <property name="ypad">0</property> >+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >+ <property name="width_chars">-1</property> >+ <property name="single_line_mode">False</property> >+ <property name="angle">0</property> >+ </widget> >+ <packing> >+ <property name="left_attach">0</property> >+ <property name="right_attach">1</property> >+ <property name="top_attach">1</property> >+ <property name="bottom_attach">2</property> >+ <property name="x_options">fill</property> >+ <property name="y_options"></property> >+ </packing> >+ </child> >+ >+ <child> >+ <widget class="GtkHBox" id="hbox29"> >+ <property name="visible">True</property> > <property name="homogeneous">False</property> > <property name="spacing">0</property> > > <child> >- <widget class="GtkCheckButton" id="openvpn-use-ta"> >+ <widget class="GtkRadioButton" id="openvpn-ta-dir-none"> > <property name="visible">True</property> > <property name="can_focus">True</property> >- <property name="label" translatable="yes">Use TLS auth:</property> >+ <property name="label" translatable="yes">none</property> > <property name="use_underline">True</property> > <property name="relief">GTK_RELIEF_NORMAL</property> > <property name="focus_on_click">True</property> >- <property name="active">False</property> >+ <property name="active">True</property> > <property name="inconsistent">False</property> > <property name="draw_indicator">True</property> > </widget> >@@ -2523,225 +2631,99 @@ > </child> > > <child> >- <widget class="GtkEntry" id="openvpn-ta"> >+ <widget class="GtkRadioButton" id="openvpn-ta-dir-zero"> > <property name="visible">True</property> > <property name="can_focus">True</property> >- <property name="editable">False</property> >- <property name="visibility">True</property> >- <property name="max_length">0</property> >- <property name="text" translatable="yes"></property> >- <property name="has_frame">True</property> >- <property name="invisible_char">â¢</property> >- <property name="activates_default">False</property> >+ <property name="label" translatable="yes">0</property> >+ <property name="use_underline">True</property> >+ <property name="relief">GTK_RELIEF_NORMAL</property> >+ <property name="focus_on_click">True</property> >+ <property name="active">False</property> >+ <property name="inconsistent">False</property> >+ <property name="draw_indicator">True</property> > </widget> > <packing> > <property name="padding">0</property> >- <property name="expand">True</property> >- <property name="fill">True</property> >+ <property name="expand">False</property> >+ <property name="fill">False</property> > </packing> > </child> > > <child> >- <widget class="GtkButton" id="openvpn-but-ta"> >+ <widget class="GtkRadioButton" id="openvpn-ta-dir-one"> > <property name="visible">True</property> > <property name="can_focus">True</property> >+ <property name="label" translatable="yes">1</property> >+ <property name="use_underline">True</property> > <property name="relief">GTK_RELIEF_NORMAL</property> > <property name="focus_on_click">True</property> >- >- <child> >- <widget class="GtkAlignment" id="alignment7"> >- <property name="visible">True</property> >- <property name="xalign">0.5</property> >- <property name="yalign">0.5</property> >- <property name="xscale">0</property> >- <property name="yscale">0</property> >- <property name="top_padding">0</property> >- <property name="bottom_padding">0</property> >- <property name="left_padding">0</property> >- <property name="right_padding">0</property> >- >- <child> >- <widget class="GtkHBox" id="hbox24"> >- <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">2</property> >- >- <child> >- <widget class="GtkImage" id="image7"> >- <property name="visible">True</property> >- <property name="stock">gtk-open</property> >- <property name="icon_size">4</property> >- <property name="xalign">0.5</property> >- <property name="yalign">0.5</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkLabel" id="label55"> >- <property name="visible">True</property> >- <property name="label" translatable="yes"></property> >- <property name="use_underline">False</property> >- <property name="use_markup">False</property> >- <property name="justify">GTK_JUSTIFY_LEFT</property> >- <property name="wrap">False</property> >- <property name="selectable">False</property> >- <property name="xalign">0.5</property> >- <property name="yalign">0.5</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >- <property name="width_chars">-1</property> >- <property name="single_line_mode">False</property> >- <property name="angle">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- </widget> >- </child> >- </widget> >- </child> >+ <property name="active">False</property> >+ <property name="inconsistent">False</property> >+ <property name="draw_indicator">True</property> > </widget> > <packing> >- <property name="padding">4</property> >+ <property name="padding">0</property> > <property name="expand">False</property> > <property name="fill">False</property> > </packing> > </child> > </widget> > <packing> >- <property name="padding">0</property> >- <property name="expand">True</property> >- <property name="fill">True</property> >+ <property name="left_attach">1</property> >+ <property name="right_attach">2</property> >+ <property name="top_attach">1</property> >+ <property name="bottom_attach">2</property> >+ <property name="y_options">fill</property> > </packing> > </child> > > <child> >- <widget class="GtkAlignment" id="alignment16"> >+ <widget class="GtkFileChooserButton" id="openvpn-ta"> > <property name="visible">True</property> >- <property name="xalign">0.5</property> >- <property name="yalign">0.5</property> >- <property name="xscale">1</property> >- <property name="yscale">1</property> >- <property name="top_padding">1</property> >- <property name="bottom_padding">110</property> >- <property name="left_padding">114</property> >- <property name="right_padding">0</property> >+ <property name="title" translatable="yes">Datei auswählen</property> >+ <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> >+ <property name="local_only">True</property> >+ <property name="show_hidden">False</property> >+ <property name="do_overwrite_confirmation">False</property> >+ <property name="width_chars">-1</property> >+ </widget> >+ <packing> >+ <property name="left_attach">1</property> >+ <property name="right_attach">2</property> >+ <property name="top_attach">0</property> >+ <property name="bottom_attach">1</property> >+ <property name="x_options">fill</property> >+ </packing> >+ </child> > >- <child> >- <widget class="GtkHBox" id="hbox29"> >- <property name="visible">True</property> >- <property name="homogeneous">False</property> >- <property name="spacing">0</property> >- >- <child> >- <widget class="GtkLabel" id="openvpn-ta-dir-label"> >- <property name="visible">True</property> >- <property name="label" translatable="yes">Direction:</property> >- <property name="use_underline">False</property> >- <property name="use_markup">False</property> >- <property name="justify">GTK_JUSTIFY_LEFT</property> >- <property name="wrap">False</property> >- <property name="selectable">False</property> >- <property name="xalign">0.5</property> >- <property name="yalign">0.5</property> >- <property name="xpad">0</property> >- <property name="ypad">0</property> >- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >- <property name="width_chars">-1</property> >- <property name="single_line_mode">False</property> >- <property name="angle">0</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkRadioButton" id="openvpn-ta-dir-none"> >- <property name="visible">True</property> >- <property name="can_focus">True</property> >- <property name="label" translatable="yes">none</property> >- <property name="use_underline">True</property> >- <property name="relief">GTK_RELIEF_NORMAL</property> >- <property name="focus_on_click">True</property> >- <property name="active">True</property> >- <property name="inconsistent">False</property> >- <property name="draw_indicator">True</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkRadioButton" id="openvpn-ta-dir-zero"> >- <property name="visible">True</property> >- <property name="can_focus">True</property> >- <property name="label" translatable="yes">0</property> >- <property name="use_underline">True</property> >- <property name="relief">GTK_RELIEF_NORMAL</property> >- <property name="focus_on_click">True</property> >- <property name="active">False</property> >- <property name="inconsistent">False</property> >- <property name="draw_indicator">True</property> >- <property name="group">openvpn-ta-dir-none</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- >- <child> >- <widget class="GtkRadioButton" id="openvpn-ta-dir-one"> >- <property name="visible">True</property> >- <property name="can_focus">True</property> >- <property name="label" translatable="yes">1</property> >- <property name="use_underline">True</property> >- <property name="relief">GTK_RELIEF_NORMAL</property> >- <property name="focus_on_click">True</property> >- <property name="active">False</property> >- <property name="inconsistent">False</property> >- <property name="draw_indicator">True</property> >- <property name="group">openvpn-ta-dir-none</property> >- </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >- </packing> >- </child> >- </widget> >- </child> >+ <child> >+ <widget class="GtkLabel" id="label-ta"> >+ <property name="visible">True</property> >+ <property name="label" translatable="yes">TLS Auth File:</property> >+ <property name="use_underline">False</property> >+ <property name="use_markup">False</property> >+ <property name="justify">GTK_JUSTIFY_LEFT</property> >+ <property name="wrap">False</property> >+ <property name="selectable">False</property> >+ <property name="xalign">0</property> >+ <property name="yalign">0.5</property> >+ <property name="xpad">0</property> >+ <property name="ypad">0</property> >+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> >+ <property name="width_chars">-1</property> >+ <property name="single_line_mode">False</property> >+ <property name="angle">0</property> > </widget> > <packing> >- <property name="padding">0</property> >- <property name="expand">False</property> >- <property name="fill">False</property> >+ <property name="left_attach">0</property> >+ <property name="right_attach">1</property> >+ <property name="top_attach">0</property> >+ <property name="bottom_attach">1</property> >+ <property name="x_options">fill</property> >+ <property name="y_options"></property> > </packing> > </child> > </widget> >- <packing> >- <property name="padding">0</property> >- <property name="expand">True</property> >- <property name="fill">True</property> >- </packing> > </child> > </widget> > <packing> >Index: properties/nm-openvpn.c >=================================================================== >--- properties/nm-openvpn.c (Revision 2834) >+++ properties/nm-openvpn.c (Arbeitskopie) >@@ -28,6 +28,7 @@ > #include <glib/gi18n-lib.h> > #include <string.h> > #include <glade/glade.h> >+#include <syslog.h> > > #define NM_VPN_API_SUBJECT_TO_CHANGE > >@@ -58,11 +59,14 @@ > GtkEntry *w_cert; > GtkEntry *w_key; > GtkCheckButton *w_use_routes; >+ //experimental >+ GtkCheckButton *w_use_custom_dns; >+ GtkEntry *w_custom_dns; >+ //</experimental> > GtkEntry *w_routes; > GtkCheckButton *w_use_lzo; > GtkCheckButton *w_use_tap; > GtkCheckButton *w_use_tcp; >- GtkExpander *w_opt_info_expander; > GtkButton *w_advanced_button; > GtkButton *w_import_button; > GtkButton *w_button_ca; >@@ -87,7 +91,7 @@ > GtkCheckButton *w_use_cipher; > GtkComboBox *w_cipher; > GtkCheckButton *w_use_ta; >- GtkEntry *w_ta; >+ GtkFileChooserButton *w_ta; > GtkButton *w_button_ta; > GtkLabel *w_ta_dir_label; > GtkRadioButton *w_ta_dir_none; >@@ -117,6 +121,11 @@ > gtk_entry_set_text (impl->w_x509userpass_key, ""); > gtk_entry_set_text (impl->w_x509userpass_username, ""); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), FALSE); >+ //experimental >+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_custom_dns), FALSE); >+ gtk_entry_set_text (impl->w_custom_dns, ""); >+ //</experimental> >+ > gtk_entry_set_text (impl->w_routes, ""); > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), FALSE); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_lzo), FALSE); >@@ -134,7 +143,7 @@ > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_ta_dir_none), FALSE); > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_ta_dir_zero), FALSE); > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_ta_dir_one), FALSE); >- gtk_entry_set_text (impl->w_ta, ""); >+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (impl->w_ta), ""); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_ta_dir_none), TRUE); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_ta_dir_zero), FALSE); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_ta_dir_one), FALSE); >@@ -185,12 +194,10 @@ > { > GSList *i; > NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data; >- gboolean should_expand; >+ gboolean should_expand = FALSE; > > openvpn_clear_widget (impl); > >- should_expand = FALSE; >- > if (connection_name != NULL) > gtk_entry_set_text (impl->w_connection_name, connection_name); > >@@ -215,7 +222,12 @@ > (strcmp (value, "yes") == 0) ) { > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_lzo), TRUE); > should_expand = TRUE; >- } else if ( strcmp (key, "connection-type") == 0) { >+ } >+ else if ( (strcmp (key, "use-custom-dns") == 0) ) >+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_custom_dns), (strcmp (value, "yes") == 0)); >+ else if (strcmp (key, "custom-dns") == 0) >+ gtk_entry_set_text (impl->w_custom_dns, value); >+ else if ( strcmp (key, "connection-type") == 0) { > gint type_cbox_sel = 0; > > if ( strcmp (value, "x509") == 0 ) { >@@ -227,7 +239,7 @@ > } else if ( strcmp (value, "x509userpass") == 0 ) { > type_cbox_sel = NM_OPENVPN_CONTYPE_X509USERPASS; > } >- >+ > gtk_combo_box_set_active (GTK_COMBO_BOX (impl->w_connection_type), type_cbox_sel); > connection_type_changed (GTK_COMBO_BOX (impl->w_connection_type), impl); > } else if ( strcmp (key, "local-ip") == 0 ) { >@@ -249,7 +261,7 @@ > } else if (strcmp (key, "cipher") == 0) { > set_cipher(impl->w_cipher, impl->w_use_cipher, value); > } else if (strcmp (key, "ta") == 0) { >- gtk_entry_set_text (impl->w_ta, value); >+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (impl->w_ta), value); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_ta), TRUE); > } else if (strcmp (key, "ta-dir") == 0) { > /* printf("ta_dir='%s'\n", value); */ >@@ -309,6 +321,9 @@ > gboolean use_tcp; > gboolean use_cipher; > gboolean use_ta; >+ gboolean use_non_local_dns; >+ gboolean use_custom_dns; >+ const gchar *dns_address; > > connectionname = gtk_entry_get_text (impl->w_connection_name); > remote = gtk_entry_get_text (impl->w_remote); >@@ -325,6 +340,7 @@ > username = gtk_entry_get_text (impl->w_username); > use_cipher = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_cipher)); > use_ta = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_ta)); >+ use_custom_dns = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_custom_dns)); > > data = NULL; > data = g_slist_append (data, g_strdup ("connection-type")); >@@ -366,6 +382,14 @@ > data = g_slist_append (data, g_strdup (remote_ip)); > data = g_slist_append (data, g_strdup ("username")); > data = g_slist_append (data, g_strdup (username)); >+ >+ //use custom dns settings? >+ data = g_slist_append (data, g_strdup ("use-custom-dns")); >+ data = g_slist_append (data, use_custom_dns ? g_strdup ("yes") : g_strdup("no")); >+ dns_address = gtk_entry_get_text(impl->w_custom_dns); >+ data = g_slist_append (data, g_strdup ("custom-dns")); >+ data = g_slist_append (data, g_strdup(dns_address)); >+ > if (use_cipher) { > const gchar *cipher = gtk_combo_box_get_active_text(impl->w_cipher); > if (cipher != NULL) { >@@ -377,7 +401,7 @@ > const gchar* dir; > > data = g_slist_append (data, g_strdup ("ta")); >- data = g_slist_append (data, g_strdup (gtk_entry_get_text (impl->w_ta))); >+ data = g_slist_append (data, g_strdup (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (impl->w_ta)))); > data = g_slist_append (data, g_strdup ("ta-dir")); > if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_ta_dir_zero))) > dir = "0"; >@@ -546,7 +570,7 @@ > (!check_port (port)) ) { > > is_valid = FALSE; >- >+ > } else if ( connection_type == NM_OPENVPN_CONTYPE_SHAREDKEY ) { > const char *shared_key; > const char *local_ip; >@@ -568,7 +592,7 @@ > > } else if ( connection_type == NM_OPENVPN_CONTYPE_PASSWORD ) { > >- const char *username; >+ const char *username; > const char *ca; > > username = gtk_entry_get_text (impl->w_username); >@@ -636,7 +660,6 @@ > if (is_valid) { > GSList *i; > GSList *routes; >- > routes = get_routes (impl); > > for (i = routes; is_valid && (i != NULL); i = g_slist_next (i)) { >@@ -648,7 +671,7 @@ > g_slist_free (routes); > } > } >- >+ > return is_valid; > } > >@@ -658,13 +681,16 @@ > { > NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) user_data; > >- if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_routes) >+ if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_custom_dns) { >+ gtk_widget_set_sensitive (GTK_WIDGET (impl->w_custom_dns), >+ gtk_toggle_button_get_active (togglebutton)); >+ } else if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_routes) { > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), > gtk_toggle_button_get_active (togglebutton)); >- else if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_cipher) >+ } else if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_cipher) { > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_cipher), >- gtk_toggle_button_get_active (togglebutton)); >- else if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_ta) { >+ gtk_toggle_button_get_active (togglebutton)); >+ } else if (GTK_CHECK_BUTTON(togglebutton) == impl->w_use_ta) { > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_ta), > gtk_toggle_button_get_active (togglebutton)); > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_button_ta), >@@ -789,7 +815,7 @@ > use_cipher = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_cipher)); > cipher = gtk_combo_box_get_active_text(impl->w_cipher); > use_ta = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_ta)); >- ta = gtk_entry_get_text (impl->w_ta); >+ ta = gtk_file_chooser_get_filename (GK_FILE_CHOOSER (impl->w_ta)); > if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(impl->w_ta_dir_zero))) > ta_dir = "0"; > else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(impl->w_ta_dir_one))) >@@ -1059,7 +1085,7 @@ > } > > if ((ta != NULL) && (strlen (ta) > 0)) { >- gtk_entry_set_text (impl->w_ta, ta); >+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (impl->w_ta), ta); > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_ta), TRUE); > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_ta), TRUE); > gtk_widget_set_sensitive (GTK_WIDGET (impl->w_button_ta), TRUE); >@@ -1252,9 +1278,6 @@ > } else if ( button == impl->w_button_x509userpass_key ) { > msg = _("Select key to use"); > entry = impl->w_x509userpass_key; >- } else if ( button == impl->w_button_ta ) { >- msg = _("Select TA to use"); >- entry = impl->w_ta; > } else { > return; > } >@@ -1557,8 +1580,6 @@ > impl->w_port = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-port")); > impl->w_use_routes = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-routes")); > impl->w_routes = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-routes")); >- impl->w_opt_info_expander = GTK_EXPANDER (glade_xml_get_widget (impl->xml, >- "openvpn-optional-information-expander")); > impl->w_advanced_button = GTK_BUTTON (glade_xml_get_widget (impl->xml, > "openvpn-advanced-button")); > >@@ -1603,18 +1624,26 @@ > populate_cipher(impl->w_cipher); > > impl->w_use_ta = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-ta")); >- impl->w_ta = GTK_ENTRY( glade_xml_get_widget( impl->xml, "openvpn-ta" ) ); >+ impl->w_ta = GTK_FILE_CHOOSER_BUTTON (glade_xml_get_widget( impl->xml, "openvpn-ta" ) ); > impl->w_button_ta = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-but-ta" ) ); > impl->w_ta_dir_label = GTK_LABEL( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-label" ) ); > impl->w_ta_dir_none = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-none" ) ); > impl->w_ta_dir_zero = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-zero" ) ); > impl->w_ta_dir_one = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-one" ) ); > >+ impl->w_use_custom_dns = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-custom-dns")); >+ impl->w_custom_dns = GTK_ENTRY( glade_xml_get_widget( impl->xml, "openvpn-custom-dns" ) ); >+ > impl->callback = NULL; > >+ gtk_signal_connect (GTK_OBJECT (impl->w_use_custom_dns), >+ "toggled", GTK_SIGNAL_FUNC (use_editable_toggled), impl); >+ gtk_signal_connect (GTK_OBJECT (impl->w_custom_dns), >+ "toggled", GTK_SIGNAL_FUNC (editable_changed), impl); >+ > > gtk_signal_connect (GTK_OBJECT (impl->w_use_routes), >- "toggled", GTK_SIGNAL_FUNC (use_editable_toggled), impl); >+ "toggled", GTK_SIGNAL_FUNC (use_editable_toggled), impl); > gtk_signal_connect (GTK_OBJECT (impl->w_use_cipher), > "toggled", GTK_SIGNAL_FUNC (use_editable_toggled), impl); > gtk_signal_connect (GTK_OBJECT (impl->w_use_ta), >@@ -1652,8 +1681,6 @@ > "changed", GTK_SIGNAL_FUNC (editable_changed), impl); > gtk_signal_connect (GTK_OBJECT (impl->w_x509userpass_username), > "changed", GTK_SIGNAL_FUNC (editable_changed), impl); >- gtk_signal_connect (GTK_OBJECT (impl->w_ta), >- "changed", GTK_SIGNAL_FUNC (editable_changed), impl); > > gtk_signal_connect (GTK_OBJECT (impl->w_button_ca), > "clicked", GTK_SIGNAL_FUNC (open_button_clicked), impl);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 244274
:
198331
| 200951 |
201971