diff options
author | Antti Kaijanmäki <antti@kaijanmaki.net> | 2008-08-18 08:30:28 +0000 |
---|---|---|
committer | Antti Kaijanmäki <antti@kaijanmaki.net> | 2008-08-18 08:30:28 +0000 |
commit | 2c21a2fe6b0498585fba0beb003ac8aa6351803c (patch) | |
tree | 9544edfe2ed9a6c96eda933c35fb5110f1d666c6 | |
parent | e04934d93efba622123809cc767488af673b2967 (diff) | |
download | NetworkManager-mbca.tar.gz |
keep up with trunkmbca
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/branches/mbca@3981 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
139 files changed, 6796 insertions, 7141 deletions
@@ -1,3 +1,350 @@ +2008-08-17 Dan Williams <dcbw@redhat.com> + + * include/NetworkManager.h + introspection/nm-device.xml + src/nm-gsm-device.c + - Finer-grained GSM registration failure error codes + +2008-08-17 Dan Williams <dcbw@redhat.com> + + * callouts/Makefile.am + src/Makefile.am + - Move dispatcher directory creation to callouts/Makefile.am + + * system-settings/plugins/keyfile/Makefile.am + - Create keyfile connections directory in DESTDIR (bgo #546833) + +2008-08-15 Dan Williams <dcbw@redhat.com> + + Do connection sharing in a cleaner manner; all required iptables rules + are now stored in the activation request and pertain only to the device + which is being shared to other computers. (rh #458625) + + * src/nm-activation-request.c + src/nm-activation-request.h + - (nm_act_request_add_share_rule): new function; add a sharing rule to + the activation request which will get torn down automatically when + the activation request dies + - (nm_act_request_set_shared): push sharing rules to iptables when sharing + is started, and tear them down when sharing is stopped + + * src/nm-device.c + - (start_sharing): start up sharing by doing the required iptables magic + - (share_init): poke the right bits of the kernel and load the right + modules for NAT + - (nm_device_activate_stage5_ip_config_commit): start NAT-ing this + connection if it's a 'shared' connection + + * src/NetworkManagerPolicy.c + - Remove all sharing stuff; done in the device code itself + +2008-08-15 Dan Williams <dcbw@redhat.com> + + * src/dnsmasq-manager/nm-dnsmasq-manager.c + - (create_dm_cmd_line): send the right router address + +2008-08-15 Dan Williams <dcbw@redhat.com> + + * src/ppp-manager/nm-ppp-manager.c + - (pppd_timed_out): ensure timeouts fail the connection + +2008-08-14 Dan Williams <dcbw@redhat.com> + + * src/nm-properties-changed-signal.c + src/nm-properties-changed-signal.h + - Add a property spec flag for "don't export this property" in + property changed signals + + * src/nm-hso-gsm-device.c + src/nm-gsm-device.c + src/nm-cdma-device.c + - Don't export monitor interface or netdev interface properties + +2008-08-14 Dan Williams <dcbw@redhat.com> + + * src/NetworkManagerPolicy.c + - (update_routing_and_dns): 'hso' devices can be default even if they + don't have a gateway + +2008-08-14 Dan Williams <dcbw@redhat.com> + + * src/nm-device.c + - (nm_device_deactivate_quickly): tear down activation request after + calling device-specific deactivation + + * src/nm-hso-gsm-device.c + - (real_deactivate_quickly): terminate connection when deactivating + +2008-08-14 Dan Williams <dcbw@redhat.com> + + * src/nm-activation-request.h + - Add HSO secrets caller + + * src/nm-gsm-device.c + src/nm-gsm-device.h + - (modem_wait_for_reply): add a 'user_data' argument so callers can pass + something to the callback function + - (set_apn, set_apn_done): call class dial function, not a static one + - (nm_gsm_device_class_init): add a class 'dial' function + + * src/nm-hal-manager.c + - (get_hso_netdev): find the hso-driven hardware's net device + - (modem_device_creator): recognize hso-driven hardware and create the + right type of device object for it + + * src/Makefile.am + src/nm-hso-gsm-device.c + src/nm-hso-gsm-device.h + - Implement support for devices driven by the 'hso' driver as a subclass + of NMGsmDevice + +2008-08-14 Dan Williams <dcbw@redhat.com> + + * src/NetworkManagerSystem.c + - (nm_system_device_is_up_with_iface): ensure ifreq is cleared before using + - (nm_system_device_set_up_down_with_iface): cleanups; only return + success if the operation really was successful + +2008-08-14 Dan Williams <dcbw@redhat.com> + + * src/nm-netlink-monitor.c + src/nm-netlink-monitor.h + src/nm-device-ethernet.c + - (nm_netlink_monitor_request_status): return an error on failure + - (constructor): don't segfault on missing error + +2008-08-13 Dan Williams <dcbw@redhat.com> + + * callouts/nm-dispatcher-action.c + - Add IP4 config info to script environment + +2008-08-12 Dan Williams <dcbw@redhat.com> + + * src/nm-device.c + - (nm_device_set_ip4_config): don't touch hostnames here; distros + that want to use DHCP hostnames should use dispatcher scripts + for that + + * src/NetworkManagerSystem.h + src/backends/NetworkManagerArch.c + src/backends/NetworkManagerDebian.c + src/backends/NetworkManagerFrugalware.c + src/backends/NetworkManagerGeneric.c + src/backends/NetworkManagerGeneric.h + src/backends/NetworkManagerGentoo.c + src/backends/NetworkManagerMandriva.c + src/backends/NetworkManagerPaldo.c + src/backends/NetworkManagerRedHat.c + src/backends/NetworkManagerSlackware.c + src/backends/NetworkManagerSuSE.c + - Remove nm_system_set_hostname(), no longer used + + * src/backends/Makefile.am + src/backends/shvar.c + src/backends/shvar.h + - Remove shvar.*; no longer used + +2008-08-12 Dan Williams <dcbw@redhat.com> + + Revert most of the 'hostname' patch. Too much stuff still breaks when + hostname is updated at runtime. Distros or users who want hostname updates + can use dispatcher scripts to update the hostname if they need it. + +2008-08-12 Dan Williams <dcbw@redhat.com> + + * introspection/nm-settings-system.xml + system-settings/src/dbus-settings.c + system-settings/src/dbus-settings.h + - Add a 'Hostname' property (rw) which represents the configured + hostname and domain of the system, if any + + * system-settings/src/nm-system-config-error.c + system-settings/src/nm-system-config-error.h + system-settings/src/nm-system-config-interface.c + system-settings/src/nm-system-config-interface.h + - Add a 'hostname' property to the plugin interface + - Add a method to send updated hostname to plugins to save in their + backing configuration store + + * system-settings/plugins/keyfile/nm-keyfile-connection.c + system-settings/plugins/keyfile/plugin.c + system-settings/plugins/keyfile/writer.c + system-settings/plugins/keyfile/writer.h + system-settings/plugins/ifcfg-suse/plugin.c + - Add minimal hostname support + + * system-settings/plugins/ifcfg-fedora/plugin.c + - Add support for updating system hostname in /etc/sysconfig/network + +2008-08-12 Dan Williams <dcbw@redhat.com> + + * system-settings/plugins/ifcfg-fedora/shvar.c + system-settings/plugins/ifcfg-fedora/shvar.c + - Fix double-free caused by svSetValue() followed by svCloseFile() + +2008-08-12 Tambet Ingo <tambet@gmail.com> + + * Makefile.am: Fix distcheck. + +2008-08-12 Tambet Ingo <tambet@gmail.com> + + * libnm-glib/*.c. Document some more. + +2008-08-12 Tambet Ingo <tambet@gmail.com> + + Start documenting libnm-glib public API using gtk-doc. + + * libnm-glib/nm-serial-device.c: + * libnm-glib/nm-object.c: + * libnm-glib/nm-gsm-device.c: + * libnm-glib/nm-device.c: + * libnm-glib/nm-device-wifi.c: + * libnm-glib/nm-device-ethernet.c: + * libnm-glib/nm-client.c: + * libnm-glib/nm-cdma-device.c: Document the public API. + + * docs/libnm-glib/libnm-glib.types: Implement. + + * docs/libnm-glib/Makefile.am: Implement. + + * autogen.sh: + * configure.in: + * Makefile.am: Add gtk-doc support. + +2008-08-12 Tambet Ingo <tambet@gmail.com> + + * src/backends/*: Get rid of nm_system_should_modify_resolv_conf(). + + * src/named-manager/nm-named-manager.c (rewrite_resolv_conf): Calculate + the composite result of all the IP4 configurations and call a distro + specific update_resolv_conf(). + (update_resolv_conf): Implement one for directly writing to + /etc/resolv.conf and one for opensuse to call netconfig. + +2008-08-11 Dan Williams <dcbw@redhat.com> + + * src/ppp-manager/nm-ppp-manager.c + - (impl_ppp_manager_need_secrets): pass interface as required + +2008-08-11 Dan Williams <dcbw@redhat.com> + + Merge the vpn-properties setting with the vpn setting since it was pointless + to keep both of them around. Convert the vpn 'data' hash table to a hash + of string:string (instead of string:variant) so that system settings plugins + can have an easier time dealing with the arbitrary key/value pairs. + +2008-08-11 Dan Williams <dcbw@redhat.com> + + * libnm-util/nm-utils.c + - (nm_utils_register_value_transformations): add value transform for + a hash table of string:string + +2008-08-10 Dan Williams <dcbw@redhat.com> + + * libnm-glib/nm-vpn-plugin.c + - (nm_vpn_plugin_connect): stop plugin after connection failure from + an idle handler so the Connect reply gets delivered before the + stop StateChanged signal + +2008-08-10 Dan Williams <dcbw@redhat.com> + + * src/nm-ip4-config.c + - (get_property): use common ip4 address/route conversion functions + - (nm_ip4_config_replace_address, nm_ip4_config_replace_route): should + copy the new route here, not take ownership + +2008-08-08 Tambet Ingo <tambet@gmail.com> + + * system-settings/plugins/ifcfg-suse/parser.c (make_ip4_setting): + Update the IP4 setting's method name. + +2008-08-07 Dan Williams <dcbw@redhat.com> + + * introspection/nm-ip4-config.xml + libnm-glib/libnm-glib-test.c + libnm-glib/nm-ip4-config.c + libnm-glib/nm-ip4-config.h + src/NetworkManagerSystem.h + src/backends/NetworkManagerArch.c + src/backends/NetworkManagerDebian.c + src/backends/NetworkManagerFrugalware.c + src/backends/NetworkManagerGeneric.c + src/backends/NetworkManagerGeneric.h + src/backends/NetworkManagerGentoo.c + src/backends/NetworkManagerMandriva.c + src/backends/NetworkManagerPaldo.c + src/backends/NetworkManagerRedHat.c + src/backends/NetworkManagerSlackware.c + src/backends/NetworkManagerSuSE.c + src/dhcp-manager/nm-dhcp-manager.c + src/nm-device.c + src/nm-ip4-config.c + src/nm-ip4-config.h + - Remove NIS logic; should be done from dispatcher scripts instead + +2008-08-07 Dan Williams <dcbw@redhat.com> + + * src/dhcp-manager/nm-dhcp-manager.c + - (nm_dhcp_manager_get_ip4_config): fix regression which caused + mis-handling of DHCP responses that returned more than one router + (found by Grant Williamson) + +2008-08-07 Dan Williams <dcbw@redhat.com> + + * callouts/nm-dispatcher-action.c + - (nm_dispatcher_action): grab device path and create the device; pass + the device's DHCP4 config to script caller + - (dispatch_scripts): dump the DHCP4 config to the environment of called + scripts + + * libnm-glib/nm-dhcp4-config.c + libnm-glib/nm-dhcp4-config.h + - (nm_dhcp4_config_get_options): expose + - (nm_dhcp4_config_get_one_option): renamed from nm_dhcp4_config_get_option + +2008-08-07 Dan Williams <dcbw@redhat.com> + + * include/NetworkManager.h + - Add the DHCP4Config D-Bus interface + + * libnm-glib/Makefile.am + libnm-glib/nm-dhcp4-config.c + libnm-glib/nm-dhcp4-config.h + - Handle DHCP4 config objects exported by NM over D-Bus + + * libnm-glib/nm-device.c + libnm-glib/nm-device.h + - Add a 'dhcp4-config' property + + * libnm-glib/libnm-glib-test.c + - Print out DHCP4 config for devices + - Fix some crashes when no connections are active + + * src/nm-device-interface.c + src/nm-device.c + src/nm-dhcp4-config.c + src/nm-dhcp4-config.h + - Treat dhcp4-config object as an object path at the D-Bus interface so + that when it doesn't exist we can proxy it as "/" which dbus-glib + doesn't let us do when the property type is G_TYPE_OBJECT + +2008-08-07 Dan Williams <dcbw@redhat.com> + + * src/NetworkManager.c + src/NetworkManagerSystem.h + src/backends/NetworkManagerArch.c + src/backends/NetworkManagerDebian.c + src/backends/NetworkManagerFrugalware.c + src/backends/NetworkManagerGeneric.c + src/backends/NetworkManagerGeneric.h + src/backends/NetworkManagerGentoo.c + src/backends/NetworkManagerMandriva.c + src/backends/NetworkManagerPaldo.c + src/backends/NetworkManagerRedHat.c + src/backends/NetworkManagerSlackware.c + src/backends/NetworkManagerSuSE.c + - (nm_system_init, nm_system_kill_all_dhcp_daemons): remove, unused + 2008-08-06 Dan Williams <dcbw@redhat.com> * libnm-glib/nm-ip4-config.c diff --git a/Makefile.am b/Makefile.am index ccc9c92b71..89fb2ae057 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,8 @@ SUBDIRS += \ callouts \ system-settings \ tools \ - policy + policy \ + docs/libnm-glib EXTRA_DIST = \ CONTRIBUTING \ @@ -49,6 +50,8 @@ EXTRA_DIST = \ intltool-merge.in \ intltool-update.in +DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc + DISTCLEANFILES = intltool-extract intltool-merge intltool-update pkgconfigdir = $(libdir)/pkgconfig diff --git a/autogen.sh b/autogen.sh index 8d402e4cb7..176102f364 100755 --- a/autogen.sh +++ b/autogen.sh @@ -14,6 +14,7 @@ PKG_NAME=NetworkManager } (cd $srcdir; + gtkdocize || exit 1 autoreconf --install --symlink && intltoolize --force && autoreconf && diff --git a/callouts/Makefile.am b/callouts/Makefile.am index 2974645a91..83ab7669d9 100644 --- a/callouts/Makefile.am +++ b/callouts/Makefile.am @@ -59,6 +59,7 @@ nm_dispatcher_action_CPPFLAGS = \ nm_dispatcher_action_LDADD = \ $(DBUS_LIBS) \ $(GTHREAD_LIBS) \ + $(top_builddir)/libnm-glib/libnm_glib.la \ $(top_builddir)/libnm-util/libnm-util.la nm-dispatcher-glue.h: nm-dispatcher.xml @@ -77,6 +78,10 @@ edit = @sed \ -e 's|@localstatedir[@]|$(localstatedir)|g' \ -e 's|@libexecdir[@]|$(libexecdir)|g' +dispatcherdir=$(sysconfdir)/NetworkManager/dispatcher.d +install-data-hook: + $(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir) + BUILT_SOURCES = nm-dispatcher-glue.h CLEANFILES = $(BUILT_SOURCES) $(dbusactivation_DATA) diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c index 7919425b30..1c47ca2099 100644 --- a/callouts/nm-dispatcher-action.c +++ b/callouts/nm-dispatcher-action.c @@ -29,6 +29,7 @@ #include <sys/stat.h> #include <sys/wait.h> #include <errno.h> +#include <arpa/inet.h> #include <glib.h> #include <dbus/dbus.h> @@ -37,12 +38,16 @@ #include <NetworkManager.h> #include <libnm-util/nm-connection.h> +#include <libnm-util/nm-setting-ip4-config.h> +#include <libnm-glib/nm-dhcp4-config.h> +#include <libnm-glib/nm-device.h> #include "nm-dispatcher-action.h" #define NMD_SCRIPT_DIR SYSCONFDIR "/NetworkManager/dispatcher.d" static GMainLoop *loop = NULL; +static gboolean debug = FALSE; static gboolean quit_timeout_cb (gpointer user_data); @@ -214,16 +219,170 @@ child_setup (gpointer user_data G_GNUC_UNUSED) setpgid (pid, pid); } +typedef struct { + char **envp; + guint32 i; +} EnvAddInfo; + +static void +add_one_option_to_envp (gpointer key, gpointer value, gpointer user_data) +{ + EnvAddInfo *info = (EnvAddInfo *) user_data; + char *ucased; + + ucased = g_ascii_strup (key, -1); + info->envp[info->i++] = g_strdup_printf ("DHCP4_%s=%s", ucased, (char *) value); + g_free (ucased); +} + +static char ** +construct_envp (NMIP4Config *ip4_config, NMDHCP4Config *dhcp4_config) +{ + guint32 env_size = 0; + char **envp; + guint32 envp_idx = 0; + GHashTable *options = NULL; + GSList *addresses, *routes, *iter; + GArray *nameservers; + GPtrArray *domains; + guint32 num, i; + GString *tmp; + + if (!ip4_config) + return g_new0 (char *, 1); + + addresses = (GSList *) nm_ip4_config_get_addresses (ip4_config); + nameservers = (GArray *) nm_ip4_config_get_nameservers (ip4_config); + domains = (GPtrArray *) nm_ip4_config_get_domains (ip4_config); + routes = (GSList *) nm_ip4_config_get_routes (ip4_config); + + env_size = g_slist_length (addresses) + + 1 /* addresses length */ + + 1 /* nameservers */ + + 1 /* domains */ + + 1 /* hostname */ + + g_slist_length (routes) + + 1 /* routes length */; + + if (dhcp4_config) { + options = nm_dhcp4_config_get_options (dhcp4_config); + env_size += g_hash_table_size (options); + } + + envp = g_new0 (char *, env_size + 1); + + /* IP4 config stuff */ + for (iter = addresses, num = 0; iter; iter = g_slist_next (iter)) { + NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data; + char str_addr[INET_ADDRSTRLEN + 1]; + char str_gw[INET_ADDRSTRLEN + 1]; + struct in_addr tmp_addr; + + memset (str_addr, 0, sizeof (str_addr)); + tmp_addr.s_addr = addr->address; + if (!inet_ntop (AF_INET, &tmp_addr, str_addr, sizeof (str_addr))) + continue; + + memset (str_gw, 0, sizeof (str_gw)); + tmp_addr.s_addr = addr->gateway; + inet_ntop (AF_INET, &tmp_addr, str_gw, sizeof (str_gw)); + + tmp = g_string_sized_new (25 + strlen (str_addr) + strlen (str_gw)); + g_string_append_printf (tmp, "IP4_ADDRESS_%d=%s/%d %s", num++, str_addr, addr->prefix, str_gw); + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + if (num) + envp[envp_idx++] = g_strdup_printf ("IP4_NUM_ADDRESSES=%d", num); + + if (nameservers && nameservers->len) { + gboolean first = TRUE; + + tmp = g_string_new ("IP4_NAMESERVERS="); + for (i = 0; i < nameservers->len; i++) { + struct in_addr addr; + char buf[INET_ADDRSTRLEN + 1]; + + addr.s_addr = g_array_index (nameservers, guint32, i); + memset (buf, 0, sizeof (buf)); + if (inet_ntop (AF_INET, &addr, buf, sizeof (buf))) { + if (!first) + g_string_append_c (tmp, ' '); + g_string_append (tmp, buf); + first = FALSE; + } + } + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + + if (domains && domains->len) { + tmp = g_string_new ("IP4_DOMAINS="); + for (i = 0; i < domains->len; i++) { + if (i > 0) + g_string_append_c (tmp, ' '); + g_string_append (tmp, (char *) g_ptr_array_index (domains, i)); + } + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + + for (iter = routes, num = 0; iter; iter = g_slist_next (iter)) { + NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data; + char str_addr[INET_ADDRSTRLEN + 1]; + char str_nh[INET_ADDRSTRLEN + 1]; + struct in_addr tmp_addr; + + memset (str_addr, 0, sizeof (str_addr)); + tmp_addr.s_addr = route->address; + if (!inet_ntop (AF_INET, &tmp_addr, str_addr, sizeof (str_addr))) + continue; + + memset (str_nh, 0, sizeof (str_nh)); + tmp_addr.s_addr = route->next_hop; + inet_ntop (AF_INET, &tmp_addr, str_nh, sizeof (str_nh)); + + tmp = g_string_sized_new (30 + strlen (str_addr) + strlen (str_nh)); + g_string_append_printf (tmp, "IP4_ROUTE_%d=%s/%d %s %d", num++, str_addr, route->prefix, str_nh, route->metric); + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + envp[envp_idx++] = g_strdup_printf ("IP4_NUM_ROUTES=%d", num); + + /* DHCP stuff */ + if (dhcp4_config && options) { + EnvAddInfo info; + + info.envp = envp; + info.i = envp_idx; + g_hash_table_foreach (options, add_one_option_to_envp, &info); + } + + if (debug) { + char **p; + + g_message ("-----------------------------------------"); + for (p = envp; *p; p++) + g_message (" %s", *p); + g_message ("\n"); + } + + return envp; +} + static void dispatch_scripts (const char *action, const char *iface, const char *parent_iface, - NMDeviceType type) + NMDeviceType type, + NMIP4Config *ip4_config, + NMDHCP4Config *dhcp4_config) { GDir *dir; const char *filename; GSList *scripts = NULL, *iter; GError *error = NULL; + char **envp = NULL; if (!(dir = g_dir_open (NMD_SCRIPT_DIR, 0, &error))) { g_warning ("g_dir_open() could not open '" NMD_SCRIPT_DIR "'. '%s'", @@ -261,9 +420,10 @@ dispatch_scripts (const char *action, } g_dir_close (dir); + envp = construct_envp (ip4_config, dhcp4_config); + for (iter = scripts; iter; iter = g_slist_next (iter)) { gchar *argv[4]; - gchar *envp[1] = { NULL }; gint status = -1; argv[0] = (char *) iter->data; @@ -286,6 +446,8 @@ dispatch_scripts (const char *action, } } + g_strfreev (envp); + g_slist_foreach (scripts, (GFunc) g_free, NULL); g_slist_free (scripts); } @@ -303,6 +465,10 @@ nm_dispatcher_action (Handler *h, char *iface = NULL; char *parent_iface = NULL; NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN; + NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN; + NMDevice *device = NULL; + NMDHCP4Config *dhcp4_config = NULL; + NMIP4Config *ip4_config = NULL; GValue *value; /* Back off the quit timeout */ @@ -322,6 +488,7 @@ nm_dispatcher_action (Handler *h, *error = NULL; } + /* interface name */ value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_INTERFACE); if (!value || !G_VALUE_HOLDS_STRING (value)) { g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_INTERFACE "!"); @@ -329,6 +496,7 @@ nm_dispatcher_action (Handler *h, } iface = (char *) g_value_get_string (value); + /* IP interface name */ value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_IP_INTERFACE); if (value) { if (!G_VALUE_HOLDS_STRING (value)) { @@ -339,6 +507,7 @@ nm_dispatcher_action (Handler *h, iface = (char *) g_value_get_string (value); } + /* Device type */ value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_TYPE); if (!value || !G_VALUE_HOLDS_UINT (value)) { g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_TYPE "!"); @@ -346,7 +515,32 @@ nm_dispatcher_action (Handler *h, } type = g_value_get_uint (value); - dispatch_scripts (action, iface, parent_iface, type); + /* Device state */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_STATE); + if (!value || !G_VALUE_HOLDS_UINT (value)) { + g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_STATE "!"); + goto out; + } + dev_state = g_value_get_uint (value); + + /* device itself */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_PATH); + if (!value || (G_VALUE_TYPE (value) != DBUS_TYPE_G_OBJECT_PATH)) { + g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_PATH "!"); + goto out; + } + device = NM_DEVICE (nm_device_new (d->g_connection, (const char *) g_value_get_boxed (value))); + + /* Get the DHCP4 config */ + if (device && (dev_state == NM_DEVICE_STATE_ACTIVATED)) { + dhcp4_config = nm_device_get_dhcp4_config (device); + ip4_config = nm_device_get_ip4_config (device); + } + + dispatch_scripts (action, iface, parent_iface, type, ip4_config, dhcp4_config); + + if (device) + g_object_unref (device); out: return TRUE; @@ -519,7 +713,6 @@ main (int argc, char **argv) Dispatcher *d = g_malloc0 (sizeof (Dispatcher)); GOptionContext *opt_ctx; GError *error = NULL; - gboolean debug = FALSE; gboolean persist = FALSE; GOptionEntry entries[] = { diff --git a/configure.in b/configure.in index 60f4f9865a..4a581c1ee5 100644 --- a/configure.in +++ b/configure.in @@ -170,7 +170,7 @@ if test "$ac_have_iwevgenie" = no; then AC_MSG_ERROR(wireless-tools >= 28pre9 not installed or not functional) fi -PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.75) +PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.74) ##### Find out the version of DBUS we're using dbus_version=`pkg-config --modversion dbus-1` @@ -407,6 +407,8 @@ else AC_MSG_RESULT(no) fi +GTK_DOC_CHECK(1.0) + AC_CONFIG_FILES([ Makefile include/Makefile @@ -457,6 +459,7 @@ man/NetworkManager.8 man/nm-tool.1 po/Makefile.in policy/Makefile +docs/libnm-glib/Makefile NetworkManager.pc ]) AC_OUTPUT diff --git a/docs/libnm-glib/Makefile.am b/docs/libnm-glib/Makefile.am new file mode 100644 index 0000000000..652bd447d9 --- /dev/null +++ b/docs/libnm-glib/Makefile.am @@ -0,0 +1,79 @@ +## Process this file with automake to produce Makefile.in +AUTOMAKE_OPTIONS = 1.6 + +# The name of the module +DOC_MODULE=libnm-glib + +# The top-level SGML file. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting functions and macros. +DOC_SOURCE_DIR=../../libnm-glib + +# Extra options to supply to gtkdoc-scan. +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-scangobj. +SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();' + +# Extra options to supply to gtkdoc-mkdb. +MKDB_OPTIONS=--sgml-mode --output-format=xml + +# Extra options to supply to gtkdoc-fixref. +FIXXREF_OPTIONS= + +# Used for dependencies. +HFILE_GLOB= +CFILE_GLOB= + +# Header files to ignore when scanning. +IGNORE_HFILES= \ + nm-dbus-utils.h \ + nm-device-private.h \ + nm-object-cache.h \ + nm-object-private.h \ + nm-types-private.h \ + nm-access-point-bindings.h \ + nm-client-bindings.h \ + nm-device-bindings.h \ + nm-device-ethernet-bindings.h \ + nm-device-wifi-bindings.h \ + nm-exported-connection-glue.h \ + nm-exported-connection-bindings.h \ + nm-settings-glue.h \ + nm-settings-bindings.h \ + nm-settings-system-bindings.h \ + nm-vpn-connection-bindings.h \ + nm-vpn-plugin-glue.h \ + nm-active-connection-bindings.h \ + nm-ip4-config-bindings.h \ + nm-dhcp4-config-bindings.h + +# Images to copy into HTML directory. +HTML_IMAGES = + +# Extra XML files that are included by $(DOC_MAIN_SGML_FILE). +content_files = + +# Other files to distribute. +extra_files = + + +# CFLAGS and LDFLAGS for compiling scan program. Only needed +# if $(DOC_MODULE).types is non-empty. +GTKDOC_CFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/marshallers \ + -I$(top_srcdir)/libnm-glib \ + $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) + +GTKDOC_LIBS = $(top_builddir)/libnm-glib/libnm_glib.la + + +# include common portion ... +include $(top_srcdir)/gtk-doc.make + diff --git a/docs/libnm-glib/libnm-glib-docs.sgml b/docs/libnm-glib/libnm-glib-docs.sgml new file mode 100644 index 0000000000..5a3ca81b86 --- /dev/null +++ b/docs/libnm-glib/libnm-glib-docs.sgml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude"> + <bookinfo> + <title>libnm-glib Reference Manual</title> + <releaseinfo> + for libnm-glib [VERSION] + The latest version of this documentation can be found on-line at + <ulink role="online-location" url="http://[SERVER]/libnm-glib/index.html">http://[SERVER]/libnm-glib/</ulink>. + </releaseinfo> + </bookinfo> + + <chapter> + <title>[Insert title here]</title> + <xi:include href="xml/nm-access-point.xml"/> + <xi:include href="xml/nm-cdma-device.xml"/> + <xi:include href="xml/nm-client.xml"/> + <xi:include href="xml/nm-gsm-device.xml"/> + <xi:include href="xml/nm-device.xml"/> + <xi:include href="xml/nm-ip4-config.xml"/> + <xi:include href="xml/nm-object.xml"/> + <xi:include href="xml/nm-settings.xml"/> + <xi:include href="xml/nm-vpn-connection.xml"/> + <xi:include href="xml/nm-vpn-plugin.xml"/> + <xi:include href="xml/nm-dbus-settings-system.xml"/> + <xi:include href="xml/nm-active-connection.xml"/> + <xi:include href="xml/nm-device-ethernet.xml"/> + <xi:include href="xml/nm-device-wifi.xml"/> + <xi:include href="xml/nm-dbus-connection.xml"/> + <xi:include href="xml/nm-serial-device.xml"/> + <xi:include href="xml/nm-dbus-settings.xml"/> + <xi:include href="xml/nm-dhcp4-config.xml"/> + <xi:include href="xml/nm-vpn-plugin-ui-interface.xml"/> + <xi:include href="xml/libnm_glib.xml"/> + <xi:include href="xml/nm-types.xml"/> + </chapter> +</book> diff --git a/docs/libnm-glib/libnm-glib.types b/docs/libnm-glib/libnm-glib.types new file mode 100644 index 0000000000..8c5fcf754e --- /dev/null +++ b/docs/libnm-glib/libnm-glib.types @@ -0,0 +1,23 @@ +#include <nm-client.h> +#include <nm-device-ethernet.h> +#include <nm-device-wifi.h> +#include <nm-cdma-device.h> +#include <nm-gsm-device.h> +#include <nm-serial-device.h> +#include <nm-access-point.h> +#include <nm-ip4-config.h> +#include <nm-active-connection.h> +#include <nm-dhcp4-config.h> + +nm_object_get_type +nm_client_get_type +nm_device_get_type +nm_device_ethernet_get_type +nm_device_wifi_get_type +nm_gsm_device_get_type +nm_cdma_device_get_type +nm_serial_device_get_type +nm_access_point_get_type +nm_ip4_config_get_type +nm_active_connection_get_type +nm_dhcp4_config_get_type diff --git a/include/NetworkManager.h b/include/NetworkManager.h index e2ef802da1..825c22af5c 100644 --- a/include/NetworkManager.h +++ b/include/NetworkManager.h @@ -39,6 +39,7 @@ #define NM_DBUS_INTERFACE_CDMA_DEVICE NM_DBUS_INTERFACE_DEVICE ".Cdma" #define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active" #define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config" +#define NM_DBUS_INTERFACE_DHCP4_CONFIG NM_DBUS_INTERFACE ".DHCP4Config" #define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings" @@ -306,6 +307,15 @@ typedef enum { /* Failed to select the specified APN */ NM_DEVICE_STATE_REASON_GSM_APN_FAILED, + /* Not searching for networks */ + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING, + + /* Network registration denied */ + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED, + + /* Network registration timed out */ + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT, + /* Failed to register with the requested network */ NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED, diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml index eb545a3c68..22b636cbc2 100644 --- a/introspection/nm-device.xml +++ b/introspection/nm-device.xml @@ -290,12 +290,27 @@ Failed to select the specified GSM APN. </tp:docstring> </tp:enumvalue> - <tp:enumvalue suffix="GSM_REGISTRATION_FAILED" value="30"> + <tp:enumvalue suffix="GSM_REGISTRATION_NOT_SEARCHING" value="30"> + <tp:docstring> + Not searching for networks. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="GSM_REGISTRATION_DENIED" value="31"> + <tp:docstring> + Network registration was denied. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="GSM_REGISTRATION_TIMEOUT" value="32"> + <tp:docstring> + Network registration timed out. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="GSM_REGISTRATION_FAILED" value="33"> <tp:docstring> Failed to register with the requested GSM network. </tp:docstring> </tp:enumvalue> - <tp:enumvalue suffix="GSM_PIN_CHECK_FAILED" value="31"> + <tp:enumvalue suffix="GSM_PIN_CHECK_FAILED" value="34"> <tp:docstring> PIN check failed. </tp:docstring> diff --git a/introspection/nm-ip4-config.xml b/introspection/nm-ip4-config.xml index a4eea8163c..87ad489104 100644 --- a/introspection/nm-ip4-config.xml +++ b/introspection/nm-ip4-config.xml @@ -14,12 +14,6 @@ <property name="Domains" type="as" access="read"> <tp:docstring>A list of domains this address belongs to.</tp:docstring> </property> - <property name="NisDomain" type="s" access="read"> - <tp:docstring>The NIS domain this address belongs to.</tp:docstring> - </property> - <property name="NisServers" type="au" access="read"> - <tp:docstring>The NIS servers associated with this address.</tp:docstring> - </property> <property name="Routes" type="aau" access="read"> <tp:docstring>Tuples of IPv4 route/prefix/next-hop/metric.</tp:docstring> </property> diff --git a/introspection/nm-settings-system.xml b/introspection/nm-settings-system.xml index c7579714ef..1bea6a8ba4 100644 --- a/introspection/nm-settings-system.xml +++ b/introspection/nm-settings-system.xml @@ -8,14 +8,14 @@ <method name="AddConnection"> <tp:docstring> - Add new connection. + Add new connection. </tp:docstring> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_add_connection"/> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <arg name="connection" type="a{sa{sv}}" direction="in"> - <tp:docstring> - Connection properties. - </tp:docstring> + <tp:docstring> + Connection properties. + </tp:docstring> </arg> </method> diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am index 3b2fd8d313..d3c73b61c2 100644 --- a/libnm-glib/Makefile.am +++ b/libnm-glib/Makefile.am @@ -16,7 +16,9 @@ BUILT_SOURCES = \ nm-settings-system-bindings.h \ nm-vpn-connection-bindings.h \ nm-vpn-plugin-glue.h \ - nm-active-connection-bindings.h + nm-active-connection-bindings.h \ + nm-ip4-config-bindings.h \ + nm-dhcp4-config-bindings.h lib_LTLIBRARIES = libnm_glib.la libnm_glib_vpn.la @@ -49,7 +51,8 @@ libnminclude_HEADERS = \ nm-active-connection.h \ nm-dbus-connection.h \ nm-dbus-settings.h \ - nm-dbus-settings-system.h + nm-dbus-settings-system.h \ + nm-dhcp4-config.h libnm_glib_la_SOURCES = \ libnm_glib.c \ @@ -76,7 +79,8 @@ libnm_glib_la_SOURCES = \ nm-active-connection.c \ nm-dbus-connection.c \ nm-dbus-settings.c \ - nm-dbus-settings-system.c + nm-dbus-settings-system.c \ + nm-dhcp4-config.c libnm_glib_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ @@ -138,6 +142,12 @@ nm-vpn-plugin-glue.h: $(top_srcdir)/introspection/nm-vpn-plugin.xml nm-active-connection-bindings.h: $(top_srcdir)/introspection/nm-active-connection.xml dbus-binding-tool --prefix=nm_active_connection --mode=glib-client --output=$@ $< +nm-ip4-config-bindings.h: $(top_srcdir)/introspection/nm-ip4-config.xml + dbus-binding-tool --prefix=nm_ip4_config --mode=glib-client --output=$@ $< + +nm-dhcp4-config-bindings.h: $(top_srcdir)/introspection/nm-dhcp4-config.xml + dbus-binding-tool --prefix=nm_dhcp4_config --mode=glib-client --output=$@ $< + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnm_glib.pc libnm_glib_vpn.pc diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index 80844f4950..daa3abf832 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -106,18 +106,30 @@ dump_ip4_config (NMIP4Config *cfg) for (i = 0; i < ptr_array->len; i++) g_print ("\t%s\n", (const char *) g_ptr_array_index (ptr_array, i)); } +} - g_print ("IP4 NIS domain: %s\n", nm_ip4_config_get_nis_domain (cfg)); +static void +print_one_dhcp4_option (gpointer key, gpointer data, gpointer user_data) +{ + const char *option = (const char *) key; + const char *value = (const char *) data; - array = nm_ip4_config_get_nis_servers (cfg); - if (array) { - g_print ("IP4 NIS servers:\n"); - for (i = 0; i < array->len; i++) { - tmp = ip4_address_as_string (g_array_index (array, guint32, i)); - g_print ("\t%s\n", tmp); - g_free (tmp); - } - } + g_print (" %s: %s\n", option, value); +} + +static void +dump_dhcp4_config (NMDHCP4Config *config) +{ + GHashTable *options = NULL; + + if (!config) + return; + + g_print ("\nDHCP4 Options:\n"); + g_print ("-------------------------------------\n"); + + g_object_get (G_OBJECT (config), NM_DHCP4_CONFIG_OPTIONS, &options, NULL); + g_hash_table_foreach (options, print_one_dhcp4_option, NULL); } static void @@ -206,6 +218,8 @@ dump_device (NMDevice *device) dump_wired (NM_DEVICE_ETHERNET (device)); else if (NM_IS_DEVICE_WIFI (device)) dump_wireless (NM_DEVICE_WIFI (device)); + + dump_dhcp4_config (nm_device_get_dhcp4_config (device)); } static gboolean @@ -238,7 +252,7 @@ active_connections_changed (NMClient *client, GParamSpec *pspec, gpointer user_d g_print ("Active connections changed:\n"); connections = nm_client_get_active_connections (client); - for (i = 0; i < connections->len; i++) { + for (i = 0; connections && (i < connections->len); i++) { NMActiveConnection *connection; const GPtrArray *devices; @@ -266,7 +280,7 @@ test_get_active_connections (NMClient *client) g_print ("Active connections:\n"); connections = nm_client_get_active_connections (client); - for (i = 0; i < connections->len; i++) { + for (i = 0; connections && (i < connections->len); i++) { const GPtrArray *devices; g_print (" %s\n", nm_object_get_path (g_ptr_array_index (connections, i))); diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c index c06a161fd9..fba7532501 100644 --- a/libnm-glib/nm-access-point.c +++ b/libnm-glib/nm-access-point.c @@ -53,6 +53,15 @@ enum { #define DBUS_PROP_MAX_BITRATE "MaxBitrate" #define DBUS_PROP_STRENGTH "Strength" +/** + * nm_access_point_new: + * @connection: the #DBusGConnection + * @path: the DBusobject path of the access point + * + * Creates a new #NMAccessPoint. + * + * Returns: a new access point + **/ GObject * nm_access_point_new (DBusGConnection *connection, const char *path) { @@ -65,6 +74,14 @@ nm_access_point_new (DBusGConnection *connection, const char *path) NULL); } +/** + * nm_access_point_get_flags: + * @ap: a #NMAccessPoint + * + * Gets the flags of the access point + * + * Returns: the flags + **/ guint32 nm_access_point_get_flags (NMAccessPoint *ap) { @@ -82,6 +99,14 @@ nm_access_point_get_flags (NMAccessPoint *ap) return priv->flags; } +/** + * nm_access_point_get_wpa_flags: + * @ap: a #NMAccessPoint + * + * Gets the WPA flags of the access point. + * + * Returns: the WPA flags + **/ guint32 nm_access_point_get_wpa_flags (NMAccessPoint *ap) { @@ -99,6 +124,14 @@ nm_access_point_get_wpa_flags (NMAccessPoint *ap) return priv->wpa_flags; } +/** + * nm_access_point_get_rsn_flags: + * @ap: a #NMAccessPoint + * + * Gets the RSN flags of the access point. + * + * Returns: the RSN flags + **/ guint32 nm_access_point_get_rsn_flags (NMAccessPoint *ap) { @@ -116,6 +149,15 @@ nm_access_point_get_rsn_flags (NMAccessPoint *ap) return priv->rsn_flags; } +/** + * nm_access_point_get_ssid: + * @ap: a #NMAccessPoint + * + * Gets the SSID of the access point. + * + * Returns: the #GByteArray containing the SSID. This is the internal copy used by the + * access point, and must not be modified. + **/ const GByteArray * nm_access_point_get_ssid (NMAccessPoint *ap) { @@ -133,6 +175,14 @@ nm_access_point_get_ssid (NMAccessPoint *ap) return priv->ssid; } +/** + * nm_access_point_get_frequency: + * @ap: a #NMAccessPoint + * + * Gets the frequency of the access point. + * + * Returns: the frequency + **/ guint32 nm_access_point_get_frequency (NMAccessPoint *ap) { @@ -150,6 +200,15 @@ nm_access_point_get_frequency (NMAccessPoint *ap) return priv->frequency; } +/** + * nm_access_point_get_hw_address: + * @ap: a #NMAccessPoint + * + * Gets the hardware (MAC) address of the access point. + * + * Returns: the hardware address of the access point. This is the internal string used by the + * access point and must not be modified. + **/ const char * nm_access_point_get_hw_address (NMAccessPoint *ap) { @@ -167,6 +226,14 @@ nm_access_point_get_hw_address (NMAccessPoint *ap) return priv->hw_address; } +/** + * nm_access_point_get_mode: + * @ap: a #NMAccessPoint + * + * Gets the mode of the access point. + * + * Returns: the mode + **/ NM80211Mode nm_access_point_get_mode (NMAccessPoint *ap) { @@ -184,6 +251,14 @@ nm_access_point_get_mode (NMAccessPoint *ap) return priv->mode; } +/** + * nm_access_point_get_max_bitrate: + * @ap: a #NMAccessPoint + * + * Gets the maximum bit rate of the access point. + * + * Returns: the maximum bit rate + **/ guint32 nm_access_point_get_max_bitrate (NMAccessPoint *ap) { @@ -201,6 +276,14 @@ nm_access_point_get_max_bitrate (NMAccessPoint *ap) return priv->max_bitrate; } +/** + * nm_access_point_get_strength: + * @ap: + * + * Gets the current signal strength of the access point. + * + * Returns: the signal strength + **/ guint8 nm_access_point_get_strength (NMAccessPoint *ap) { @@ -371,6 +454,12 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) object_class->finalize = finalize; /* properties */ + + /** + * NMAccessPoint:flags: + * + * The flags of the access point. + **/ g_object_class_install_property (object_class, PROP_FLAGS, g_param_spec_uint (NM_ACCESS_POINT_FLAGS, @@ -381,6 +470,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) NM_802_11_AP_FLAGS_NONE, G_PARAM_READABLE)); + /** + * NMAccessPoint:wpa-flags: + * + * The WPA flags of the access point. + **/ g_object_class_install_property (object_class, PROP_WPA_FLAGS, g_param_spec_uint (NM_ACCESS_POINT_WPA_FLAGS, @@ -389,6 +483,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMAccessPoint:rsn-flags: + * + * The RSN flags of the access point. + **/ g_object_class_install_property (object_class, PROP_RSN_FLAGS, g_param_spec_uint (NM_ACCESS_POINT_RSN_FLAGS, @@ -397,6 +496,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMAccessPoint:ssid: + * + * The SSID of the access point. + **/ g_object_class_install_property (object_class, PROP_SSID, g_param_spec_boxed (NM_ACCESS_POINT_SSID, @@ -405,6 +509,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) NM_TYPE_SSID, G_PARAM_READABLE)); + /** + * NMAccessPoint:frequency: + * + * The frequency of the access point. + **/ g_object_class_install_property (object_class, PROP_FREQUENCY, g_param_spec_uint (NM_ACCESS_POINT_FREQUENCY, @@ -413,6 +522,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) 0, 10000, 0, G_PARAM_READABLE)); + /** + * NMAccessPoint:hw-address: + * + * The hardware address of the access point. + **/ g_object_class_install_property (object_class, PROP_HW_ADDRESS, g_param_spec_string (NM_ACCESS_POINT_HW_ADDRESS, @@ -421,6 +535,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) NULL, G_PARAM_READABLE)); + /** + * NMAccessPoint:mode: + * + * The mode of the access point. + **/ g_object_class_install_property (object_class, PROP_MODE, g_param_spec_uint (NM_ACCESS_POINT_MODE, @@ -429,6 +548,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) NM_802_11_MODE_ADHOC, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA, G_PARAM_READABLE)); + /** + * NMAccessPoint:max-bitrate: + * + * The maximum bit rate of the access point. + **/ g_object_class_install_property (object_class, PROP_MAX_BITRATE, g_param_spec_uint (NM_ACCESS_POINT_MAX_BITRATE, @@ -437,6 +561,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMAccessPoint:strength: + * + * The current signal strength of the access point. + **/ g_object_class_install_property (object_class, PROP_STRENGTH, g_param_spec_uchar (NM_ACCESS_POINT_STRENGTH, diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c index 9d2eac719a..3d3e3b67e3 100644 --- a/libnm-glib/nm-active-connection.c +++ b/libnm-glib/nm-active-connection.c @@ -50,6 +50,15 @@ enum { #define DBUS_PROP_STATE "State" #define DBUS_PROP_DEFAULT "Default" +/** + * nm_active_connection_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMActiveConnection. + * + * Returns: a new active connection + **/ GObject * nm_active_connection_new (DBusGConnection *connection, const char *path) { @@ -73,6 +82,15 @@ get_scope_for_service_name (const char *service_name) return NM_CONNECTION_SCOPE_UNKNOWN; } +/** + * nm_active_connection_get_service_name: + * @connection: a #NMActiveConnection + * + * Gets the service name of the active connection. + * + * Returns: the service name. This is the internal string used by the + * connection, and must not be modified. + **/ const char * nm_active_connection_get_service_name (NMActiveConnection *connection) { @@ -91,6 +109,14 @@ nm_active_connection_get_service_name (NMActiveConnection *connection) return priv->service_name; } +/** + * nm_active_connection_get_scope: + * @connection: a #NMActiveConnection + * + * Gets the scope of the active connection. + * + * Returns: the connection's scope + **/ NMConnectionScope nm_active_connection_get_scope (NMActiveConnection *connection) { @@ -101,6 +127,15 @@ nm_active_connection_get_scope (NMActiveConnection *connection) return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->scope; } +/** + * nm_active_connection_get_connection: + * @connection: a #NMActiveConnection + * + * Gets the #NMConnection<!-- -->'s DBus object path. + * + * Returns: the object path of the #NMConnection inside of #NMActiveConnection. + * This is the internal string used by the connection, and must not be modified. + **/ const char * nm_active_connection_get_connection (NMActiveConnection *connection) { @@ -118,6 +153,15 @@ nm_active_connection_get_connection (NMActiveConnection *connection) return priv->connection; } +/** + * nm_active_connection_get_specific_object: + * @connection: a #NMActiveConnection + * + * Gets the "specific object" used at the activation. + * + * Returns: the specific object's DBus path. This is the internal string used by the + * connection, and must not be modified. + **/ const char * nm_active_connection_get_specific_object (NMActiveConnection *connection) { @@ -135,6 +179,15 @@ nm_active_connection_get_specific_object (NMActiveConnection *connection) return priv->specific_object; } +/** + * nm_active_connection_get_devices: + * @connection: a #NMActiveConnection + * + * Gets the #NMDevice<!-- -->s used for the active connections. + * + * Returns: the #GPtrArray containing #NMDevice<!-- -->s. + * This is the internal copy used by the connection, and must not be modified. + **/ const GPtrArray * nm_active_connection_get_devices (NMActiveConnection *connection) { @@ -160,6 +213,14 @@ nm_active_connection_get_devices (NMActiveConnection *connection) return handle_ptr_array_return (priv->devices); } +/** + * nm_active_connection_get_state: + * @connection: a #NMActiveConnection + * + * Gets the active connection's state. + * + * Returns: the state + **/ NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection) { @@ -177,6 +238,15 @@ nm_active_connection_get_state (NMActiveConnection *connection) return priv->state; } +/** + * nm_active_connection_get_default: + * @connection: a #NMActiveConnection + * + * Whether the active connection is the default one (that is, is used for the default route + * and DNS information). + * + * Returns: %TRUE if the active connection is the default one + **/ gboolean nm_active_connection_get_default (NMActiveConnection *connection) { @@ -350,6 +420,12 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) object_class->finalize = finalize; /* properties */ + + /** + * NMActiveConnection:service-name: + * + * The service name of the active connection. + **/ g_object_class_install_property (object_class, PROP_SERVICE_NAME, g_param_spec_string (NM_ACTIVE_CONNECTION_SERVICE_NAME, @@ -358,6 +434,11 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) NULL, G_PARAM_READABLE)); + /** + * NMActiveConnection:connection: + * + * The connection's path of the active connection. + **/ g_object_class_install_property (object_class, PROP_CONNECTION, g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, @@ -366,6 +447,11 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) NULL, G_PARAM_READABLE)); + /** + * NMActiveConnection:specific-object: + * + * The specific object's path of the active connection. + **/ g_object_class_install_property (object_class, PROP_SPECIFIC_OBJECT, g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, @@ -374,6 +460,11 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) NULL, G_PARAM_READABLE)); + /** + * NMActiveConnection:device: + * + * The devices (#NMDevice) of the active connection. + **/ g_object_class_install_property (object_class, PROP_DEVICES, g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, @@ -382,6 +473,11 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) NM_TYPE_OBJECT_ARRAY, G_PARAM_READABLE)); + /** + * NMActiveConnection:state: + * + * The state of the active connection. + **/ g_object_class_install_property (object_class, PROP_STATE, g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, @@ -392,6 +488,11 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) NM_ACTIVE_CONNECTION_STATE_UNKNOWN, G_PARAM_READABLE)); + /** + * NMActiveConnection:default: + * + * Whether the active connection is the default one. + **/ g_object_class_install_property (object_class, PROP_DEFAULT, g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, diff --git a/libnm-glib/nm-cdma-device.c b/libnm-glib/nm-cdma-device.c index 9266707ecd..afd2b6a4ae 100644 --- a/libnm-glib/nm-cdma-device.c +++ b/libnm-glib/nm-cdma-device.c @@ -87,6 +87,15 @@ nm_cdma_device_class_init (NMCdmaDeviceClass *device_class) object_class->dispose = dispose; } +/** + * nm_cdma_device_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMCdmaDevice. + * + * Returns: a new device + **/ GObject * nm_cdma_device_new (DBusGConnection *connection, const char *path) { diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 050cc671b5..0def21e045 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -381,6 +381,12 @@ nm_client_class_init (NMClientClass *client_class) object_class->dispose = dispose; /* properties */ + + /** + * NMClient:state: + * + * The current daemon state. + **/ g_object_class_install_property (object_class, PROP_STATE, g_param_spec_uint (NM_CLIENT_STATE, @@ -389,6 +395,11 @@ nm_client_class_init (NMClientClass *client_class) NM_STATE_UNKNOWN, NM_STATE_DISCONNECTED, NM_STATE_UNKNOWN, G_PARAM_READABLE)); + /** + * NMClient::manager-running: + * + * Whether the daemon is running. + **/ g_object_class_install_property (object_class, PROP_MANAGER_RUNNING, g_param_spec_boolean (NM_CLIENT_MANAGER_RUNNING, @@ -397,6 +408,11 @@ nm_client_class_init (NMClientClass *client_class) FALSE, G_PARAM_READABLE)); + /** + * NMClient::wireless-enabled: + * + * Whether wireless is enabled. + **/ g_object_class_install_property (object_class, PROP_WIRELESS_ENABLED, g_param_spec_boolean (NM_CLIENT_WIRELESS_ENABLED, @@ -405,6 +421,11 @@ nm_client_class_init (NMClientClass *client_class) TRUE, G_PARAM_READWRITE)); + /** + * NMClient::wireless-hardware-enabled: + * + * Whether the wireless hardware is enabled. + **/ g_object_class_install_property (object_class, PROP_WIRELESS_HARDWARE_ENABLED, g_param_spec_boolean (NM_CLIENT_WIRELESS_HARDWARE_ENABLED, @@ -413,6 +434,11 @@ nm_client_class_init (NMClientClass *client_class) TRUE, G_PARAM_READABLE)); + /** + * NMClient::active-connections: + * + * The active connections. + **/ g_object_class_install_property (object_class, PROP_ACTIVE_CONNECTIONS, g_param_spec_boxed (NM_CLIENT_ACTIVE_CONNECTIONS, @@ -422,6 +448,14 @@ nm_client_class_init (NMClientClass *client_class) G_PARAM_READABLE)); /* signals */ + + /** + * NMClient::device-added: + * @client: the client that received the signal + * @device: the new device + * + * Notifies that a #NMDevice is added. + **/ signals[DEVICE_ADDED] = g_signal_new ("device-added", G_OBJECT_CLASS_TYPE (object_class), @@ -432,6 +466,13 @@ nm_client_class_init (NMClientClass *client_class) G_TYPE_NONE, 1, G_TYPE_OBJECT); + /** + * NMClient::device-removed: + * @widget: the client that received the signal + * @device: the removed device + * + * Notifies that a #NMDevice is removed. + **/ signals[DEVICE_REMOVED] = g_signal_new ("device-removed", G_OBJECT_CLASS_TYPE (object_class), @@ -443,6 +484,13 @@ nm_client_class_init (NMClientClass *client_class) G_TYPE_OBJECT); } +/** + * nm_client_new: + * + * Creates a new #NMClient. + * + * Returns: a new #NMClient + **/ NMClient * nm_client_new (void) { @@ -541,6 +589,15 @@ client_device_removed_proxy (DBusGProxy *proxy, char *path, gpointer user_data) } } +/** + * nm_client_get_devices: + * @client: a #NMClient + * + * Gets all the detected devices. + * + * Returns: a #GPtrArray containing all the #NMDevice<!-- -->s. + * The returned array is owned by the client and should not be modified. + **/ const GPtrArray * nm_client_get_devices (NMClient *client) { @@ -571,6 +628,15 @@ nm_client_get_devices (NMClient *client) return handle_ptr_array_return (priv->devices); } +/** + * nm_client_get_device_by_path: + * @client: a #NMClient + * @object_path: the object path to search for + * + * Gets a #NMDevice from a #NMClient. + * + * Returns: the #NMDevice for the given @object_path or %NULL if none is found. + **/ NMDevice * nm_client_get_device_by_path (NMClient *client, const char *object_path) { @@ -617,6 +683,19 @@ activate_cb (DBusGProxy *proxy, g_slice_free (ActivateDeviceInfo, info); } +/** + * nm_client_activate_connection: + * @client: a #NMClient + * @service_name: the connection's service name + * @connection_path: the connection's DBus path + * @device: the #NMDevice + * @specific_object: the device specific object (currently used only for + * activating wireless devices and should be the #NMAccessPoint<!-- -->'s path. + * @callback: the function to call when the call is done + * @user_data: user data to pass to the callback function + * + * Activates a connection with the given #NMDevice. + **/ void nm_client_activate_connection (NMClient *client, const char *service_name, @@ -653,6 +732,13 @@ nm_client_activate_connection (NMClient *client, info); } +/** + * nm_client_deactivate_connection: + * @client: a #NMClient + * @active: the #NMActiveConnection to deactivate + * + * Deactivates an active #NMActiveConnection. + **/ void nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active) { @@ -672,6 +758,15 @@ nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active) } } +/** + * nm_client_get_active_connections: + * @client: a #NMClient + * + * Gets the active connections. + * + * Returns: a #GPtrArray containing all the active #NMActiveConnection<!-- -->s. + * The returned array is owned by the client and should not be modified. + **/ const GPtrArray * nm_client_get_active_connections (NMClient *client) { @@ -684,6 +779,9 @@ nm_client_get_active_connections (NMClient *client) if (priv->active_connections) return handle_ptr_array_return (priv->active_connections); + if (!priv->manager_running) + return NULL; + if (!nm_object_get_property (NM_OBJECT (client), "org.freedesktop.DBus.Properties", "ActiveConnections", @@ -697,6 +795,14 @@ nm_client_get_active_connections (NMClient *client) return handle_ptr_array_return (priv->active_connections); } +/** + * nm_client_wireless_get_enabled: + * @client: a #NMClient + * + * Determines whether the wireless is enabled. + * + * Returns: %TRUE if wireless is enabled + **/ gboolean nm_client_wireless_get_enabled (NMClient *client) { @@ -705,6 +811,13 @@ nm_client_wireless_get_enabled (NMClient *client) return NM_CLIENT_GET_PRIVATE (client)->wireless_enabled; } +/** + * nm_client_wireless_set_enabled: + * @client: a #NMClient + * @enabled: %TRUE to enable wireless + * + * Enables or disables wireless devices. + **/ void nm_client_wireless_set_enabled (NMClient *client, gboolean enabled) { @@ -721,6 +834,14 @@ nm_client_wireless_set_enabled (NMClient *client, gboolean enabled) &value); } +/** + * nm_client_wireless_hardware_get_enabled: + * @client: a #NMClient + * + * Determines whether the wireless hardware is enabled. + * + * Returns: %TRUE if the wireless hardware is enabled + **/ gboolean nm_client_wireless_hardware_get_enabled (NMClient *client) { @@ -729,6 +850,14 @@ nm_client_wireless_hardware_get_enabled (NMClient *client) return NM_CLIENT_GET_PRIVATE (client)->wireless_hw_enabled; } +/** + * nm_client_get_state: + * @client: a #NMClient + * + * Gets the current daemon state. + * + * Returns: the current %NMState + **/ NMState nm_client_get_state (NMClient *client) { @@ -747,6 +876,14 @@ nm_client_get_state (NMClient *client) return priv->state; } +/** + * nm_client_sleep: + * @client: a #NMClient + * @sleep: %TRUE to put the daemon to sleep + * + * Enables or disables networking. When the daemon is put to sleep, it'll deactivate and disable + * all the active devices. + **/ void nm_client_sleep (NMClient *client, gboolean sleep) { @@ -760,6 +897,14 @@ nm_client_sleep (NMClient *client, gboolean sleep) } } +/** + * nm_client_get_manager_running: + * @client: a #NMClient + * + * Determines whether the daemon is running. + * + * Returns: %TRUE if the daemon is running + **/ gboolean nm_client_get_manager_running (NMClient *client) { diff --git a/libnm-glib/nm-device-ethernet.c b/libnm-glib/nm-device-ethernet.c index d8d43e55c3..57c423f8b5 100644 --- a/libnm-glib/nm-device-ethernet.c +++ b/libnm-glib/nm-device-ethernet.c @@ -32,6 +32,15 @@ enum { #define DBUS_PROP_SPEED "Speed" #define DBUS_PROP_CARRIER "Carrier" +/** + * nm_device_ethernet_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMDeviceEthernet. + * + * Returns: a new device + **/ GObject * nm_device_ethernet_new (DBusGConnection *connection, const char *path) { @@ -44,6 +53,15 @@ nm_device_ethernet_new (DBusGConnection *connection, const char *path) NULL); } +/** + * nm_device_ethernet_get_hw_address: + * @device: a #NMDeviceEthernet + * + * Gets the hardware (MAC) address of the #NMDeviceEthernet + * + * Returns: the hardware address. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_ethernet_get_hw_address (NMDeviceEthernet *device) { @@ -61,6 +79,14 @@ nm_device_ethernet_get_hw_address (NMDeviceEthernet *device) return priv->hw_address; } +/** + * nm_device_ethernet_get_speed: + * @device: a #NMDeviceEthernet + * + * Gets the speed of the #NMDeviceEthernet. + * + * Returns: the speed of the device + **/ guint32 nm_device_ethernet_get_speed (NMDeviceEthernet *device) { @@ -78,6 +104,14 @@ nm_device_ethernet_get_speed (NMDeviceEthernet *device) return priv->speed; } +/** + * nm_device_ethernet_get_carrier: + * @device: a #NMDeviceEthernet + * + * Whether the device has carrier. + * + * Returns: %TRUE if the device has carrier + **/ gboolean nm_device_ethernet_get_carrier (NMDeviceEthernet *device) { @@ -214,6 +248,12 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *device_class) object_class->get_property = get_property; /* properties */ + + /** + * NMDeviceEthernet:hw-address: + * + * The hardware (MAC) address of the device. + **/ g_object_class_install_property (object_class, PROP_HW_ADDRESS, g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS, @@ -222,6 +262,11 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDeviceEthernet:speed: + * + * The speed of the device. + **/ g_object_class_install_property (object_class, PROP_SPEED, g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, @@ -230,6 +275,11 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *device_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMDeviceEthernet:carrier: + * + * Whether the device has carrier. + **/ g_object_class_install_property (object_class, PROP_CARRIER, g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER, diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c index ae2e753450..ac6b93e251 100644 --- a/libnm-glib/nm-device-wifi.c +++ b/libnm-glib/nm-device-wifi.c @@ -60,6 +60,15 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +/** + * nm_device_wifi_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMDeviceWifi. + * + * Returns: a new device + **/ GObject * nm_device_wifi_new (DBusGConnection *connection, const char *path) { @@ -72,6 +81,15 @@ nm_device_wifi_new (DBusGConnection *connection, const char *path) NULL); } +/** + * nm_device_wifi_get_hw_address: + * @device: a #NMDeviceWifi + * + * Gets the hardware (MAC) address of the #NMDeviceWifi + * + * Returns: the hardware address. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_wifi_get_hw_address (NMDeviceWifi *device) { @@ -89,6 +107,14 @@ nm_device_wifi_get_hw_address (NMDeviceWifi *device) return priv->hw_address; } +/** + * nm_device_wifi_get_mode: + * @device: a #NMDeviceWifi + * + * Gets the #NMDeviceWifi mode. + * + * Returns: the mode + **/ NM80211Mode nm_device_wifi_get_mode (NMDeviceWifi *device) { @@ -106,6 +132,14 @@ nm_device_wifi_get_mode (NMDeviceWifi *device) return priv->mode; } +/** + * nm_device_wifi_get_bitrate: + * @device: a #NMDeviceWifi + * + * Gets the bit rate of the #NMDeviceWifi. + * + * Returns: the bit rate + **/ guint32 nm_device_wifi_get_bitrate (NMDeviceWifi *device) { @@ -137,6 +171,14 @@ nm_device_wifi_get_bitrate (NMDeviceWifi *device) return priv->rate; } +/** + * nm_device_wifi_get_capabilities: + * @device: a #NMDeviceWifi + * + * Gets the WIFI capabilities of the #NMDeviceWifi. + * + * Returns: the capabilities + **/ guint32 nm_device_wifi_get_capabilities (NMDeviceWifi *device) { @@ -154,6 +196,14 @@ nm_device_wifi_get_capabilities (NMDeviceWifi *device) return priv->wireless_caps; } +/** + * nm_device_wifi_get_active_access_point: + * @self: a #NMDeviceWifi + * + * Gets the active #NMAccessPoint. + * + * Returns: the access point or %NULL if none is active + **/ NMAccessPoint * nm_device_wifi_get_active_access_point (NMDeviceWifi *self) { @@ -196,6 +246,15 @@ nm_device_wifi_get_active_access_point (NMDeviceWifi *self) return priv->active_ap; } +/** + * nm_device_wifi_get_access_points: + * @self: a #NMDeviceWifi + * + * Gets all the scanned access points of the #NMDeviceWifi. + * + * Returns: a #GPtrArray containing all the scanned #NMAccessPoint<!-- -->s. + * The returned array is owned by the client and should not be modified. + **/ const GPtrArray * nm_device_wifi_get_access_points (NMDeviceWifi *self) { @@ -226,6 +285,15 @@ nm_device_wifi_get_access_points (NMDeviceWifi *self) return handle_ptr_array_return (priv->aps); } +/** + * nm_device_wifi_get_access_point_by_path: + * @self: a #NMDeviceWifi + * @path: the object path of the access point + * + * Gets a #NMAccessPoint by path. + * + * Returns: the access point or %NULL if none is found. + **/ NMAccessPoint * nm_device_wifi_get_access_point_by_path (NMDeviceWifi *self, const char *path) @@ -323,6 +391,13 @@ clean_up_aps (NMDeviceWifi *self, gboolean notify) } } +/** + * nm_device_wifi_set_wireless_enabled: + * @device: a #NMDeviceWifi + * @enabled: %TRUE to enable the device + * + * Enables or disables the wireless device. + **/ void nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled) @@ -547,6 +622,12 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) object_class->finalize = finalize; /* properties */ + + /** + * NMDeviceWifi:hw-address: + * + * The hardware (MAC) address of the device. + **/ g_object_class_install_property (object_class, PROP_HW_ADDRESS, g_param_spec_string (NM_DEVICE_WIFI_HW_ADDRESS, @@ -555,6 +636,11 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDeviceWifi:mode: + * + * The mode of the device. + **/ g_object_class_install_property (object_class, PROP_MODE, g_param_spec_uint (NM_DEVICE_WIFI_MODE, @@ -563,6 +649,11 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA, G_PARAM_READABLE)); + /** + * NMDeviceWifi:bitrate: + * + * The bit rate of the device. + **/ g_object_class_install_property (object_class, PROP_BITRATE, g_param_spec_uint (NM_DEVICE_WIFI_BITRATE, @@ -571,6 +662,11 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMDeviceWifi:active-access-point: + * + * The active #NMAccessPoint of the device. + **/ g_object_class_install_property (object_class, PROP_ACTIVE_ACCESS_POINT, g_param_spec_object (NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT, @@ -579,6 +675,11 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) NM_TYPE_ACCESS_POINT, G_PARAM_READABLE)); + /** + * NMDeviceWifi:wireless-capabilities: + * + * The wireless capabilities of the device. + **/ g_object_class_install_property (object_class, PROP_WIRELESS_CAPABILITIES, g_param_spec_uint (NM_DEVICE_WIFI_CAPABILITIES, @@ -588,6 +689,14 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) G_PARAM_READABLE)); /* signals */ + + /** + * NMDeviceWifi::access-point-added: + * @device: the wifi device that received the signal + * @ap: the new access point + * + * Notifies that a #NMAccessPoint is added to the wifi device. + **/ signals[ACCESS_POINT_ADDED] = g_signal_new ("access-point-added", G_OBJECT_CLASS_TYPE (object_class), @@ -598,6 +707,13 @@ nm_device_wifi_class_init (NMDeviceWifiClass *device_class) G_TYPE_NONE, 1, G_TYPE_OBJECT); + /** + * NMDeviceWifi::access-point-removed: + * @device: the wifi device that received the signal + * @ap: the removed access point + * + * Notifies that a #NMAccessPoint is removed from the wifi device. + **/ signals[ACCESS_POINT_REMOVED] = g_signal_new ("access-point-removed", G_OBJECT_CLASS_TYPE (object_class), diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 24ca876cfd..d142bfe29f 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -28,6 +28,8 @@ typedef struct { gboolean managed; NMIP4Config *ip4_config; gboolean null_ip4_config; + NMDHCP4Config *dhcp4_config; + gboolean null_dhcp4_config; NMDeviceState state; char *product; char *vendor; @@ -41,6 +43,7 @@ enum { PROP_CAPABILITIES, PROP_MANAGED, PROP_IP4_CONFIG, + PROP_DHCP4_CONFIG, PROP_STATE, PROP_PRODUCT, PROP_VENDOR, @@ -106,6 +109,46 @@ demarshal_ip4_config (NMObject *object, GParamSpec *pspec, GValue *value, gpoint return TRUE; } +static gboolean +demarshal_dhcp4_config (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (object); + const char *path; + NMDHCP4Config *config = NULL; + DBusGConnection *connection; + + if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_OBJECT_PATH)) + return FALSE; + + priv->null_dhcp4_config = FALSE; + + path = g_value_get_boxed (value); + if (path) { + if (!strcmp (path, "/")) + priv->null_dhcp4_config = TRUE; + else { + config = NM_DHCP4_CONFIG (nm_object_cache_get (path)); + if (config) + config = g_object_ref (config); + else { + connection = nm_object_get_connection (object); + config = NM_DHCP4_CONFIG (nm_dhcp4_config_new (connection, path)); + } + } + } + + if (priv->dhcp4_config) { + g_object_unref (priv->dhcp4_config); + priv->dhcp4_config = NULL; + } + + if (config) + priv->dhcp4_config = config; + + nm_object_queue_notify (object, NM_DEVICE_DHCP4_CONFIG); + return TRUE; +} + static void register_for_property_changed (NMDevice *device) { @@ -117,6 +160,7 @@ register_for_property_changed (NMDevice *device) { NM_DEVICE_CAPABILITIES, nm_object_demarshal_generic, &priv->capabilities }, { NM_DEVICE_MANAGED, nm_object_demarshal_generic, &priv->managed }, { NM_DEVICE_IP4_CONFIG, demarshal_ip4_config, &priv->ip4_config }, + { NM_DEVICE_DHCP4_CONFIG, demarshal_dhcp4_config, &priv->dhcp4_config }, { NULL }, }; @@ -198,6 +242,8 @@ dispose (GObject *object) g_object_unref (priv->proxy); if (priv->ip4_config) g_object_unref (priv->ip4_config); + if (priv->dhcp4_config) + g_object_unref (priv->dhcp4_config); G_OBJECT_CLASS (nm_device_parent_class)->dispose (object); } @@ -243,6 +289,9 @@ get_property (GObject *object, case PROP_IP4_CONFIG: g_value_set_object (value, nm_device_get_ip4_config (device)); break; + case PROP_DHCP4_CONFIG: + g_value_set_object (value, nm_device_get_dhcp4_config (device)); + break; case PROP_STATE: g_value_set_uint (value, nm_device_get_state (device)); break; @@ -272,6 +321,12 @@ nm_device_class_init (NMDeviceClass *device_class) object_class->finalize = finalize; /* properties */ + + /** + * NMDevice:interface: + * + * The interface of the device. + **/ g_object_class_install_property (object_class, PROP_INTERFACE, g_param_spec_string (NM_DEVICE_INTERFACE, @@ -280,6 +335,11 @@ nm_device_class_init (NMDeviceClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDevice:udi: + * + * The HAL UDI of the device. + **/ g_object_class_install_property (object_class, PROP_UDI, g_param_spec_string (NM_DEVICE_UDI, @@ -288,6 +348,11 @@ nm_device_class_init (NMDeviceClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDevice:driver: + * + * The driver of the device. + **/ g_object_class_install_property (object_class, PROP_DRIVER, g_param_spec_string (NM_DEVICE_DRIVER, @@ -296,6 +361,11 @@ nm_device_class_init (NMDeviceClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDevice:capabilities: + * + * The capabilities of the device. + **/ g_object_class_install_property (object_class, PROP_CAPABILITIES, g_param_spec_uint (NM_DEVICE_CAPABILITIES, @@ -304,6 +374,11 @@ nm_device_class_init (NMDeviceClass *device_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMDevice:managed: + * + * Whether the device is managed by NetworkManager. + **/ g_object_class_install_property (object_class, PROP_MANAGED, g_param_spec_boolean (NM_DEVICE_MANAGED, @@ -312,6 +387,11 @@ nm_device_class_init (NMDeviceClass *device_class) FALSE, G_PARAM_READABLE)); + /** + * NMDevice:ip4-config: + * + * The #NMIP4Config of the device. + **/ g_object_class_install_property (object_class, PROP_IP4_CONFIG, g_param_spec_object (NM_DEVICE_IP4_CONFIG, @@ -320,6 +400,24 @@ nm_device_class_init (NMDeviceClass *device_class) NM_TYPE_IP4_CONFIG, G_PARAM_READABLE)); + /** + * NMDevice:dhcp4-config: + * + * The #NMDHCP4Config of the device. + **/ + g_object_class_install_property + (object_class, PROP_DHCP4_CONFIG, + g_param_spec_object (NM_DEVICE_DHCP4_CONFIG, + "DHCP4 Config", + "DHCP4 Config", + NM_TYPE_DHCP4_CONFIG, + G_PARAM_READABLE)); + + /** + * NMDevice:state: + * + * The state of the device. + **/ g_object_class_install_property (object_class, PROP_STATE, g_param_spec_uint (NM_DEVICE_STATE, @@ -328,6 +426,11 @@ nm_device_class_init (NMDeviceClass *device_class) 0, G_MAXUINT32, 0, G_PARAM_READABLE)); + /** + * NMDevice:vendor: + * + * The vendor string of the device. + **/ g_object_class_install_property (object_class, PROP_VENDOR, g_param_spec_string (NM_DEVICE_VENDOR, @@ -336,6 +439,11 @@ nm_device_class_init (NMDeviceClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDevice:product: + * + * The product string of the device. + **/ g_object_class_install_property (object_class, PROP_PRODUCT, g_param_spec_string (NM_DEVICE_PRODUCT, @@ -345,6 +453,14 @@ nm_device_class_init (NMDeviceClass *device_class) G_PARAM_READABLE)); /* signals */ + + /** + * NMDevice::state-changed: + * @device: the client that received the signal + * @state: the new state of the device + * + * Notifies the state change of a #NMDevice. + **/ signals[STATE_CHANGED] = g_signal_new ("state-changed", G_OBJECT_CLASS_TYPE (object_class), @@ -356,6 +472,15 @@ nm_device_class_init (NMDeviceClass *device_class) G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); } +/** + * nm_device_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMDevice. + * + * Returns: a new device + **/ GObject * nm_device_new (DBusGConnection *connection, const char *path) { @@ -418,6 +543,15 @@ out: return G_OBJECT (device); } +/** + * nm_device_get_iface: + * @device: a #NMDevice + * + * Gets the interface name of the #NMDevice. + * + * Returns: the interface of the device. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_get_iface (NMDevice *device) { @@ -435,6 +569,15 @@ nm_device_get_iface (NMDevice *device) return priv->iface; } +/** + * nm_device_get_udi: + * @device: a #NMDevice + * + * Gets the HAL UDI of the #NMDevice. + * + * Returns: the HAL UDI of the device. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_get_udi (NMDevice *device) { @@ -452,6 +595,15 @@ nm_device_get_udi (NMDevice *device) return priv->udi; } +/** + * nm_device_get_driver: + * @device: a #NMDevice + * + * Gets the driver of the #NMDevice. + * + * Returns: the driver of the device. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_get_driver (NMDevice *device) { @@ -469,6 +621,14 @@ nm_device_get_driver (NMDevice *device) return priv->driver; } +/** + * nm_device_get_capabilities: + * @device: a #NMDevice + * + * Gets the device' capabilities. + * + * Returns: the capabilities + **/ guint32 nm_device_get_capabilities (NMDevice *device) { @@ -486,6 +646,14 @@ nm_device_get_capabilities (NMDevice *device) return priv->capabilities; } +/** + * nm_device_get_managed: + * @device: a #NMDevice + * + * Whether the #NMDevice is managed by NetworkManager. + * + * Returns: %TRUE if the device is managed by NetworkManager + **/ gboolean nm_device_get_managed (NMDevice *device) { @@ -503,6 +671,14 @@ nm_device_get_managed (NMDevice *device) return priv->managed; } +/** + * nm_device_get_ip4_config: + * @device: a #NMDevice + * + * Gets the current #NMIP4Config associated with the #NMDevice. + * + * Returns: the #NMIP4Config or %NULL if the device is not activated. + **/ NMIP4Config * nm_device_get_ip4_config (NMDevice *device) { @@ -529,6 +705,49 @@ nm_device_get_ip4_config (NMDevice *device) return priv->ip4_config; } +/** + * nm_device_get_dhcp4_config: + * @device: a #NMDevice + * + * Gets the current #NMDHCP4Config associated with the #NMDevice. + * + * Returns: the #NMDHCPConfig or %NULL if the device is not activated or not + * using DHCP. + **/ +NMDHCP4Config * +nm_device_get_dhcp4_config (NMDevice *device) +{ + NMDevicePrivate *priv; + char *path; + GValue value = { 0, }; + + g_return_val_if_fail (NM_IS_DEVICE (device), NULL); + + priv = NM_DEVICE_GET_PRIVATE (device); + if (priv->dhcp4_config) + return priv->dhcp4_config; + if (priv->null_dhcp4_config) + return NULL; + + path = nm_object_get_object_path_property (NM_OBJECT (device), NM_DBUS_INTERFACE_DEVICE, "Dhcp4Config"); + if (path) { + g_value_init (&value, DBUS_TYPE_G_OBJECT_PATH); + g_value_take_boxed (&value, path); + demarshal_dhcp4_config (NM_OBJECT (device), NULL, &value, &priv->dhcp4_config); + g_value_unset (&value); + } + + return priv->dhcp4_config; +} + +/** + * nm_device_get_state: + * @device: a #NMDevice + * + * Gets the current #NMDevice state. + * + * Returns: the current device state + **/ NMDeviceState nm_device_get_state (NMDevice *device) { @@ -724,6 +943,15 @@ nm_device_update_description (NMDevice *device) nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_PRODUCT); } +/** + * nm_device_get_product: + * @device: a #NMDevice + * + * Gets the product string of the #NMDevice. + * + * Returns: the product name of the device. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_get_product (NMDevice *device) { @@ -737,6 +965,15 @@ nm_device_get_product (NMDevice *device) return priv->product; } +/** + * nm_device_get_vendor: + * @device: a #NMDevice + * + * Gets the vendor string of the #NMDevice. + * + * Returns: the vendor name of the device. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_device_get_vendor (NMDevice *device) { diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h index 1b1214c5c3..f74d892c44 100644 --- a/libnm-glib/nm-device.h +++ b/libnm-glib/nm-device.h @@ -7,6 +7,7 @@ #include "nm-object.h" #include "NetworkManager.h" #include "nm-ip4-config.h" +#include "nm-dhcp4-config.h" #include "nm-connection.h" G_BEGIN_DECLS @@ -24,6 +25,7 @@ G_BEGIN_DECLS #define NM_DEVICE_CAPABILITIES "capabilities" #define NM_DEVICE_MANAGED "managed" #define NM_DEVICE_IP4_CONFIG "ip4-config" +#define NM_DEVICE_DHCP4_CONFIG "dhcp4-config" #define NM_DEVICE_STATE "state" #define NM_DEVICE_VENDOR "vendor" #define NM_DEVICE_PRODUCT "product" @@ -46,15 +48,16 @@ GType nm_device_get_type (void); GObject * nm_device_new (DBusGConnection *connection, const char *path); -const char * nm_device_get_iface (NMDevice *device); -const char * nm_device_get_udi (NMDevice *device); -const char * nm_device_get_driver (NMDevice *device); -guint32 nm_device_get_capabilities (NMDevice *device); -gboolean nm_device_get_managed (NMDevice *device); -NMIP4Config * nm_device_get_ip4_config (NMDevice *device); -NMDeviceState nm_device_get_state (NMDevice *device); -const char * nm_device_get_product (NMDevice *device); -const char * nm_device_get_vendor (NMDevice *device); +const char * nm_device_get_iface (NMDevice *device); +const char * nm_device_get_udi (NMDevice *device); +const char * nm_device_get_driver (NMDevice *device); +guint32 nm_device_get_capabilities (NMDevice *device); +gboolean nm_device_get_managed (NMDevice *device); +NMIP4Config * nm_device_get_ip4_config (NMDevice *device); +NMDHCP4Config * nm_device_get_dhcp4_config (NMDevice *device); +NMDeviceState nm_device_get_state (NMDevice *device); +const char * nm_device_get_product (NMDevice *device); +const char * nm_device_get_vendor (NMDevice *device); G_END_DECLS diff --git a/libnm-glib/nm-dhcp4-config.c b/libnm-glib/nm-dhcp4-config.c new file mode 100644 index 0000000000..a01be523c2 --- /dev/null +++ b/libnm-glib/nm-dhcp4-config.c @@ -0,0 +1,223 @@ +#include <string.h> + +#include "nm-dhcp4-config.h" +#include "NetworkManager.h" +#include "nm-types-private.h" +#include "nm-object-private.h" +#include "nm-utils.h" + +G_DEFINE_TYPE (NMDHCP4Config, nm_dhcp4_config, NM_TYPE_OBJECT) + +#define NM_DHCP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP4_CONFIG, NMDHCP4ConfigPrivate)) + +typedef struct { + DBusGProxy *proxy; + + GHashTable *options; +} NMDHCP4ConfigPrivate; + +enum { + PROP_0, + PROP_OPTIONS, + + LAST_PROP +}; + +static void +nm_dhcp4_config_init (NMDHCP4Config *config) +{ +} + +static void +copy_options (gpointer key, gpointer data, gpointer user_data) +{ + GHashTable *options = (GHashTable *) user_data; + GValue *value = (GValue *) data; + + g_hash_table_insert (options, g_strdup (key), g_value_dup_string (value)); +} + +static gboolean +demarshal_dhcp4_options (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field) +{ + NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object); + GHashTable *new_options; + + g_hash_table_remove_all (priv->options); + + new_options = g_value_get_boxed (value); + if (new_options) + g_hash_table_foreach (new_options, copy_options, priv->options); + + nm_object_queue_notify (object, NM_DHCP4_CONFIG_OPTIONS); + return TRUE; +} + +static void +register_for_property_changed (NMDHCP4Config *config) +{ + NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (config); + const NMPropertiesChangedInfo property_changed_info[] = { + { NM_DHCP4_CONFIG_OPTIONS, demarshal_dhcp4_options, &priv->options }, + { NULL }, + }; + + nm_object_handle_properties_changed (NM_OBJECT (config), + priv->proxy, + property_changed_info); +} + +static GObject* +constructor (GType type, + guint n_construct_params, + GObjectConstructParam *construct_params) +{ + NMObject *object; + DBusGConnection *connection; + NMDHCP4ConfigPrivate *priv; + + object = (NMObject *) G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->constructor (type, + n_construct_params, + construct_params); + if (!object) + return NULL; + + priv = NM_DHCP4_CONFIG_GET_PRIVATE (object); + priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + + connection = nm_object_get_connection (object); + + priv->proxy = dbus_g_proxy_new_for_name (connection, + NM_DBUS_SERVICE, + nm_object_get_path (object), + NM_DBUS_INTERFACE_DHCP4_CONFIG); + + register_for_property_changed (NM_DHCP4_CONFIG (object)); + + return G_OBJECT (object); +} + +static void +finalize (GObject *object) +{ + NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object); + + if (priv->options) + g_hash_table_destroy (priv->options); + + G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->finalize (object); +} + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + NMDHCP4Config *self = NM_DHCP4_CONFIG (object); + + switch (prop_id) { + case PROP_OPTIONS: + g_value_set_boxed (value, nm_dhcp4_config_get_options (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_dhcp4_config_class_init (NMDHCP4ConfigClass *config_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (config_class); + + g_type_class_add_private (config_class, sizeof (NMDHCP4ConfigPrivate)); + + /* virtual methods */ + object_class->constructor = constructor; + object_class->get_property = get_property; + object_class->finalize = finalize; + + /* properties */ + + /** + * NMDHCP4Config:options: + * + * The #GHashTable containing options of the configuration. + **/ + g_object_class_install_property + (object_class, PROP_OPTIONS, + g_param_spec_boxed (NM_DHCP4_CONFIG_OPTIONS, + "Options", + "Options", + G_TYPE_HASH_TABLE, + G_PARAM_READABLE)); +} + +/** + * nm_dhcp4_config_new: + * @connection: the #DBusGConnection + * @object_path: the DBus object path of the device + * + * Creates a new #NMDHCP4Config. + * + * Returns: a new configuration + **/ +GObject * +nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path) +{ + return (GObject *) g_object_new (NM_TYPE_DHCP4_CONFIG, + NM_OBJECT_DBUS_CONNECTION, connection, + NM_OBJECT_DBUS_PATH, object_path, + NULL); +} + +/** + * nm_dhcp4_config_get_options: + * @self: a #NMDHCP4Config + * + * Gets all the options contained in the configuration. + * + * Returns: the #GHashTable containing strings for keys and values. + * This is the internal copy used by the configuration, and must not be modified. + **/ +GHashTable * +nm_dhcp4_config_get_options (NMDHCP4Config *self) +{ + NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self); + GValue value = { 0, }; + + if (g_hash_table_size (priv->options)) + return priv->options; + + if (!nm_object_get_property (NM_OBJECT (self), + "org.freedesktop.DBus.Properties", + "Options", + &value)) + goto out; + + demarshal_dhcp4_options (NM_OBJECT (self), NULL, &value, &priv->options); + g_value_unset (&value); + +out: + return priv->options; +} + +/** + * nm_dhcp4_config_get_one_option: + * @self: a #NMDHCP4Config + * @option: the option to retrieve + * + * Gets one option by option name. + * + * Returns: the configuration option's value. This is the internal string used by the + * configuration, and must not be modified. + **/ +const char * +nm_dhcp4_config_get_one_option (NMDHCP4Config *self, const char *option) +{ + g_return_val_if_fail (NM_IS_DHCP4_CONFIG (self), NULL); + + return g_hash_table_lookup (nm_dhcp4_config_get_options (self), option); +} + diff --git a/libnm-glib/nm-dhcp4-config.h b/libnm-glib/nm-dhcp4-config.h new file mode 100644 index 0000000000..496dedd11c --- /dev/null +++ b/libnm-glib/nm-dhcp4-config.h @@ -0,0 +1,37 @@ +#ifndef NM_DHCP4_CONFIG_H +#define NM_DHCP4_CONFIG_H + +#include <glib/gtypes.h> +#include <glib-object.h> +#include <dbus/dbus-glib.h> +#include "nm-object.h" + +G_BEGIN_DECLS + +#define NM_TYPE_DHCP4_CONFIG (nm_dhcp4_config_get_type ()) +#define NM_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP4_CONFIG, NMDHCP4Config)) +#define NM_DHCP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DHCP4_CONFIG, NMDHCP4ConfigClass)) +#define NM_IS_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP4_CONFIG)) +#define NM_IS_DHCP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_DHCP4_CONFIG)) + +typedef struct { + NMObject parent; +} NMDHCP4Config; + +typedef struct { + NMObjectClass parent; +} NMDHCP4ConfigClass; + +#define NM_DHCP4_CONFIG_OPTIONS "options" + +GType nm_dhcp4_config_get_type (void); + +GObject *nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path); + +GHashTable * nm_dhcp4_config_get_options (NMDHCP4Config *config); + +const char * nm_dhcp4_config_get_one_option (NMDHCP4Config *config, const char *option); + +G_END_DECLS + +#endif /* NM_DHCP4_CONFIG_H */ diff --git a/libnm-glib/nm-gsm-device.c b/libnm-glib/nm-gsm-device.c index c3c28f46db..7db338c8a7 100644 --- a/libnm-glib/nm-gsm-device.c +++ b/libnm-glib/nm-gsm-device.c @@ -87,6 +87,15 @@ nm_gsm_device_class_init (NMGsmDeviceClass *device_class) object_class->dispose = dispose; } +/** + * nm_gsm_device_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMGsmDevice. + * + * Returns: a new device + **/ NMGsmDevice * nm_gsm_device_new (DBusGConnection *connection, const char *path) { diff --git a/libnm-glib/nm-ip4-config.c b/libnm-glib/nm-ip4-config.c index 1382378d35..dac3085eaa 100644 --- a/libnm-glib/nm-ip4-config.c +++ b/libnm-glib/nm-ip4-config.c @@ -17,8 +17,6 @@ typedef struct { char *hostname; GArray *nameservers; GPtrArray *domains; - char *nis_domain; - GArray *nis_servers; GSList *routes; } NMIP4ConfigPrivate; @@ -28,8 +26,6 @@ enum { PROP_HOSTNAME, PROP_NAMESERVERS, PROP_DOMAINS, - PROP_NIS_DOMAIN, - PROP_NIS_SERVERS, PROP_ROUTES, LAST_PROP @@ -63,8 +59,6 @@ demarshal_ip4_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointe if (!strcmp (pspec->name, NM_IP4_CONFIG_NAMESERVERS)) nm_object_queue_notify (object, NM_IP4_CONFIG_NAMESERVERS); - else if (!strcmp (pspec->name, NM_IP4_CONFIG_NIS_SERVERS)) - nm_object_queue_notify (object, NM_IP4_CONFIG_NAMESERVERS); return TRUE; } @@ -102,8 +96,6 @@ register_for_property_changed (NMIP4Config *config) { NM_IP4_CONFIG_HOSTNAME, nm_object_demarshal_generic, &priv->hostname }, { NM_IP4_CONFIG_NAMESERVERS, demarshal_ip4_array, &priv->nameservers }, { NM_IP4_CONFIG_DOMAINS, demarshal_domains, &priv->domains }, - { NM_IP4_CONFIG_NIS_DOMAIN, nm_object_demarshal_generic, &priv->nis_domain }, - { NM_IP4_CONFIG_NIS_SERVERS, demarshal_ip4_array, &priv->nis_servers }, { NM_IP4_CONFIG_ROUTES, demarshal_ip4_routes_array, &priv->routes }, { NULL }, }; @@ -153,11 +145,8 @@ finalize (GObject *object) g_slist_free (priv->routes); g_free (priv->hostname); - g_free (priv->nis_domain); if (priv->nameservers) g_array_free (priv->nameservers, TRUE); - if (priv->nis_servers) - g_array_free (priv->nis_servers, TRUE); if (priv->domains) { g_ptr_array_foreach (priv->domains, (GFunc) g_free, NULL); @@ -189,12 +178,6 @@ get_property (GObject *object, case PROP_DOMAINS: g_value_set_boxed (value, nm_ip4_config_get_domains (self)); break; - case PROP_NIS_DOMAIN: - g_value_set_string (value, nm_ip4_config_get_nis_domain (self)); - break; - case PROP_NIS_SERVERS: - g_value_set_boxed (value, nm_ip4_config_get_nis_servers (self)); - break; case PROP_ROUTES: nm_utils_ip4_routes_to_gvalue (priv->routes, value); break; @@ -217,6 +200,12 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) object_class->finalize = finalize; /* properties */ + + /** + * NMIP4Config:addresses: + * + * The #GPtrArray containing #NMSettingIP4Address<!-- -->es of the configuration. + **/ g_object_class_install_property (object_class, PROP_ADDRESSES, g_param_spec_pointer (NM_IP4_CONFIG_ADDRESSES, @@ -224,6 +213,11 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) "Addresses", G_PARAM_READABLE)); + /** + * NMIP4Config:hostname: + * + * The host name string of the configuration. + **/ g_object_class_install_property (object_class, PROP_HOSTNAME, g_param_spec_string (NM_IP4_CONFIG_HOSTNAME, @@ -232,6 +226,11 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) NULL, G_PARAM_READABLE)); + /** + * NMIP4Config:nameservers: + * + * The #GArray containing name servers (%guint32<!-- -->es) of the configuration. + **/ g_object_class_install_property (object_class, PROP_NAMESERVERS, g_param_spec_boxed (NM_IP4_CONFIG_NAMESERVERS, @@ -240,6 +239,11 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) NM_TYPE_UINT_ARRAY, G_PARAM_READABLE)); + /** + * NMIP4Config:domains: + * + * The #GPtrArray containing domain strings of the configuration. + **/ g_object_class_install_property (object_class, PROP_DOMAINS, g_param_spec_boxed (NM_IP4_CONFIG_DOMAINS, @@ -248,22 +252,11 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) NM_TYPE_STRING_ARRAY, G_PARAM_READABLE)); - g_object_class_install_property - (object_class, PROP_NIS_DOMAIN, - g_param_spec_string (NM_IP4_CONFIG_NIS_DOMAIN, - "NIS domain", - "NIS domain", - NULL, - G_PARAM_READABLE)); - - g_object_class_install_property - (object_class, PROP_NIS_SERVERS, - g_param_spec_boxed (NM_IP4_CONFIG_NIS_SERVERS, - "NIS servers", - "NIS servers", - NM_TYPE_UINT_ARRAY, - G_PARAM_READABLE)); - + /** + * NMIP4Config:routes: + * + * The #GPtrArray containing #NMSettingIP4Route<!-- -->s of the configuration. + **/ g_object_class_install_property (object_class, PROP_ROUTES, g_param_spec_pointer (NM_IP4_CONFIG_ROUTES, @@ -272,6 +265,15 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) G_PARAM_READABLE)); } +/** + * nm_ip4_config_new: + * @connection: the #DBusGConnection + * @object_path: the DBus object path of the device + * + * Creates a new #NMIP4Config. + * + * Returns: a new IP4 configuration + **/ GObject * nm_ip4_config_new (DBusGConnection *connection, const char *object_path) { @@ -281,6 +283,15 @@ nm_ip4_config_new (DBusGConnection *connection, const char *object_path) NULL); } +/** + * nm_ip4_config_get_addresses: + * @config: a #NMIP4Config + * + * Gets the IP4 addresses (containing the address, prefix, and gateway). + * + * Returns: the #GSList containing #NMSettingIP4Address<!-- -->es. This is the internal copy + * used by the configuration and must not be modified. + **/ const GSList * nm_ip4_config_get_addresses (NMIP4Config *config) { @@ -306,6 +317,15 @@ nm_ip4_config_get_addresses (NMIP4Config *config) return priv->addresses; } +/** + * nm_ip4_config_get_hostname: + * @config: a #NMIP4Config + * + * Gets the host name. + * + * Returns: the host name from the configuration. This is the internal copy used by the + * configuration and must not be modified. + **/ const char * nm_ip4_config_get_hostname (NMIP4Config *config) { @@ -323,6 +343,15 @@ nm_ip4_config_get_hostname (NMIP4Config *config) return priv->hostname; } +/** + * nm_ip4_config_get_nameservers: + * @config: a #NMIP4Config + * + * Gets the domain name servers (DNS). + * + * Returns: the #GArray containing %guint32<!-- -->s. This is the internal copy used by the + * configuration and must not be modified. + **/ const GArray * nm_ip4_config_get_nameservers (NMIP4Config *config) { @@ -349,7 +378,15 @@ nm_ip4_config_get_nameservers (NMIP4Config *config) return priv->nameservers; } - +/** + * nm_ip4_config_get_domains: + * @config: a #NMIP4Config + * + * Gets the domain names. + * + * Returns: the #GPtrArray containing domains as strings. This is the + * internal copy used by the configuration, and must not be modified. + **/ const GPtrArray * nm_ip4_config_get_domains (NMIP4Config *config) { @@ -380,50 +417,15 @@ nm_ip4_config_get_domains (NMIP4Config *config) return handle_ptr_array_return (priv->domains); } -const char * -nm_ip4_config_get_nis_domain (NMIP4Config *config) -{ - NMIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL); - - priv = NM_IP4_CONFIG_GET_PRIVATE (config); - if (!priv->nis_domain) { - priv->nis_domain = nm_object_get_string_property (NM_OBJECT (config), - NM_DBUS_INTERFACE_IP4_CONFIG, - "NisDomain"); - } - - return priv->nis_domain; -} - -const GArray * -nm_ip4_config_get_nis_servers (NMIP4Config *config) -{ - NMIP4ConfigPrivate *priv; - GArray *array = NULL; - GValue value = {0,}; - - g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL); - - priv = NM_IP4_CONFIG_GET_PRIVATE (config); - if (!priv->nis_servers) { - if (nm_object_get_property (NM_OBJECT (config), - NM_DBUS_INTERFACE_IP4_CONFIG, - "NisServers", - &value)) { - array = (GArray *) g_value_get_boxed (&value); - if (array && array->len) { - priv->nis_servers = g_array_sized_new (FALSE, TRUE, sizeof (guint32), array->len); - g_array_append_vals (priv->nis_servers, array->data, array->len); - } - g_value_unset (&value); - } - } - - return priv->nis_servers; -} - +/** + * nm_ip4_config_get_routes: + * @config: a #NMIP4Config + * + * Gets the routes. + * + * Returns: the #GSList containing #NMSettingIP4Route<!-- -->s. This is the + * internal copy used by the configuration, and must not be modified. + **/ const GSList * nm_ip4_config_get_routes (NMIP4Config *config) { diff --git a/libnm-glib/nm-ip4-config.h b/libnm-glib/nm-ip4-config.h index 79de2f8496..10ff688544 100644 --- a/libnm-glib/nm-ip4-config.h +++ b/libnm-glib/nm-ip4-config.h @@ -27,8 +27,6 @@ typedef struct { #define NM_IP4_CONFIG_HOSTNAME "hostname" #define NM_IP4_CONFIG_NAMESERVERS "nameservers" #define NM_IP4_CONFIG_DOMAINS "domains" -#define NM_IP4_CONFIG_NIS_DOMAIN "nis-domain" -#define NM_IP4_CONFIG_NIS_SERVERS "nis-servers" #define NM_IP4_CONFIG_ROUTES "routes" GType nm_ip4_config_get_type (void); @@ -39,8 +37,6 @@ const GSList * nm_ip4_config_get_addresses (NMIP4Config *config); const char * nm_ip4_config_get_hostname (NMIP4Config *config); const GArray * nm_ip4_config_get_nameservers (NMIP4Config *config); const GPtrArray *nm_ip4_config_get_domains (NMIP4Config *config); -const char * nm_ip4_config_get_nis_domain (NMIP4Config *config); -const GArray * nm_ip4_config_get_nis_servers (NMIP4Config *config); const GSList * nm_ip4_config_get_routes (NMIP4Config *config); G_END_DECLS diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 9472f25280..b981306ed2 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -168,6 +168,12 @@ nm_object_class_init (NMObjectClass *nm_object_class) object_class->finalize = finalize; /* porperties */ + + /** + * NMObject:connection: + * + * The #DBusGConnection of the object. + **/ g_object_class_install_property (object_class, PROP_CONNECTION, g_param_spec_boxed (NM_OBJECT_DBUS_CONNECTION, @@ -176,6 +182,11 @@ nm_object_class_init (NMObjectClass *nm_object_class) DBUS_TYPE_G_CONNECTION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + /** + * NMObject:path: + * + * The DBus object path. + **/ g_object_class_install_property (object_class, PROP_PATH, g_param_spec_string (NM_OBJECT_DBUS_PATH, @@ -185,6 +196,14 @@ nm_object_class_init (NMObjectClass *nm_object_class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } +/** + * nm_object_get_connection: + * @object: a #NMObject + * + * Gets the #NMObject's DBusGConnection. + * + * Returns: the connection + **/ DBusGConnection * nm_object_get_connection (NMObject *object) { @@ -193,6 +212,15 @@ nm_object_get_connection (NMObject *object) return NM_OBJECT_GET_PRIVATE (object)->connection; } +/** + * nm_object_get_path: + * @object: a #NMObject + * + * Gets the DBus path of the #NMObject. + * + * Returns: the object's path. This is the internal string used by the + * device, and must not be modified. + **/ const char * nm_object_get_path (NMObject *object) { diff --git a/libnm-glib/nm-serial-device.c b/libnm-glib/nm-serial-device.c index 65815d9cf8..2baf1a2751 100644 --- a/libnm-glib/nm-serial-device.c +++ b/libnm-glib/nm-serial-device.c @@ -26,6 +26,15 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +/** + * nm_serial_device_get_bytes_received: + * @self: a #NMSerialDevice + * + * Gets the amount of bytes received by the serial device. + * This counter is reset when the device is activated. + * + * Returns: bytes received + **/ guint32 nm_serial_device_get_bytes_received (NMSerialDevice *self) { @@ -34,6 +43,15 @@ nm_serial_device_get_bytes_received (NMSerialDevice *self) return NM_SERIAL_DEVICE_GET_PRIVATE (self)->in_bytes; } +/** + * nm_serial_device_get_bytes_sent: + * @self: a #NMSerialDevice + * + * Gets the amount of bytes sent by the serial device. + * This counter is reset when the device is activated. + * + * Returns: bytes sent + **/ guint32 nm_serial_device_get_bytes_sent (NMSerialDevice *self) { @@ -148,6 +166,15 @@ nm_serial_device_class_init (NMSerialDeviceClass *device_class) object_class->dispose = dispose; /* Signals */ + + /** + * NMSerialDevice::ppp-stats: + * @device: the serial device that received the signal + * @in_bytes: the amount of bytes received + * @out_bytes: the amount of bytes sent + * + * Notifies that a #NMAccessPoint is added to the wifi device. + **/ signals[PPP_STATS] = g_signal_new ("ppp-stats", G_OBJECT_CLASS_TYPE (object_class), diff --git a/libnm-glib/nm-settings.c b/libnm-glib/nm-settings.c index 303f93cfc5..3ac5b63340 100644 --- a/libnm-glib/nm-settings.c +++ b/libnm-glib/nm-settings.c @@ -7,6 +7,13 @@ #include "nm-dbus-glib-types.h" +/** + * nm_settings_error_quark: + * + * Setting error quark. + * + * Returns: the setting error quark + **/ GQuark nm_settings_error_quark (void) { @@ -80,6 +87,14 @@ nm_settings_class_init (NMSettingsClass *settings_class) settings_class->list_connections = NULL; /* signals */ + + /** + * NMSettings::new-connection: + * @setting: the setting that received the signal + * @connection: the new #NMExportedConnection + * + * Notifies that a new exported connection is added. + **/ settings_signals[S_NEW_CONNECTION] = g_signal_new ("new-connection", G_OBJECT_CLASS_TYPE (object_class), @@ -94,6 +109,14 @@ nm_settings_class_init (NMSettingsClass *settings_class) &dbus_glib_nm_settings_object_info); } +/** + * nm_settings_list_connections: + * @settings: + * + * Lists all the available connections. + * + * Returns: the #GSList containing #NMExportedConnection<!-- -->s + **/ GSList * nm_settings_list_connections (NMSettings *settings) { diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index 05e7bf3e8e..3ebd2fc17d 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -46,6 +46,7 @@ typedef struct { /* Temporary stuff */ guint connect_timer; guint quit_timer; + guint fail_stop_id; } NMVPNPluginPrivate; #define NM_VPN_PLUGIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_VPN_PLUGIN, NMVPNPluginPrivate)) @@ -257,10 +258,20 @@ quit_timer_expired (gpointer data) } static gboolean +fail_stop (gpointer data) +{ + NMVPNPlugin *plugin = NM_VPN_PLUGIN (data); + + nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED); + return FALSE; +} + +static gboolean nm_vpn_plugin_connect (NMVPNPlugin *plugin, NMConnection *connection, GError **err) { + NMVPNPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin); gboolean ret = FALSE; NMVPNServiceState state; @@ -293,8 +304,14 @@ nm_vpn_plugin_connect (NMVPNPlugin *plugin, case NM_VPN_SERVICE_STATE_INIT: nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STARTING); ret = NM_VPN_PLUGIN_GET_CLASS (plugin)->connect (plugin, connection, err); - if (!ret) - nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED); + if (!ret) { + /* Stop the plugin from and idle handler so that the Connect + * method return gets sent before the STOP StateChanged signal. + */ + if (priv->fail_stop_id) + g_source_remove (priv->fail_stop_id); + priv->fail_stop_id = g_idle_add (fail_stop, plugin); + } break; default: @@ -584,6 +601,9 @@ dispose (GObject *object) priv->disposed = TRUE; + if (priv->fail_stop_id) + g_source_remove (priv->fail_stop_id); + state = nm_vpn_plugin_get_state (plugin); if (state == NM_VPN_SERVICE_STATE_STARTED || @@ -633,6 +653,11 @@ state_changed (NMVPNPlugin *plugin, NMVPNServiceState state) if (priv->quit_timer) g_source_remove (priv->quit_timer); + if (priv->fail_stop_id) { + g_source_remove (priv->fail_stop_id); + priv->fail_stop_id = 0; + } + /* Add a timer to make sure we do not wait indefinitely for the successful connect. */ priv->connect_timer = g_timeout_add_full (G_PRIORITY_DEFAULT, NM_VPN_PLUGIN_CONNECT_TIMER, @@ -655,6 +680,10 @@ state_changed (NMVPNPlugin *plugin, NMVPNServiceState state) if (priv->quit_timer) g_source_remove (priv->quit_timer); + if (priv->fail_stop_id) { + g_source_remove (priv->fail_stop_id); + priv->fail_stop_id = 0; + } break; } } diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index a406e9fc3e..21fd6b10a4 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -24,7 +24,6 @@ libnm_util_include_HEADERS = \ nm-setting-wireless.h \ nm-setting-wireless-security.h \ nm-setting-vpn.h \ - nm-setting-vpn-properties.h \ nm-utils.h libnm_util_la_SOURCES= \ @@ -47,7 +46,6 @@ libnm_util_la_SOURCES= \ nm-setting-wireless.c \ nm-setting-wireless-security.c \ nm-setting-vpn.c \ - nm-setting-vpn-properties.c \ nm-utils.c \ $(libnm_util_include_HEADERS) diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index f8e7a71d62..3064e3488d 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -39,7 +39,6 @@ #include "nm-setting-wireless.h" #include "nm-setting-wireless-security.h" #include "nm-setting-vpn.h" -#include "nm-setting-vpn-properties.h" #include "nm-setting-serial.h" #include "nm-setting-gsm.h" @@ -197,11 +196,6 @@ register_default_settings (void) NM_SETTING_VPN_ERROR, 4); - register_one_setting (NM_SETTING_VPN_PROPERTIES_SETTING_NAME, - NM_TYPE_SETTING_VPN_PROPERTIES, - NM_SETTING_VPN_PROPERTIES_ERROR, - 5); - register_one_setting (NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_TYPE_SETTING_IP4_CONFIG, NM_SETTING_IP4_CONFIG_ERROR, diff --git a/libnm-util/nm-setting-vpn-properties.c b/libnm-util/nm-setting-vpn-properties.c deleted file mode 100644 index c7bf5bcc8f..0000000000 --- a/libnm-util/nm-setting-vpn-properties.c +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * (C) Copyright 2007 - 2008 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. - */ - -#include <dbus/dbus-glib.h> -#include "nm-setting-vpn-properties.h" -#include "nm-param-spec-specialized.h" -#include "nm-dbus-glib-types.h" - -GQuark -nm_setting_vpn_properties_error_quark (void) -{ - static GQuark quark; - - if (G_UNLIKELY (!quark)) - quark = g_quark_from_static_string ("nm-setting-vpn-properties-error-quark"); - return quark; -} - -/* This should really be standard. */ -#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } - -GType -nm_setting_vpn_properties_error_get_type (void) -{ - static GType etype = 0; - - if (etype == 0) { - static const GEnumValue values[] = { - /* Unknown error. */ - ENUM_ENTRY (NM_SETTING_VPN_PROPERTIES_ERROR_UNKNOWN, "UnknownError"), - /* The specified property was invalid. */ - ENUM_ENTRY (NM_SETTING_VPN_PROPERTIES_ERROR_INVALID_PROPERTY, "InvalidProperty"), - /* The specified property was missing and is required. */ - ENUM_ENTRY (NM_SETTING_VPN_PROPERTIES_ERROR_MISSING_PROPERTY, "MissingProperty"), - { 0, 0, 0 } - }; - etype = g_enum_register_static ("NMSettingVPNPropertiesError", values); - } - return etype; -} - - -G_DEFINE_TYPE (NMSettingVPNProperties, nm_setting_vpn_properties, NM_TYPE_SETTING) - -enum { - PROP_0, - PROP_DATA, - - LAST_PROP -}; - -NMSetting * -nm_setting_vpn_properties_new (void) -{ - return (NMSetting *) g_object_new (NM_TYPE_SETTING_VPN_PROPERTIES, NULL); -} - -static gboolean -verify (NMSetting *setting, GSList *all_settings, GError **error) -{ - NMSettingVPNProperties *self = NM_SETTING_VPN_PROPERTIES (setting); - - g_return_val_if_fail (self->data != NULL, FALSE); - - /* FIXME: actually check the data as well */ - - return TRUE; -} - -static void -nm_gvalue_destroy (gpointer data) -{ - GValue *value = (GValue *) data; - - g_value_unset (value); - g_slice_free (GValue, value); -} - -static void -update_one_secret (NMSetting *setting, const char *key, GValue *value) -{ - NMSettingVPNProperties *self = NM_SETTING_VPN_PROPERTIES (setting); - GValue *copy_val; - - g_return_if_fail (key != NULL); - g_return_if_fail (value != NULL); - - /* Secrets are really only known to the VPNs themselves. */ - copy_val = g_slice_new0 (GValue); - g_value_init (copy_val, G_VALUE_TYPE (value)); - g_value_copy (value, copy_val); - g_hash_table_insert (self->data, g_strdup (key), copy_val); -} - -static void -nm_setting_vpn_properties_init (NMSettingVPNProperties *self) -{ - g_object_set (NM_SETTING (self), "name", NM_SETTING_VPN_PROPERTIES_SETTING_NAME, NULL); - - self->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); -} - -static void -finalize (GObject *object) -{ - NMSettingVPNProperties *self = NM_SETTING_VPN_PROPERTIES (object); - - g_hash_table_destroy (self->data); - - G_OBJECT_CLASS (nm_setting_vpn_properties_parent_class)->finalize (object); -} - -static void -copy_hash (gpointer key, gpointer data, gpointer user_data) -{ - GHashTable *hash = (GHashTable *) user_data; - GValue *src_val = (GValue *) data; - GValue *copy_val; - - copy_val = g_slice_new0 (GValue); - g_value_init (copy_val, G_VALUE_TYPE (src_val)); - g_value_copy (src_val, copy_val); - g_hash_table_insert (hash, g_strdup (key), copy_val); -} - -static void -set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - NMSettingVPNProperties *setting = NM_SETTING_VPN_PROPERTIES (object); - - switch (prop_id) { - case PROP_DATA: - /* Must make a deep copy of the hash table here... */ - g_hash_table_remove_all (setting->data); - g_hash_table_foreach (g_value_get_boxed (value), copy_hash, setting->data); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - NMSettingVPNProperties *setting = NM_SETTING_VPN_PROPERTIES (object); - - switch (prop_id) { - case PROP_DATA: - g_value_set_boxed (value, setting->data); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -nm_setting_vpn_properties_class_init (NMSettingVPNPropertiesClass *setting_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (setting_class); - NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class); - - /* virtual methods */ - object_class->set_property = set_property; - object_class->get_property = get_property; - object_class->finalize = finalize; - parent_class->verify = verify; - parent_class->update_one_secret = update_one_secret; - - /* Properties */ - g_object_class_install_property - (object_class, PROP_DATA, - nm_param_spec_specialized (NM_SETTING_VPN_PROPERTIES_DATA, - "Data", - "VPN Service specific data", - DBUS_TYPE_G_MAP_OF_VARIANT, - G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); -} diff --git a/libnm-util/nm-setting-vpn-properties.h b/libnm-util/nm-setting-vpn-properties.h deleted file mode 100644 index 8a9ed8593d..0000000000 --- a/libnm-util/nm-setting-vpn-properties.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * (C) Copyright 2007 - 2008 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. - */ - -#ifndef NM_SETTING_VPN_PROPERTIES_H -#define NM_SETTING_VPN_PROPERTIES_H - -#include <nm-setting.h> - -G_BEGIN_DECLS - -#define NM_TYPE_SETTING_VPN_PROPERTIES (nm_setting_vpn_properties_get_type ()) -#define NM_SETTING_VPN_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_VPN_PROPERTIES, NMSettingVPNProperties)) -#define NM_SETTING_VPN_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_VPN_PROPERTIES, NMSettingVPNPropertiesClass)) -#define NM_IS_SETTING_VPN_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_VPN_PROPERTIES)) -#define NM_IS_SETTING_VPN_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SETTING_VPN_PROPERTIES)) -#define NM_SETTING_VPN_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_VPN_PROPERTIES, NMSettingVPNPropertiesClass)) - -#define NM_SETTING_VPN_PROPERTIES_SETTING_NAME "vpn-properties" - -typedef enum -{ - NM_SETTING_VPN_PROPERTIES_ERROR_UNKNOWN = 0, - NM_SETTING_VPN_PROPERTIES_ERROR_INVALID_PROPERTY, - NM_SETTING_VPN_PROPERTIES_ERROR_MISSING_PROPERTY, -} NMSettingVPNPropertiesError; - -#define NM_TYPE_SETTING_VPN_PROPERTIES_ERROR (nm_setting_vpn_properties_error_get_type ()) -GType nm_setting_vpn_properties_error_get_type (void); - -#define NM_SETTING_VPN_PROPERTIES_ERROR nm_setting_vpn_properties_error_quark () -GQuark nm_setting_vpn_properties_error_quark (void); - -#define NM_SETTING_VPN_PROPERTIES_DATA "data" - -typedef struct { - NMSetting parent; - - /* The hash table is created at setting object - * init time and should not be replaced. It is - * a char * -> GValue * mapping, and both the key - * and value are owned by the hash table. GValues - * inserted into the hash table must be allocated - * with the g_slice_* functions. - */ - GHashTable *data; -} NMSettingVPNProperties; - -typedef struct { - NMSettingClass parent; -} NMSettingVPNPropertiesClass; - -GType nm_setting_vpn_properties_get_type (void); - -NMSetting *nm_setting_vpn_properties_new (void); - -G_END_DECLS - -#endif /* NM_SETTING_VPN_PROPERTIES_H */ diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c index 9a8258b847..aa2fcfd6d2 100644 --- a/libnm-util/nm-setting-vpn.c +++ b/libnm-util/nm-setting-vpn.c @@ -70,6 +70,7 @@ enum { PROP_0, PROP_SERVICE_TYPE, PROP_USER_NAME, + PROP_DATA, LAST_PROP }; @@ -114,9 +115,24 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) } static void +update_one_secret (NMSetting *setting, const char *key, GValue *value) +{ + NMSettingVPN *self = NM_SETTING_VPN (setting); + + g_return_if_fail (key != NULL); + g_return_if_fail (value != NULL); + g_return_if_fail (G_VALUE_HOLDS_STRING (value)); + + /* Secrets are really only known to the VPNs themselves. */ + g_hash_table_insert (self->data, g_strdup (key), g_value_dup_string (value)); +} + +static void nm_setting_vpn_init (NMSettingVPN *setting) { - ((NMSetting *) setting)->name = g_strdup (NM_SETTING_VPN_SETTING_NAME); + NM_SETTING (setting)->name = g_strdup (NM_SETTING_VPN_SETTING_NAME); + + setting->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } static void @@ -126,11 +142,18 @@ finalize (GObject *object) g_free (self->service_type); g_free (self->user_name); + g_hash_table_destroy (self->data); G_OBJECT_CLASS (nm_setting_vpn_parent_class)->finalize (object); } static void +copy_hash (gpointer key, gpointer value, gpointer user_data) +{ + g_hash_table_insert ((GHashTable *) user_data, g_strdup (key), g_strdup (value)); +} + +static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { @@ -145,6 +168,11 @@ set_property (GObject *object, guint prop_id, g_free (setting->user_name); setting->user_name = g_value_dup_string (value); break; + case PROP_DATA: + /* Must make a deep copy of the hash table here... */ + g_hash_table_remove_all (setting->data); + g_hash_table_foreach (g_value_get_boxed (value), copy_hash, setting->data); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -164,6 +192,9 @@ get_property (GObject *object, guint prop_id, case PROP_USER_NAME: g_value_set_string (value, setting->user_name); break; + case PROP_DATA: + g_value_set_boxed (value, setting->data); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -181,6 +212,7 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) object_class->get_property = get_property; object_class->finalize = finalize; parent_class->verify = verify; + parent_class->update_one_secret = update_one_secret; /* Properties */ g_object_class_install_property @@ -198,4 +230,12 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) "User name", NULL, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + g_object_class_install_property + (object_class, PROP_DATA, + nm_param_spec_specialized (NM_SETTING_VPN_DATA, + "Data", + "VPN Service specific data", + DBUS_TYPE_G_MAP_OF_STRING, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); } diff --git a/libnm-util/nm-setting-vpn.h b/libnm-util/nm-setting-vpn.h index a52627ae9f..f87365e63d 100644 --- a/libnm-util/nm-setting-vpn.h +++ b/libnm-util/nm-setting-vpn.h @@ -54,12 +54,27 @@ GQuark nm_setting_vpn_error_quark (void); #define NM_SETTING_VPN_SERVICE_TYPE "service-type" #define NM_SETTING_VPN_USER_NAME "user-name" +#define NM_SETTING_VPN_DATA "data" typedef struct { NMSetting parent; char *service_type; + + /* username of the user requesting this connection, thus + * it's really only valid for user connections, and it also + * should never be saved out to persistent config. + */ char *user_name; + + /* The hash table is created at setting object + * init time and should not be replaced. It is + * a char * -> char * mapping, and both the key + * and value are owned by the hash table, and should + * be allocated with functions whose value can be + * freed with g_free() + */ + GHashTable *data; } NMSettingVPN; typedef struct { diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 3171660b05..ed656054b4 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -577,7 +577,7 @@ nm_utils_convert_ip4_addr_struct_array_to_string (const GValue *src_value, GValu } static void -convert_one_hash_entry (gpointer key, gpointer value, gpointer user_data) +convert_one_gvalue_hash_entry (gpointer key, gpointer value, gpointer user_data) { GString *printable = (GString *) user_data; char *value_as_string; @@ -598,7 +598,33 @@ nm_utils_convert_gvalue_hash_to_string (const GValue *src_value, GValue *dest_va hash = (GHashTable *) g_value_get_boxed (src_value); printable = g_string_new ("["); - g_hash_table_foreach (hash, convert_one_hash_entry, printable); + g_hash_table_foreach (hash, convert_one_gvalue_hash_entry, printable); + g_string_append (printable, " ]"); + + g_value_take_string (dest_value, printable->str); + g_string_free (printable, FALSE); +} + +static void +convert_one_string_hash_entry (gpointer key, gpointer value, gpointer user_data) +{ + GString *printable = (GString *) user_data; + + g_string_append_printf (printable, " { '%s': %s },", (const char *) key, (const char *) value); +} + +static void +nm_utils_convert_string_hash_to_string (const GValue *src_value, GValue *dest_value) +{ + GHashTable *hash; + GString *printable; + + g_return_if_fail (g_type_is_a (G_VALUE_TYPE (src_value), DBUS_TYPE_G_MAP_OF_STRING)); + + hash = (GHashTable *) g_value_get_boxed (src_value); + + printable = g_string_new ("["); + g_hash_table_foreach (hash, convert_one_string_hash_entry, printable); g_string_append (printable, " ]"); g_value_take_string (dest_value, printable->str); @@ -626,6 +652,9 @@ nm_utils_register_value_transformations (void) g_value_register_transform_func (DBUS_TYPE_G_MAP_OF_VARIANT, G_TYPE_STRING, nm_utils_convert_gvalue_hash_to_string); + g_value_register_transform_func (DBUS_TYPE_G_MAP_OF_STRING, + G_TYPE_STRING, + nm_utils_convert_string_hash_to_string); registered = TRUE; } } diff --git a/po/ChangeLog b/po/ChangeLog index 402adaf3aa..48c952f0a2 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,15 @@ +2008-08-14 Claude Paroz <claude@2xlibre.net> + + * fr.po: Updated French translation by Robert-André Mauchin. + +2008-08-14 Ilkka Tuohela <hile@iki.fi> + + * fi.po: Updated Finnish translation. + +2008-08-09 Kjartan Maraas <kmaraas@gnome.org> + + * nb.po: Updated Norwegian bokmål translation. + 2008-08-02 Alexander Shopov <ash@contact.bg> * bg.po: Updated Bulgarian translation by @@ -2,14 +2,14 @@ # Copyright (C) 2005 Ilkka Tuohela. # This file is distributed under the same license as the NetworkManager package. # -# Ilkka Tuohela <hile@iki.fi>, 2005. +# Ilkka Tuohela <hile@iki.fi>, 2005-2008. # msgid "" msgstr "" "Project-Id-Version: NetworkManager\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-03-14 09:44+0300\n" -"PO-Revision-Date: 2007-01-31 10:50+0300\n" +"POT-Creation-Date: 2008-08-13 17:50+0300\n" +"PO-Revision-Date: 2008-08-14 08:00+0300\n" "Last-Translator: Ilkka Tuohela <hile@iki.fi>\n" "Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n" "MIME-Version: 1.0\n" @@ -17,54 +17,246 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/nm-netlink-monitor.c:188 ../src/nm-netlink-monitor.c:448 +#: ../src/nm-netlink-monitor.c:193 ../src/nm-netlink-monitor.c:471 #, c-format msgid "error processing netlink message: %s" msgstr "virhe käsiteltäessä netlink-viestiä: %s" -#: ../src/nm-netlink-monitor.c:245 +#: ../src/nm-netlink-monitor.c:250 #, c-format msgid "unable to allocate netlink handle for monitoring link status: %s" msgstr "ei voitu varata netlink-kahvaa linkin tilan tarkkailulle: %s" -#: ../src/nm-netlink-monitor.c:255 +#: ../src/nm-netlink-monitor.c:260 #, c-format msgid "unable to connect to netlink for monitoring link status: %s" msgstr "" "ei voitu yhdistää netlink-pistokkeeseen linkin tilan tarkkailua varten: %s" -#: ../src/nm-netlink-monitor.c:263 +#: ../src/nm-netlink-monitor.c:268 #, c-format msgid "unable to join netlink group for monitoring link status: %s" msgstr "ei voit liittyä netlink-ryhmään linkin tilan tarkkailua varten: %s" -#: ../src/nm-netlink-monitor.c:271 +#: ../src/nm-netlink-monitor.c:276 #, c-format msgid "unable to allocate netlink link cache for monitoring link status: %s" msgstr "" "ei voitu varata netlink-linkin välimuistia inkin tilan tarkkailua varten %s" -#: ../src/nm-netlink-monitor.c:471 +#: ../src/nm-netlink-monitor.c:494 #, c-format msgid "error occurred while waiting for data on socket" msgstr "virhe odotettaessa tietoja pistokkeesta" -#: ../src/NetworkManager.c:255 +#: ../src/NetworkManager.c:250 #, c-format msgid "Invalid option. Please use --help to see a list of valid options.\n" msgstr "" "Virheellinen valitsin: Antamalla --help näet luettelon kelvollisista\n" "valitsimista.\n" -#: ../src/named-manager/nm-named-manager.c:218 +#: ../src/dhcp-manager/nm-dhcp-dhclient.c:87 +msgid "# Created by NetworkManager\n" +msgstr "# NetworkManagerin luoma\n" + +#: ../src/dhcp-manager/nm-dhcp-dhclient.c:93 +#, c-format +msgid "" +"# Merged from %s\n" +"\n" +msgstr "" +"# Yhdistetty tiedostosta %s\n" +"\n" + +#: ../src/named-manager/nm-named-manager.c:257 msgid "NOTE: the glibc resolver does not support more than 3 nameservers." msgstr "HUOMAUTUS: glibc-nimenselvennys ei tue kuin kolmea nimipalvelinta." -#: ../src/named-manager/nm-named-manager.c:220 +#: ../src/named-manager/nm-named-manager.c:259 msgid "The nameservers listed below may not be recognized." msgstr "Alla olevaa nimipalvelinluetteloa ei voitu tunnistaa." -#: ../system-settings/plugins/ifcfg-fedora/plugin.c:94 -msgid "Auto Wired" -msgstr "Automaattinen kiinteä" +#: ../system-settings/src/main.c:365 +#, c-format +msgid "Auto %s" +msgstr "Auto-%s" + +#: ../libnm-util/crypto.c:125 +#, c-format +msgid "PEM key file had no end tag '%s'." +msgstr "PEM-avaintiedostossa ei ole loppumerkkiä \"%s\"." + +#: ../libnm-util/crypto.c:135 +#, c-format +msgid "Doesn't look like a PEM private key file." +msgstr "Tämä ei näytä PEM-muotoiselta salaisen avaimen tiedostolta." + +#: ../libnm-util/crypto.c:143 +#, c-format +msgid "Not enough memory to store PEM file data." +msgstr "Muisti ei riitä PEM-tiedoston sisällön tallentamiseen." + +#: ../libnm-util/crypto.c:159 +#, c-format +msgid "Malformed PEM file: Proc-Type was not first tag." +msgstr "Virheellinen PEM-tiedosto: ensimmäinen merkintä ei ollut Proc-Type." + +#: ../libnm-util/crypto.c:167 +#, c-format +msgid "Malformed PEM file: unknown Proc-Type tag '%s'." +msgstr "Virheellinen PEM-tiedosto: tuntematon Proc-Type-merkintä \"%s\"." + +#: ../libnm-util/crypto.c:177 +#, c-format +msgid "Malformed PEM file: DEK-Info was not the second tag." +msgstr "Virheellinen PEM-tiedosto: DEK-Info ei ollut toinen merkintä." + +#: ../libnm-util/crypto.c:188 +#, c-format +msgid "Malformed PEM file: no IV found in DEK-Info tag." +msgstr "Virheellinen PEM-tiedosto: alustusvektoria ei löytynyt DEK-Infosta." + +#: ../libnm-util/crypto.c:195 +#, c-format +msgid "Malformed PEM file: invalid format of IV in DEK-Info tag." +msgstr "Virheellinen PEM-tiedosto: alustusvektori DEK-Infossa on virheellinen." + +#: ../libnm-util/crypto.c:208 +#, c-format +msgid "Malformed PEM file: unknown private key cipher '%s'." +msgstr "Virheellinen PEM-tiedosto: tuntematon salaisen avaimen sifferi \"%s\"." + +#: ../libnm-util/crypto.c:227 +#, c-format +msgid "Could not decode private key." +msgstr "Salaista avainta ei voitu purkaa." + +#: ../libnm-util/crypto.c:271 +#, c-format +msgid "PEM certificate '%s' had no end tag '%s'." +msgstr "PEM-varmenne \"%s\" ei sisällä päätösmerkkiä \"%s\"." + +#: ../libnm-util/crypto.c:281 +#, c-format +msgid "Failed to decode certificate." +msgstr "Varmennetta ei voitu purkaa." + +#: ../libnm-util/crypto.c:290 ../libnm-util/crypto.c:298 +#, c-format +msgid "Not enough memory to store certificate data." +msgstr "Muisti ei riitä varmenteen tietojen tallennukseen." + +#: ../libnm-util/crypto.c:328 +#, c-format +msgid "IV must be an even number of bytes in length." +msgstr "Alustusvektorin täytyy olla parillisen tavumäärän pituinen." + +#: ../libnm-util/crypto.c:337 +#, c-format +msgid "Not enough memory to store the IV." +msgstr "Muisti ei riitä alustusvektorin tallennukseen." + +#: ../libnm-util/crypto.c:348 +#, c-format +msgid "IV contains non-hexadecimal digits." +msgstr "Alustusvektori sisältää muita kuin heksadesimaalisia merkkejä." + +#: ../libnm-util/crypto.c:386 ../libnm-util/crypto_gnutls.c:126 +#: ../libnm-util/crypto_nss.c:136 +#, c-format +msgid "Private key cipher '%s' was unknown." +msgstr "Salaisen avaimen sifferi \"%s\" oli tuntematon." + +#: ../libnm-util/crypto.c:395 +#, c-format +msgid "Not enough memory to create private key decryption key." +msgstr "Muisti ei riitä luomaan salaisen avaimen purkuavainta." + +#: ../libnm-util/crypto.c:513 +#, c-format +msgid "Not enough memory to store decrypted private key." +msgstr "Muisti ei riitä puretun salaisen avaimen tallennukseen." + +#: ../libnm-util/crypto_gnutls.c:73 +#, c-format +msgid "Failed to initialize the MD5 engine: %s / %s." +msgstr "MD5-moottoria ei voitu alustaa: %s / %s." + +#: ../libnm-util/crypto_gnutls.c:135 ../libnm-util/crypto_nss.c:145 +#, c-format +msgid "Not enough memory for decrypted key buffer." +msgstr "Muisti ei riitä puretulle avainpuskurille." + +#: ../libnm-util/crypto_gnutls.c:143 +#, c-format +msgid "Failed to initialize the decryption cipher context: %s / %s." +msgstr "Virhe alustettaessa purkusifferin kontekstia: %s / %s." + +#: ../libnm-util/crypto_gnutls.c:152 +#, c-format +msgid "Failed to set symmetric key for decryption: %s / %s." +msgstr "Virhe asetettaessa symmetristä salausavainta: %s / %s." + +#: ../libnm-util/crypto_gnutls.c:161 +#, c-format +msgid "Failed to set IV for decryption: %s / %s." +msgstr "Alustusvektoria purkua varten ei voitu alustaa: %s / %s." + +#: ../libnm-util/crypto_gnutls.c:170 +#, c-format +msgid "Failed to decrypt the private key: %s / %s." +msgstr "Salaista avainta ei voitu purkaa: %s / %s." + +#: ../libnm-util/crypto_gnutls.c:208 +#, c-format +msgid "Error initializing certificate data: %s" +msgstr "Virhe alustettaessa varmenteen tietoja: %s" + +#: ../libnm-util/crypto_gnutls.c:220 +#, c-format +msgid "Couldn't decode certificate: %s" +msgstr "Varmennetta ei voitu purkaa: %s" + +#: ../libnm-util/crypto_nss.c:78 +#, c-format +msgid "Failed to initialize the MD5 context: %d." +msgstr "MD5-kontekstia ei voitu alustaa: %d." + +#: ../libnm-util/crypto_nss.c:153 +#, c-format +msgid "Failed to initialize the decryption cipher slot." +msgstr "Salausmenetelmän lohkoa ei voitu alustaa." + +#: ../libnm-util/crypto_nss.c:163 +#, c-format +msgid "Failed to set symmetric key for decryption." +msgstr "Symmetristä salausavainta ei voitu asettaa." + +#: ../libnm-util/crypto_nss.c:173 +#, c-format +msgid "Failed to set IV for decryption." +msgstr "Salauksen purun aloitusvektorin asetus epäonnistui." + +#: ../libnm-util/crypto_nss.c:181 +#, c-format +msgid "Failed to initialize the decryption context." +msgstr "Salauksen purun kontekstia ei voitu alustaa." + +#: ../libnm-util/crypto_nss.c:194 +#, c-format +msgid "Failed to decrypt the private key: %d." +msgstr "Salaista avainta ei voitu purkaa: %d." + +#: ../libnm-util/crypto_nss.c:206 +#, c-format +msgid "Failed to finalize decryption of the private key: %d." +msgstr "Salaisen avaimen salauksen purkua ei voitu viimeistellä: %d." + +#: ../libnm-util/crypto_nss.c:250 +#, c-format +msgid "Couldn't decode certificate: %d" +msgstr "Varmennetta ei voitu tulkita: %d" +#~ msgid "Auto Wired" +#~ msgstr "Automaattinen kiinteä" @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager 0.7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-03-09 13:08+0100\n" -"PO-Revision-Date: 2008-03-09 13:09+0100\n" +"POT-Creation-Date: 2008-08-14 21:02+0200\n" +"PO-Revision-Date: 2008-08-14 20:59+0200\n" "Last-Translator: Robert-André Mauchin <zebob.m@pengzone.org>\n" "Language-Team: GNOME French Team <gnomefr@traduc.org>\n" "MIME-Version: 1.0\n" @@ -20,55 +20,259 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n>1;\n" -#: ../src/nm-netlink-monitor.c:188 ../src/nm-netlink-monitor.c:448 +#: ../src/nm-netlink-monitor.c:193 ../src/nm-netlink-monitor.c:474 #, c-format msgid "error processing netlink message: %s" msgstr "erreur lors du traitement du message netlink : %s" -#: ../src/nm-netlink-monitor.c:245 +#: ../src/nm-netlink-monitor.c:250 #, c-format msgid "unable to allocate netlink handle for monitoring link status: %s" msgstr "" "impossible d'allouer un gestionnaire netlink pour surveiller l'état de la " "connexion : %s" -#: ../src/nm-netlink-monitor.c:255 +#: ../src/nm-netlink-monitor.c:260 #, c-format msgid "unable to connect to netlink for monitoring link status: %s" msgstr "" "impossible de se connecter à netlink pour surveiller l'état de la " "connexion : %s" -#: ../src/nm-netlink-monitor.c:263 +#: ../src/nm-netlink-monitor.c:268 #, c-format msgid "unable to join netlink group for monitoring link status: %s" msgstr "" -"impossible de joindre le group netlink pour surveiller l'état de la " +"impossible de joindre le groupe netlink pour surveiller l'état de la " "connexion : %s" -#: ../src/nm-netlink-monitor.c:271 +#: ../src/nm-netlink-monitor.c:276 #, c-format msgid "unable to allocate netlink link cache for monitoring link status: %s" msgstr "" "impossible d'allouer un cache de connexion netlink pour surveiller l'état de " "la connexion : %s" -#: ../src/nm-netlink-monitor.c:471 +#: ../src/nm-netlink-monitor.c:439 +#, c-format +msgid "error updating link cache: %s" +msgstr "erreur lors de la mise à jour du cache de connexion : %s" + +#: ../src/nm-netlink-monitor.c:497 #, c-format msgid "error occurred while waiting for data on socket" msgstr "une erreur est survenue pendant l'attente de données sur le connecteur" -#: ../src/NetworkManager.c:255 +#: ../src/NetworkManager.c:250 #, c-format msgid "Invalid option. Please use --help to see a list of valid options.\n" msgstr "" "Option non valide. Utilisez --help pour afficher une liste d'options " "valides.\n" -#: ../src/named-manager/nm-named-manager.c:218 +#: ../src/dhcp-manager/nm-dhcp-dhclient.c:87 +msgid "# Created by NetworkManager\n" +msgstr "# Créé par NetworkManager\n" + +#: ../src/dhcp-manager/nm-dhcp-dhclient.c:93 +#, c-format +msgid "" +"# Merged from %s\n" +"\n" +msgstr "" +"# Fusionné depuis %s\n" +"\n" + +#: ../src/named-manager/nm-named-manager.c:257 msgid "NOTE: the glibc resolver does not support more than 3 nameservers." -msgstr "NOTE : le solveur glibc ne prend pas en charge plus de 3 serveurs de noms." +msgstr "" +"NOTE : le solveur glibc ne prend pas en charge plus de 3 serveurs de noms." -#: ../src/named-manager/nm-named-manager.c:220 +#: ../src/named-manager/nm-named-manager.c:259 msgid "The nameservers listed below may not be recognized." msgstr "Les serveurs de noms listés ci-dessous peuvent ne pas être reconnus." + +#: ../system-settings/src/main.c:365 +#, c-format +msgid "Auto %s" +msgstr "Auto %s" + +#: ../libnm-util/crypto.c:125 +#, c-format +msgid "PEM key file had no end tag '%s'." +msgstr "Le fichier de clé PEM n'a pas de balise de fin « %s »." + +#: ../libnm-util/crypto.c:135 +#, c-format +msgid "Doesn't look like a PEM private key file." +msgstr "Cela ne semble pas être un fichier de clé privée PEM." + +#: ../libnm-util/crypto.c:143 +#, c-format +msgid "Not enough memory to store PEM file data." +msgstr "Mémoire insuffisante pour contenir les données du fichier PEM." + +#: ../libnm-util/crypto.c:159 +#, c-format +msgid "Malformed PEM file: Proc-Type was not first tag." +msgstr "Fichier PEM incorrect : Proc-Type n'est pas la première balise." + +#: ../libnm-util/crypto.c:167 +#, c-format +msgid "Malformed PEM file: unknown Proc-Type tag '%s'." +msgstr "Fichier PEM incorrect : étiquette Proc-Type « %s » inconnue." + +#: ../libnm-util/crypto.c:177 +#, c-format +msgid "Malformed PEM file: DEK-Info was not the second tag." +msgstr "Fichier PEM incorrect : DEK-Info n'est pas la deuxième balise." + +#: ../libnm-util/crypto.c:188 +#, c-format +msgid "Malformed PEM file: no IV found in DEK-Info tag." +msgstr "Fichier PEM incorrect : aucun IV trouvé dans la balise DEK-Info." + +#: ../libnm-util/crypto.c:195 +#, c-format +msgid "Malformed PEM file: invalid format of IV in DEK-Info tag." +msgstr "Fichier PEM incorrect : format de IV invalide dans la balise DEK-Info." + +#: ../libnm-util/crypto.c:208 +#, c-format +msgid "Malformed PEM file: unknown private key cipher '%s'." +msgstr "Fichier PEM incorrect : chiffre de clé privée « %s » inconnu." + +#: ../libnm-util/crypto.c:227 +#, c-format +msgid "Could not decode private key." +msgstr "Impossible de décoder la clé privée." + +#: ../libnm-util/crypto.c:271 +#, c-format +msgid "PEM certificate '%s' had no end tag '%s'." +msgstr "Le certificat PEM « %s » n'a pas de balise de fin « %s »." + +#: ../libnm-util/crypto.c:281 +#, c-format +msgid "Failed to decode certificate." +msgstr "Impossible de décoder le certificat." + +#: ../libnm-util/crypto.c:290 ../libnm-util/crypto.c:298 +#, c-format +msgid "Not enough memory to store certificate data." +msgstr "Mémoire insuffisante pour contenir les données du certificat." + +#: ../libnm-util/crypto.c:328 +#, c-format +msgid "IV must be an even number of bytes in length." +msgstr "La longueur en octets de IV doit être paire." + +#: ../libnm-util/crypto.c:337 +#, c-format +msgid "Not enough memory to store the IV." +msgstr "Mémoire insuffisante pour contenir IV." + +#: ../libnm-util/crypto.c:348 +#, c-format +msgid "IV contains non-hexadecimal digits." +msgstr "IV contient des chiffres non-hexadécimaux." + +#: ../libnm-util/crypto.c:386 ../libnm-util/crypto_gnutls.c:126 +#: ../libnm-util/crypto_nss.c:136 +#, c-format +msgid "Private key cipher '%s' was unknown." +msgstr "Le chiffre « %s » de la clé privée est inconnu." + +#: ../libnm-util/crypto.c:395 +#, c-format +msgid "Not enough memory to create private key decryption key." +msgstr "" +"Mémoire insuffisante pour créer une clé de déchiffrement de la clé privée." + +#: ../libnm-util/crypto.c:513 +#, c-format +msgid "Not enough memory to store decrypted private key." +msgstr "Mémoire insuffisante pour contenir la clé privée déchiffrée." + +#: ../libnm-util/crypto_gnutls.c:73 +#, c-format +msgid "Failed to initialize the MD5 engine: %s / %s." +msgstr "L'initialisation du moteur MD5 a échoué : %s / %s." + +#: ../libnm-util/crypto_gnutls.c:135 ../libnm-util/crypto_nss.c:145 +#, c-format +msgid "Not enough memory for decrypted key buffer." +msgstr "Mémoire insuffisante pour le tampon de clé déchiffrée." + +#: ../libnm-util/crypto_gnutls.c:143 +#, c-format +msgid "Failed to initialize the decryption cipher context: %s / %s." +msgstr "" +"L'initialisation du contexte du chiffre de déchiffrement a échoué : %s / %s." + +#: ../libnm-util/crypto_gnutls.c:152 +#, c-format +msgid "Failed to set symmetric key for decryption: %s / %s." +msgstr "" +"La définition de la clé symétrique pour le déchiffrement a échoué : %s / %s." + +#: ../libnm-util/crypto_gnutls.c:161 +#, c-format +msgid "Failed to set IV for decryption: %s / %s." +msgstr "La définition de IV pour le déchiffrement a échoué : %s / %s." + +#: ../libnm-util/crypto_gnutls.c:170 +#, c-format +msgid "Failed to decrypt the private key: %s / %s." +msgstr "Le déchiffrement de la clé privée a échoué : %s / %s." + +#: ../libnm-util/crypto_gnutls.c:208 +#, c-format +msgid "Error initializing certificate data: %s" +msgstr "Erreur lors de l'initialisation des données du certificat : %s" + +#: ../libnm-util/crypto_gnutls.c:220 +#, c-format +msgid "Couldn't decode certificate: %s" +msgstr "Impossible de décoder le certificat : %s" + +#: ../libnm-util/crypto_nss.c:78 +#, c-format +msgid "Failed to initialize the MD5 context: %d." +msgstr "L'initialisation du contexte MD5 a échoué : %d." + +#: ../libnm-util/crypto_nss.c:153 +#, c-format +msgid "Failed to initialize the decryption cipher slot." +msgstr "" +"L'initialisation de l'emplacement du chiffre de déchiffrement a échoué." + +#: ../libnm-util/crypto_nss.c:163 +#, c-format +msgid "Failed to set symmetric key for decryption." +msgstr "La définition de la clé symétrique pour le déchiffrement a échoué." + +#: ../libnm-util/crypto_nss.c:173 +#, c-format +msgid "Failed to set IV for decryption." +msgstr "La définition de IV pour le déchiffrement a échoué." + +#: ../libnm-util/crypto_nss.c:181 +#, c-format +msgid "Failed to initialize the decryption context." +msgstr "L'initialisation du contexte de déchiffrement a échoué." + +#: ../libnm-util/crypto_nss.c:194 +#, c-format +msgid "Failed to decrypt the private key: %d." +msgstr "Le déchiffrement de la clé privée a échoué : %d." + +#: ../libnm-util/crypto_nss.c:206 +#, c-format +msgid "Failed to finalize decryption of the private key: %d." +msgstr "La finalisation du déchiffrement de la clé privée a échoué : %d." + +#: ../libnm-util/crypto_nss.c:250 +#, c-format +msgid "Couldn't decode certificate: %d" +msgstr "Impossible de décoder le certificat : %d" @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager 0.9.x\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-10 09:46+0200\n" -"PO-Revision-Date: 2008-07-10 09:48+0200\n" +"POT-Creation-Date: 2008-08-09 10:37+0200\n" +"PO-Revision-Date: 2008-08-09 10:38+0200\n" "Last-Translator: Kjartan Maraas <kmaraas@gnome.org>\n" "Language-Team: Norwegian Bokmål <i18n-nb@lister.ping.uio.no>\n" "MIME-Version: 1.0\n" @@ -58,16 +58,18 @@ msgid "Invalid option. Please use --help to see a list of valid options.\n" msgstr "" "Ugyldig flagg. Vennligst bruk --help for å se en liste med gyldige flagg.\n" -#: ../src/dhcp-manager/nm-dhcp-manager.c:638 +#: ../src/dhcp-manager/nm-dhcp-dhclient.c:87 msgid "# Created by NetworkManager\n" msgstr "# Laget av NetworkManager\n" -#: ../src/dhcp-manager/nm-dhcp-manager.c:644 +#: ../src/dhcp-manager/nm-dhcp-dhclient.c:93 #, c-format msgid "" "# Merged from %s\n" "\n" -msgstr "# Flettet fra %s\n\n" +msgstr "" +"# Flettet fra %s\n" +"\n" #: ../src/named-manager/nm-named-manager.c:117 msgid "NOTE: the glibc resolver does not support more than 3 nameservers." @@ -82,211 +84,178 @@ msgstr "Navnetjenere listet under vil kanskje ikke bli gjenkjent." msgid "Auto %s" msgstr "Auto %s" -#: ../libnm-util/crypto.c:123 +#: ../libnm-util/crypto.c:125 #, c-format msgid "PEM key file had no end tag '%s'." msgstr "PEM-nøkkelfil hadde ikke avsluttende tagg «%s»." -#: ../libnm-util/crypto.c:133 +#: ../libnm-util/crypto.c:135 #, c-format msgid "Doesn't look like a PEM private key file." msgstr "Ser ikke ut som en privat PEM-nøkkelfil." -#: ../libnm-util/crypto.c:141 +#: ../libnm-util/crypto.c:143 #, c-format msgid "Not enough memory to store PEM file data." msgstr "Ikke nok minne til å lagre data for PEM-fil." -#: ../libnm-util/crypto.c:157 +#: ../libnm-util/crypto.c:159 #, c-format msgid "Malformed PEM file: Proc-Type was not first tag." msgstr "Feilutformet PEM-fil: Proc-Type var ikke første tagg." -#: ../libnm-util/crypto.c:165 +#: ../libnm-util/crypto.c:167 #, c-format msgid "Malformed PEM file: unknown Proc-Type tag '%s'." msgstr "" -#: ../libnm-util/crypto.c:175 +#: ../libnm-util/crypto.c:177 #, c-format msgid "Malformed PEM file: DEK-Info was not the second tag." msgstr "" -#: ../libnm-util/crypto.c:186 +#: ../libnm-util/crypto.c:188 #, c-format msgid "Malformed PEM file: no IV found in DEK-Info tag." msgstr "" -#: ../libnm-util/crypto.c:193 +#: ../libnm-util/crypto.c:195 #, c-format msgid "Malformed PEM file: invalid format of IV in DEK-Info tag." msgstr "" -#: ../libnm-util/crypto.c:206 +#: ../libnm-util/crypto.c:208 #, c-format msgid "Malformed PEM file: unknown private key cipher '%s'." msgstr "" -#: ../libnm-util/crypto.c:225 +#: ../libnm-util/crypto.c:227 #, c-format msgid "Could not decode private key." msgstr "Kunne ikke dekode privat nøkkel." -#: ../libnm-util/crypto.c:269 +#: ../libnm-util/crypto.c:271 #, c-format msgid "PEM certificate '%s' had no end tag '%s'." msgstr "" -#: ../libnm-util/crypto.c:279 +#: ../libnm-util/crypto.c:281 #, c-format msgid "Failed to decode certificate." msgstr "Klarte ikke å dekode sertifikat." -#: ../libnm-util/crypto.c:288 ../libnm-util/crypto.c:296 +#: ../libnm-util/crypto.c:290 ../libnm-util/crypto.c:298 #, c-format msgid "Not enough memory to store certificate data." msgstr "Ikke nok minne til å lagre sertifikatdata." -#: ../libnm-util/crypto.c:326 +#: ../libnm-util/crypto.c:328 #, c-format msgid "IV must be an even number of bytes in length." msgstr "" -#: ../libnm-util/crypto.c:335 +#: ../libnm-util/crypto.c:337 #, c-format msgid "Not enough memory to store the IV." msgstr "" -#: ../libnm-util/crypto.c:346 +#: ../libnm-util/crypto.c:348 #, c-format msgid "IV contains non-hexadecimal digits." msgstr "" -#: ../libnm-util/crypto.c:384 ../libnm-util/crypto_gnutls.c:125 -#: ../libnm-util/crypto_nss.c:134 +#: ../libnm-util/crypto.c:386 ../libnm-util/crypto_gnutls.c:126 +#: ../libnm-util/crypto_nss.c:136 #, c-format msgid "Private key cipher '%s' was unknown." msgstr "" -#: ../libnm-util/crypto.c:393 +#: ../libnm-util/crypto.c:395 #, c-format msgid "Not enough memory to create private key decryption key." msgstr "" -#: ../libnm-util/crypto.c:511 +#: ../libnm-util/crypto.c:513 #, c-format msgid "Not enough memory to store decrypted private key." msgstr "" -#: ../libnm-util/crypto_gnutls.c:72 +#: ../libnm-util/crypto_gnutls.c:73 #, c-format msgid "Failed to initialize the MD5 engine: %s / %s." msgstr "" -#: ../libnm-util/crypto_gnutls.c:134 ../libnm-util/crypto_nss.c:143 +#: ../libnm-util/crypto_gnutls.c:135 ../libnm-util/crypto_nss.c:145 #, c-format msgid "Not enough memory for decrypted key buffer." msgstr "" -#: ../libnm-util/crypto_gnutls.c:142 +#: ../libnm-util/crypto_gnutls.c:143 #, c-format msgid "Failed to initialize the decryption cipher context: %s / %s." msgstr "" -#: ../libnm-util/crypto_gnutls.c:151 +#: ../libnm-util/crypto_gnutls.c:152 #, c-format msgid "Failed to set symmetric key for decryption: %s / %s." msgstr "" -#: ../libnm-util/crypto_gnutls.c:160 +#: ../libnm-util/crypto_gnutls.c:161 #, c-format msgid "Failed to set IV for decryption: %s / %s." msgstr "" -#: ../libnm-util/crypto_gnutls.c:169 +#: ../libnm-util/crypto_gnutls.c:170 #, c-format msgid "Failed to decrypt the private key: %s / %s." msgstr "" -#: ../libnm-util/crypto_gnutls.c:207 +#: ../libnm-util/crypto_gnutls.c:208 #, c-format msgid "Error initializing certificate data: %s" msgstr "" -#: ../libnm-util/crypto_gnutls.c:219 +#: ../libnm-util/crypto_gnutls.c:220 #, c-format msgid "Couldn't decode certificate: %s" msgstr "Kunne ikke dekode sertifikat: %s" -#: ../libnm-util/crypto_nss.c:76 +#: ../libnm-util/crypto_nss.c:78 #, c-format msgid "Failed to initialize the MD5 context: %d." msgstr "" -#: ../libnm-util/crypto_nss.c:151 +#: ../libnm-util/crypto_nss.c:153 #, c-format msgid "Failed to initialize the decryption cipher slot." msgstr "" -#: ../libnm-util/crypto_nss.c:161 +#: ../libnm-util/crypto_nss.c:163 #, c-format msgid "Failed to set symmetric key for decryption." msgstr "" -#: ../libnm-util/crypto_nss.c:171 +#: ../libnm-util/crypto_nss.c:173 #, c-format msgid "Failed to set IV for decryption." msgstr "" -#: ../libnm-util/crypto_nss.c:179 +#: ../libnm-util/crypto_nss.c:181 #, c-format msgid "Failed to initialize the decryption context." msgstr "" -#: ../libnm-util/crypto_nss.c:192 +#: ../libnm-util/crypto_nss.c:194 #, c-format msgid "Failed to decrypt the private key: %d." msgstr "" -#: ../libnm-util/crypto_nss.c:204 +#: ../libnm-util/crypto_nss.c:206 #, c-format msgid "Failed to finalize decryption of the private key: %d." msgstr "" -#: ../libnm-util/crypto_nss.c:248 +#: ../libnm-util/crypto_nss.c:250 #, c-format msgid "Couldn't decode certificate: %d" msgstr "Kunne ikke dekode sertifikat: %d" - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:68 -msgid "Choose a Certificate Authority certificate..." -msgstr "" - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:87 -msgid "Choose your personal certificate..." -msgstr "" - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:105 -msgid "Choose your private key..." -msgstr "Velg din private nøkkel..." - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:158 -msgid "Choose an OpenVPN static key..." -msgstr "Velg en statisk nøkkel for OpenVPN..." - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:176 -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:864 -msgid "None" -msgstr "Ingen" - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:519 -msgid "PEM certificates (*.pem, *.crt, *.key)" -msgstr "PEM-sertifikater (*.pem, *.crt, *.key)" - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:579 -msgid "OpenVPN Static Keys (*.key)" -msgstr "Statisk nøkkel for OpenVPN (*.key)" - -#: ../vpn-daemons/openvpn/properties/auth-helpers.c:703 -msgid "Default" -msgstr "Forvalg" diff --git a/src/Makefile.am b/src/Makefile.am index 807623dc03..2917c80bc5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,6 +65,8 @@ NetworkManager_SOURCES = \ nm-gsm-device.h \ nm-cdma-device.c \ nm-cdma-device.h \ + nm-hso-gsm-device.c \ + nm-hso-gsm-device.h \ wpa.c \ wpa.h \ nm-netlink.c \ @@ -179,10 +181,8 @@ EXTRA_DIST = \ $(NetworkManager_DATA) rundir=$(localstatedir)/run/NetworkManager -dispatcherdir=$(sysconfdir)/NetworkManager/dispatcher.d install-data-hook: - $(mkinstalldirs) -m 0700 $(DESTDIR)$(rundir) - $(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir) + $(mkinstalldirs) -m 0700 $(DESTDIR)$(rundir) CLEANFILES = $(BUILT_SOURCES) diff --git a/src/NetworkManager.c b/src/NetworkManager.c index 9468c94ba0..e3079db489 100644 --- a/src/NetworkManager.c +++ b/src/NetworkManager.c @@ -287,7 +287,6 @@ main (int argc, char *argv[]) nm_logging_setup (become_daemon); nm_info ("starting..."); - nm_system_init (); main_loop = g_main_loop_new (NULL, FALSE); /* Create watch functions that monitor cards for link status. */ diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index 631068fa43..c8fa251b19 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -20,17 +20,7 @@ * (C) Copyright 2005 Red Hat, Inc. */ -#include <stdio.h> -#include <unistd.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <signal.h> -#include <fcntl.h> -#include <sys/select.h> #include <string.h> -#include <stdlib.h> -#include <sys/wait.h> #include "NetworkManagerPolicy.h" #include "NetworkManagerUtils.h" @@ -41,6 +31,7 @@ #include "nm-device.h" #include "nm-device-wifi.h" #include "nm-device-ethernet.h" +#include "nm-hso-gsm-device.h" #include "nm-gsm-device.h" #include "nm-cdma-device.h" #include "nm-dbus-manager.h" @@ -122,7 +113,6 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update) NMActRequest *best_req = NULL; GSList *devices, *iter; NMNamedManager *named_mgr; - NMIP4Config *config; devices = nm_manager_get_devices (policy->manager); for (iter = devices; iter; iter = g_slist_next (iter)) { @@ -133,7 +123,7 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update) NMSettingIP4Config *s_ip4; guint32 prio; guint i; - gboolean have_gateway = FALSE; + gboolean can_default = FALSE; if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED) continue; @@ -158,12 +148,13 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update) addr = nm_ip4_config_get_address (ip4_config, i); if (addr->gateway) { - have_gateway = TRUE; + can_default = TRUE; break; } } - if (!have_gateway) + /* 'hso' devices never get a gateway from the remote end */ + if (!can_default && !NM_IS_HSO_GSM_DEVICE (dev)) continue; prio = get_device_priority (dev); @@ -196,15 +187,17 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update) } named_mgr = nm_named_manager_get (); - config = nm_device_get_ip4_config (best); - nm_named_manager_add_ip4_config (named_mgr, config, NM_NAMED_IP_CONFIG_TYPE_BEST_DEVICE); + nm_named_manager_add_ip4_config (named_mgr, + nm_device_get_ip_iface (best), + nm_device_get_ip4_config (best), + NM_NAMED_IP_CONFIG_TYPE_BEST_DEVICE); g_object_unref (named_mgr); /* Now set new default active connection _after_ updating DNS info, so that * if the connection is shared dnsmasq picks up the right stuff. */ if (best_req) - nm_act_request_set_default (best_req, TRUE); + nm_act_request_set_default (best_req, TRUE); nm_info ("Policy set (%s) as default device for routing and DNS.", nm_device_get_iface (best)); @@ -342,178 +335,6 @@ get_device_connection (NMDevice *device) return nm_act_request_get_connection (req); } -static gboolean -do_cmd (const char *fmt, ...) -{ - va_list args; - char *cmd; - int ret; - - va_start (args, fmt); - cmd = g_strdup_vprintf (fmt, args); - va_end (args); - - nm_info ("Executing: %s", cmd); - ret = system (cmd); - g_free (cmd); - - if (ret == -1) { - nm_info ("** Error executing command."); - return FALSE; - } else if (WEXITSTATUS (ret)) { - nm_info ("** Command returned exit status %d.", WEXITSTATUS (ret)); - return FALSE; - } - - return TRUE; -} - -static void -sharing_init (void) -{ - do_cmd ("echo \"1\" > /proc/sys/net/ipv4/ip_forward"); - do_cmd ("echo \"1\" > /proc/sys/net/ipv4/ip_dynaddr"); - do_cmd ("/sbin/modprobe ip_tables iptable_nat ip_nat_ftp ip_nat_irc"); - do_cmd ("/sbin/iptables -P INPUT ACCEPT"); - do_cmd ("/sbin/iptables -F INPUT"); - do_cmd ("/sbin/iptables -P OUTPUT ACCEPT"); - do_cmd ("/sbin/iptables -F OUTPUT"); - do_cmd ("/sbin/iptables -P FORWARD DROP"); - do_cmd ("/sbin/iptables -F FORWARD"); - do_cmd ("/sbin/iptables -t nat -F"); -} - -static void -sharing_stop (NMActRequest *req) -{ - do_cmd ("/sbin/iptables -F INPUT"); - do_cmd ("/sbin/iptables -F OUTPUT"); - do_cmd ("/sbin/iptables -P FORWARD DROP"); - do_cmd ("/sbin/iptables -F FORWARD"); - do_cmd ("/sbin/iptables -F -t nat"); - - // Delete all User-specified chains - do_cmd ("/sbin/iptables -X"); - - // Reset all IPTABLES counters - do_cmd ("/sbin/iptables -Z"); - - nm_act_request_set_shared (req, FALSE); -} - -/* Given a default activation request, start NAT-ing if there are any shared - * connections. - */ -static void -sharing_restart (NMPolicy *policy, NMActRequest *req) -{ - GSList *devices, *iter; - const char *extif; - gboolean have_shared = FALSE; - - if (nm_act_request_get_shared (req)) - sharing_stop (req); - - extif = nm_device_get_ip_iface (NM_DEVICE (nm_act_request_get_device (req))); - g_assert (extif); - - /* Start NAT-ing every 'shared' connection */ - devices = nm_manager_get_devices (policy->manager); - for (iter = devices; iter; iter = g_slist_next (iter)) { - NMDevice *candidate = NM_DEVICE (iter->data); - NMSettingIP4Config *s_ip4; - NMConnection *connection; - const char *intif; - - if (nm_device_get_state (candidate) != NM_DEVICE_STATE_ACTIVATED) - continue; - - connection = get_device_connection (candidate); - g_assert (connection); - - s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); - if (!s_ip4 || strcmp (s_ip4->method, "shared")) - continue; - - /* Init sharing if there's a shared connection to NAT */ - if (!have_shared) { - sharing_init (); - have_shared = TRUE; - } - - // FWD: Allow all connections OUT and only existing and related ones IN - intif = nm_device_get_ip_iface (candidate); - g_assert (intif); - do_cmd ("/sbin/iptables -A FORWARD -i %s -o %s -m state --state ESTABLISHED,RELATED -j ACCEPT", extif, intif); - do_cmd ("/sbin/iptables -A FORWARD -i %s -o %s -j ACCEPT", extif, intif); - do_cmd ("/sbin/iptables -A FORWARD -i %s -o %s -j ACCEPT", intif, extif); - } - - if (have_shared) { - // Enabling SNAT (MASQUERADE) functionality on $EXTIF - do_cmd ("/sbin/iptables -t nat -A POSTROUTING -o %s -j MASQUERADE", extif); - - nm_act_request_set_shared (req, TRUE); - } -} - -static void -check_sharing (NMPolicy *policy, NMDevice *device, NMConnection *connection) -{ - NMSettingIP4Config *s_ip4; - GSList *devices, *iter; - NMActRequest *default_req = NULL; - - if (!connection) - return; - - /* We only care about 'shared' connections going up or down */ - s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); - if (!s_ip4 || strcmp (s_ip4->method, "shared")) - return; - - /* Find the default connection, if any */ - devices = nm_manager_get_devices (policy->manager); - for (iter = devices; iter; iter = g_slist_next (iter)) { - NMDevice *candidate = NM_DEVICE (iter->data); - NMActRequest *req = nm_device_get_act_request (candidate); - - if (req && nm_act_request_get_default (req)) { - default_req = req; - break; - } - } - - /* Restart sharing if there's a default active connection */ - if (default_req) - sharing_restart (policy, default_req); -} - -static void -active_connection_default_changed (NMActRequest *req, - GParamSpec *pspec, - NMPolicy *policy) -{ - gboolean is_default = nm_act_request_get_default (req); - - if (is_default) { - if (nm_act_request_get_shared (req)) { - /* Already shared, shouldn't get here */ - nm_warning ("%s: Active connection '%s' already shared.", - __func__, nm_act_request_get_active_connection_path (req)); - return; - } - - sharing_restart (policy, req); - } else { - if (!nm_act_request_get_shared (req)) - return; /* Don't care about non-shared connections */ - - /* Tear down all NAT-ing */ - sharing_stop (req); - } -} - static void device_state_changed (NMDevice *device, NMDeviceState new_state, @@ -532,27 +353,19 @@ device_state_changed (NMDevice *device, nm_info ("Marking connection '%s' invalid.", get_connection_id (connection)); } schedule_activate_check (policy, device); - check_sharing (policy, device, connection); break; case NM_DEVICE_STATE_ACTIVATED: /* Clear the invalid tag on the connection */ if (connection) g_object_set_data (G_OBJECT (connection), INVALID_TAG, NULL); - g_signal_connect (G_OBJECT (nm_device_get_act_request (device)), - "notify::default", - G_CALLBACK (active_connection_default_changed), - policy); - update_routing_and_dns (policy, FALSE); - check_sharing (policy, device, connection); break; case NM_DEVICE_STATE_UNMANAGED: case NM_DEVICE_STATE_UNAVAILABLE: case NM_DEVICE_STATE_DISCONNECTED: update_routing_and_dns (policy, FALSE); schedule_activate_check (policy, device); - check_sharing (policy, device, connection); break; default: break; diff --git a/src/NetworkManagerSystem.c b/src/NetworkManagerSystem.c index bf6b11d792..c97d18ded2 100644 --- a/src/NetworkManagerSystem.c +++ b/src/NetworkManagerSystem.c @@ -385,7 +385,7 @@ nm_system_vpn_device_set_from_ip4_config (NMDevice *active_device, out: named_mgr = nm_named_manager_get (); - nm_named_manager_add_ip4_config (named_mgr, config, NM_NAMED_IP_CONFIG_TYPE_VPN); + nm_named_manager_add_ip4_config (named_mgr, iface, config, NM_NAMED_IP_CONFIG_TYPE_VPN); g_object_unref (named_mgr); return TRUE; @@ -406,7 +406,7 @@ gboolean nm_system_vpn_device_unset_from_ip4_config (NMDevice *active_device, co g_return_val_if_fail (config != NULL, FALSE); named_mgr = nm_named_manager_get (); - nm_named_manager_remove_ip4_config (named_mgr, config); + nm_named_manager_remove_ip4_config (named_mgr, iface, config); g_object_unref (named_mgr); return TRUE; @@ -428,10 +428,10 @@ gboolean nm_system_device_set_up_down (NMDevice *dev, gboolean up) gboolean nm_system_device_set_up_down_with_iface (const char *iface, gboolean up) { + struct rtnl_link *request = NULL, *old = NULL; + struct nl_handle *nlh; gboolean success = FALSE; guint32 idx; - struct rtnl_link * request = NULL; - struct rtnl_link * old = NULL; g_return_val_if_fail (iface != NULL, FALSE); @@ -446,16 +446,13 @@ gboolean nm_system_device_set_up_down_with_iface (const char *iface, gboolean up idx = nm_netlink_iface_to_index (iface); old = nm_netlink_index_to_rtnl_link (idx); if (old) { - struct nl_handle *nlh; - nlh = nm_netlink_get_default_handle (); if (nlh) - rtnl_link_change (nlh, old, request, 0); + success = (rtnl_link_change (nlh, old, request, 0) == 0) ? TRUE : FALSE; } rtnl_link_put (old); rtnl_link_put (request); - success = TRUE; out: return success; @@ -483,6 +480,7 @@ nm_system_device_is_up_with_iface (const char *iface) } /* Get device's flags */ + memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, iface, IFNAMSIZ); if (ioctl (fd, SIOCGIFFLAGS, &ifr) < 0) { if (errno != ENODEV) { diff --git a/src/NetworkManagerSystem.h b/src/NetworkManagerSystem.h index fa2b337957..60e24c6abb 100644 --- a/src/NetworkManagerSystem.h +++ b/src/NetworkManagerSystem.h @@ -32,8 +32,6 @@ * implemented in the backend files in backends/ directory */ -void nm_system_init (void); - void nm_system_device_flush_ip4_routes (NMDevice *dev); void nm_system_device_flush_ip4_routes_with_iface (const char *iface); @@ -45,7 +43,6 @@ void nm_system_device_flush_ip4_addresses (NMDevice *dev); void nm_system_device_flush_ip4_addresses_with_iface (const char *iface); void nm_system_enable_loopback (void); -void nm_system_kill_all_dhcp_daemons (void); void nm_system_update_dns (void); gboolean nm_system_device_set_from_ip4_config (const char *iface, @@ -65,12 +62,6 @@ gboolean nm_system_device_set_up_down_with_iface (const char *iface, gboolean gboolean nm_system_device_is_up (NMDevice *device); gboolean nm_system_device_is_up_with_iface (const char *iface); -void nm_system_set_hostname (NMIP4Config *config); -void nm_system_activate_nis (NMIP4Config *config); -void nm_system_shutdown_nis (void); - gboolean nm_system_device_set_mtu (const char *iface, guint32 mtu); -gboolean nm_system_should_modify_resolv_conf (void); - #endif diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 66fe990795..a1afc65f1f 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -113,14 +113,14 @@ nm_print_device_capabilities (NMDevice *dev) driver = "<unknown>"; if (caps == NM_DEVICE_CAP_NONE || !(NM_DEVICE_CAP_NM_SUPPORTED)) { - nm_info ("%s: Driver support level for '%s' is unsupported", + nm_info ("%s: driver '%s' is unsupported", nm_device_get_iface (dev), driver); return; } if (NM_IS_DEVICE_ETHERNET (dev)) { if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) { - nm_info ("%s: Driver '%s' does not support carrier detection.\n" + nm_info ("%s: driver '%s' does not support carrier detection.\n" "\tYou must switch to it manually.", nm_device_get_iface (dev), driver); full_support = FALSE; @@ -130,7 +130,7 @@ nm_print_device_capabilities (NMDevice *dev) } if (full_support) { - nm_info ("%s: Device is fully-supported using driver '%s'.", + nm_info ("%s: driver is '%s'.", nm_device_get_iface (dev), driver); } } diff --git a/src/backends/Makefile.am b/src/backends/Makefile.am index 10830c7bc4..14af1de535 100644 --- a/src/backends/Makefile.am +++ b/src/backends/Makefile.am @@ -7,54 +7,46 @@ INCLUDES = -I${top_srcdir} \ noinst_LTLIBRARIES = libnmbackend.la -libnmbackend_la_SOURCES = NetworkManagerGeneric.c \ +libnmbackend_la_SOURCES = NetworkManagerGeneric.c \ NetworkManagerGeneric.h libnmbackend_la_LIBADD = if TARGET_REDHAT -libnmbackend_la_SOURCES += NetworkManagerRedHat.c \ - shvar.c \ - shvar.h +libnmbackend_la_SOURCES += NetworkManagerRedHat.c endif if TARGET_SUSE -libnmbackend_la_SOURCES += NetworkManagerSuSE.c \ - shvar.c \ - shvar.h +libnmbackend_la_SOURCES += NetworkManagerSuSE.c endif if TARGET_GENTOO -libnmbackend_la_SOURCES += NetworkManagerGentoo.c \ - shvar.c \ - shvar.h +libnmbackend_la_SOURCES += NetworkManagerGentoo.c endif if TARGET_DEBIAN -libnmbackend_la_SOURCES += NetworkManagerDebian.c +libnmbackend_la_SOURCES += NetworkManagerDebian.c endif if TARGET_SLACKWARE -libnmbackend_la_SOURCES += NetworkManagerSlackware.c +libnmbackend_la_SOURCES += NetworkManagerSlackware.c endif if TARGET_ARCH -libnmbackend_la_SOURCES += NetworkManagerArch.c +libnmbackend_la_SOURCES += NetworkManagerArch.c endif if TARGET_PALDO -libnmbackend_la_SOURCES += NetworkManagerPaldo.c +libnmbackend_la_SOURCES += NetworkManagerPaldo.c endif if TARGET_FRUGALWARE -libnmbackend_la_SOURCES += NetworkManagerFrugalware.c +libnmbackend_la_SOURCES += NetworkManagerFrugalware.c libnmbackend_la_LIBADD += -lfwnetconfig -lfwutil endif if TARGET_MANDRIVA -libnmbackend_la_SOURCES += NetworkManagerMandriva.c \ - shvar.c \ - shvar.h +libnmbackend_la_SOURCES += NetworkManagerMandriva.c endif libnmbackend_la_LIBADD += $(DBUS_LIBS) $(GTHREAD_LIBS) diff --git a/src/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c index c7dc1bfd37..3ed5677e87 100644 --- a/src/backends/NetworkManagerArch.c +++ b/src/backends/NetworkManagerArch.c @@ -36,31 +36,12 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <signal.h> -#include <arpa/inet.h> -#include <glib/gprintf.h> -#include <glib/gfileutils.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} /* * nm_system_enable_loopback @@ -70,22 +51,10 @@ void nm_system_init (void) */ void nm_system_enable_loopback (void) { - nm_system_device_set_up_down_with_iface ("lo", TRUE); + nm_generic_enable_loopback (); } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ - nm_spawn_process ("/usr/bin/killall -q dhclient"); -} - - -/* * nm_system_update_dns * * Make glibc/nscd aware of any changes to the resolv.conf file by @@ -96,48 +65,6 @@ void nm_system_update_dns (void) { /* Check if the daemon was already running - do not start a new instance */ if (g_file_test("/var/run/daemons/nscd", G_FILE_TEST_EXISTS)) - { nm_spawn_process ("/etc/rc.d/nscd restart"); - } -} - -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ } diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c index ef6e501460..d4a518befb 100644 --- a/src/backends/NetworkManagerDebian.c +++ b/src/backends/NetworkManagerDebian.c @@ -28,28 +28,12 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <arpa/inet.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} /* * nm_system_enable_loopback @@ -63,18 +47,6 @@ void nm_system_enable_loopback (void) } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ - nm_spawn_process ("/usr/bin/killall -q dhclient"); -} - - -/* * nm_system_update_dns * * Make glibc/nscd aware of any changes to the resolv.conf file by @@ -84,46 +56,5 @@ void nm_system_kill_all_dhcp_daemons (void) void nm_system_update_dns (void) { nm_spawn_process ("/usr/sbin/invoke-rc.d nscd restart"); - -} - -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; } diff --git a/src/backends/NetworkManagerFrugalware.c b/src/backends/NetworkManagerFrugalware.c index 301985ddf4..492bf19399 100644 --- a/src/backends/NetworkManagerFrugalware.c +++ b/src/backends/NetworkManagerFrugalware.c @@ -24,29 +24,13 @@ */ #include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <arpa/inet.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerSystem.h" -#include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" -// Provided by the frugalwareutils package on Frugalware -#include <libfwnetconfig.h> - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ -} +/* Provided by the frugalwareutils package on Frugalware */ +#include <libfwnetconfig.h> /* * nm_system_enable_loopback @@ -61,18 +45,6 @@ void nm_system_enable_loopback (void) /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ - nm_spawn_process ("/usr/bin/killall -q dhclient"); -} - - -/* * nm_system_update_dns * * Make glibc/nscd aware of any changes to the resolv.conf file by @@ -84,43 +56,3 @@ void nm_system_update_dns (void) /* I'm not running nscd */ } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - diff --git a/src/backends/NetworkManagerGeneric.c b/src/backends/NetworkManagerGeneric.c index 1143c4387b..93b1e1262d 100644 --- a/src/backends/NetworkManagerGeneric.c +++ b/src/backends/NetworkManagerGeneric.c @@ -34,9 +34,8 @@ #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" #include "nm-netlink.h" +#include "nm-utils.h" /* Because of a bug in libnl, rtnl.h should be included before route.h */ #include <netlink/route/rtnl.h> @@ -45,18 +44,6 @@ #include <netlink/netlink.h> /* - * nm_generic_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_generic_init (void) -{ - /* Kill any dhclients lying around */ - nm_system_kill_all_dhcp_daemons (); -} - -/* * nm_generic_enable_loopback * * Bring up the loopback interface @@ -112,17 +99,6 @@ out: } /* - * nm_generic_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_generic_kill_all_dhcp_daemons (void) -{ -} - - -/* * nm_generic_update_dns * * Make glibc/nscd aware of any changes to the resolv.conf file by @@ -133,162 +109,3 @@ void nm_generic_update_dns (void) { } -/* - * nm_generic_set_ip4_config_from_resolv_conf - * - * Add nameservers and search names from a resolv.conf format file. - * - */ -void nm_generic_set_ip4_config_from_resolv_conf (const char *filename, NMIP4Config *ip4_config) -{ - char * contents = NULL; - char ** split_contents = NULL; - int i, len; - - g_return_if_fail (filename != NULL); - g_return_if_fail (ip4_config != NULL); - - if (!g_file_get_contents (filename, &contents, NULL, NULL) || (contents == NULL)) - return; - - if (!(split_contents = g_strsplit (contents, "\n", 0))) - goto out; - - len = g_strv_length (split_contents); - for (i = 0; i < len; i++) - { - char *line = split_contents[i]; - - /* Ignore comments */ - if (!line || (line[0] == ';') || (line[0] == '#')) - continue; - - line = g_strstrip (line); - if ((strncmp (line, "search", 6) == 0) && (strlen (line) > 6)) - { - char *searches = g_strdup (line + 7); - char **split_searches = NULL; - - if (!searches || !strlen (searches)) - continue; - - /* Allow space-separated search domains */ - if ((split_searches = g_strsplit (searches, " ", 0))) - { - int m, srch_len; - - srch_len = g_strv_length (split_searches); - for (m = 0; m < srch_len; m++) - { - if (split_searches[m]) - nm_ip4_config_add_domain (ip4_config, split_searches[m]); - } - g_strfreev (split_searches); - } - else - { - /* Only 1 item, add the whole line */ - nm_ip4_config_add_domain (ip4_config, searches); - } - - g_free (searches); - } - else if ((strncmp (line, "nameserver", 10) == 0) && (strlen (line) > 10)) - { - guint32 addr = (guint32) (inet_addr (line + 11)); - - if (addr != (guint32) -1) - nm_ip4_config_add_nameserver (ip4_config, addr); - } - } - - g_strfreev (split_contents); - -out: - g_free (contents); -} - - -/* - * nm_generic_device_get_system_config - * - * Retrieve any relevant configuration info for a particular device - * from the system network configuration information. Clear out existing - * info before setting stuff too. - * - */ -void* nm_generic_device_get_system_config (NMDevice *dev) -{ - return NULL; -} - -/* - * nm_generic_device_free_system_config - * - * Free stored system config data - * - */ -void nm_generic_device_free_system_config (NMDevice *dev, void *system_config_data) -{ - return; -} - - -/* - * nm_generic_device_get_disabled - * - * Return whether the distro-specific system config tells us to use - * dhcp for this device. - * - */ -gboolean nm_generic_device_get_disabled (NMDevice *dev) -{ - return FALSE; -} - - -NMIP4Config *nm_generic_device_new_ip4_system_config (NMDevice *dev) -{ - return NULL; -} - -/* - * nm_generic_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_generic_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_generic_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_generic_shutdown_nis (void) -{ -} - -/* - * nm_generic_set_hostname - * - * set the hostname - * - */ -void nm_generic_set_hostname (NMIP4Config *config) -{ -} - -/* - * nm_generic_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_generic_should_modify_resolv_conf (void) -{ - return TRUE; -} - diff --git a/src/backends/NetworkManagerGeneric.h b/src/backends/NetworkManagerGeneric.h index 420bc25a4e..0a0a88a215 100644 --- a/src/backends/NetworkManagerGeneric.h +++ b/src/backends/NetworkManagerGeneric.h @@ -24,39 +24,7 @@ #ifndef NETWORK_MANAGER_GENERIC_H #define NETWORK_MANAGER_GENERIC_H -#include <glib.h> -#include "nm-device.h" -#include "nm-ip4-config.h" -#include "nm-named-manager.h" - -/* Prototypes for system/distribution dependent functions, - * implemented in the backend files in backends/ directory - */ - -void nm_generic_init (void); - -void nm_generic_enable_loopback (void); -void nm_generic_kill_all_dhcp_daemons (void); -void nm_generic_update_dns (void); - -void nm_generic_set_ip4_config_from_resolv_conf (const char *filename, NMIP4Config *ip4_config); -void * nm_generic_device_get_system_config (NMDevice *dev); -void nm_generic_device_free_system_config (NMDevice *dev, void *system_config_data); -NMIP4Config * nm_generic_device_new_ip4_system_config (NMDevice *dev); - -gboolean nm_generic_device_get_disabled (NMDevice *dev); - -gboolean nm_generic_device_set_from_ip4_config (NMDevice *dev); -gboolean nm_generic_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config, char **routes, int num_routes); -gboolean nm_generic_vpn_device_unset_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config); - -gboolean nm_generic_device_set_up_down (NMDevice *dev, gboolean up); -gboolean nm_generic_device_set_up_down_with_iface (NMDevice *dev, const char *iface, gboolean up); - -void nm_generic_set_hostname (NMIP4Config *config); -void nm_generic_activate_nis (NMIP4Config *config); -void nm_generic_shutdown_nis (void); - -gboolean nm_generic_should_modify_resolv_conf (void); +void nm_generic_enable_loopback (void); +void nm_generic_update_dns (void); #endif diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index ee7e0dbddc..7fa12078a1 100644 --- a/src/backends/NetworkManagerGentoo.c +++ b/src/backends/NetworkManagerGentoo.c @@ -28,29 +28,12 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> #include <string.h> #include <stdlib.h> -#include <arpa/inet.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" -#include "shvar.h" - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} /* * nm_system_enable_loopback @@ -66,18 +49,6 @@ void nm_system_enable_loopback (void) } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ - /* TODO */ - /* Tell dhcdbd to kill its dhclient instance */ -} - -/* * nm_system_update_dns * * Make glibc/nscd aware of any changes to the resolv.conf file by @@ -94,44 +65,3 @@ void nm_system_update_dns (void) #endif } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - - diff --git a/src/backends/NetworkManagerMandriva.c b/src/backends/NetworkManagerMandriva.c index f41c4bdc46..527a25d896 100644 --- a/src/backends/NetworkManagerMandriva.c +++ b/src/backends/NetworkManagerMandriva.c @@ -26,30 +26,12 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <arpa/inet.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" -#include "shvar.h" - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} - /* * nm_system_enable_loopback @@ -63,17 +45,6 @@ void nm_system_enable_loopback (void) } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ -} - - -/* * nm_system_update_dns * * Invalidate the nscd host cache, if it exists, since @@ -88,44 +59,3 @@ void nm_system_update_dns (void) } } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - diff --git a/src/backends/NetworkManagerPaldo.c b/src/backends/NetworkManagerPaldo.c index 017d0cbb94..0147a3b0e4 100644 --- a/src/backends/NetworkManagerPaldo.c +++ b/src/backends/NetworkManagerPaldo.c @@ -27,31 +27,15 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <arpa/inet.h> -#include <glib/gkeyfile.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" #include "nm-utils.h" /* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} - -/* * nm_system_enable_loopback * * Bring up the loopback interface @@ -63,17 +47,6 @@ void nm_system_enable_loopback (void) } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ -} - - -/* * nm_system_update_dns * * Invalidate the nscd host cache, if it exists, since @@ -86,44 +59,3 @@ void nm_system_update_dns (void) nm_spawn_process ("/usr/sbin/nscd -i hosts"); } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index 284ef40e4e..1e3f7e9652 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -24,29 +24,12 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <arpa/inet.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" -#include "shvar.h" - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} /* * nm_system_enable_loopback @@ -60,17 +43,6 @@ void nm_system_enable_loopback (void) } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ -} - - -/* * nm_system_update_dns * * Invalidate the nscd host cache, if it exists, since @@ -85,44 +57,3 @@ void nm_system_update_dns (void) } } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index 91fac1c766..8d7c5bf294 100644 --- a/src/backends/NetworkManagerSlackware.c +++ b/src/backends/NetworkManagerSlackware.c @@ -25,31 +25,11 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> #include <string.h> #include <stdlib.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" -#include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "nm-utils.h" - -/* - * Mostly a mix of the Gentoo and RedHat Backends - */ - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} /* * nm_system_enable_loopback @@ -64,18 +44,6 @@ void nm_system_enable_loopback (void) /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ - nm_spawn_process ("/bin/killall -q dhcpcd"); -} - - -/* * nm_system_update_dns * * Make glibc/nscd aware of any changes to the resolv.conf file by @@ -87,43 +55,3 @@ void nm_system_update_dns (void) /* I'm not running nscd */ } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ -} - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ -} - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - return TRUE; -} - diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index 8578c7b4cb..a0cd1cb105 100644 --- a/src/backends/NetworkManagerSuSE.c +++ b/src/backends/NetworkManagerSuSE.c @@ -28,34 +28,13 @@ #endif #include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <sys/stat.h> -#include <arpa/inet.h> #include <string.h> #include <stdlib.h> -#include <unistd.h> -#include <netdb.h> -#include <errno.h> #include "NetworkManagerGeneric.h" #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" -#include "nm-device.h" -#include "NetworkManagerPolicy.h" #include "nm-utils.h" -#include "shvar.h" - -/* - * nm_system_init - * - * Initializes the distribution-specific system backend - * - */ -void nm_system_init (void) -{ - nm_generic_init (); -} /* * nm_system_enable_loopback @@ -69,17 +48,6 @@ void nm_system_enable_loopback (void) } /* - * nm_system_kill_all_dhcp_daemons - * - * Kill all DHCP daemons currently running, done at startup. - * - */ -void nm_system_kill_all_dhcp_daemons (void) -{ -} - - -/* * nm_system_update_dns * * Invalidate the nscd host cache, if it exists, since @@ -92,192 +60,3 @@ void nm_system_update_dns (void) nm_spawn_process ("/usr/sbin/nscd -i hosts"); } -/* - * nm_system_activate_nis - * - * set up the nis domain and write a yp.conf - * - */ -void nm_system_activate_nis (NMIP4Config *config) -{ - shvarFile *file; - const char *nis_domain; - char *name, *buf; - struct in_addr temp_addr; - int i; - FILE *ypconf = NULL; - char addr_buf[INET_ADDRSTRLEN+1]; - - memset (&addr_buf, '\0', sizeof (addr_buf)); - - g_return_if_fail (config != NULL); - - nis_domain = nm_ip4_config_get_nis_domain(config); - - name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp"); - file = svNewFile (name); - if (!file) - goto out_gfree; - - buf = svGetValue (file, "DHCLIENT_SET_DOMAINNAME"); - if (!buf) - goto out_close; - - if ((!strcmp (buf, "yes")) && nis_domain && (setdomainname (nis_domain, strlen (nis_domain)) < 0)) - nm_warning ("Could not set nis domain name."); - free (buf); - - buf = svGetValue (file, "DHCLIENT_MODIFY_NIS_CONF"); - if (!buf) - goto out_close; - - if (!strcmp (buf, "yes")) { - int num_nis_servers; - - num_nis_servers = nm_ip4_config_get_num_nis_servers(config); - if (num_nis_servers > 0) - { - struct stat sb; - - /* write out yp.conf and restart the daemon */ - - ypconf = fopen ("/etc/yp.conf", "w"); - - if (ypconf) - { - fprintf (ypconf, "# generated by NetworkManager, do not edit!\n\n"); - for (i = 0; i < num_nis_servers; i++) { - temp_addr.s_addr = nm_ip4_config_get_nis_server (config, i); - - if (!inet_ntop (AF_INET, &temp_addr, addr_buf, INET_ADDRSTRLEN)) - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (temp_addr.s_addr)); - else - fprintf (ypconf, "domain %s server %s\n", nis_domain, addr_buf); - } - fprintf (ypconf, "\n"); - fclose (ypconf); - } else - nm_warning ("Could not commit NIS changes to /etc/yp.conf."); - - if (stat ("/usr/sbin/rcautofs", &sb) != -1) - { - nm_info ("Restarting autofs."); - nm_spawn_process ("/usr/sbin/rcautofs reload"); - } - } - } - free (buf); - -out_close: - svCloseFile (file); -out_gfree: - g_free (name); -} - - -/* - * nm_system_shutdown_nis - * - * shutdown ypbind - * - */ -void nm_system_shutdown_nis (void) -{ -} - - -/* - * nm_system_set_hostname - * - * set the hostname - * - */ -void nm_system_set_hostname (NMIP4Config *config) -{ - char *filename, *h_name = NULL, *buf; - shvarFile *file; - - g_return_if_fail (config != NULL); - - filename = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp"); - file = svNewFile (filename); - if (!file) - goto out_gfree; - - buf = svGetValue (file, "DHCLIENT_SET_HOSTNAME"); - if (!buf) - goto out_close; - - if (!strcmp (buf, "yes")) - { - const char *hostname; - - hostname = nm_ip4_config_get_hostname (config); - if (!hostname) - { - struct in_addr temp_addr; - struct hostent *host; - const NMSettingIP4Address *ip_address; - - /* try to get hostname via dns */ - ip_address = nm_ip4_config_get_address (config, 0); - temp_addr.s_addr = ip_address->address; - host = gethostbyaddr ((char *) &temp_addr, sizeof (temp_addr), AF_INET); - if (host) - { - h_name = g_strdup (host->h_name); - hostname = strtok (h_name, "."); - } - else - nm_warning ("nm_system_set_hostname(): gethostbyaddr failed, h_errno = %d", h_errno); - } - - if (hostname) - { - nm_info ("Setting hostname to '%s'", hostname); - if (sethostname (hostname, strlen (hostname)) < 0) - nm_warning ("Could not set hostname."); - } - } - - g_free (h_name); - free (buf); -out_close: - svCloseFile (file); -out_gfree: - g_free (filename); -} - -/* - * nm_system_should_modify_resolv_conf - * - * Can NM update resolv.conf, or is it locked down? - */ -gboolean nm_system_should_modify_resolv_conf (void) -{ - char *name, *buf; - shvarFile *file; - gboolean ret = TRUE; - - name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp"); - file = svNewFile (name); - if (!file) - goto out_gfree; - - buf = svGetValue (file, "DHCLIENT_MODIFY_RESOLV_CONF"); - if (!buf) - goto out_close; - - if (strcmp (buf, "no") == 0) - ret = FALSE; - - free (buf); -out_close: - svCloseFile (file); -out_gfree: - g_free (name); - - return ret; -} - diff --git a/src/backends/shvar.c b/src/backends/shvar.c deleted file mode 100644 index 67b3019d48..0000000000 --- a/src/backends/shvar.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * shvar.c - * - * Implementation of non-destructively reading/writing files containing - * only shell variable declarations and full-line comments. - * - * Includes explicit inheritance mechanism intended for use with - * Red Hat Linux ifcfg-* files. There is no protection against - * inheritance loops; they will generally cause stack overflows. - * Furthermore, they are only intended for one level of inheritance; - * the value setting algorithm assumes this. - * - * Copyright 1999,2000 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "shvar.h" - -/* Open the file <name>, returning a shvarFile on success and NULL on failure. - Add a wrinkle to let the caller specify whether or not to create the file - (actually, return a structure anyway) if it doesn't exist. */ -static shvarFile * -svOpenFile(const char *name, gboolean create) -{ - shvarFile *s = NULL; - int closefd = 0; - - s = g_malloc0(sizeof(shvarFile)); - -#if 1 /* NetworkManager local change */ - s->fd = open(name, O_RDONLY); /* NOT O_CREAT */ - if (s->fd != -1) closefd = 1; -#else - s->fd = open(name, O_RDWR); /* NOT O_CREAT */ - if (s->fd == -1) { - /* try read-only */ - s->fd = open(name, O_RDONLY); /* NOT O_CREAT */ - if (s->fd != -1) closefd = 1; - } -#endif - s->fileName = g_strdup(name); - - if (s->fd != -1) { - struct stat buf; - char *p, *q; - - if (fstat(s->fd, &buf) < 0) goto bail; - s->arena = g_malloc0(buf.st_size + 1); - - if (read(s->fd, s->arena, buf.st_size) < 0) goto bail; - - /* we'd use g_strsplit() here, but we want a list, not an array */ - for(p = s->arena; (q = strchr(p, '\n')) != NULL; p = q + 1) { - s->lineList = g_list_append(s->lineList, g_strndup(p, q - p)); - } - - /* closefd is set if we opened the file read-only, so go ahead and - close it, because we can't write to it anyway */ - if (closefd) { - close(s->fd); - s->fd = -1; - } - - return s; - } - - if (create) { - return s; - } - -bail: - if (s->fd != -1) close(s->fd); - if (s->arena) g_free (s->arena); - if (s->fileName) g_free (s->fileName); - g_free (s); - return NULL; -} - -/* Open the file <name>, return shvarFile on success, NULL on failure */ -shvarFile * -svNewFile(const char *name) -{ - return svOpenFile(name, FALSE); -} - -/* Create a new file structure, returning actual data if the file exists, - * and a suitable starting point if it doesn't. */ -shvarFile * -svCreateFile(const char *name) -{ - return svOpenFile(name, TRUE); -} - -/* remove escaped characters in place */ -static void -unescape(char *s) { - int len, i; - - len = strlen(s); - if ((s[0] == '"' || s[0] == '\'') && s[0] == s[len-1]) { - i = len - 2; - memmove(s, s+1, i); - s[i+1] = '\0'; - len = i; - } - for (i = 0; i < len; i++) { - if (s[i] == '\\') { - memmove(s+i, s+i+1, len-(i+1)); - len--; - } - s[len] = '\0'; - } -} - - -/* create a new string with all necessary characters escaped. - * caller must free returned string - */ -static const char escapees[] = "\"'\\$~`"; /* must be escaped */ -static const char spaces[] = " \t|&;()<>"; /* only require "" */ -static char * -escape(const char *s) { - char *new; - int i, j, mangle = 0, space = 0; - int newlen, slen; - static int esclen, splen; - - if (!esclen) esclen = strlen(escapees); - if (!splen) splen = strlen(spaces); - slen = strlen(s); - - for (i = 0; i < slen; i++) { - if (strchr(escapees, s[i])) mangle++; - if (strchr(spaces, s[i])) space++; - } - if (!mangle && !space) return strdup(s); - - newlen = slen + mangle + 3; /* 3 is extra ""\0 */ - new = g_malloc0(newlen); - if (!new) return NULL; - - j = 0; - new[j++] = '"'; - for (i = 0; i < slen; i++) { - if (strchr(escapees, s[i])) { - new[j++] = '\\'; - } - new[j++] = s[i]; - } - new[j++] = '"'; - g_assert(j == slen + mangle + 2); /* j is the index of the '\0' */ - - return new; -} - -/* Get the value associated with the key, and leave the current pointer - * pointing at the line containing the value. The char* returned MUST - * be freed by the caller. - */ -char * -svGetValue(shvarFile *s, const char *key) -{ - char *value = NULL; - char *line; - char *keyString; - int len; - - g_assert(s); - g_assert(key); - - keyString = g_malloc0(strlen(key) + 2); - strcpy(keyString, key); - keyString[strlen(key)] = '='; - len = strlen(keyString); - - for (s->current = s->lineList; s->current; s->current = s->current->next) { - line = s->current->data; - if (!strncmp(keyString, line, len)) { - value = g_strdup(line + len); - unescape(value); - break; - } - } - g_free(keyString); - - if (value) { - if (value[0]) { - return value; - } else { - g_free(value); - return NULL; - } - } - if (s->parent) value = svGetValue(s->parent, key); - return value; -} - -/* return 1 if <key> resolves to any truth value (e.g. "yes", "y", "true") - * return 0 if <key> resolves to any non-truth value (e.g. "no", "n", "false") - * return <default> otherwise - */ -int -svTrueValue(shvarFile *s, const char *key, int def) -{ - char *tmp; - int returnValue = def; - - tmp = svGetValue(s, key); - if (!tmp) return returnValue; - - if ( (!strcasecmp("yes", tmp)) || - (!strcasecmp("true", tmp)) || - (!strcasecmp("t", tmp)) || - (!strcasecmp("y", tmp)) ) returnValue = 1; - else - if ( (!strcasecmp("no", tmp)) || - (!strcasecmp("false", tmp)) || - (!strcasecmp("f", tmp)) || - (!strcasecmp("n", tmp)) ) returnValue = 0; - - g_free (tmp); - return returnValue; -} - - -/* Set the variable <key> equal to the value <value>. - * If <key> does not exist, and the <current> pointer is set, append - * the key=value pair after that line. Otherwise, prepend the pair - * to the top of the file. Here's the algorithm, as the C code - * seems to be rather dense: - * - * if (value == NULL), then: - * if val2 (parent): change line to key= or append line key= - * if val1 (this) : delete line - * else noop - * else use this table: - * val2 - * NULL value other - * v NULL append line noop append line - * a - * l value noop noop noop - * 1 - * other change line delete line change line - * - * No changes are ever made to the parent config file, only to the - * specific file passed on the command line. - * - */ -void -svSetValue(shvarFile *s, const char *key, const char *value) -{ - char *newval = NULL, *val1 = NULL, *val2 = NULL; - char *keyValue; - - g_assert(s); - g_assert(key); - /* value may be NULL */ - - if (value) newval = escape(value); - keyValue = g_strdup_printf("%s=%s", key, newval ? newval : ""); - - val1 = svGetValue(s, key); - if (val1 && newval && !strcmp(val1, newval)) goto bail; - if (s->parent) val2 = svGetValue(s->parent, key); - - if (!newval || !newval[0]) { - /* delete value somehow */ - if (val2) { - /* change/append line to get key= */ - if (s->current) s->current->data = keyValue; - else s->lineList = g_list_append(s->lineList, keyValue); - s->freeList = g_list_append(s->freeList, keyValue); - s->modified = 1; - } else if (val1) { - /* delete line */ - s->lineList = g_list_remove_link(s->lineList, s->current); - g_list_free_1(s->current); - s->modified = 1; - goto bail; /* do not need keyValue */ - } - goto end; - } - - if (!val1) { - if (val2 && !strcmp(val2, newval)) goto end; - /* append line */ - s->lineList = g_list_append(s->lineList, keyValue); - s->freeList = g_list_append(s->freeList, keyValue); - s->modified = 1; - goto end; - } - - /* deal with a whole line of noops */ - if (val1 && !strcmp(val1, newval)) goto end; - - /* At this point, val1 && val1 != value */ - if (val2 && !strcmp(val2, newval)) { - /* delete line */ - s->lineList = g_list_remove_link(s->lineList, s->current); - g_list_free_1(s->current); - s->modified = 1; - goto bail; /* do not need keyValue */ - } else { - /* change line */ - if (s->current) s->current->data = keyValue; - else s->lineList = g_list_append(s->lineList, keyValue); - s->freeList = g_list_append(s->freeList, keyValue); - s->modified = 1; - } - -end: - if (newval) free(newval); - if (val1) free(val1); - if (val2) free(val2); - return; - -bail: - if (keyValue) free (keyValue); - goto end; -} - -/* Write the current contents iff modified. Returns -1 on error - * and 0 on success. Do not write if no values have been modified. - * The mode argument is only used if creating the file, not if - * re-writing an existing file, and is passed unchanged to the - * open() syscall. - */ -int -svWriteFile(shvarFile *s, int mode) -{ - FILE *f; - int tmpfd; - - if (s->modified) { - if (s->fd == -1) - s->fd = open(s->fileName, O_WRONLY|O_CREAT, mode); - if (s->fd == -1) - return -1; - if (ftruncate(s->fd, 0) < 0) - return -1; - - tmpfd = dup(s->fd); - f = fdopen(tmpfd, "w"); - fseek(f, 0, SEEK_SET); - for (s->current = s->lineList; s->current; s->current = s->current->next) { - char *line = s->current->data; - fprintf(f, "%s\n", line); - } - fclose(f); - } - - return 0; -} - - -/* Close the file descriptor (if open) and delete the shvarFile. - * Returns -1 on error and 0 on success. - */ -int -svCloseFile(shvarFile *s) -{ - - g_assert(s); - - if (s->fd != -1) close(s->fd); - - g_free(s->arena); - for (s->current = s->freeList; s->current; s->current = s->current->next) { - g_free(s->current->data); - } - g_free(s->fileName); - g_list_free(s->freeList); - g_list_foreach (s->lineList, (GFunc) g_free, NULL); - g_list_free(s->lineList); /* implicitly frees s->current */ - g_free(s); - return 0; -} diff --git a/src/backends/shvar.h b/src/backends/shvar.h deleted file mode 100644 index 00e1a8e59f..0000000000 --- a/src/backends/shvar.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * shvar.h - * - * Interface for non-destructively reading/writing files containing - * only shell variable declarations and full-line comments. - * - * Includes explicit inheritance mechanism intended for use with - * Red Hat Linux ifcfg-* files. There is no protection against - * inheritance loops; they will generally cause stack overflows. - * Furthermore, they are only intended for one level of inheritance; - * the value setting algorithm assumes this. - * - * Copyright 1999 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -#ifndef _SHVAR_H -#define _SHVAR_H - -#include <glib.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _shvarFile shvarFile; -struct _shvarFile { - char *fileName; /* read-only */ - int fd; /* read-only */ - char *arena; /* ignore */ - GList *lineList; /* read-only */ - GList *freeList; /* ignore */ - GList *current; /* set implicitly or explicitly, - points to element of lineList */ - shvarFile *parent; /* set explicitly */ - int modified; /* ignore */ -}; - - -/* Create the file <name>, return shvarFile on success, NULL on failure */ -shvarFile * -svCreateFile(const char *name); - -/* Open the file <name>, return shvarFile on success, NULL on failure */ -shvarFile * -svNewFile(const char *name); - -/* Get the value associated with the key, and leave the current pointer - * pointing at the line containing the value. The char* returned MUST - * be freed by the caller. - */ -char * -svGetValue(shvarFile *s, const char *key); - -/* return 1 if <key> resolves to any truth value (e.g. "yes", "y", "true") - * return 0 if <key> resolves to any non-truth value (e.g. "no", "n", "false") - * return <def> otherwise - */ -int -svTrueValue(shvarFile *s, const char *key, int def); - -/* Set the variable <key> equal to the value <value>. - * If <key> does not exist, and the <current> pointer is set, append - * the key=value pair after that line. Otherwise, prepend the pair - * to the top of the file. - */ -void -svSetValue(shvarFile *s, const char *key, const char *value); - - -/* Write the current contents iff modified. Returns -1 on error - * and 0 on success. Do not write if no values have been modified. - * The mode argument is only used if creating the file, not if - * re-writing an existing file, and is passed unchanged to the - * open() syscall. - */ -int -svWriteFile(shvarFile *s, int mode); - -/* Close the file descriptor (if open) and delete the shvarFile. - * Returns -1 on error and 0 on success. - */ -int -svCloseFile(shvarFile *s); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! _SHVAR_H */ diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index 94c4a65c61..c4087e682b 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -747,9 +747,20 @@ nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, } str = g_hash_table_lookup (device->options, "new_routers"); - if (str && (inet_pton (AF_INET, str, &tmp_addr) > 0)) { - addr->gateway = tmp_addr.s_addr; - nm_info(" gateway %s", str); + if (str) { + char **routers = g_strsplit (str, " ", 0); + char **s; + + for (s = routers; *s; s++) { + /* FIXME: how to handle multiple routers? */ + if (inet_pton (AF_INET, *s, &tmp_addr) > 0) { + addr->gateway = tmp_addr.s_addr; + nm_info (" gateway %s", *s); + break; + } else + nm_warning ("Ignoring invalid gateway '%s'", *s); + } + g_strfreev (routers); } nm_ip4_config_take_address (ip4_config, addr); @@ -800,27 +811,6 @@ nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, g_strfreev (searches); } - str = g_hash_table_lookup (device->options, "new_nis_domain"); - if (str) { - nm_ip4_config_set_nis_domain (ip4_config, str); - nm_info (" nis domain '%s'", str); - } - - str = g_hash_table_lookup (device->options, "new_nis_servers"); - if (str) { - char **searches = g_strsplit (str, " ", 0); - char **s; - - for (s = searches; *s; s++) { - if (inet_pton (AF_INET, *s, &tmp_addr) > 0) { - nm_ip4_config_add_nis_server (ip4_config, tmp_addr.s_addr); - nm_info (" nis server '%s'", *s); - } else - nm_warning ("Ignoring invalid nis server '%s'", *s); - } - g_strfreev (searches); - } - str = g_hash_table_lookup (device->options, "new_static_routes"); if (str) { char **searches = g_strsplit (str, " ", 0); @@ -894,7 +884,7 @@ copy_dhcp4_config_option (gpointer key, char *tmp_key = NULL; const char **p; static const char *filter_options[] = { - "interface", "pid", "reason", NULL + "interface", "pid", "reason", "dhcp_message_type", NULL }; /* Filter out stuff that's not actually new DHCP options */ diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index 7ae4ef2224..848507f92e 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -236,6 +236,7 @@ create_dm_cmd_line (const char *iface, const NMSettingIP4Address *tmp; struct in_addr addr; char buf[INET_ADDRSTRLEN + 1]; + char localaddr[INET_ADDRSTRLEN + 1]; dm_binary = nm_find_dnsmasq (); if (!dm_binary) { @@ -259,12 +260,12 @@ create_dm_cmd_line (const char *iface, s = g_string_new ("--listen-address="); addr.s_addr = tmp->address; - if (!inet_ntop (AF_INET, &addr, &buf[0], INET_ADDRSTRLEN)) { + if (!inet_ntop (AF_INET, &addr, &localaddr[0], INET_ADDRSTRLEN)) { nm_warning ("%s: error converting IP4 address 0x%X", __func__, ntohl (addr.s_addr)); goto error; } - g_string_append (s, buf); + g_string_append (s, localaddr); nm_cmd_line_add_string (cmd, s->str); g_string_free (s, TRUE); @@ -294,7 +295,11 @@ create_dm_cmd_line (const char *iface, nm_cmd_line_add_string (cmd, s->str); g_string_free (s, TRUE); - nm_cmd_line_add_string (cmd, "--dhcp-option=option:router,0.0.0.0"); + s = g_string_new ("--dhcp-option=option:router,"); + g_string_append (s, localaddr); + nm_cmd_line_add_string (cmd, s->str); + g_string_free (s, TRUE); + nm_cmd_line_add_string (cmd, "--dhcp-lease-max=50"); s = g_string_new ("--pid-file="); diff --git a/src/named-manager/nm-named-manager.c b/src/named-manager/nm-named-manager.c index 0162ea9657..4fc42c023e 100644 --- a/src/named-manager/nm-named-manager.c +++ b/src/named-manager/nm-named-manager.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ + /* * Copyright (C) 2004 - 2008 Red Hat, Inc. * @@ -26,6 +28,8 @@ #include <stdlib.h> #include <errno.h> #include <arpa/inet.h> +#include <sys/types.h> +#include <unistd.h> #include <glib.h> #include <glib/gi18n.h> @@ -85,50 +89,6 @@ nm_named_manager_error_quark (void) return quark; } -static char * -compute_nameservers (NMIP4Config *config) -{ - int i, num; - GString *str = NULL; - - g_return_val_if_fail (config != NULL, NULL); - - num = nm_ip4_config_get_num_nameservers (config); - if (num == 0) - return NULL; - - str = g_string_new (""); - for (i = 0; i < num; i++) { - #define ADDR_BUF_LEN 50 - struct in_addr addr; - char *buf; - - addr.s_addr = nm_ip4_config_get_nameserver (config, i); - buf = g_malloc0 (ADDR_BUF_LEN); - if (!buf) - continue; - - if (!inet_ntop (AF_INET, &addr, buf, ADDR_BUF_LEN)) - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (addr.s_addr)); - - if (i == 3) { - g_string_append (str, "\n# "); - g_string_append (str, _("NOTE: the glibc resolver does not support more than 3 nameservers.")); - g_string_append (str, "\n# "); - g_string_append (str, _("The nameservers listed below may not be recognized.")); - g_string_append_c (str, '\n'); - } - - g_string_append (str, "nameserver "); - g_string_append (str, buf); - g_string_append_c (str, '\n'); - g_free (buf); - } - - return g_string_free (str, FALSE); -} - static void merge_one_ip4_config (NMIP4Config *dst, NMIP4Config *src) { @@ -155,49 +115,221 @@ merge_one_ip4_config (NMIP4Config *dst, NMIP4Config *src) } } +#if defined(TARGET_SUSE) +/**********************************/ +/* SUSE */ + +static void +netconfig_child_setup (gpointer user_data G_GNUC_UNUSED) +{ + pid_t pid = getpid (); + setpgid (pid, pid); +} + +static gint +run_netconfig (GError **error) +{ + GPtrArray *argv; + gint stdin_fd; + + argv = g_ptr_array_new (); + g_ptr_array_add (argv, "/sbin/netconfig"); + g_ptr_array_add (argv, "modify"); + g_ptr_array_add (argv, "--service"); + g_ptr_array_add (argv, "NetworkManager"); + g_ptr_array_add (argv, NULL); + + if (!g_spawn_async_with_pipes (NULL, (char **) argv->pdata, NULL, + G_SPAWN_DO_NOT_REAP_CHILD, + netconfig_child_setup, + NULL, NULL, &stdin_fd, + NULL, NULL, error)) { + stdin_fd = -1; + } + + g_ptr_array_free (argv, TRUE); + + return stdin_fd; +} + +static void +write_to_netconfig (gint fd, const char *key, const char *value) +{ + char *str; + int x; + + str = g_strdup_printf ("%s='%s'\n", key, value); + x = write (fd, str, strlen (str)); + g_free (str); +} + static gboolean -rewrite_resolv_conf (NMNamedManager *mgr, GError **error) +update_resolv_conf (const char *iface, + const char *domain, + char **searches, + char **nameservers, + GError **error) { - NMNamedManagerPrivate *priv; - const char *tmp_resolv_conf = RESOLV_CONF ".tmp"; - char *searches = NULL, *domain = NULL; - char *nameservers = NULL; - guint32 num_domains, num_searches, i; - NMIP4Config *composite; - GSList *iter; - FILE *f; - GString *str; + gint fd; + char *str; - g_return_val_if_fail (error != NULL, FALSE); - g_return_val_if_fail (*error == NULL, FALSE); + fd = run_netconfig (error); + if (fd < 0) + return FALSE; - priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr); + write_to_netconfig (fd, "INTERFACE", iface); - /* If the sysadmin disabled modifying resolv.conf, exit silently */ - if (!nm_system_should_modify_resolv_conf ()) { - nm_info ("DHCP returned name servers but system has disabled dynamic modification!"); - return TRUE; + if (searches) { + str = g_strjoinv (" ", searches); + write_to_netconfig (fd, "DNSDOMAIN", str); + g_free (str); } + if (nameservers) { + str = g_strjoinv (" ", nameservers); + write_to_netconfig (fd, "DNSSERVERS", str); + g_free (str); + } + + close (fd); + + return TRUE; +} + +#else +/**********************************/ +/* Generic */ + +static gboolean +update_resolv_conf (const char *iface, + const char *domain, + char **searches, + char **nameservers, + GError **error) +{ + const char *tmp_resolv_conf = RESOLV_CONF ".tmp"; + char *domain_str = NULL; + char *searches_str = NULL; + char *nameservers_str = NULL; + FILE *f; + if ((f = fopen (tmp_resolv_conf, "w")) == NULL) { g_set_error (error, - NM_NAMED_MANAGER_ERROR, - NM_NAMED_MANAGER_ERROR_SYSTEM, - "Could not open " RESOLV_CONF ": %s\n", - g_strerror (errno)); + NM_NAMED_MANAGER_ERROR, + NM_NAMED_MANAGER_ERROR_SYSTEM, + "Could not open " RESOLV_CONF ": %s\n", + g_strerror (errno)); return FALSE; } if (fprintf (f, "%s","# generated by NetworkManager, do not edit!\n\n") < 0) { g_set_error (error, - NM_NAMED_MANAGER_ERROR, - NM_NAMED_MANAGER_ERROR_SYSTEM, - "Could not write " RESOLV_CONF ": %s\n", - g_strerror (errno)); + NM_NAMED_MANAGER_ERROR, + NM_NAMED_MANAGER_ERROR_SYSTEM, + "Could not write " RESOLV_CONF ": %s\n", + g_strerror (errno)); fclose (f); return FALSE; } + if (domain) + domain_str = g_strconcat ("domain ", domain, "\n\n", NULL); + + if (searches) { + char *tmp_str; + + tmp_str = g_strjoinv (" ", searches); + searches_str = g_strconcat ("search ", tmp_str, "\n\n", NULL); + g_free (tmp_str); + } + + if (nameservers) { + GString *str; + int num; + int i; + + str = g_string_new (""); + num = g_strv_length (nameservers); + + for (i = 0; i < num; i++) { + if (i == 3) { + g_string_append (str, "\n# "); + g_string_append (str, _("NOTE: the glibc resolver does not support more than 3 nameservers.")); + g_string_append (str, "\n# "); + g_string_append (str, _("The nameservers listed below may not be recognized.")); + g_string_append_c (str, '\n'); + } + + g_string_append (str, "nameserver "); + g_string_append (str, nameservers[i]); + g_string_append_c (str, '\n'); + } + + nameservers_str = g_string_free (str, FALSE); + } + + if (fprintf (f, "%s%s%s\n", + domain_str ? domain_str : "", + searches_str ? searches_str : "", + nameservers_str ? nameservers_str : "") < 0) { + g_set_error (error, + NM_NAMED_MANAGER_ERROR, + NM_NAMED_MANAGER_ERROR_SYSTEM, + "Could not write to " RESOLV_CONF ": %s\n", + g_strerror (errno)); + } + + g_free (domain_str); + g_free (searches_str); + g_free (nameservers_str); + + if (fclose (f) < 0) { + if (*error == NULL) { + g_set_error (error, + NM_NAMED_MANAGER_ERROR, + NM_NAMED_MANAGER_ERROR_SYSTEM, + "Could not close " RESOLV_CONF ": %s\n", + g_strerror (errno)); + } + } + + if (*error == NULL) { + if (rename (tmp_resolv_conf, RESOLV_CONF) < 0) { + g_set_error (error, + NM_NAMED_MANAGER_ERROR, + NM_NAMED_MANAGER_ERROR_SYSTEM, + "Could not replace " RESOLV_CONF ": %s\n", + g_strerror (errno)); + } + } + + return *error ? FALSE : TRUE; +} +#endif + +#define ADDR_BUF_LEN 50 + +static gboolean +rewrite_resolv_conf (NMNamedManager *mgr, const char *iface, GError **error) +{ + NMNamedManagerPrivate *priv; + NMIP4Config *composite; + GSList *iter; + GPtrArray *array; + const char *domain = NULL; + char **searches = NULL; + char **nameservers = NULL; + int num_domains; + int num_searches; + int num_nameservers; + int i; + gboolean success; + + g_return_val_if_fail (error != NULL, FALSE); + g_return_val_if_fail (*error == NULL, FALSE); + + priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr); + /* Construct the composite config from all the currently active IP4Configs */ composite = nm_ip4_config_new (); @@ -239,79 +371,65 @@ rewrite_resolv_conf (NMNamedManager *mgr, GError **error) num_domains = nm_ip4_config_get_num_domains (composite); num_searches = nm_ip4_config_get_num_searches (composite); + /* Domain */ + if (num_domains > 0) + domain = nm_ip4_config_get_domain (composite, 0); + + /* Searches */ if ((num_searches == 0) && (num_domains > 0)) { - str = g_string_new ("search"); - for (i = 0; i < num_domains; i++) { - g_string_append_c (str, ' '); - g_string_append (str, nm_ip4_config_get_domain (composite, i)); - } + array = g_ptr_array_sized_new (num_domains + 1); + for (i = 0; i < num_domains; i++) + g_ptr_array_add (array, g_strdup (nm_ip4_config_get_domain (composite, i))); - g_string_append (str, "\n\n"); - searches = g_string_free (str, FALSE); + g_ptr_array_add (array, NULL); + searches = (char **) g_ptr_array_free (array, FALSE); } else if (num_searches > 0) { - str = g_string_new ("search"); - for (i = 0; i < num_searches; i++) { - g_string_append_c (str, ' '); - g_string_append (str, nm_ip4_config_get_search (composite, i)); - } + array = g_ptr_array_sized_new (num_searches + 1); + for (i = 0; i < num_searches; i++) + g_ptr_array_add (array, g_strdup (nm_ip4_config_get_search (composite, i))); - g_string_append (str, "\n\n"); - searches = g_string_free (str, FALSE); + g_ptr_array_add (array, NULL); + searches = (char **) g_ptr_array_free (array, FALSE); } - /* Compute resolv.conf domain */ - if (num_domains > 0) { - str = g_string_new ("domain "); - g_string_append (str, nm_ip4_config_get_domain (composite, 0)); - g_string_append (str, "\n\n"); - - domain = g_string_free (str, FALSE); - } + /* Name servers */ + num_nameservers = nm_ip4_config_get_num_nameservers (composite); + if (num_nameservers > 0) { + array = g_ptr_array_sized_new (num_nameservers + 1); + for (i = 0; i < num_nameservers; i++) { + struct in_addr addr; + char *buf; + + addr.s_addr = nm_ip4_config_get_nameserver (composite, i); + buf = g_malloc0 (ADDR_BUF_LEN); + if (!buf) + continue; + + if (inet_ntop (AF_INET, &addr, buf, ADDR_BUF_LEN)) + g_ptr_array_add (array, buf); + else + nm_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (addr.s_addr)); + } - /* Using glibc resolver */ - nameservers = compute_nameservers (composite); - if (fprintf (f, "%s%s%s\n", - domain ? domain : "", - searches ? searches : "", - nameservers ? nameservers : "") < 0) { - g_set_error (error, - NM_NAMED_MANAGER_ERROR, - NM_NAMED_MANAGER_ERROR_SYSTEM, - "Could not write to " RESOLV_CONF ": %s\n", - g_strerror (errno)); + g_ptr_array_add (array, NULL); + nameservers = (char **) g_ptr_array_free (array, FALSE); } - g_free (nameservers); - if (fclose (f) < 0) { - if (*error == NULL) { - g_set_error (error, - NM_NAMED_MANAGER_ERROR, - NM_NAMED_MANAGER_ERROR_SYSTEM, - "Could not close " RESOLV_CONF ": %s\n", - g_strerror (errno)); - } - } + success = update_resolv_conf (iface, domain, searches, nameservers, error); - g_free (domain); - g_free (searches); + g_strfreev (searches); + g_strfreev (nameservers); - if (*error == NULL) { - if (rename (tmp_resolv_conf, RESOLV_CONF) < 0) { - g_set_error (error, - NM_NAMED_MANAGER_ERROR, - NM_NAMED_MANAGER_ERROR_SYSTEM, - "Could not replace " RESOLV_CONF ": %s\n", - g_strerror (errno)); - } else { - nm_system_update_dns (); - } - } + if (success) + nm_system_update_dns (); - return *error ? FALSE : TRUE; + return success; } gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr, + const char *iface, NMIP4Config *config, NMNamedIPConfigType cfg_type) { @@ -319,6 +437,7 @@ nm_named_manager_add_ip4_config (NMNamedManager *mgr, GError *error = NULL; g_return_val_if_fail (mgr != NULL, FALSE); + g_return_val_if_fail (iface != NULL, FALSE); g_return_val_if_fail (config != NULL, FALSE); priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr); @@ -338,7 +457,7 @@ nm_named_manager_add_ip4_config (NMNamedManager *mgr, if (!g_slist_find (priv->configs, config)) priv->configs = g_slist_append (priv->configs, g_object_ref (config)); - if (!rewrite_resolv_conf (mgr, &error)) { + if (!rewrite_resolv_conf (mgr, iface, &error)) { nm_warning ("Could not commit DNS changes. Error: '%s'", error ? error->message : "(none)"); g_error_free (error); } @@ -347,12 +466,15 @@ nm_named_manager_add_ip4_config (NMNamedManager *mgr, } gboolean -nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config) +nm_named_manager_remove_ip4_config (NMNamedManager *mgr, + const char *iface, + NMIP4Config *config) { NMNamedManagerPrivate *priv; GError *error = NULL; g_return_val_if_fail (mgr != NULL, FALSE); + g_return_val_if_fail (iface != NULL, FALSE); g_return_val_if_fail (config != NULL, FALSE); priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr); @@ -371,7 +493,7 @@ nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config) g_object_unref (config); - if (!rewrite_resolv_conf (mgr, &error)) { + if (!rewrite_resolv_conf (mgr, iface, &error)) { nm_warning ("Could not commit DNS changes. Error: '%s'", error ? error->message : "(none)"); if (error) g_error_free (error); diff --git a/src/named-manager/nm-named-manager.h b/src/named-manager/nm-named-manager.h index 33f4dec181..00787a89bf 100644 --- a/src/named-manager/nm-named-manager.h +++ b/src/named-manager/nm-named-manager.h @@ -68,10 +68,13 @@ GType nm_named_manager_get_type (void); NMNamedManager * nm_named_manager_get (void); gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr, + const char *iface, NMIP4Config *config, NMNamedIPConfigType cfg_type); -gboolean nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config); +gboolean nm_named_manager_remove_ip4_config (NMNamedManager *mgr, + const char *iface, + NMIP4Config *config); G_END_DECLS diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c index 4df9f887e9..071511792e 100644 --- a/src/nm-activation-request.c +++ b/src/nm-activation-request.c @@ -20,6 +20,9 @@ */ #include <string.h> +#include <stdlib.h> +#include <sys/wait.h> +#include <unistd.h> #include <dbus/dbus-glib.h> #include "nm-activation-request.h" @@ -49,6 +52,10 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +typedef struct { + char *table; + char *rule; +} ShareRule; typedef struct { gboolean disposed; @@ -63,6 +70,7 @@ typedef struct { NMActiveConnectionState state; gboolean is_default; gboolean shared; + GSList *share_rules; char *ac_path; } NMActRequestPrivate; @@ -206,12 +214,33 @@ dispose (GObject *object) cleanup_secrets_dbus_call (NM_ACT_REQUEST (object)); + /* Clear any share rules */ + nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE); + g_object_unref (priv->connection); G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); } static void +clear_share_rules (NMActRequest *req) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); + GSList *iter; + + for (iter = priv->share_rules; iter; iter = g_slist_next (iter)) { + ShareRule *rule = (ShareRule *) iter->data; + + g_free (rule->table); + g_free (rule->rule); + g_free (rule); + } + + g_slist_free (priv->share_rules); + priv->share_rules = NULL; +} + +static void finalize (GObject *object) { NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); @@ -219,6 +248,8 @@ finalize (GObject *object) g_free (priv->specific_object); g_free (priv->ac_path); + clear_share_rules (NM_ACT_REQUEST (object)); + G_OBJECT_CLASS (nm_act_request_parent_class)->finalize (object); } @@ -646,12 +677,69 @@ nm_act_request_get_default (NMActRequest *req) return NM_ACT_REQUEST_GET_PRIVATE (req)->is_default; } +static void +share_child_setup (gpointer user_data G_GNUC_UNUSED) +{ + /* We are in the child process at this point */ + pid_t pid = getpid (); + setpgid (pid, pid); +} + void nm_act_request_set_shared (NMActRequest *req, gboolean shared) { + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); + GSList *list, *iter; + g_return_if_fail (NM_IS_ACT_REQUEST (req)); NM_ACT_REQUEST_GET_PRIVATE (req)->shared = shared; + + /* Tear the rules down in reverse order when sharing is stopped */ + list = g_slist_copy (priv->share_rules); + if (!shared) + list = g_slist_reverse (list); + + /* Send the rules to iptables */ + for (iter = list; iter; iter = g_slist_next (iter)) { + ShareRule *rule = (ShareRule *) iter->data; + char *envp[1] = { NULL }; + char **argv; + char *cmd; + int status; + GError *error = NULL; + + if (shared) + cmd = g_strdup_printf ("/sbin/iptables --table %s --insert %s", rule->table, rule->rule); + else + cmd = g_strdup_printf ("/sbin/iptables --table %s --delete %s", rule->table, rule->rule); + + argv = g_strsplit (cmd, " ", 0); + if (!argv || !argv[0]) { + continue; + g_free (cmd); + } + + nm_info ("Executing: %s", cmd); + g_free (cmd); + + if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, + share_child_setup, NULL, NULL, NULL, &status, &error)) { + nm_info ("Error executing command: (%d) %s", + error ? error->code : 0, (error && error->message) ? error->message : "unknown"); + if (error) + g_error_free (error); + } else if (WEXITSTATUS (status)) + nm_info ("** Command returned exit status %d.", WEXITSTATUS (status)); + + g_strfreev (argv); + } + + g_slist_free (list); + + /* Clear the share rule list when sharing is stopped */ + if (!shared) + clear_share_rules (req); } gboolean @@ -662,6 +750,24 @@ nm_act_request_get_shared (NMActRequest *req) return NM_ACT_REQUEST_GET_PRIVATE (req)->shared; } +void +nm_act_request_add_share_rule (NMActRequest *req, + const char *table, + const char *table_rule) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); + ShareRule *rule; + + g_return_if_fail (NM_IS_ACT_REQUEST (req)); + g_return_if_fail (table != NULL); + g_return_if_fail (table_rule != NULL); + + rule = g_malloc0 (sizeof (ShareRule)); + rule->table = g_strdup (table); + rule->rule = g_strdup (table_rule); + priv->share_rules = g_slist_append (priv->share_rules, rule); +} + GObject * nm_act_request_get_device (NMActRequest *req) { diff --git a/src/nm-activation-request.h b/src/nm-activation-request.h index ff26cc4e35..44dc297f8b 100644 --- a/src/nm-activation-request.h +++ b/src/nm-activation-request.h @@ -44,7 +44,8 @@ typedef enum { SECRETS_CALLER_WIFI, SECRETS_CALLER_GSM, SECRETS_CALLER_CDMA, - SECRETS_CALLER_PPP + SECRETS_CALLER_PPP, + SECRETS_CALLER_HSO_GSM } RequestSecretsCaller; typedef struct { @@ -94,6 +95,10 @@ gboolean nm_act_request_get_shared (NMActRequest *req); void nm_act_request_set_shared (NMActRequest *req, gboolean shared); +void nm_act_request_add_share_rule (NMActRequest *req, + const char *table, + const char *rule); + GObject * nm_act_request_get_device (NMActRequest *req); #endif /* NM_ACTIVATION_REQUEST_H */ diff --git a/src/nm-cdma-device.c b/src/nm-cdma-device.c index 9a2fd197b0..31023e17d1 100644 --- a/src/nm-cdma-device.c +++ b/src/nm-cdma-device.c @@ -513,7 +513,7 @@ nm_cdma_device_class_init (NMCdmaDeviceClass *klass) "Monitoring interface", "Monitoring interface", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); /* Signals */ signals[PROPERTIES_CHANGED] = diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c index a07f9573c2..7db4063320 100644 --- a/src/nm-device-ethernet.c +++ b/src/nm-device-ethernet.c @@ -291,7 +291,7 @@ constructor (GType type, dev); if (!nm_netlink_monitor_request_status (monitor, &error)) { - nm_warning ("couldn't request carrier state: %s", error->message); + nm_warning ("couldn't request carrier state: %s", error ? error->message : "unknown"); g_error_free (error); } diff --git a/src/nm-device-interface.c b/src/nm-device-interface.c index 0ae1b974a5..c3d578c2e8 100644 --- a/src/nm-device-interface.c +++ b/src/nm-device-interface.c @@ -98,10 +98,10 @@ nm_device_interface_init (gpointer g_iface) g_object_interface_install_property (g_iface, - g_param_spec_object (NM_DEVICE_INTERFACE_DHCP4_CONFIG, + g_param_spec_boxed (NM_DEVICE_INTERFACE_DHCP4_CONFIG, "DHCP4 Config", "DHCP4 Config", - G_TYPE_OBJECT, + DBUS_TYPE_G_OBJECT_PATH, G_PARAM_READWRITE)); g_object_interface_install_property diff --git a/src/nm-device.c b/src/nm-device.c index a97986cd08..37cb500496 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -33,6 +33,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <arpa/inet.h> +#include <fcntl.h> #include "nm-device-interface.h" #include "nm-device.h" @@ -1199,6 +1200,140 @@ nm_device_activate_schedule_stage4_ip_config_timeout (NMDevice *self) nm_device_get_iface (self)); } +static void +share_child_setup (gpointer user_data G_GNUC_UNUSED) +{ + /* We are in the child process at this point */ + pid_t pid = getpid (); + setpgid (pid, pid); +} + +static gboolean +share_init (void) +{ + int fd, count, status; + char *modules[] = { "ip_tables", "iptable_nat", "nf_nat_ftp", "nf_nat_irc", + "nf_nat_sip", "nf_nat_tftp", "nf_nat_pptp", "nf_nat_h323", + NULL }; + char **iter; + + fd = open ("/proc/sys/net/ipv4/ip_forward", O_WRONLY | O_TRUNC); + if (fd) { + count = write (fd, "1\n", 2); + if (count != 2) { + nm_warning ("%s: Error starting IP forwarding: (%d) %s", + __func__, errno, strerror (errno)); + return FALSE; + } + close (fd); + } + + fd = open ("/proc/sys/net/ipv4/ip_dynaddr", O_WRONLY | O_TRUNC); + if (fd) { + count = write (fd, "1\n", 2); + if (count != 2) { + nm_warning ("%s: Error starting IP forwarding: (%d) %s", + __func__, errno, strerror (errno)); + } + close (fd); + } + + for (iter = modules; *iter; iter++) { + char *argv[3] = { "/sbin/modprobe", *iter, NULL }; + char *envp[1] = { NULL }; + GError *error = NULL; + + if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, + share_child_setup, NULL, NULL, NULL, &status, &error)) { + nm_info ("%s: Error loading NAT module %s: (%d) %s", + __func__, *iter, error ? error->code : 0, + (error && error->message) ? error->message : "unknown"); + if (error) + g_error_free (error); + } + } + + return TRUE; +} + +static void +add_share_rule (NMActRequest *req, const char *table, const char *fmt, ...) +{ + va_list args; + char *cmd; + + va_start (args, fmt); + cmd = g_strdup_vprintf (fmt, args); + va_end (args); + + nm_act_request_add_share_rule (req, table, cmd); + g_free (cmd); +} + +static gboolean +start_sharing (NMDevice *self) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMActRequest *req; + GError *error = NULL; + char str_addr[INET_ADDRSTRLEN + 1]; + char str_mask[INET_ADDRSTRLEN + 1]; + guint32 netmask, network; + NMIP4Config *ip4_config; + const NMSettingIP4Address *ip4_addr; + const char *iface; + + iface = nm_device_get_ip_iface (self); + if (!iface) + iface = nm_device_get_iface (self); + + ip4_config = nm_device_get_ip4_config (self); + if (!ip4_config) + return FALSE; + + ip4_addr = nm_ip4_config_get_address (ip4_config, 0); + if (!ip4_addr || !ip4_addr->address) + return FALSE; + + netmask = nm_utils_ip4_prefix_to_netmask (ip4_addr->prefix); + if (!inet_ntop (AF_INET, &netmask, str_mask, sizeof (str_mask))) + return FALSE; + + network = ip4_addr->address & netmask; + if (!inet_ntop (AF_INET, &network, str_addr, sizeof (str_addr))) + return FALSE; + + if (!share_init ()) + return FALSE; + + req = nm_device_get_act_request (self); + g_assert (req); + + add_share_rule (req, "filter", "INPUT --in-interface %s --protocol tcp --destination-port 53 --jump ACCEPT", iface); + add_share_rule (req, "filter", "INPUT --in-interface %s --protocol udp --destination-port 53 --jump ACCEPT", iface); + add_share_rule (req, "filter", "INPUT --in-interface %s --protocol tcp --destination-port 67 --jump ACCEPT", iface); + add_share_rule (req, "filter", "INPUT --in-interface %s --protocol udp --destination-port 67 --jump ACCEPT", iface); + add_share_rule (req, "filter", "FORWARD --in-interface %s --jump REJECT", iface); + add_share_rule (req, "filter", "FORWARD --out-interface %s --jump REJECT", iface); + add_share_rule (req, "filter", "FORWARD --in-interface %s --out-interface %s --jump ACCEPT", iface, iface); + add_share_rule (req, "filter", "FORWARD --source %s/%s --in-interface %s --jump ACCEPT", str_addr, str_mask, iface); + add_share_rule (req, "filter", "FORWARD --destination %s/%s --out-interface %s --match state --state ESTABLISHED,RELATED --jump ACCEPT", str_addr, str_mask, iface); + add_share_rule (req, "nat", "POSTROUTING --source %s/%s --destination ! %s/%s --jump MASQUERADE", str_addr, str_mask, str_addr, str_mask); + + nm_act_request_set_shared (req, TRUE); + + if (!nm_dnsmasq_manager_start (priv->dnsmasq_manager, ip4_config, &error)) { + nm_warning ("(%s): failed to start dnsmasq: %s", iface, error->message); + g_error_free (error); + nm_act_request_set_shared (req, FALSE); + return FALSE; + } + + priv->dnsmasq_state_id = g_signal_connect (priv->dnsmasq_manager, "state-changed", + G_CALLBACK (dnsmasq_state_changed_cb), + self); + return TRUE; +} /* * nm_device_activate_stage5_ip_config_commit @@ -1237,18 +1372,11 @@ nm_device_activate_stage5_ip_config_commit (gpointer user_data) connection = nm_act_request_get_connection (nm_device_get_act_request (self)); s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); if (s_ip4 && !strcmp (s_ip4->method, "shared")) { - GError *error = NULL; - - if (!nm_dnsmasq_manager_start (priv->dnsmasq_manager, ip4_config, &error)) { - nm_warning ("(%s): failed to start dnsmasq: %s", iface, error->message); - g_error_free (error); + if (!start_sharing (self)) { + nm_warning ("Activation (%s) Stage 5 of 5 (IP Configure Commit) start sharing failed.", iface); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SHARED_START_FAILED); goto out; } - - priv->dnsmasq_state_id = g_signal_connect (priv->dnsmasq_manager, "state-changed", - G_CALLBACK (dnsmasq_state_changed_cb), - self); } nm_device_state_changed (self, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE); @@ -1329,8 +1457,6 @@ nm_device_deactivate_quickly (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); - nm_system_shutdown_nis (); - /* Break the activation chain */ if (priv->act_source_id) { g_source_remove (priv->act_source_id); @@ -1363,13 +1489,13 @@ nm_device_deactivate_quickly (NMDevice *self) aipd_cleanup (self); - /* Tear down an existing activation request */ - clear_act_request (self); - /* Call device type-specific deactivation */ if (NM_DEVICE_GET_CLASS (self)->deactivate_quickly) NM_DEVICE_GET_CLASS (self)->deactivate_quickly (self); + /* Tear down an existing activation request */ + clear_act_request (self); + return TRUE; } @@ -1736,13 +1862,14 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas g_return_val_if_fail (reason != NULL, FALSE); priv = NM_DEVICE_GET_PRIVATE (self); + ip_iface = nm_device_get_ip_iface (self); if (priv->ip4_config) { NMNamedManager *named_mgr; /* Remove any previous IP4 Config from the named manager */ named_mgr = nm_named_manager_get (); - nm_named_manager_remove_ip4_config (named_mgr, priv->ip4_config); + nm_named_manager_remove_ip4_config (named_mgr, ip_iface, priv->ip4_config); g_object_unref (named_mgr); g_object_unref (priv->ip4_config); @@ -1754,14 +1881,9 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas priv->ip4_config = g_object_ref (config); - ip_iface = nm_device_get_ip_iface (self); - success = nm_system_device_set_from_ip4_config (ip_iface, config); - if (success) { + if (success) nm_device_update_ip4_address (self); - nm_system_set_hostname (config); - nm_system_activate_nis (config); - } g_object_notify (G_OBJECT (self), NM_DEVICE_INTERFACE_IP4_CONFIG); @@ -2062,9 +2184,9 @@ get_property (GObject *object, guint prop_id, case NM_DEVICE_INTERFACE_PROP_DHCP4_CONFIG: if ( ((state == NM_DEVICE_STATE_ACTIVATED) || (state == NM_DEVICE_STATE_IP_CONFIG)) && nm_device_get_use_dhcp (self)) - g_value_set_object (value, priv->dhcp4_config); + g_value_set_boxed (value, nm_dhcp4_config_get_dbus_path (priv->dhcp4_config)); else - g_value_set_object (value, NULL); + g_value_set_boxed (value, "/"); break; case NM_DEVICE_INTERFACE_PROP_STATE: g_value_set_uint (value, priv->state); diff --git a/src/nm-device.h b/src/nm-device.h index 2c234f0455..6a04d596d4 100644 --- a/src/nm-device.h +++ b/src/nm-device.h @@ -60,8 +60,6 @@ struct _NMDevice NMDevicePrivate *priv; }; -struct NMData; - struct _NMDeviceClass { GObjectClass parent; diff --git a/src/nm-dhcp4-config.c b/src/nm-dhcp4-config.c index 334a1b0e57..2d5e23c975 100644 --- a/src/nm-dhcp4-config.c +++ b/src/nm-dhcp4-config.c @@ -105,6 +105,14 @@ nm_dhcp4_config_get_option (NMDHCP4Config *self, const char *key) return value ? g_value_get_string (value) : NULL; } +const char * +nm_dhcp4_config_get_dbus_path (NMDHCP4Config *self) +{ + g_return_val_if_fail (NM_IS_DHCP4_CONFIG (self), NULL); + + return NM_DHCP4_CONFIG_GET_PRIVATE (self)->dbus_path; +} + static void nm_gvalue_destroy (gpointer data) { diff --git a/src/nm-dhcp4-config.h b/src/nm-dhcp4-config.h index 8e6cb03013..dbe716a5cf 100644 --- a/src/nm-dhcp4-config.h +++ b/src/nm-dhcp4-config.h @@ -51,6 +51,8 @@ GType nm_dhcp4_config_get_type (void); NMDHCP4Config *nm_dhcp4_config_new (void); +const char *nm_dhcp4_config_get_dbus_path (NMDHCP4Config *config); + void nm_dhcp4_config_add_option (NMDHCP4Config *config, const char *key, const char *option); diff --git a/src/nm-gsm-device.c b/src/nm-gsm-device.c index df8471fd6a..284597c2b8 100644 --- a/src/nm-gsm-device.c +++ b/src/nm-gsm-device.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ #include <stdio.h> #include <string.h> @@ -74,13 +74,14 @@ modem_wait_for_reply (NMGsmDevice *self, guint timeout, char **responses, char **terminators, - NMSerialWaitForReplyFn callback) + NMSerialWaitForReplyFn callback, + gpointer user_data) { NMSerialDevice *serial = NM_SERIAL_DEVICE (self); guint id = 0; if (nm_serial_device_send_command_string (serial, command)) - id = nm_serial_device_wait_for_reply (serial, timeout, responses, terminators, callback, NULL); + id = nm_serial_device_wait_for_reply (serial, timeout, responses, terminators, callback, user_data); if (id == 0) nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_UNKNOWN); @@ -163,7 +164,7 @@ dial_done (NMSerialDevice *device, } static void -do_dial (NMGsmDevice *device, guint cid) +real_do_dial (NMGsmDevice *device, guint cid) { NMSettingGsm *setting; char *command; @@ -185,7 +186,7 @@ do_dial (NMGsmDevice *device, guint cid) } else command = g_strconcat ("ATDT", setting->number, NULL); - modem_wait_for_reply (device, command, 60, responses, responses, dial_done); + modem_wait_for_reply (device, command, 60, responses, responses, dial_done, NULL); g_free (command); } @@ -196,7 +197,7 @@ set_apn_done (NMSerialDevice *device, { switch (reply_index) { case 0: - do_dial (NM_GSM_DEVICE (device), 1); + NM_GSM_DEVICE_GET_CLASS (device)->do_dial (NM_GSM_DEVICE (device), GPOINTER_TO_UINT (user_data)); break; default: nm_warning ("Setting APN failed"); @@ -216,15 +217,14 @@ set_apn (NMGsmDevice *device) guint cid = 1; setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM)); - if (!setting->apn) { /* APN not set, nothing to do */ - do_dial (device, 0); + NM_GSM_DEVICE_GET_CLASS (device)->do_dial (NM_GSM_DEVICE (device), 0); return; } command = g_strdup_printf ("AT+CGDCONT=%d, \"IP\", \"%s\"", cid, setting->apn); - modem_wait_for_reply (device, command, 3, responses, responses, set_apn_done); + modem_wait_for_reply (device, command, 3, responses, responses, set_apn_done, GUINT_TO_POINTER (cid)); g_free (command); } @@ -241,7 +241,7 @@ manual_registration_done (NMSerialDevice *device, nm_warning ("Manual registration timed out"); nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED); + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT); break; default: nm_warning ("Manual registration failed"); @@ -262,7 +262,7 @@ manual_registration (NMGsmDevice *device) setting = NM_SETTING_GSM (gsm_device_get_setting (device, NM_TYPE_SETTING_GSM)); command = g_strdup_printf ("AT+COPS=1,2,\"%s\"", setting->network_id); - modem_wait_for_reply (device, command, 30, responses, responses, manual_registration_done); + modem_wait_for_reply (device, command, 30, responses, responses, manual_registration_done, NULL); g_free (command); } @@ -304,7 +304,7 @@ automatic_registration_response (NMSerialDevice *device, nm_warning ("Automatic registration failed: not registered and not searching."); nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED); + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING); break; case 1: nm_info ("Registered on Home network"); @@ -317,7 +317,7 @@ automatic_registration_response (NMSerialDevice *device, nm_warning ("Automatic registration failed: registration denied."); nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED); + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED); break; case 4: nm_info ("Registered on Roaming network"); @@ -327,7 +327,7 @@ automatic_registration_response (NMSerialDevice *device, nm_warning ("Automatic registration timed out"); nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED); + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT); break; default: nm_warning ("Automatic registration failed"); @@ -344,7 +344,7 @@ automatic_registration (NMGsmDevice *device) char *responses[] = { "+CREG: 0,0", "+CREG: 0,1", "+CREG: 0,2", "+CREG: 0,3", "+CREG: 0,5", NULL }; char *terminators[] = { "OK", "ERROR", "ERR", NULL }; - modem_wait_for_reply (device, "AT+CREG?", 60, responses, terminators, automatic_registration_response); + modem_wait_for_reply (device, "AT+CREG?", 60, responses, terminators, automatic_registration_response, NULL); } static void @@ -393,7 +393,7 @@ init_modem_full (NMGsmDevice *device) * just breaks stuff since echo-ed commands are interpreted as replies. * rh #456770 */ - modem_wait_for_reply (device, "ATZ E0", 10, responses, responses, init_full_done); + modem_wait_for_reply (device, "ATZ E0", 10, responses, responses, init_full_done, NULL); } static void @@ -473,7 +473,7 @@ enter_pin (NMGsmDevice *device, gboolean retry) char *responses[] = { "OK", "ERROR", "ERR", NULL }; command = g_strdup_printf ("AT+CPIN=\"%s\"", secret); - modem_wait_for_reply (device, command, 3, responses, responses, enter_pin_done); + modem_wait_for_reply (device, command, 3, responses, responses, enter_pin_done, NULL); g_free (command); } else { nm_info ("(%s): GSM %s secret required", nm_device_get_iface (NM_DEVICE (device)), secret_name); @@ -527,7 +527,7 @@ check_pin (NMGsmDevice *self) char *responses[] = { "READY", "SIM PIN", "SIM PUK", "ERROR", "ERR", NULL }; char *terminators[] = { "OK", "ERROR", "ERR", NULL }; - modem_wait_for_reply (self, "AT+CPIN?", 3, responses, terminators, check_pin_done); + modem_wait_for_reply (self, "AT+CPIN?", 3, responses, terminators, check_pin_done, NULL); } static void @@ -559,7 +559,7 @@ init_modem (NMSerialDevice *device, gpointer user_data) { char *responses[] = { "OK", "ERROR", "ERR", NULL }; - modem_wait_for_reply (NM_GSM_DEVICE (device), "AT E0", 10, responses, responses, init_done); + modem_wait_for_reply (NM_GSM_DEVICE (device), "AT E0", 10, responses, responses, init_done, NULL); } static NMActStageReturn @@ -911,6 +911,8 @@ nm_gsm_device_class_init (NMGsmDeviceClass *klass) device_class->connection_secrets_updated = real_connection_secrets_updated; device_class->deactivate_quickly = real_deactivate_quickly; + klass->do_dial = real_do_dial; + /* Properties */ g_object_class_install_property (object_class, PROP_MONITOR_IFACE, @@ -918,7 +920,7 @@ nm_gsm_device_class_init (NMGsmDeviceClass *klass) "Monitoring interface", "Monitoring interface", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); /* Signals */ signals[PROPERTIES_CHANGED] = diff --git a/src/nm-gsm-device.h b/src/nm-gsm-device.h index 1cd122f7e7..5dbd1306d9 100644 --- a/src/nm-gsm-device.h +++ b/src/nm-gsm-device.h @@ -23,6 +23,8 @@ typedef struct { typedef struct { NMSerialDeviceClass parent; + void (*do_dial) (NMGsmDevice *device, guint cid); + /* Signals */ void (*properties_changed) (NMGsmDevice *device, GHashTable *properties); } NMGsmDeviceClass; diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index e5e0cb0eb2..0123014578 100644 --- a/src/nm-hal-manager.c +++ b/src/nm-hal-manager.c @@ -14,6 +14,7 @@ #include "nm-device-wifi.h" #include "nm-device-ethernet.h" #include "nm-gsm-device.h" +#include "nm-hso-gsm-device.h" #include "nm-cdma-device.h" #include "probe-modem.h" @@ -221,6 +222,50 @@ is_modem_device (NMHalManager *self, const char *udi) return is_modem; } +static char * +get_hso_netdev (LibHalContext *ctx, const char *udi) +{ + char *serial_parent, *netdev = NULL; + char **netdevs; + int num, i; + + /* Get the serial interface's originating device UDI, used to find the + * originating device's netdev. + */ + serial_parent = libhal_device_get_property_string (ctx, udi, "serial.originating_device", NULL); + if (!serial_parent) + serial_parent = libhal_device_get_property_string (ctx, udi, "info.parent", NULL); + if (!serial_parent) + return NULL; + + /* Look for the originating device's netdev */ + netdevs = libhal_find_device_by_capability (ctx, "net", &num, NULL); + for (i = 0; netdevs && !netdev && (i < num); i++) { + char *netdev_parent, *tmp; + + netdev_parent = libhal_device_get_property_string (ctx, netdevs[i], "net.originating_device", NULL); + if (!netdev_parent) + netdev_parent = libhal_device_get_property_string (ctx, netdevs[i], "net.physical_device", NULL); + if (!netdev_parent) + continue; + + if (!strcmp (netdev_parent, serial_parent)) { + /* We found it */ + tmp = libhal_device_get_property_string (ctx, netdevs[i], "net.interface", NULL); + if (tmp) { + netdev = g_strdup (tmp); + libhal_free_string (tmp); + } + } + + libhal_free_string (netdev_parent); + } + libhal_free_string_array (netdevs); + libhal_free_string (serial_parent); + + return netdev; +} + static GObject * modem_device_creator (NMHalManager *self, const char *udi, gboolean managed) { @@ -233,6 +278,7 @@ modem_device_creator (NMHalManager *self, const char *udi, gboolean managed) gboolean type_gsm = FALSE; gboolean type_cdma = FALSE; gboolean type_v250 = FALSE; + char *netdev = NULL; serial_device = libhal_device_get_property_string (priv->hal_ctx, udi, "serial.device", NULL); @@ -289,8 +335,15 @@ retry: } } + /* Special handling of 'hso' cards (until punted out to a modem manager) */ + if (type_gsm && !strcmp (driver_name, "hso")) + netdev = get_hso_netdev (priv->hal_ctx, udi); + if (type_gsm) - device = (GObject *) nm_gsm_device_new (udi, serial_device + strlen ("/dev/"), NULL, driver_name, managed); + if (netdev) + device = (GObject *) nm_hso_gsm_device_new (udi, serial_device + strlen ("/dev/"), NULL, netdev, driver_name, managed); + else + device = (GObject *) nm_gsm_device_new (udi, serial_device + strlen ("/dev/"), NULL, driver_name, managed); else if (type_cdma) device = (GObject *) nm_cdma_device_new (udi, serial_device + strlen ("/dev/"), NULL, driver_name, managed); @@ -317,7 +370,7 @@ register_built_in_creators (NMHalManager *self) /* Wireless device */ creator = g_slice_new0 (DeviceCreator); - creator->device_type_name = g_strdup ("wireless (802.11)"); + creator->device_type_name = g_strdup ("802.11 WiFi"); creator->capability_str = g_strdup ("net.80211"); creator->is_device_fn = is_wireless_device; creator->creator_fn = wireless_device_creator; diff --git a/src/nm-hso-gsm-device.c b/src/nm-hso-gsm-device.c new file mode 100644 index 0000000000..d659dcba3d --- /dev/null +++ b/src/nm-hso-gsm-device.c @@ -0,0 +1,563 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +#include <arpa/inet.h> +#include <dbus/dbus-glib.h> + +#include "nm-device.h" +#include "nm-hso-gsm-device.h" +#include "nm-gsm-device.h" +#include "nm-device-interface.h" +#include "nm-device-private.h" +#include "nm-setting-gsm.h" +#include "nm-utils.h" +#include "nm-properties-changed-signal.h" +#include "nm-setting-connection.h" +#include "NetworkManagerSystem.h" + +G_DEFINE_TYPE (NMHsoGsmDevice, nm_hso_gsm_device, NM_TYPE_GSM_DEVICE) + +#define NM_HSO_GSM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_HSO_GSM_DEVICE, NMHsoGsmDevicePrivate)) + +extern const DBusGObjectInfo dbus_glib_nm_gsm_device_object_info; + +#define GSM_CID "gsm-cid" +#define HSO_SECRETS_TRIES "gsm-secrets-tries" + +typedef struct { + char *netdev_iface; + NMIP4Config *pending_ip4_config; +} NMHsoGsmDevicePrivate; + +enum { + PROP_0, + PROP_NETDEV_IFACE, + + LAST_PROP +}; + +NMHsoGsmDevice * +nm_hso_gsm_device_new (const char *udi, + const char *data_iface, + const char *monitor_iface, + const char *netdev_iface, + const char *driver, + gboolean managed) +{ + g_return_val_if_fail (udi != NULL, NULL); + g_return_val_if_fail (data_iface != NULL, NULL); + g_return_val_if_fail (driver != NULL, NULL); + g_return_val_if_fail (netdev_iface != NULL, NULL); + + return (NMHsoGsmDevice *) g_object_new (NM_TYPE_HSO_GSM_DEVICE, + NM_DEVICE_INTERFACE_UDI, udi, + NM_DEVICE_INTERFACE_IFACE, data_iface, + NM_DEVICE_INTERFACE_DRIVER, driver, + NM_GSM_DEVICE_MONITOR_IFACE, monitor_iface, + NM_HSO_GSM_DEVICE_NETDEV_IFACE, netdev_iface, + NM_DEVICE_INTERFACE_MANAGED, managed, + NULL); +} + +static void +modem_wait_for_reply (NMGsmDevice *self, + const char *command, + guint timeout, + char **responses, + char **terminators, + NMSerialWaitForReplyFn callback, + gpointer user_data) +{ + NMSerialDevice *serial = NM_SERIAL_DEVICE (self); + guint id = 0; + + if (nm_serial_device_send_command_string (serial, command)) + id = nm_serial_device_wait_for_reply (serial, timeout, responses, terminators, callback, user_data); + + if (id == 0) + nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_UNKNOWN); +} + +static void +modem_get_reply (NMGsmDevice *self, + const char *command, + guint timeout, + const char *terminators, + NMSerialGetReplyFn callback) +{ + NMSerialDevice *serial = NM_SERIAL_DEVICE (self); + guint id = 0; + + if (nm_serial_device_send_command_string (serial, command)) + id = nm_serial_device_get_reply (serial, timeout, terminators, callback, NULL); + + if (id == 0) + nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_UNKNOWN); +} + +static NMSetting * +gsm_device_get_setting (NMGsmDevice *device, GType setting_type) +{ + NMActRequest *req; + NMSetting *setting = NULL; + + req = nm_device_get_act_request (NM_DEVICE (device)); + if (req) { + NMConnection *connection; + + connection = nm_act_request_get_connection (req); + if (connection) + setting = nm_connection_get_setting (connection, setting_type); + } + + return setting; +} + +static void +hso_call_done (NMSerialDevice *device, + int reply_index, + gpointer user_data) +{ + gboolean success = FALSE; + + switch (reply_index) { + case 0: + nm_info ("Connected, Woo!"); + success = TRUE; + break; + default: + nm_warning ("Connect request failed"); + break; + } + + if (success) + nm_device_activate_schedule_stage3_ip_config_start (NM_DEVICE (device)); + else + nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED); +} + +static void +hso_clear_done (NMSerialDevice *device, + int reply_index, + gpointer user_data) +{ + char *responses[] = { "_OWANCALL: ", "ERROR", NULL }; + guint cid = GPOINTER_TO_UINT (user_data); + char *command; + + /* Try to connect */ + command = g_strdup_printf ("AT_OWANCALL=%d,1,1", cid); + modem_wait_for_reply (NM_GSM_DEVICE (device), command, 10, responses, responses, hso_call_done, NULL); + g_free (command); +} + +static void +hso_auth_done (NMSerialDevice *device, + int reply_index, + gpointer user_data) +{ + gboolean success = FALSE; + char *responses[] = { "_OWANCALL: ", "ERROR", "NO CARRIER", NULL }; + guint cid = GPOINTER_TO_UINT (user_data); + char *command; + + switch (reply_index) { + case 0: + nm_info ("Authentication successful!"); + success = TRUE; + break; + default: + nm_warning ("Authentication failed"); + break; + } + + if (!success) { + nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED); + return; + } + + /* Kill any existing connection */ + command = g_strdup_printf ("AT_OWANCALL=%d,0,1", cid); + modem_wait_for_reply (NM_GSM_DEVICE (device), command, 5, responses, responses, hso_clear_done, GUINT_TO_POINTER (cid)); + g_free (command); +} + +static void +do_hso_auth (NMHsoGsmDevice *device) +{ + NMSettingGsm *s_gsm; + NMActRequest *req; + char *responses[] = { "OK", "ERROR", NULL }; + char *command; + guint cid; + + req = nm_device_get_act_request (NM_DEVICE (device)); + g_assert (req); + + cid = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (req), GSM_CID)); + + s_gsm = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM)); + + command = g_strdup_printf ("AT$QCPDPP=%d,1,\"%s\",\"%s\"", + cid, + s_gsm->password ? s_gsm->password : "", + s_gsm->username ? s_gsm->username : ""); + modem_wait_for_reply (NM_GSM_DEVICE (device), command, 5, responses, responses, hso_auth_done, GUINT_TO_POINTER (cid)); + g_free (command); +} + +static NMActStageReturn +real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) +{ + NMActRequest *req; + NMConnection *connection; + const char *setting_name; + GPtrArray *hints = NULL; + const char *hint1 = NULL, *hint2 = NULL; + guint32 tries; + + req = nm_device_get_act_request (device); + g_assert (req); + connection = nm_act_request_get_connection (req); + g_assert (connection); + + setting_name = nm_connection_need_secrets (connection, &hints); + if (!setting_name) { + do_hso_auth (NM_HSO_GSM_DEVICE (device)); + return NM_ACT_STAGE_RETURN_POSTPONE; + } + + if (hints) { + if (hints->len > 0) + hint1 = g_ptr_array_index (hints, 0); + if (hints->len > 1) + hint2 = g_ptr_array_index (hints, 1); + } + + nm_device_state_changed (device, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE); + + tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), HSO_SECRETS_TRIES)); + nm_act_request_request_connection_secrets (req, + setting_name, + tries ? TRUE : FALSE, + SECRETS_CALLER_HSO_GSM, + hint1, + hint2); + g_object_set_data (G_OBJECT (connection), HSO_SECRETS_TRIES, GUINT_TO_POINTER (++tries)); + + if (hints) + g_ptr_array_free (hints, TRUE); + + return NM_ACT_STAGE_RETURN_POSTPONE; +} + +static void +real_do_dial (NMGsmDevice *device, guint cid) +{ + NMActRequest *req; + + req = nm_device_get_act_request (NM_DEVICE (device)); + g_assert (req); + g_object_set_data (G_OBJECT (req), GSM_CID, GUINT_TO_POINTER (cid)); + + nm_device_activate_schedule_stage2_device_config (NM_DEVICE (device)); +} + +#define OWANDATA_TAG "_OWANDATA: " + +static void +hso_ip4_config_done (NMSerialDevice *device, + const char *response, + gpointer user_data) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (device); + NMActRequest *req; + char **items, **iter; + guint cid, i; + NMSettingIP4Address addr = { 0, 32, 0 }; + guint32 dns1 = 0, dns2 = 0; + + if (!response || strncmp (response, OWANDATA_TAG, strlen (OWANDATA_TAG))) { + nm_device_activate_schedule_stage4_ip_config_timeout (NM_DEVICE (device)); + return; + } + + req = nm_device_get_act_request (NM_DEVICE (device)); + g_assert (req); + cid = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (req), GSM_CID)); + + items = g_strsplit (response + strlen (OWANDATA_TAG), ", ", 0); + for (iter = items, i = 0; *iter; iter++, i++) { + if (i == 0) { /* CID */ + long int tmp; + + errno = 0; + tmp = strtol (*iter, NULL, 10); + if (errno != 0 || tmp < 0 || (guint) tmp != cid) { + nm_warning ("%s: unknown CID in OWANDATA response (got %d, expected %d)", + nm_device_get_iface (NM_DEVICE (device)), + (guint) tmp, cid); + goto out; + } + } else if (i == 1) { /* IP address */ + if (inet_pton (AF_INET, *iter, &(addr.address)) <= 0) + addr.address = 0; + } else if (i == 3) { /* DNS 1 */ + if (inet_pton (AF_INET, *iter, &dns1) <= 0) + dns1 = 0; + } else if (i == 4) { /* DNS 2 */ + if (inet_pton (AF_INET, *iter, &dns2) <= 0) + dns2 = 0; + } + } + +out: + g_strfreev (items); + + if (addr.address) { + priv->pending_ip4_config = nm_ip4_config_new (); + + nm_ip4_config_add_address (priv->pending_ip4_config, &addr); + + if (dns1) + nm_ip4_config_add_nameserver (priv->pending_ip4_config, dns1); + if (dns2) + nm_ip4_config_add_nameserver (priv->pending_ip4_config, dns2); + + nm_device_activate_schedule_stage4_ip_config_get (NM_DEVICE (device)); + } else { + nm_device_state_changed (NM_DEVICE (device), + NM_DEVICE_STATE_FAILED, + NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); + } +} + +static NMActStageReturn +real_act_stage3_ip_config_start (NMDevice *device, NMDeviceStateReason *reason) +{ + const char terminators[] = { '\r', '\n', '\0' }; + NMActRequest *req; + char *command; + gint cid; + + req = nm_device_get_act_request (device); + g_assert (req); + + cid = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (req), GSM_CID)); + command = g_strdup_printf ("AT_OWANDATA=%d", cid); + modem_get_reply (NM_GSM_DEVICE (device), command, 5, terminators, hso_ip4_config_done); + g_free (command); + + return NM_ACT_STAGE_RETURN_POSTPONE; +} + +static NMActStageReturn +real_act_stage4_get_ip4_config (NMDevice *device, + NMIP4Config **config, + NMDeviceStateReason *reason) +{ + NMHsoGsmDevice *self = NM_HSO_GSM_DEVICE (device); + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (self); + + g_return_val_if_fail (config != NULL, NM_ACT_STAGE_RETURN_FAILURE); + g_return_val_if_fail (*config == NULL, NM_ACT_STAGE_RETURN_FAILURE); + + nm_device_set_ip_iface (device, priv->netdev_iface); + if (!nm_device_hw_bring_up (device, TRUE)) + return NM_ACT_STAGE_RETURN_FAILURE; + + *config = priv->pending_ip4_config; + priv->pending_ip4_config = NULL; + return NM_ACT_STAGE_RETURN_SUCCESS; +} + +static void +real_connection_secrets_updated (NMDevice *device, + NMConnection *connection, + GSList *updated_settings, + RequestSecretsCaller caller) +{ + g_return_if_fail (caller == SECRETS_CALLER_HSO_GSM); + g_return_if_fail (nm_device_get_state (device) == NM_DEVICE_STATE_NEED_AUTH); + + nm_device_activate_schedule_stage2_device_config (device); +} + +static void +real_deactivate_quickly (NMDevice *device) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (device); + NMActRequest *req; + guint cid; + char *command; + + if (priv->pending_ip4_config) { + g_object_unref (priv->pending_ip4_config); + priv->pending_ip4_config = NULL; + } + + /* Don't leave the modem connected */ + req = nm_device_get_act_request (device); + if (req) { + cid = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (req), GSM_CID)); + if (cid) { + command = g_strdup_printf ("AT_OWANCALL=%d,0,1", cid); + nm_serial_device_send_command_string (NM_SERIAL_DEVICE (device), command); + g_free (command); + + /* FIXME: doesn't seem to take the command otherwise, perhaps since + * the serial port gets closed right away + */ + g_usleep (G_USEC_PER_SEC / 3); + } + } + + + if (NM_DEVICE_CLASS (nm_hso_gsm_device_parent_class)->deactivate_quickly) + NM_DEVICE_CLASS (nm_hso_gsm_device_parent_class)->deactivate_quickly (device); +} + +static void +real_deactivate (NMDevice *device) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (device); + + if (priv->netdev_iface) { + nm_system_device_flush_ip4_routes_with_iface (priv->netdev_iface); + nm_system_device_flush_ip4_addresses_with_iface (priv->netdev_iface); + nm_system_device_set_up_down_with_iface (priv->netdev_iface, FALSE); + } + nm_device_set_ip_iface (device, NULL); + + if (NM_DEVICE_CLASS (nm_hso_gsm_device_parent_class)->deactivate) + NM_DEVICE_CLASS (nm_hso_gsm_device_parent_class)->deactivate (device); +} + +static gboolean +real_hw_is_up (NMDevice *device) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (device); + NMDeviceState state; + + state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device)); + + if ( priv->pending_ip4_config + || (state == NM_DEVICE_STATE_IP_CONFIG) + || (state == NM_DEVICE_STATE_ACTIVATED)) + return nm_system_device_is_up_with_iface (priv->netdev_iface); + + return TRUE; +} + +static gboolean +real_hw_bring_up (NMDevice *device) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (device); + NMDeviceState state; + + state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device)); + + if ( priv->pending_ip4_config + || (state == NM_DEVICE_STATE_IP_CONFIG) + || (state == NM_DEVICE_STATE_ACTIVATED)) + return nm_system_device_set_up_down_with_iface (priv->netdev_iface, TRUE); + + return TRUE; +} + +static void +nm_hso_gsm_device_init (NMHsoGsmDevice *self) +{ +} + +static GObject* +constructor (GType type, + guint n_params, + GObjectConstructParam *params) +{ + return G_OBJECT_CLASS (nm_hso_gsm_device_parent_class)->constructor (type, n_params, params); +} + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (object); + + switch (prop_id) { + case PROP_NETDEV_IFACE: + /* Construct only */ + priv->netdev_iface = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (object); + + switch (prop_id) { + case PROP_NETDEV_IFACE: + g_value_set_string (value, priv->netdev_iface); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +finalize (GObject *object) +{ + NMHsoGsmDevicePrivate *priv = NM_HSO_GSM_DEVICE_GET_PRIVATE (object); + + g_free (priv->netdev_iface); + + G_OBJECT_CLASS (nm_hso_gsm_device_parent_class)->finalize (object); +} + +static void +nm_hso_gsm_device_class_init (NMHsoGsmDeviceClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); + NMGsmDeviceClass *gsm_class = NM_GSM_DEVICE_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (NMHsoGsmDevicePrivate)); + + object_class->constructor = constructor; + object_class->get_property = get_property; + object_class->set_property = set_property; + object_class->finalize = finalize; + + device_class->act_stage2_config = real_act_stage2_config; + device_class->act_stage3_ip_config_start = real_act_stage3_ip_config_start; + device_class->act_stage4_get_ip4_config = real_act_stage4_get_ip4_config; + device_class->connection_secrets_updated = real_connection_secrets_updated; + device_class->deactivate_quickly = real_deactivate_quickly; + device_class->deactivate = real_deactivate; + device_class->hw_is_up = real_hw_is_up; + device_class->hw_bring_up = real_hw_bring_up; + + gsm_class->do_dial = real_do_dial; + + /* Properties */ + g_object_class_install_property + (object_class, PROP_NETDEV_IFACE, + g_param_spec_string (NM_HSO_GSM_DEVICE_NETDEV_IFACE, + "Network interface", + "Network interface", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + + dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), + &dbus_glib_nm_gsm_device_object_info); +} diff --git a/src/nm-hso-gsm-device.h b/src/nm-hso-gsm-device.h new file mode 100644 index 0000000000..a7498c8394 --- /dev/null +++ b/src/nm-hso-gsm-device.h @@ -0,0 +1,38 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +#ifndef NM_HSO_GSM_DEVICE_H +#define NM_HSO_GSM_DEVICE_H + +#include <nm-gsm-device.h> + +G_BEGIN_DECLS + +#define NM_TYPE_HSO_GSM_DEVICE (nm_hso_gsm_device_get_type ()) +#define NM_HSO_GSM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_HSO_GSM_DEVICE, NMHsoGsmDevice)) +#define NM_HSO_GSM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_HSO_GSM_DEVICE, NMHsoGsmDeviceClass)) +#define NM_IS_HSO_GSM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_HSO_GSM_DEVICE)) +#define NM_IS_HSO_GSM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_HSO_GSM_DEVICE)) +#define NM_HSO_GSM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_HSO_GSM_DEVICE, NMHsoGsmDeviceClass)) + +#define NM_HSO_GSM_DEVICE_NETDEV_IFACE "netdev-iface" + +typedef struct { + NMGsmDevice parent; +} NMHsoGsmDevice; + +typedef struct { + NMGsmDeviceClass parent; +} NMHsoGsmDeviceClass; + +GType nm_hso_gsm_device_get_type (void); + +NMHsoGsmDevice *nm_hso_gsm_device_new (const char *udi, + const char *data_iface, + const char *monitor_iface, + const char *netdev_iface, + const char *driver, + gboolean managed); + +G_END_DECLS + +#endif /* NM_HSO_GSM_DEVICE_H */ diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 0bf780b894..718c80cb41 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -56,8 +56,6 @@ typedef struct { GPtrArray *searches; gchar *hostname; - gchar *nis_domain; - GArray *nis_servers; GSList *routes; } NMIP4ConfigPrivate; @@ -68,8 +66,6 @@ enum { PROP_HOSTNAME, PROP_NAMESERVERS, PROP_DOMAINS, - PROP_NIS_DOMAIN, - PROP_NIS_SERVERS, PROP_ROUTES, LAST_PROP @@ -95,56 +91,6 @@ nm_ip4_config_new (void) return (NMIP4Config *) object; } -NMIP4Config *nm_ip4_config_copy (NMIP4Config *src_config) -{ - NMIP4Config *dst_config; - NMIP4ConfigPrivate *src_priv; - int i; - int len; - GSList *iter; - - g_return_val_if_fail (NM_IS_IP4_CONFIG (src_config), NULL); - - dst_config = nm_ip4_config_new (); - src_priv = NM_IP4_CONFIG_GET_PRIVATE (src_config); - - for (iter = src_priv->addresses; iter; iter = g_slist_next (iter)) { - NMSettingIP4Address *src_addr = (NMSettingIP4Address *) iter->data; - NMSettingIP4Address *dst_addr; - - dst_addr = g_malloc0 (sizeof (NMSettingIP4Address)); - memcpy (dst_addr, src_addr, sizeof (NMSettingIP4Address)); - nm_ip4_config_take_address (dst_config, dst_addr); - } - - nm_ip4_config_set_ptp_address (dst_config, nm_ip4_config_get_ptp_address (src_config)); - nm_ip4_config_set_hostname (dst_config, nm_ip4_config_get_hostname (src_config)); - nm_ip4_config_set_nis_domain (dst_config, nm_ip4_config_get_nis_domain (src_config)); - - len = nm_ip4_config_get_num_nameservers (src_config); - for (i = 0; i < len; i++) - nm_ip4_config_add_nameserver (dst_config, nm_ip4_config_get_nameserver (src_config, i)); - - len = nm_ip4_config_get_num_domains (src_config); - for (i = 0; i < len; i++) - nm_ip4_config_add_domain (dst_config, nm_ip4_config_get_domain (src_config, i)); - - len = nm_ip4_config_get_num_nis_servers (src_config); - for (i = 0; i < len; i++) - nm_ip4_config_add_nis_server (dst_config, nm_ip4_config_get_nis_server (src_config, i)); - - for (iter = src_priv->routes; iter; iter = g_slist_next (iter)) { - NMSettingIP4Route *src_route = (NMSettingIP4Route *) iter->data; - NMSettingIP4Route *dst_route; - - dst_route = g_malloc0 (sizeof (NMSettingIP4Route)); - memcpy (dst_route, src_route, sizeof (NMSettingIP4Route)); - nm_ip4_config_take_route (dst_config, dst_route); - } - - return dst_config; -} - void nm_ip4_config_take_address (NMIP4Config *config, NMSettingIP4Address *address) @@ -180,6 +126,7 @@ nm_ip4_config_replace_address (NMIP4Config *config, NMSettingIP4Address *new_address) { NMIP4ConfigPrivate *priv; + NMSettingIP4Address *copy; GSList *old; g_return_if_fail (NM_IS_IP4_CONFIG (config)); @@ -187,9 +134,11 @@ nm_ip4_config_replace_address (NMIP4Config *config, priv = NM_IP4_CONFIG_GET_PRIVATE (config); old = g_slist_nth (priv->addresses, i); g_return_if_fail (old != NULL); - g_free (old->data); - old->data = new_address; + + copy = g_malloc0 (sizeof (NMSettingIP4Address)); + memcpy (copy, new_address, sizeof (NMSettingIP4Address)); + old->data = copy; } const NMSettingIP4Address *nm_ip4_config_get_address (NMIP4Config *config, guint i) @@ -253,27 +202,6 @@ void nm_ip4_config_reset_nameservers (NMIP4Config *config) g_array_remove_range (priv->nameservers, 0, priv->nameservers->len); } -void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis_server) -{ - g_return_if_fail (NM_IS_IP4_CONFIG (config)); - - g_array_append_val (NM_IP4_CONFIG_GET_PRIVATE (config)->nis_servers, nis_server); -} - -guint32 nm_ip4_config_get_nis_server (NMIP4Config *config, guint i) -{ - g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0); - - return g_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->nis_servers, guint32, i); -} - -guint32 nm_ip4_config_get_num_nis_servers (NMIP4Config *config) -{ - g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0); - - return NM_IP4_CONFIG_GET_PRIVATE (config)->nis_servers->len; -} - void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname) { g_return_if_fail (NM_IS_IP4_CONFIG (config)); @@ -292,23 +220,6 @@ const char *nm_ip4_config_get_hostname (NMIP4Config *config) return NM_IP4_CONFIG_GET_PRIVATE (config)->hostname; } -void nm_ip4_config_set_nis_domain (NMIP4Config *config, const char *domain) -{ - g_return_if_fail (NM_IS_IP4_CONFIG (config)); - g_return_if_fail (domain != NULL); - - if (!strlen (domain)) - return; - - NM_IP4_CONFIG_GET_PRIVATE (config)->nis_domain = g_strdup (domain); -} - -const char *nm_ip4_config_get_nis_domain (NMIP4Config *config) -{ - g_return_val_if_fail( NM_IS_IP4_CONFIG (config), NULL); - return NM_IP4_CONFIG_GET_PRIVATE (config)->nis_domain; -} - void nm_ip4_config_take_route (NMIP4Config *config, NMSettingIP4Route *route) @@ -344,6 +255,7 @@ nm_ip4_config_replace_route (NMIP4Config *config, NMSettingIP4Route *new_route) { NMIP4ConfigPrivate *priv; + NMSettingIP4Route *copy; GSList *old; g_return_if_fail (NM_IS_IP4_CONFIG (config)); @@ -351,9 +263,11 @@ nm_ip4_config_replace_route (NMIP4Config *config, priv = NM_IP4_CONFIG_GET_PRIVATE (config); old = g_slist_nth (priv->routes, i); g_return_if_fail (old != NULL); - g_free (old->data); - old->data = new_route; + + copy = g_malloc0 (sizeof (NMSettingIP4Route)); + memcpy (copy, new_route, sizeof (NMSettingIP4Route)); + old->data = copy; } const NMSettingIP4Route * @@ -565,7 +479,6 @@ nm_ip4_config_init (NMIP4Config *config) NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); priv->nameservers = g_array_new (FALSE, TRUE, sizeof (guint32)); - priv->nis_servers = g_array_new (FALSE, TRUE, sizeof (guint32)); priv->domains = g_ptr_array_new (); priv->searches = g_ptr_array_new (); } @@ -577,44 +490,13 @@ finalize (GObject *object) nm_utils_slist_free (priv->addresses, g_free); g_free (priv->hostname); - g_free (priv->nis_domain); g_array_free (priv->nameservers, TRUE); g_ptr_array_free (priv->domains, TRUE); g_ptr_array_free (priv->searches, TRUE); - g_array_free (priv->nis_servers, TRUE); nm_utils_slist_free (priv->routes, g_free); } static void -ip4_addresses_to_gvalue (GSList *list, GValue *value) -{ - GPtrArray *addresses; - GSList *iter; - - addresses = g_ptr_array_new (); - - for (iter = list; iter; iter = iter->next) { - NMSettingIP4Address *ip4_addr = (NMSettingIP4Address *) iter->data; - GArray *array; - const guint32 empty_val = 0; - - array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); - - g_array_append_val (array, ip4_addr->address); - g_array_append_val (array, ip4_addr->prefix); - - if (ip4_addr->gateway) - g_array_append_val (array, ip4_addr->gateway); - else - g_array_append_val (array, empty_val); - - g_ptr_array_add (addresses, array); - } - - g_value_take_boxed (value, addresses); -} - -static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { @@ -622,7 +504,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_ADDRESSES: - ip4_addresses_to_gvalue (priv->addresses, value); + nm_utils_ip4_addresses_to_gvalue (priv->addresses, value); break; case PROP_HOSTNAME: g_value_set_string (value, priv->hostname); @@ -633,14 +515,8 @@ get_property (GObject *object, guint prop_id, case PROP_DOMAINS: g_value_set_boxed (value, priv->domains); break; - case PROP_NIS_DOMAIN: - g_value_set_string (value, priv->nis_domain); - break; - case PROP_NIS_SERVERS: - g_value_set_boxed (value, priv->nis_servers); - break; case PROP_ROUTES: - ip4_addresses_to_gvalue (priv->routes, value); + nm_utils_ip4_routes_to_gvalue (priv->routes, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -688,20 +564,6 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) "Domains", DBUS_TYPE_G_ARRAY_OF_STRING, G_PARAM_READABLE)); - g_object_class_install_property - (object_class, PROP_NIS_DOMAIN, - g_param_spec_string (NM_IP4_CONFIG_NIS_DOMAIN, - "NIS domain", - "NIS domain name", - NULL, - G_PARAM_READABLE)); - g_object_class_install_property - (object_class, PROP_NIS_SERVERS, - g_param_spec_boxed (NM_IP4_CONFIG_NIS_SERVERS, - "NIS servers", - "NIS servers", - DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READABLE)); g_object_class_install_property (object_class, PROP_ROUTES, diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index 00f0f1620d..eb91c9ba75 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -72,10 +72,6 @@ guint32 nm_ip4_config_get_nameserver (NMIP4Config *config, guint i); guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config); void nm_ip4_config_reset_nameservers (NMIP4Config *config); -void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis_server); -guint32 nm_ip4_config_get_nis_server (NMIP4Config *config, guint i); -guint32 nm_ip4_config_get_num_nis_servers (NMIP4Config *config); - void nm_ip4_config_take_route (NMIP4Config *config, NMSettingIP4Route *route); void nm_ip4_config_add_route (NMIP4Config *config, NMSettingIP4Route *route); void nm_ip4_config_replace_route (NMIP4Config *config, guint32 i, NMSettingIP4Route *new_route); @@ -86,9 +82,6 @@ void nm_ip4_config_reset_routes (NMIP4Config *config); void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname); const char * nm_ip4_config_get_hostname (NMIP4Config *config); -void nm_ip4_config_set_nis_domain (NMIP4Config *config, const char *domain); -const char * nm_ip4_config_get_nis_domain (NMIP4Config *config); - void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain); const char * nm_ip4_config_get_domain (NMIP4Config *config, guint i); guint32 nm_ip4_config_get_num_domains (NMIP4Config *config); diff --git a/src/nm-netlink-monitor.c b/src/nm-netlink-monitor.c index a6d8395409..0e9c87294f 100644 --- a/src/nm-netlink-monitor.c +++ b/src/nm-netlink-monitor.c @@ -434,7 +434,10 @@ nm_netlink_monitor_request_status (NMNetlinkMonitor *monitor, /* Update the link cache with latest state */ if (nl_cache_refill (priv->nlh, priv->nlh_link_cache)) { - nm_warning ("Error updating link cache: %s", nl_geterror ()); + g_set_error (error, NM_NETLINK_MONITOR_ERROR, + NM_NETLINK_MONITOR_ERROR_LINK_CACHE_UPDATE, + _("error updating link cache: %s"), + nl_geterror ()); return FALSE; } @@ -487,7 +490,7 @@ nm_netlink_monitor_error_handler (GIOChannel *channel, { GError *socket_error; - g_return_val_if_fail (!(io_condition & ~(NM_NETLINK_MONITOR_ERROR_CONDITIONS)), FALSE); + g_return_val_if_fail (io_condition & NM_NETLINK_MONITOR_ERROR_CONDITIONS, FALSE); socket_error = g_error_new (NM_NETLINK_MONITOR_ERROR, NM_NETLINK_MONITOR_ERROR_WAITING_FOR_SOCKET_DATA, diff --git a/src/nm-netlink-monitor.h b/src/nm-netlink-monitor.h index 46497a9580..a74b763a05 100644 --- a/src/nm-netlink-monitor.h +++ b/src/nm-netlink-monitor.h @@ -43,6 +43,7 @@ typedef enum { NM_NETLINK_MONITOR_ERROR_PROCESSING_MESSAGE, NM_NETLINK_MONITOR_ERROR_BAD_ALLOC, NM_NETLINK_MONITOR_ERROR_WAITING_FOR_SOCKET_DATA, + NM_NETLINK_MONITOR_ERROR_LINK_CACHE_UPDATE } NMNetlinkMonitorError; typedef struct { diff --git a/src/nm-properties-changed-signal.c b/src/nm-properties-changed-signal.c index bb7427d50a..2dcfc50384 100644 --- a/src/nm-properties-changed-signal.c +++ b/src/nm-properties-changed-signal.c @@ -141,6 +141,10 @@ notify (GObject *object, GParamSpec *pspec) PropertiesChangedInfo *info; GValue *value; + /* Ignore properties that shouldn't be exported */ + if (pspec->flags & NM_PROPERTY_PARAM_NO_EXPORT) + return; + info = (PropertiesChangedInfo *) g_object_get_data (object, NM_DBUS_PROPERTY_CHANGED); if (!info) { info = properties_changed_info_new (); diff --git a/src/nm-properties-changed-signal.h b/src/nm-properties-changed-signal.h index d77f9662a2..9ae342b965 100644 --- a/src/nm-properties-changed-signal.h +++ b/src/nm-properties-changed-signal.h @@ -5,6 +5,8 @@ #include <glib-object.h> +#define NM_PROPERTY_PARAM_NO_EXPORT (1 << (0 + G_PARAM_USER_SHIFT)) + guint nm_properties_changed_signal_new (GObjectClass *object_class, guint class_offset); diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 23bad87c94..dbb95fc3a8 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -384,7 +384,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager, */ priv->pending_secrets_context = context; nm_ppp_manager_update_secrets (manager, - NULL, /* FIXME: pass device name */ + priv->parent_iface, username ? username : "", password ? password : "", NULL); @@ -690,6 +690,8 @@ pppd_timed_out (gpointer data) nm_warning ("Looks like pppd didn't initialize our dbus module"); nm_ppp_manager_stop (manager); + g_signal_emit (manager, signals[STATE_CHANGED], 0, NM_PPP_STATUS_DEAD); + return FALSE; } diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index be32ead556..94424e9810 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * @@ -35,7 +35,6 @@ #include "nm-vpn-connection.h" #include "nm-setting-connection.h" #include "nm-setting-vpn.h" -#include "nm-setting-vpn-properties.h" #include "nm-setting-ip4-config.h" #include "nm-dbus-manager.h" #include "nm-manager.h" @@ -477,7 +476,7 @@ nm_vpn_connection_connect_cb (DBusGProxy *proxy, GError *err, gpointer user_data nm_vpn_connection_get_name (connection)); if (err) { - nm_warning ("(VPN connection '%s' could not start. dbus says: '%s'.", + nm_warning ("VPN connection '%s' failed to connect: '%s'.", nm_vpn_connection_get_name (connection), err->message); nm_vpn_connection_set_vpn_state (connection, NM_VPN_CONNECTION_STATE_FAILED, @@ -660,11 +659,11 @@ update_vpn_properties_secrets (gpointer key, gpointer data, gpointer user_data) { NMConnection *connection = NM_CONNECTION (user_data); - if (strcmp (key, NM_SETTING_VPN_PROPERTIES_SETTING_NAME)) + if (strcmp (key, NM_SETTING_VPN_SETTING_NAME)) return; nm_connection_update_secrets (connection, - NM_SETTING_VPN_PROPERTIES_SETTING_NAME, + NM_SETTING_VPN_SETTING_NAME, (GHashTable *) data); } @@ -802,9 +801,9 @@ call_need_secrets (NMVPNConnection *vpn_connection) } static void -connection_vpn_state_changed (NMVPNConnection *connection, - NMVPNConnectionState state, - NMVPNConnectionStateReason reason) +connection_state_changed (NMVPNConnection *connection, + NMVPNConnectionState state, + NMVPNConnectionStateReason reason) { NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); @@ -977,7 +976,7 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class) g_type_class_add_private (connection_class, sizeof (NMVPNConnectionPrivate)); /* virtual methods */ - connection_class->vpn_state_changed = connection_vpn_state_changed; + connection_class->vpn_state_changed = connection_state_changed; object_class->get_property = get_property; object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/system-settings/plugins/ifcfg-fedora/shvar.c b/system-settings/plugins/ifcfg-fedora/shvar.c index 67b3019d48..5ecae90fcd 100644 --- a/system-settings/plugins/ifcfg-fedora/shvar.c +++ b/system-settings/plugins/ifcfg-fedora/shvar.c @@ -121,9 +121,13 @@ unescape(char *s) { len = strlen(s); if ((s[0] == '"' || s[0] == '\'') && s[0] == s[len-1]) { i = len - 2; - memmove(s, s+1, i); - s[i+1] = '\0'; - len = i; + if (i == 0) + s[0] = '\0'; + else { + memmove(s, s+1, i); + s[i+1] = '\0'; + len = i; + } } for (i = 0; i < len; i++) { if (s[i] == '\\') { @@ -291,7 +295,6 @@ svSetValue(shvarFile *s, const char *key, const char *value) /* change/append line to get key= */ if (s->current) s->current->data = keyValue; else s->lineList = g_list_append(s->lineList, keyValue); - s->freeList = g_list_append(s->freeList, keyValue); s->modified = 1; } else if (val1) { /* delete line */ @@ -307,7 +310,6 @@ svSetValue(shvarFile *s, const char *key, const char *value) if (val2 && !strcmp(val2, newval)) goto end; /* append line */ s->lineList = g_list_append(s->lineList, keyValue); - s->freeList = g_list_append(s->freeList, keyValue); s->modified = 1; goto end; } @@ -326,7 +328,6 @@ svSetValue(shvarFile *s, const char *key, const char *value) /* change line */ if (s->current) s->current->data = keyValue; else s->lineList = g_list_append(s->lineList, keyValue); - s->freeList = g_list_append(s->freeList, keyValue); s->modified = 1; } @@ -387,11 +388,7 @@ svCloseFile(shvarFile *s) if (s->fd != -1) close(s->fd); g_free(s->arena); - for (s->current = s->freeList; s->current; s->current = s->current->next) { - g_free(s->current->data); - } g_free(s->fileName); - g_list_free(s->freeList); g_list_foreach (s->lineList, (GFunc) g_free, NULL); g_list_free(s->lineList); /* implicitly frees s->current */ g_free(s); diff --git a/system-settings/plugins/ifcfg-fedora/shvar.h b/system-settings/plugins/ifcfg-fedora/shvar.h index 00e1a8e59f..e01b08d4ae 100644 --- a/system-settings/plugins/ifcfg-fedora/shvar.h +++ b/system-settings/plugins/ifcfg-fedora/shvar.h @@ -42,7 +42,6 @@ struct _shvarFile { int fd; /* read-only */ char *arena; /* ignore */ GList *lineList; /* read-only */ - GList *freeList; /* ignore */ GList *current; /* set implicitly or explicitly, points to element of lineList */ shvarFile *parent; /* set explicitly */ diff --git a/system-settings/plugins/ifcfg-suse/parser.c b/system-settings/plugins/ifcfg-suse/parser.c index 66deec4de8..56f5eccff4 100644 --- a/system-settings/plugins/ifcfg-suse/parser.c +++ b/system-settings/plugins/ifcfg-suse/parser.c @@ -118,7 +118,7 @@ make_ip4_setting (shvarFile *ifcfg) } if (!s_ip4->method) - s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_DHCP); + s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_AUTO); str = svGetValue (ifcfg, "IPADDR"); if (str) { diff --git a/system-settings/plugins/keyfile/Makefile.am b/system-settings/plugins/keyfile/Makefile.am index d4e4a4a40e..8a9f22264d 100644 --- a/system-settings/plugins/keyfile/Makefile.am +++ b/system-settings/plugins/keyfile/Makefile.am @@ -11,6 +11,8 @@ libnm_settings_plugin_keyfile_la_SOURCES = \ writer.c \ writer.h +keyfiledir=$(sysconfdir)/NetworkManager/system-connections + libnm_settings_plugin_keyfile_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(GMODULE_CFLAGS) \ @@ -20,7 +22,7 @@ libnm_settings_plugin_keyfile_la_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/libnm-util \ -I${top_srcdir}/libnm-glib \ - -DKEYFILE_DIR=\""$(sysconfdir)/NetworkManager/system-connections"\" + -DKEYFILE_DIR=\""$(keyfiledir)"\" libnm_settings_plugin_keyfile_la_LDFLAGS = -module -avoid-version libnm_settings_plugin_keyfile_la_LIBADD = \ @@ -37,3 +39,7 @@ else libnm_settings_plugin_keyfile_la_LIBADD += \ $(GIO_LIBS) endif + +install-data-hook: + $(mkinstalldirs) -m 0755 $(DESTDIR)$(keyfiledir) + diff --git a/system-settings/plugins/keyfile/nm-keyfile-connection.c b/system-settings/plugins/keyfile/nm-keyfile-connection.c index b64f2c9146..3cdfe27d11 100644 --- a/system-settings/plugins/keyfile/nm-keyfile-connection.c +++ b/system-settings/plugins/keyfile/nm-keyfile-connection.c @@ -55,14 +55,13 @@ get_id (NMExportedConnection *exported) static gboolean update (NMExportedConnection *exported, GHashTable *new_settings, - GError **err) + GError **error) { gboolean success; - success = NM_EXPORTED_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->update (exported, new_settings, err); - + success = NM_EXPORTED_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->update (exported, new_settings, error); if (success) - write_connection (nm_exported_connection_get_connection (exported)); + success = write_connection (nm_exported_connection_get_connection (exported), error); return success; } diff --git a/system-settings/plugins/keyfile/plugin.c b/system-settings/plugins/keyfile/plugin.c index 4be851c1d3..eaf780e83e 100644 --- a/system-settings/plugins/keyfile/plugin.c +++ b/system-settings/plugins/keyfile/plugin.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ #include <config.h> #include <sys/stat.h> @@ -182,9 +182,11 @@ get_connections (NMSystemConfigInterface *config) } static gboolean -add_connection (NMSystemConfigInterface *config, NMConnection *connection) +add_connection (NMSystemConfigInterface *config, + NMConnection *connection, + GError **error) { - return write_connection (connection); + return write_connection (connection, error); } /* GObject */ diff --git a/system-settings/plugins/keyfile/reader.c b/system-settings/plugins/keyfile/reader.c index 14b974ea7c..e43486a209 100644 --- a/system-settings/plugins/keyfile/reader.c +++ b/system-settings/plugins/keyfile/reader.c @@ -8,6 +8,7 @@ #include <dbus/dbus-glib.h> #include <nm-setting.h> #include <nm-setting-ip4-config.h> +#include <nm-setting-vpn.h> #include <arpa/inet.h> #include <string.h> @@ -289,6 +290,32 @@ read_array_of_array_of_uint (GKeyFile *file, } static void +read_hash_of_string (GKeyFile *file, NMSetting *setting, const char *key) +{ + char **keys, **iter; + char *value; + + keys = g_key_file_get_keys (file, setting->name, NULL, NULL); + if (!keys || !*keys) + return; + + for (iter = keys; *iter; iter++) { + value = g_key_file_get_string (file, setting->name, *iter, NULL); + if (!value) + continue; + + if (NM_IS_SETTING_VPN (setting)) { + NMSettingVPN *s_vpn = NM_SETTING_VPN (setting); + + if (strcmp (*iter, NM_SETTING_VPN_SERVICE_TYPE)) + g_hash_table_insert (s_vpn->data, g_strdup (*iter), g_strdup (value)); + } + g_free (value); + } + g_strfreev (keys); +} + +static void read_one_setting_value (NMSetting *setting, const char *key, const GValue *value, @@ -395,9 +422,8 @@ read_one_setting_value (NMSetting *setting, g_slist_free (list); g_strfreev (sa); - } else if (type == dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) { - /* FIXME */ - g_warning ("Implement me"); + } else if (type == dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)) { + read_hash_of_string (file, setting, key); } else if (type == DBUS_TYPE_G_UINT_ARRAY) { if (!read_array_of_uint (file, setting, key)) { g_warning ("Unhandled setting property type (read): '%s/%s' : '%s'", diff --git a/system-settings/plugins/keyfile/writer.c b/system-settings/plugins/keyfile/writer.c index eb5508d5b8..ee229f6220 100644 --- a/system-settings/plugins/keyfile/writer.c +++ b/system-settings/plugins/keyfile/writer.c @@ -7,6 +7,7 @@ #include <nm-setting.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> +#include <nm-setting-vpn.h> #include <nm-utils.h> #include <string.h> #include <arpa/inet.h> @@ -141,6 +142,42 @@ write_array_of_array_of_uint (GKeyFile *file, return TRUE; } +typedef struct { + GKeyFile *file; + const char *setting_name; +} WriteStringHashInfo; + +static void +write_hash_of_string_helper (gpointer key, gpointer data, gpointer user_data) +{ + WriteStringHashInfo *info = (WriteStringHashInfo *) user_data; + const char *property = (const char *) key; + const char *value = (const char *) data; + + if ( !strcmp (info->setting_name, NM_SETTING_VPN_SETTING_NAME) + && !strcmp (property, NM_SETTING_VPN_SERVICE_TYPE)) + return; + + g_key_file_set_string (info->file, + info->setting_name, + property, + value); +} + +static void +write_hash_of_string (GKeyFile *file, + NMSetting *setting, + const char *key, + const GValue *value) +{ + GHashTable *hash = g_value_get_boxed (value); + WriteStringHashInfo info; + + info.file = file; + info.setting_name = setting->name; + g_hash_table_foreach (hash, write_hash_of_string_helper, &info); +} + static void write_setting_value (NMSetting *setting, const char *key, @@ -208,9 +245,8 @@ write_setting_value (NMSetting *setting, g_key_file_set_string_list (file, setting->name, key, (const gchar **const) array, i); g_free (array); } - } else if (type == dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) { - /* FIXME */ - g_warning ("Implement me"); + } else if (type == dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)) { + write_hash_of_string (file, setting, key, value); } else if (type == DBUS_TYPE_G_UINT_ARRAY) { if (!write_array_of_uint (file, setting, key, value)) { g_warning ("Unhandled setting property type (write) '%s/%s' : '%s'", @@ -228,7 +264,7 @@ write_setting_value (NMSetting *setting, } gboolean -write_connection (NMConnection *connection) +write_connection (NMConnection *connection, GError **error) { NMSettingConnection *s_con; GKeyFile *key_file; diff --git a/system-settings/plugins/keyfile/writer.h b/system-settings/plugins/keyfile/writer.h index 1e5726b9d9..38a20d4e44 100644 --- a/system-settings/plugins/keyfile/writer.h +++ b/system-settings/plugins/keyfile/writer.h @@ -6,6 +6,6 @@ #include <glib.h> #include <nm-connection.h> -gboolean write_connection (NMConnection *connection); +gboolean write_connection (NMConnection *connection, GError **error); #endif /* _KEYFILE_PLUGIN_WRITER_H */ diff --git a/system-settings/src/dbus-settings.c b/system-settings/src/dbus-settings.c index 21c0a448e1..0cb8abcb2c 100644 --- a/system-settings/src/dbus-settings.c +++ b/system-settings/src/dbus-settings.c @@ -1,8 +1,10 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager system settings service * * Søren Sandmann <sandmann@daimi.au.dk> + * Dan Williams <dcbw@redhat.com> + * Tambet Ingo <tambet@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +20,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 Red Hat, Inc. + * (C) Copyright 2007 - 2008 Red Hat, Inc. + * (C) Copyright 2008 Novell, Inc. */ #include <NetworkManager.h> @@ -263,7 +266,9 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class) dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (settings_class), &dbus_glib_nm_settings_system_object_info); - dbus_g_error_domain_register (NM_SYSCONFIG_SETTINGS_ERROR, NULL, NM_TYPE_SYSCONFIG_SETTINGS_ERROR); + dbus_g_error_domain_register (NM_SYSCONFIG_SETTINGS_ERROR, + NM_DBUS_IFACE_SETTINGS_SYSTEM, + NM_TYPE_SYSCONFIG_SETTINGS_ERROR); } static void @@ -453,6 +458,8 @@ impl_settings_add_connection (NMSysconfigSettings *self, connection = nm_connection_new_from_hash (hash, &cnfh_error); if (connection) { + GError *add_error = NULL; + /* Here's how it works: 1) plugin writes a connection. 2) plugin notices that a new connection is available for reading. @@ -461,9 +468,12 @@ impl_settings_add_connection (NMSysconfigSettings *self, */ success = FALSE; - for (iter = priv->plugins; iter && success == FALSE; iter = iter->next) + for (iter = priv->plugins; iter && success == FALSE; iter = iter->next) { success = nm_system_config_interface_add_connection (NM_SYSTEM_CONFIG_INTERFACE (iter->data), - connection); + connection, &add_error); + if (!success && add_error) + g_error_free (add_error); + } g_object_unref (connection); @@ -491,3 +501,4 @@ impl_settings_add_connection (NMSysconfigSettings *self, return TRUE; } } + diff --git a/system-settings/src/nm-system-config-interface.c b/system-settings/src/nm-system-config-interface.c index e868bf7fac..3b73730601 100644 --- a/system-settings/src/nm-system-config-interface.c +++ b/system-settings/src/nm-system-config-interface.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * * Dan Williams <dcbw@redhat.com> @@ -139,7 +139,8 @@ nm_system_config_interface_supports_add (NMSystemConfigInterface *config) gboolean nm_system_config_interface_add_connection (NMSystemConfigInterface *config, - NMConnection *connection) + NMConnection *connection, + GError **error) { gboolean success = FALSE; @@ -147,7 +148,7 @@ nm_system_config_interface_add_connection (NMSystemConfigInterface *config, g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection) - success = NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection); + success = NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, error); return success; } diff --git a/system-settings/src/nm-system-config-interface.h b/system-settings/src/nm-system-config-interface.h index 62306bcda6..4a258e3e99 100644 --- a/system-settings/src/nm-system-config-interface.h +++ b/system-settings/src/nm-system-config-interface.h @@ -60,12 +60,14 @@ GObject * nm_system_config_factory (void); #define NM_SYSTEM_CONFIG_INTERFACE_NAME "name" #define NM_SYSTEM_CONFIG_INTERFACE_INFO "info" +#define NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME "hostname" typedef enum { NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST = 0x1000, NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME = NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST, NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, + NM_SYSTEM_CONFIG_INTERFACE_PROP_HOSTNAME, } NMSystemConfigInterfaceProp; @@ -92,7 +94,7 @@ struct _NMSystemConfigInterface { /* * Add a new connection. */ - gboolean (*add_connection) (NMSystemConfigInterface *config, NMConnection *connection); + gboolean (*add_connection) (NMSystemConfigInterface *config, NMConnection *connection, GError **error); /* Signals */ @@ -115,7 +117,8 @@ GSList *nm_system_config_interface_get_unmanaged_devices (NMSystemConfigInterfac gboolean nm_system_config_interface_supports_add (NMSystemConfigInterface *config); gboolean nm_system_config_interface_add_connection (NMSystemConfigInterface *config, - NMConnection *connection); + NMConnection *connection, + GError **error); G_END_DECLS diff --git a/vpn-daemons/openvpn/ChangeLog b/vpn-daemons/openvpn/ChangeLog index 9bc3bcd1e7..856dc74415 100644 --- a/vpn-daemons/openvpn/ChangeLog +++ b/vpn-daemons/openvpn/ChangeLog @@ -1,3 +1,47 @@ +2008-08-18 Claude Paroz <claude@2xlibre.net> + + * properties/nm-openvpn-dialog.glade: Removed translatable property on non + user-visible strings and stock labels. + +2008-08-14 Tambet Ingo <tambet@gmail.com> + + * src/nm-openvpn-service.c (nm_openvpn_socket_data_cb): Detect private key + verification errors too. + + * auth-dialog/main.c (pem_is_encrypted): GIOChannel isn't a GObject, use the + correct unreferencing function for it. + +2008-08-12 Dan Williams <dcbw@redhat.com> + + * properties/auth-helpers.c + properties/nm-openvpn-dialog.glade + - Handle shared -> static change + - Hook up the Static Key "Local IP Address" entry + + * properties/import-export.c + - Handle shared -> static change + + * src/nm-openvpn-service.c + src/nm-openvpn-service.h + - (nm_openvpn_start_openvpn_binary): always dup strings when adding to + the argument array so that freeing the array later actually works + - (validate_one_property): validate addresses too + - (nm_openvpn_properties_validate): fix determination of error/success + - (real_connect): fix stray ; causing all connection attempts to fail + +2008-08-11 Dan Williams <dcbw@redhat.com> + + Update to match NM svn3924 vpn setting changes; verify options better; + return more informative errors on VPN launch failures; change some config + options (tap-dev, proto-tcp, connection-type) to better reflect their + usage. + +2008-08-08 Dan Williams <dcbw@redhat.com> + + * src/nm-openvpn-service.c + - (nm_openvpn_socket_data_cb): handle spaces in passwords and usernames + (bgo #482139) + 2008-08-06 Dan Williams <dcbw@redhat.com> * src/nm-openvpn-service-openvpn-helper.c diff --git a/vpn-daemons/openvpn/auth-dialog/main.c b/vpn-daemons/openvpn/auth-dialog/main.c index ebfa10d1c8..4799467240 100644 --- a/vpn-daemons/openvpn/auth-dialog/main.c +++ b/vpn-daemons/openvpn/auth-dialog/main.c @@ -32,6 +32,8 @@ #include <libgnomeui/libgnomeui.h> #include <gconf/gconf-client.h> #include <gnome-keyring.h> +#include <nm-setting-vpn.h> +#include <nm-setting-connection.h> #include "../src/nm-openvpn-service.h" #include "gnome-two-password-dialog.h" @@ -129,6 +131,7 @@ save_vpn_password (PasswordsInfo *info, const char *keyring) } } +#define PROC_TYPE_TAG "Proc-Type: 4,ENCRYPTED" /** Checks if a key is encrypted * The key file is read and it is checked if it contains a line reading @@ -140,27 +143,24 @@ save_vpn_password (PasswordsInfo *info, const char *keyring) static gboolean pem_is_encrypted (const char *filename) { - GIOChannel *pem_chan; char *str = NULL; gboolean encrypted = FALSE; pem_chan = g_io_channel_new_file (filename, "r", NULL); - - if ( pem_chan == NULL ) { - // We don't know + if (!pem_chan) return FALSE; - } - while ( ! encrypted && (g_io_channel_read_line (pem_chan, &str, NULL, NULL, NULL) != G_IO_STATUS_EOF) ) { - if ( strstr (str, "Proc-Type: 4,ENCRYPTED") == str ) { - // encrypted! + while (g_io_channel_read_line (pem_chan, &str, NULL, NULL, NULL) != G_IO_STATUS_EOF) { + if (strncmp (str, PROC_TYPE_TAG, strlen (PROC_TYPE_TAG)) == 0) { encrypted = TRUE; + break; } - g_free (str); } + g_io_channel_shutdown (pem_chan, FALSE, NULL); + g_io_channel_unref (pem_chan); return encrypted; } @@ -270,7 +270,12 @@ get_password_types (PasswordsInfo *info) return FALSE; for (iter = conf_list; iter; iter = iter->next) { - key = g_strconcat ((char *) iter->data, "/connection/type", NULL); + const char *path = (const char *) iter->data; + + key = g_strdup_printf ("%s/%s/%s", + path, + NM_SETTING_CONNECTION_SETTING_NAME, + NM_SETTING_CONNECTION_TYPE); str = gconf_client_get_string (gconf_client, key, NULL); g_free (key); @@ -279,7 +284,10 @@ get_password_types (PasswordsInfo *info) continue; } - key = g_strconcat ((char *) iter->data, "/connection/id", NULL); + key = g_strdup_printf ("%s/%s/%s", + path, + NM_SETTING_CONNECTION_SETTING_NAME, + NM_SETTING_CONNECTION_ID); str = gconf_client_get_string (gconf_client, key, NULL); g_free (key); @@ -289,7 +297,7 @@ get_password_types (PasswordsInfo *info) } /* Woo, found the connection */ - connection_path = g_strdup ((char *) iter->data); + connection_path = g_strdup (path); break; } @@ -297,37 +305,32 @@ get_password_types (PasswordsInfo *info) g_slist_free (conf_list); if (connection_path) { - int connection_type; + const char *connection_type; - key = g_strconcat (connection_path, "/vpn-properties/connection-type", NULL); - connection_type = gconf_client_get_int (gconf_client, key, NULL); + key = g_strdup_printf ("%s/%s/%s", connection_path, NM_SETTING_VPN_SETTING_NAME, + NM_OPENVPN_KEY_CONNECTION_TYPE); + connection_type = gconf_client_get_string (gconf_client, key, NULL); g_free (key); - - switch (connection_type) { - case NM_OPENVPN_CONTYPE_PASSWORD_TLS: - info->need_password = TRUE; - /* Fall through */ - case NM_OPENVPN_CONTYPE_TLS: + + if ( !strcmp (connection_type, NM_OPENVPN_CONTYPE_TLS) + || !strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { success = TRUE; - key = g_strconcat (connection_path, "/vpn-properties/", NM_OPENVPN_KEY_KEY, NULL); + if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) + info->need_password = TRUE; + + key = g_strdup_printf ("%s/%s/%s", connection_path, NM_SETTING_VPN_SETTING_NAME, + NM_OPENVPN_KEY_KEY); str = gconf_client_get_string (gconf_client, key, NULL); - g_free (key); - if (str) { + if (str) info->need_certpass = pem_is_encrypted (str); - g_free (str); - } - break; - case NM_OPENVPN_CONTYPE_STATIC_KEY: + g_free (str); + g_free (key); + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_STATIC_KEY)) { success = TRUE; - break; - case NM_OPENVPN_CONTYPE_PASSWORD: + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD)) { success = TRUE; info->need_password = TRUE; - break; - default: - /* Invalid connection type */ - break; } g_free (connection_path); diff --git a/vpn-daemons/openvpn/po/ChangeLog b/vpn-daemons/openvpn/po/ChangeLog index b18880402e..3177b85205 100644 --- a/vpn-daemons/openvpn/po/ChangeLog +++ b/vpn-daemons/openvpn/po/ChangeLog @@ -1,3 +1,19 @@ +2008-08-18 Claude Paroz <claude@2xlibre.net> + + * fr.po: Updated French translation by Robert-André Mauchin. + +2008-08-14 Jorge Gonzalez <jorgegonz@svn.gnome.org> + + * es.po: Updated Spanish translation + +2008-08-14 Ilkka Tuohela <hile@iki.fi> + + * fi.po: Updated Finnish translation. + +2008-08-08 Leonid Kanter <leon@asplinux.ru> + + ru.po: Updated Russian translation + 2008-08-02 Alexander Shopov <ash@contact.bg> * bg.po: Updated Bulgarian translation by diff --git a/vpn-daemons/openvpn/po/es.po b/vpn-daemons/openvpn/po/es.po index 41972091ce..a743155acf 100644 --- a/vpn-daemons/openvpn/po/es.po +++ b/vpn-daemons/openvpn/po/es.po @@ -13,12 +13,12 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager-openvpn.HEAD\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-19 18:11+0000\n" -"PO-Revision-Date: 2008-07-20 15:41+0200\n" +"POT-Creation-Date: 2008-08-12 17:44+0000\n" +"PO-Revision-Date: 2008-08-14 09:22+0200\n" "Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n" "Language-Team: Español <gnome-es-list@gnome.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: KBabel 1.11.4\n" @@ -79,43 +79,43 @@ msgstr "_Contraseña del certificado:" msgid "Certificate password:" msgstr "Contraseña del certificado:" -#: ../properties/auth-helpers.c:68 +#: ../properties/auth-helpers.c:69 msgid "Choose a Certificate Authority certificate..." msgstr "Elija un certificado de una autoridad de certificados…" -#: ../properties/auth-helpers.c:87 +#: ../properties/auth-helpers.c:88 msgid "Choose your personal certificate..." msgstr "Elija su certificado personal…" -#: ../properties/auth-helpers.c:105 +#: ../properties/auth-helpers.c:106 msgid "Choose your private key..." msgstr "Elija su clave privada…" -#: ../properties/auth-helpers.c:158 +#: ../properties/auth-helpers.c:159 msgid "Choose an OpenVPN static key..." msgstr "Elija una clave estática OpenVPN…" -#: ../properties/auth-helpers.c:176 ../properties/auth-helpers.c:864 +#: ../properties/auth-helpers.c:183 ../properties/auth-helpers.c:862 msgid "None" msgstr "Ninguno" -#: ../properties/auth-helpers.c:519 +#: ../properties/auth-helpers.c:518 msgid "PEM certificates (*.pem, *.crt, *.key)" msgstr "Certificados PEM (*.pem, *.crt, *.key)" -#: ../properties/auth-helpers.c:579 +#: ../properties/auth-helpers.c:578 msgid "OpenVPN Static Keys (*.key)" msgstr "Claves estáticas OpenVPN (*.key)" -#: ../properties/auth-helpers.c:703 +#: ../properties/auth-helpers.c:689 msgid "Default" msgstr "Predeterminado" -#: ../properties/nm-openvpn.c:53 +#: ../properties/nm-openvpn.c:52 msgid "OpenVPN" msgstr "OpenVPN" -#: ../properties/nm-openvpn.c:54 +#: ../properties/nm-openvpn.c:53 msgid "Compatible with the OpenVPN server." msgstr "Compatible con el servidor OpenVPN." @@ -186,78 +186,81 @@ msgid "Key File:" msgstr "Archivo de clave:" #: ../properties/nm-openvpn-dialog.glade.h:12 +msgid "Local IP Address:" +msgstr "Dirección IP local:" + +#: ../properties/nm-openvpn-dialog.glade.h:13 msgid "OpenVPN Advanced Options" msgstr "Opciones avanzadas de OpenVPN" -#: ../properties/nm-openvpn-dialog.glade.h:13 +#: ../properties/nm-openvpn-dialog.glade.h:14 msgid "Private Key:" msgstr "Clave privada:" -#: ../properties/nm-openvpn-dialog.glade.h:14 +#: ../properties/nm-openvpn-dialog.glade.h:15 msgid "Static Key:" msgstr "Clave estática:" -#: ../properties/nm-openvpn-dialog.glade.h:15 +#: ../properties/nm-openvpn-dialog.glade.h:16 msgid "Type:" msgstr "Tipo:" -#: ../properties/nm-openvpn-dialog.glade.h:16 +#: ../properties/nm-openvpn-dialog.glade.h:17 msgid "Use L_ZO data compression" msgstr "Usar compresión L_ZO" # include/scanner/scanner_usb.ycp:47 # include/scanner/scanner_usb.ycp:47 # include/scanner/scanner_usb.ycp:47 -#: ../properties/nm-openvpn-dialog.glade.h:17 +#: ../properties/nm-openvpn-dialog.glade.h:18 msgid "Use a TA_P device" msgstr "Usar dispositivo TA_P" # include/printconf/dialogs.ycp:150 -#: ../properties/nm-openvpn-dialog.glade.h:18 +#: ../properties/nm-openvpn-dialog.glade.h:19 msgid "Use a _TCP connection" msgstr "Usar conexión _TCP" -#: ../properties/nm-openvpn-dialog.glade.h:19 +#: ../properties/nm-openvpn-dialog.glade.h:20 msgid "Use additional TLS authentication" msgstr "Usar autenticación TLS adicional" -#: ../properties/nm-openvpn-dialog.glade.h:20 +#: ../properties/nm-openvpn-dialog.glade.h:21 msgid "Use custom gateway p_ort:" msgstr "Usar un p_uerto de pasarela personalizado:" -#: ../properties/nm-openvpn-dialog.glade.h:21 +#: ../properties/nm-openvpn-dialog.glade.h:22 msgid "User Certificate:" msgstr "Certificado de usuario:" -#: ../properties/nm-openvpn-dialog.glade.h:22 +#: ../properties/nm-openvpn-dialog.glade.h:23 msgid "User name:" msgstr "Nombre de usuario:" -#: ../properties/nm-openvpn-dialog.glade.h:23 +#: ../properties/nm-openvpn-dialog.glade.h:24 msgid "_Gateway:" msgstr "_Pasarela:" -#: ../properties/nm-openvpn-dialog.glade.h:24 +#: ../properties/nm-openvpn-dialog.glade.h:25 msgid "gtk-cancel" msgstr "gtk-cancel" -#: ../properties/nm-openvpn-dialog.glade.h:25 +#: ../properties/nm-openvpn-dialog.glade.h:26 msgid "gtk-ok" msgstr "gtk-ok" -#: ../properties/nm-openvpn-dialog.glade.h:26 +#: ../properties/nm-openvpn-dialog.glade.h:27 msgid "page 1" msgstr "página 1" -#: ../properties/nm-openvpn-dialog.glade.h:27 +#: ../properties/nm-openvpn-dialog.glade.h:28 msgid "page 2" msgstr "página 2" -#: ../properties/nm-openvpn-dialog.glade.h:28 +#: ../properties/nm-openvpn-dialog.glade.h:29 msgid "page 3" msgstr "página 3" -#: ../properties/nm-openvpn-dialog.glade.h:29 +#: ../properties/nm-openvpn-dialog.glade.h:30 msgid "page 4" msgstr "página 4" - diff --git a/vpn-daemons/openvpn/po/fi.po b/vpn-daemons/openvpn/po/fi.po index 9b1931e311..3de29dc4eb 100644 --- a/vpn-daemons/openvpn/po/fi.po +++ b/vpn-daemons/openvpn/po/fi.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager-openvpn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-08-11 13:29+0300\n" -"PO-Revision-Date: 2007-03-06 06:08+0300\n" +"POT-Creation-Date: 2008-08-14 08:41+0300\n" +"PO-Revision-Date: 2008-08-14 08:30+0300\n" "Last-Translator: Ilkka Tuohela <hile@iki.fi>\n" "Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n" "MIME-Version: 1.0\n" @@ -49,424 +49,450 @@ msgstr "_Muista salasana istunnon ajan" msgid "_Save password in keyring" msgstr "_Tallenna salasana avainrenkaaseen" -#: ../auth-dialog/main.c:214 +#: ../auth-dialog/main.c:187 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "Yhteydenotto VPN-verkkoon \"%s\" vaatii kirjautumista." -#: ../auth-dialog/main.c:215 +#: ../auth-dialog/main.c:188 msgid "Authenticate VPN" msgstr "Todenna VPN-yhteyden avaus" -#: ../auth-dialog/main.c:227 +#: ../auth-dialog/main.c:201 msgid "Certificate pass_word:" msgstr "Varmenteen _salasana:" -#: ../auth-dialog/main.c:252 +#: ../auth-dialog/main.c:216 msgid "Certificate password:" msgstr "Varmennettu salasana:" -#: ../nm-openvpn.desktop.in.h:1 -msgid "Add, Remove, and Edit VPN Connections" -msgstr "Lisää, poista tai muokkaa VPN-yhteyksiä" +#: ../properties/auth-helpers.c:69 +msgid "Choose a Certificate Authority certificate..." +msgstr "Valitse CA-varmenne..." -#: ../nm-openvpn.desktop.in.h:2 -msgid "VPN Connection Manager (OpenVPN)" -msgstr "VPN-yhteyksien hallinta (OpenVPN)" +#: ../properties/auth-helpers.c:88 +msgid "Choose your personal certificate..." +msgstr "Valitse oma varmenteesi..." -#: ../properties/nm-openvpn.c:146 -msgid "OpenVPN Client" -msgstr "OpenVPN-asiakas" +#: ../properties/auth-helpers.c:106 +msgid "Choose your private key..." +msgstr "Valitse salainen avaimesi..." -#: ../properties/nm-openvpn.c:803 -msgid "The following OpenVPN connection will be created:" -msgstr "Seuraava OpenVPN-yhteys luodaan:" +#: ../properties/auth-helpers.c:159 +msgid "Choose an OpenVPN static key..." +msgstr "Valitse OpenPVN:n staattinen avain..." -#: ../properties/nm-openvpn.c:805 -#, c-format -msgid "Name: %s" -msgstr "Nimi: %s" +#: ../properties/auth-helpers.c:183 ../properties/auth-helpers.c:862 +msgid "None" +msgstr "Ei mitään" -#: ../properties/nm-openvpn.c:813 -msgid "Connection Type: X.509 Certificates" -msgstr "Yhteyden tyyppi: X.509-varmenteet" +#: ../properties/auth-helpers.c:518 +msgid "PEM certificates (*.pem, *.crt, *.key)" +msgstr "PEM-varmenteet (*.pem, *.crt, *.key)" -#: ../properties/nm-openvpn.c:816 ../properties/nm-openvpn.c:843 -#: ../properties/nm-openvpn.c:855 -#, c-format -msgid "CA: %s" -msgstr "CA: %s" +#: ../properties/auth-helpers.c:578 +msgid "OpenVPN Static Keys (*.key)" +msgstr "Pysyvät OpenVPN-avaimet (*.key)" -#: ../properties/nm-openvpn.c:819 ../properties/nm-openvpn.c:858 -#, c-format -msgid "Cert: %s" -msgstr "Varmenne: %s" +#: ../properties/auth-helpers.c:689 +msgid "Default" +msgstr "Oletus" -#: ../properties/nm-openvpn.c:822 ../properties/nm-openvpn.c:861 -#, c-format -msgid "Key: %s" -msgstr "Avain: %s" +#: ../properties/nm-openvpn.c:52 +msgid "OpenVPN" +msgstr "OpenVPN" -#: ../properties/nm-openvpn.c:826 -msgid "Connection Type: Shared Key" -msgstr "Yhteyden tyyppi: jaettu avain" +#: ../properties/nm-openvpn.c:53 +msgid "Compatible with the OpenVPN server." +msgstr "Yhteensopiva OpenVPN-palvelimen kanssa." -#: ../properties/nm-openvpn.c:829 -#, c-format -msgid "Shared Key: %s" -msgstr "Jaettu avain: %s" +#: ../properties/nm-openvpn.c:310 ../properties/nm-openvpn-dialog.glade.h:7 +msgid "Certificates (TLS)" +msgstr "Varmenteet (TLS)" -#: ../properties/nm-openvpn.c:832 -#, c-format -msgid "Local IP: %s" -msgstr "Oma IP-osoite: %s" +#: ../properties/nm-openvpn.c:322 +msgid "Password" +msgstr "Salasana" -#: ../properties/nm-openvpn.c:835 -#, c-format -msgid "Remote IP: %s" -msgstr "Palvelimen IP-osoite: %s" +#: ../properties/nm-openvpn.c:336 +msgid "Password with Certificates (TLS)" +msgstr "Salasana varmenteiden kanssa (TLS)" -#: ../properties/nm-openvpn.c:840 -msgid "Connection Type: Password" -msgstr "Yhteyden tyyppi: Salasana" +#: ../properties/nm-openvpn.c:348 +msgid "Static Key" +msgstr "Staattinen avain" -#: ../properties/nm-openvpn.c:846 ../properties/nm-openvpn.c:864 -#, c-format -msgid "Username: %s" -msgstr "Käyttäjätunnus: %s" +#: ../properties/nm-openvpn-dialog.glade.h:1 +msgid " " +msgstr " " -#: ../properties/nm-openvpn.c:852 -msgid "Connection Type: X.509 with Password Authentication" -msgstr "Yhteyden tyyppi: X.509 salasanalla todennuksella" +#: ../properties/nm-openvpn-dialog.glade.h:2 +msgid "<b>Authentication</b>" +msgstr "<b>Tunnistautuminen</b>" -#: ../properties/nm-openvpn.c:870 -#, c-format -msgid "Remote: %s" -msgstr "Palvelin: %s" +#: ../properties/nm-openvpn-dialog.glade.h:3 +msgid "<b>General</b>" +msgstr "<b>Yleisasetukset</b>" -#: ../properties/nm-openvpn.c:873 -#, c-format -msgid "Port: %s" -msgstr "Portti: %s" +#: ../properties/nm-openvpn-dialog.glade.h:4 +msgid "" +"<i>If key direction is used, it must be the opposite of that used on the VPN " +"peer. For example, if the peer uses '1', this connection must use '0'. If " +"you are unsure what value to use, contact your system administrator.</i>" +msgstr "" +"<i>Jos avaimen suuntaa käytetään, täytyy annetun arvon olla vastkkainen kuin " +"VPN-yhteyden toisessa päässä. Jos esimerkiksi vastapäässä on arvo 1, tämän " +"täytyy olla 0. Jos et tiedä mitä tässä pitäisi olla, kysy VPN-yhteytesi " +"ylläpitäjältä lisätietoja.</i>" -#: ../properties/nm-openvpn.c:876 -#, c-format -msgid "Device: %s" -msgstr "Laite: %s" +#: ../properties/nm-openvpn-dialog.glade.h:5 +msgid "Ad_vanced..." +msgstr "_Lisäasetukset..." -#: ../properties/nm-openvpn.c:876 -msgid "TAP" -msgstr "TAP" +#: ../properties/nm-openvpn-dialog.glade.h:6 +msgid "CA Certificate:" +msgstr "CA-varmenne:" -#: ../properties/nm-openvpn.c:876 -msgid "TUN" -msgstr "TUN" +#: ../properties/nm-openvpn-dialog.glade.h:8 +msgid "Cipher:" +msgstr "Salausmenetelmä:" -#: ../properties/nm-openvpn.c:879 -#, c-format -msgid "Protocol: %s" -msgstr "Protokolla: %s" +#: ../properties/nm-openvpn-dialog.glade.h:9 +msgid "General" +msgstr "Yleisasetukset" -#: ../properties/nm-openvpn.c:879 -msgid "TCP" -msgstr "TCP" +#: ../properties/nm-openvpn-dialog.glade.h:10 +msgid "Key Direction:" +msgstr "Avaimen suunta:" -#: ../properties/nm-openvpn.c:879 -msgid "UDP" -msgstr "UDP" +#: ../properties/nm-openvpn-dialog.glade.h:11 +msgid "Key File:" +msgstr "Avaintiedosto:" -#: ../properties/nm-openvpn.c:883 -#, c-format -msgid "Routes: %s" -msgstr "Reitit: %s" +#: ../properties/nm-openvpn-dialog.glade.h:12 +msgid "Local IP Address:" +msgstr "Oma IP-osoite:" -#: ../properties/nm-openvpn.c:887 -#, c-format -msgid "Use LZO Compression: %s" -msgstr "Käytä LZO-pakkausta: %s" +#: ../properties/nm-openvpn-dialog.glade.h:13 +msgid "OpenVPN Advanced Options" +msgstr "OpenVPN-lisäasetukset" -#: ../properties/nm-openvpn.c:887 -msgid "Yes" -msgstr "Kyllä" +#: ../properties/nm-openvpn-dialog.glade.h:14 +msgid "Private Key:" +msgstr "Salainen avain:" -#: ../properties/nm-openvpn.c:887 -msgid "No" -msgstr "Ei" +#: ../properties/nm-openvpn-dialog.glade.h:15 +msgid "Static Key:" +msgstr "Kiinteä avain:" -#: ../properties/nm-openvpn.c:891 -#, c-format -msgid "Cipher: %s" -msgstr "Salausmenetelmä: %s" +#: ../properties/nm-openvpn-dialog.glade.h:16 +msgid "Type:" +msgstr "Tyyppi:" -#: ../properties/nm-openvpn.c:896 -#, c-format -msgid "TLS auth: %s %s" -msgstr "TLS-todentaminen: %s %s" +#: ../properties/nm-openvpn-dialog.glade.h:17 +msgid "Use L_ZO data compression" +msgstr "Käytä L_ZO-pakkausta" -#: ../properties/nm-openvpn.c:900 -msgid "The connection details can be changed using the \"Edit\" button." -msgstr "Yhteyden yksityiskohtia voi muuttaa valitsemalla \"Muokkaa\"." +#: ../properties/nm-openvpn-dialog.glade.h:18 +msgid "Use a TA_P device" +msgstr "Käytä TA_P-laitetta" -#: ../properties/nm-openvpn.c:1124 -msgid "Cannot import settings" -msgstr "Asetuksia ei voi tuoda" +#: ../properties/nm-openvpn-dialog.glade.h:19 +msgid "Use a _TCP connection" +msgstr "Käytä _TCP-yhteyttä" -#: ../properties/nm-openvpn.c:1126 -#, c-format -msgid "The VPN settings file '%s' does not contain valid data." -msgstr "VPN-asetustiedosto \"%s\" ei sisällä kelvollisia tietoja." +#: ../properties/nm-openvpn-dialog.glade.h:20 +msgid "Use additional TLS authentication" +msgstr "Käytä lisäksi TLS-tunnistatumista" -#: ../properties/nm-openvpn.c:1173 -msgid "Select file to import" -msgstr "Valitse tuotava tiedosto" +#: ../properties/nm-openvpn-dialog.glade.h:21 +msgid "Use custom gateway p_ort:" +msgstr "Käytä _muuta yhdyskäytävän porttia:" -#: ../properties/nm-openvpn.c:1232 ../properties/nm-openvpn.c:1244 -#: ../properties/nm-openvpn.c:1247 -msgid "Select CA to use" -msgstr "Valitse käytettävä CA" +#: ../properties/nm-openvpn-dialog.glade.h:22 +msgid "User Certificate:" +msgstr "Käyttäjän varmenne:" -#: ../properties/nm-openvpn.c:1235 ../properties/nm-openvpn.c:1250 -msgid "Select certificate to use" -msgstr "Valitse käytettävä varmenne" +#: ../properties/nm-openvpn-dialog.glade.h:23 +msgid "User name:" +msgstr "Käyttäjätunnus:" -#: ../properties/nm-openvpn.c:1238 ../properties/nm-openvpn.c:1253 -msgid "Select key to use" -msgstr "Valitse käytettävä avain" +#: ../properties/nm-openvpn-dialog.glade.h:24 +msgid "_Gateway:" +msgstr "_Yhdyskäytävä:" -#: ../properties/nm-openvpn.c:1241 -msgid "Select shared key to use" -msgstr "Valitse käytettävä jaettu avain" +#: ../properties/nm-openvpn-dialog.glade.h:25 +msgid "gtk-cancel" +msgstr "gtk-cancel" -#: ../properties/nm-openvpn.c:1256 -msgid "Select TA to use" -msgstr "Valitse käytettävä TA" +#: ../properties/nm-openvpn-dialog.glade.h:26 +msgid "gtk-ok" +msgstr "gtk-ok" -#. printf ("in impl_export\n"); -#: ../properties/nm-openvpn.c:1450 -msgid "Save as..." -msgstr "Tallenna nimellä..." +#: ../properties/nm-openvpn-dialog.glade.h:27 +msgid "page 1" +msgstr "sivu 1" -#: ../properties/nm-openvpn.c:1480 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Tiedosto \"%s\" on jo olemassa." +#: ../properties/nm-openvpn-dialog.glade.h:28 +msgid "page 2" +msgstr "sivu 2" -#: ../properties/nm-openvpn.c:1483 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Haluatko korvata sen tiedostolla jota olet tallentamassa?" +#: ../properties/nm-openvpn-dialog.glade.h:29 +msgid "page 3" +msgstr "sivu 3" -#: ../properties/nm-openvpn.c:1497 -msgid "Failed to export configuration" -msgstr "Asetuksia ei voitu viedä" +#: ../properties/nm-openvpn-dialog.glade.h:30 +msgid "page 4" +msgstr "sivu 4" -#: ../properties/nm-openvpn.c:1499 -#, c-format -msgid "Failed to save file %s" -msgstr "Tiedostoa \"%s\" ei voitu tallentaa" +#~ msgid "The following OpenVPN connection will be created:" +#~ msgstr "Seuraava OpenVPN-yhteys luodaan:" -#: ../properties/nm-openvpn-dialog.glade.h:1 -msgid "(Default: 1194)" -msgstr "(oletus: 1194)" +#~ msgid "Name: %s" +#~ msgstr "Nimi: %s" -#: ../properties/nm-openvpn-dialog.glade.h:2 -msgid "65536" -msgstr "65536" +#~ msgid "Connection Type: X.509 Certificates" +#~ msgstr "Yhteyden tyyppi: X.509-varmenteet" -#: ../properties/nm-openvpn-dialog.glade.h:3 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>esimerkki: 172.16.0.0/16 10.11.12.0/24</i>" +#~ msgid "CA: %s" +#~ msgstr "CA: %s" -#: ../properties/nm-openvpn-dialog.glade.h:4 -msgid "Ad_vanced" -msgstr "_Lisäasetukset" +#~ msgid "Cert: %s" +#~ msgstr "Varmenne: %s" -#: ../properties/nm-openvpn-dialog.glade.h:5 -msgid "C_A file:" -msgstr "C_A-tiedosto:" +#~ msgid "Key: %s" +#~ msgstr "Avain: %s" -#: ../properties/nm-openvpn-dialog.glade.h:6 -msgid "C_ertificate:" -msgstr "_Varmenne:" +#~ msgid "Connection Type: Shared Key" +#~ msgstr "Yhteyden tyyppi: jaettu avain" -#: ../properties/nm-openvpn-dialog.glade.h:7 -msgid "Co_nnection type:" -msgstr "_Yhteyden tyyppi:" +#~ msgid "Shared Key: %s" +#~ msgstr "Jaettu avain: %s" -#: ../properties/nm-openvpn-dialog.glade.h:8 -msgid "Connection na_me:" -msgstr "Yhteyden _nimi:" +#~ msgid "Remote IP: %s" +#~ msgstr "Palvelimen IP-osoite: %s" -#: ../properties/nm-openvpn-dialog.glade.h:9 -msgid "Direction:" -msgstr "Suunta:" +#~ msgid "Connection Type: Password" +#~ msgstr "Yhteyden tyyppi: Salasana" -#: ../properties/nm-openvpn-dialog.glade.h:10 -msgid "Import _Saved Configuration..." -msgstr "Tuo _tallennettu määrittely..." +#~ msgid "Username: %s" +#~ msgstr "Käyttäjätunnus: %s" -#: ../properties/nm-openvpn-dialog.glade.h:11 -msgid "" -"Name used to identify the connection to the private network, e.g. \"Campus " -"VPN\" or \"Corporate Network\"" -msgstr "" -"Yksilöllinen VPN-verkon nimi, esimerkiksi \"Kampusverkko\" tai \"Työpaikan " -"verkko\"." +#~ msgid "Connection Type: X.509 with Password Authentication" +#~ msgstr "Yhteyden tyyppi: X.509 salasanalla todennuksella" -#: ../properties/nm-openvpn-dialog.glade.h:12 -msgid "Network" -msgstr "Verkko" +#~ msgid "Remote: %s" +#~ msgstr "Palvelin: %s" -#: ../properties/nm-openvpn-dialog.glade.h:13 -msgid "Only use _VPN connection for these addresses:" -msgstr "_Käytä VPN-yhteyttä seuraaville osoitteille" +#~ msgid "Port: %s" +#~ msgstr "Portti: %s" -#: ../properties/nm-openvpn-dialog.glade.h:14 -msgid "OpenVPN Advanced Options" -msgstr "OpenVPN-lisäasetukset" +#~ msgid "Device: %s" +#~ msgstr "Laite: %s" -#: ../properties/nm-openvpn-dialog.glade.h:15 -msgid "OpenVPN Configuration" -msgstr "OpenVPN-määrittely" +#~ msgid "TAP" +#~ msgstr "TAP" -#: ../properties/nm-openvpn-dialog.glade.h:16 -msgid "" -"Please enter the information provided by your system administrator below. Do " -"not enter your password here as you will be prompted when connecting." -msgstr "" -"Syötä järjestelmän ylläpitäjältä saamasi tiedot alla oleviin kohtiin. Älä " -"syötä tähän salasanaasi, sillä se kysytään vasta otettaessa yhteyttä." +#~ msgid "TUN" +#~ msgstr "TUN" -#: ../properties/nm-openvpn-dialog.glade.h:17 -msgid "" -"Please note that the file you import is not an OpenVPN configuration file. " -"Ask your administrator for the file." -msgstr "" -"Huomaa, että tuotava tiedosto ei ole OpenVPN-asetustiedosto. Kysy " -"ylläpitäjältäsi oikeaa tiedostoa." +#~ msgid "Protocol: %s" +#~ msgstr "Protokolla: %s" -#: ../properties/nm-openvpn-dialog.glade.h:18 -msgid "Shared _key:" -msgstr "_Jaettu avain:" +#~ msgid "TCP" +#~ msgstr "TCP" -#: ../properties/nm-openvpn-dialog.glade.h:19 -msgid "TLS-Auth" -msgstr "TLS-todentaminen" +#~ msgid "UDP" +#~ msgstr "UDP" -#: ../properties/nm-openvpn-dialog.glade.h:20 -msgid "Use L_ZO compression" -msgstr "Käytä L_ZO-pakkausta" +#~ msgid "Routes: %s" +#~ msgstr "Reitit: %s" -#: ../properties/nm-openvpn-dialog.glade.h:21 -msgid "Use TA_P device" -msgstr "Käytä TA_P-laitetta" +#~ msgid "Use LZO Compression: %s" +#~ msgstr "Käytä LZO-pakkausta: %s" -#: ../properties/nm-openvpn-dialog.glade.h:22 -msgid "Use _TCP connection" -msgstr "Käytä _TCP-yhteyttä" +#~ msgid "Yes" +#~ msgstr "Kyllä" -#: ../properties/nm-openvpn-dialog.glade.h:23 -msgid "Use _TLS auth:" -msgstr "Käytä _TLS-todentamista:" +#~ msgid "TLS auth: %s %s" +#~ msgstr "TLS-todentaminen: %s %s" -#: ../properties/nm-openvpn-dialog.glade.h:24 -msgid "Use cip_her:" -msgstr "Salaus_menetelmä:" +#~ msgid "The connection details can be changed using the \"Edit\" button." +#~ msgstr "Yhteyden yksityiskohtia voi muuttaa valitsemalla \"Muokkaa\"." -#: ../properties/nm-openvpn-dialog.glade.h:25 -msgid "" -"X.509 Certificates\n" -"Pre-shared key\n" -"Password Authentication\n" -"X.509 with Password Authentication" -msgstr "" -"X.509-varmenteet\n" -"Jaettu avain\n" -"Salasanalla todentaminen\n" -"X.509 salasanatodennuksella" +#~ msgid "Cannot import settings" +#~ msgstr "Asetuksia ei voi tuoda" -#: ../properties/nm-openvpn-dialog.glade.h:29 -msgid "_0" -msgstr "_0" +#~ msgid "The VPN settings file '%s' does not contain valid data." +#~ msgstr "VPN-asetustiedosto \"%s\" ei sisällä kelvollisia tietoja." -#: ../properties/nm-openvpn-dialog.glade.h:30 -msgid "_1" -msgstr "_1" +#~ msgid "Select file to import" +#~ msgstr "Valitse tuotava tiedosto" -#: ../properties/nm-openvpn-dialog.glade.h:31 -msgid "_Gateway address:" -msgstr "_Yhdyskäytävän osoite:" +#~ msgid "Select CA to use" +#~ msgstr "Valitse käytettävä CA" -#: ../properties/nm-openvpn-dialog.glade.h:32 -msgid "_Gateway port:" -msgstr "_Yhdyskäytävän portti:" +#~ msgid "Select certificate to use" +#~ msgstr "Valitse käytettävä varmenne" -#: ../properties/nm-openvpn-dialog.glade.h:33 -msgid "_Key:" -msgstr "_Avain:" +#~ msgid "Select key to use" +#~ msgstr "Valitse käytettävä avain" -#: ../properties/nm-openvpn-dialog.glade.h:34 -msgid "_Local IP:" -msgstr "_Paikallinen IP-osoite:" +#~ msgid "Select shared key to use" +#~ msgstr "Valitse käytettävä jaettu avain" -#: ../properties/nm-openvpn-dialog.glade.h:35 -msgid "_Remote IP:" -msgstr "_Palvelimen IP-osoite:" +#~ msgid "Select TA to use" +#~ msgstr "Valitse käytettävä TA" -#: ../properties/nm-openvpn-dialog.glade.h:36 -msgid "_User name:" -msgstr "_Käyttäjätunnus:" +#~ msgid "Save as..." +#~ msgstr "Tallenna nimellä..." -#: ../properties/nm-openvpn-dialog.glade.h:37 -msgid "_none" -msgstr "_ei mitään" +#~ msgid "A file named \"%s\" already exists." +#~ msgstr "Tiedosto \"%s\" on jo olemassa." -#: ../src/nm-openvpn-service.c:127 -msgid "" -"The VPN login failed because the user name and password were not accepted or " -"the certificate password was wrong." -msgstr "" -"VPN-kirjautuminen epäonnistui, koska käyttäjätunnusta ja salasanaa ei " -"hyväsytty, tai varmenteen salasana oli väärin." +#~ msgid "Do you want to replace it with the one you are saving?" +#~ msgstr "Haluatko korvata sen tiedostolla jota olet tallentamassa?" -#: ../src/nm-openvpn-service.c:129 -msgid "The VPN login failed because the VPN program could not be started." -msgstr "VPN-kirjautuminen epäonnistui, koska VPN-ohjelmaa ei voitu käynnistää." +#~ msgid "Failed to export configuration" +#~ msgstr "Asetuksia ei voitu viedä" -#: ../src/nm-openvpn-service.c:131 -msgid "" -"The VPN login failed because the VPN program could not connect to the VPN " -"server." -msgstr "" -"VPN-kirjatuminen epäonnistui, koska VPN-ohjelma ei saanut yhteyttä VPN-" -"palvelimeen." +#~ msgid "Failed to save file %s" +#~ msgstr "Tiedostoa \"%s\" ei voitu tallentaa" -#: ../src/nm-openvpn-service.c:133 -msgid "" -"The VPN login failed because the VPN configuration options were invalid." -msgstr "" -"VPN-kirjautuminen epäonnistui, koska VPN-asetuksten valinnat olivat " -"virheelliset." +#~ msgid "65536" +#~ msgstr "65536" -#: ../src/nm-openvpn-service.c:135 -msgid "" -"The VPN login failed because the VPN program received an invalid " -"configuration from the VPN server." -msgstr "" -"VPN-kirjautuminen epäonnistui, koska VPN-ohjelma sai epäyhteensopivat " -"asetukset VPN-palvelimelta." +#~ msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" +#~ msgstr "<i>esimerkki: 172.16.0.0/16 10.11.12.0/24</i>" -#: ../src/nm-openvpn-service.c:137 -msgid "VPN connection failed" -msgstr "VPN-yhteyden avaus epäonnistui" +#~ msgid "C_A file:" +#~ msgstr "C_A-tiedosto:" -#~ msgid "<b>Connection Information</b>" -#~ msgstr "<b>Tietoja yhteydestä</b>" +#~ msgid "Co_nnection type:" +#~ msgstr "_Yhteyden tyyppi:" + +#~ msgid "Connection na_me:" +#~ msgstr "Yhteyden _nimi:" + +#~ msgid "Import _Saved Configuration..." +#~ msgstr "Tuo _tallennettu määrittely..." + +#~ msgid "" +#~ "Name used to identify the connection to the private network, e.g. " +#~ "\"Campus VPN\" or \"Corporate Network\"" +#~ msgstr "" +#~ "Yksilöllinen VPN-verkon nimi, esimerkiksi \"Kampusverkko\" tai " +#~ "\"Työpaikan verkko\"." + +#~ msgid "Network" +#~ msgstr "Verkko" + +#~ msgid "Only use _VPN connection for these addresses:" +#~ msgstr "_Käytä VPN-yhteyttä seuraaville osoitteille" + +#~ msgid "OpenVPN Configuration" +#~ msgstr "OpenVPN-määrittely" + +#~ msgid "" +#~ "Please enter the information provided by your system administrator below. " +#~ "Do not enter your password here as you will be prompted when connecting." +#~ msgstr "" +#~ "Syötä järjestelmän ylläpitäjältä saamasi tiedot alla oleviin kohtiin. Älä " +#~ "syötä tähän salasanaasi, sillä se kysytään vasta otettaessa yhteyttä." + +#~ msgid "" +#~ "Please note that the file you import is not an OpenVPN configuration " +#~ "file. Ask your administrator for the file." +#~ msgstr "" +#~ "Huomaa, että tuotava tiedosto ei ole OpenVPN-asetustiedosto. Kysy " +#~ "ylläpitäjältäsi oikeaa tiedostoa." + +#~ msgid "Shared _key:" +#~ msgstr "_Jaettu avain:" + +#~ msgid "TLS-Auth" +#~ msgstr "TLS-todentaminen" -#~ msgid "<b>Connection Name</b>" -#~ msgstr "<b>Yhteyden nimi</b>" +#~ msgid "Use _TLS auth:" +#~ msgstr "Käytä _TLS-todentamista:" -#~ msgid "<b>Required</b>" -#~ msgstr "<b>Vaaditut tiedot</b>" +#~ msgid "Use cip_her:" +#~ msgstr "Salaus_menetelmä:" + +#~ msgid "" +#~ "X.509 Certificates\n" +#~ "Pre-shared key\n" +#~ "Password Authentication\n" +#~ "X.509 with Password Authentication" +#~ msgstr "" +#~ "X.509-varmenteet\n" +#~ "Jaettu avain\n" +#~ "Salasanalla todentaminen\n" +#~ "X.509 salasanatodennuksella" + +#~ msgid "_0" +#~ msgstr "_0" + +#~ msgid "_1" +#~ msgstr "_1" + +#~ msgid "_Gateway address:" +#~ msgstr "_Yhdyskäytävän osoite:" + +#~ msgid "_Key:" +#~ msgstr "_Avain:" + +#~ msgid "_Local IP:" +#~ msgstr "_Paikallinen IP-osoite:" + +#~ msgid "_Remote IP:" +#~ msgstr "_Palvelimen IP-osoite:" + +#~ msgid "_none" +#~ msgstr "_ei mitään" + +#~ msgid "Add, Remove, and Edit VPN Connections" +#~ msgstr "Lisää, poista tai muokkaa VPN-yhteyksiä" + +#~ msgid "VPN Connection Manager (OpenVPN)" +#~ msgstr "VPN-yhteyksien hallinta (OpenVPN)" + +#~ msgid "" +#~ "The VPN login failed because the user name and password were not accepted " +#~ "or the certificate password was wrong." +#~ msgstr "" +#~ "VPN-kirjautuminen epäonnistui, koska käyttäjätunnusta ja salasanaa ei " +#~ "hyväsytty, tai varmenteen salasana oli väärin." + +#~ msgid "The VPN login failed because the VPN program could not be started." +#~ msgstr "" +#~ "VPN-kirjautuminen epäonnistui, koska VPN-ohjelmaa ei voitu käynnistää." + +#~ msgid "" +#~ "The VPN login failed because the VPN program could not connect to the VPN " +#~ "server." +#~ msgstr "" +#~ "VPN-kirjatuminen epäonnistui, koska VPN-ohjelma ei saanut yhteyttä VPN-" +#~ "palvelimeen." + +#~ msgid "" +#~ "The VPN login failed because the VPN configuration options were invalid." +#~ msgstr "" +#~ "VPN-kirjautuminen epäonnistui, koska VPN-asetuksten valinnat olivat " +#~ "virheelliset." + +#~ msgid "" +#~ "The VPN login failed because the VPN program received an invalid " +#~ "configuration from the VPN server." +#~ msgstr "" +#~ "VPN-kirjautuminen epäonnistui, koska VPN-ohjelma sai epäyhteensopivat " +#~ "asetukset VPN-palvelimelta." + +#~ msgid "VPN connection failed" +#~ msgstr "VPN-yhteyden avaus epäonnistui" + +#~ msgid "<b>Connection Information</b>" +#~ msgstr "<b>Tietoja yhteydestä</b>" #~ msgid "CA file:" #~ msgstr "CA-tiedosto:" @@ -474,12 +500,6 @@ msgstr "VPN-yhteyden avaus epäonnistui" #~ msgid "Optional" #~ msgstr "Valinnaiset tiedot" -#~ msgid "Password" -#~ msgstr "Salasana" - -#~ msgid "Shared Key:" -#~ msgstr "Jaettu avain:" - #~ msgid "Username:" #~ msgstr "Käyttäjätunnus:" diff --git a/vpn-daemons/openvpn/po/fr.po b/vpn-daemons/openvpn/po/fr.po index 915ef1b2a8..82c48fe624 100644 --- a/vpn-daemons/openvpn/po/fr.po +++ b/vpn-daemons/openvpn/po/fr.po @@ -5,14 +5,14 @@ # Haïkel Guémar <karlthered@gmail.com>, 2006. # Jonathan Ernst <jonathan@ernstfamily.ch>, 2007. # Stéphane Raimbault <stephane.raimbault@gmail.com>, 2007-2008. -# Robert-André Mauchin <zebob.m@pengzone.org>, 2007. +# Robert-André Mauchin <zebob.m@pengzone.org>, 2007-2008. # msgid "" msgstr "" -"Project-Id-Version: NetworkManager-openvpn 0.3.2\n" +"Project-Id-Version: NetworkManager-openvpn HEAD\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-01-19 16:18+0100\n" -"PO-Revision-Date: 2008-01-19 16:19+0100\n" +"POT-Creation-Date: 2008-08-18 08:09+0200\n" +"PO-Revision-Date: 2008-08-13 10:31+0200\n" "Last-Translator: Robert-André Mauchin <zebob.m@pengzone.org>\n" "Language-Team: GNOME French Team <gnomefr@traduc.org>\n" "MIME-Version: 1.0\n" @@ -37,7 +37,7 @@ msgstr "_Domaine :" #: ../auth-dialog/gnome-two-password-dialog.c:357 msgid "Connect _anonymously" -msgstr "Connexion _anonyme" +msgstr "Se connecter _anonymement" #: ../auth-dialog/gnome-two-password-dialog.c:362 msgid "Connect as _user:" @@ -51,368 +51,175 @@ msgstr "_Conserver le mot de passe pour cette session" msgid "_Save password in keyring" msgstr "_Enregistrer le mot de passe dans le trousseau de clés" -#: ../auth-dialog/main.c:181 +#: ../auth-dialog/main.c:187 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "Authentifiez-vous pour accéder au réseau privé virtuel « %s »." -#: ../auth-dialog/main.c:182 +#: ../auth-dialog/main.c:188 msgid "Authenticate VPN" msgstr "Authentifier le VPN" -#: ../auth-dialog/main.c:195 +#: ../auth-dialog/main.c:201 msgid "Certificate pass_word:" msgstr "_Mot de passe du certificat :" -#: ../auth-dialog/main.c:210 +#: ../auth-dialog/main.c:216 msgid "Certificate password:" msgstr "Mot de passe du certificat :" -#: ../properties/nm-openvpn.c:150 -msgid "OpenVPN Client" -msgstr "Client OpenVPN" +#: ../properties/auth-helpers.c:69 +msgid "Choose a Certificate Authority certificate..." +msgstr "Choisissez un certificat d'une autorité de certification..." -#: ../properties/nm-openvpn.c:826 -msgid "The following OpenVPN connection will be created:" -msgstr "La connexion OpenVPN suivante va être créée :" +#: ../properties/auth-helpers.c:88 +msgid "Choose your personal certificate..." +msgstr "Choisissez votre certificat personnel..." -#: ../properties/nm-openvpn.c:828 -#, c-format -msgid "Name: %s" -msgstr "Nom : %s" - -#: ../properties/nm-openvpn.c:836 -msgid "Connection Type: X.509 Certificates" -msgstr "Type de connexion : certificats X.509" - -#: ../properties/nm-openvpn.c:839 ../properties/nm-openvpn.c:866 -#: ../properties/nm-openvpn.c:878 -#, c-format -msgid "CA: %s" -msgstr "AC : %s" - -#: ../properties/nm-openvpn.c:842 ../properties/nm-openvpn.c:881 -#, c-format -msgid "Cert: %s" -msgstr "Cert : %s" - -#: ../properties/nm-openvpn.c:845 ../properties/nm-openvpn.c:884 -#, c-format -msgid "Key: %s" -msgstr "Clé : %s" - -#: ../properties/nm-openvpn.c:849 -msgid "Connection Type: Shared Key" -msgstr "Type de connexion : clé partagée" - -#: ../properties/nm-openvpn.c:852 -#, c-format -msgid "Shared Key: %s" -msgstr "Clé partagée : %s" - -#: ../properties/nm-openvpn.c:855 -#, c-format -msgid "Local IP: %s" -msgstr "Adresse IP locale : %s" - -#: ../properties/nm-openvpn.c:858 -#, c-format -msgid "Remote IP: %s" -msgstr "Adresse IP distante : %s" - -#: ../properties/nm-openvpn.c:863 -msgid "Connection Type: Password" -msgstr "Type de connexion : mot de passe" - -#: ../properties/nm-openvpn.c:869 ../properties/nm-openvpn.c:887 -#, c-format -msgid "Username: %s" -msgstr "Nom d'_utilisateur : %s" - -#: ../properties/nm-openvpn.c:875 -msgid "Connection Type: X.509 with Password Authentication" -msgstr "Type de connexion : X.509 avec authentification par mot de passe" - -#: ../properties/nm-openvpn.c:893 -#, c-format -msgid "Remote: %s" -msgstr "Distant : %s" - -#: ../properties/nm-openvpn.c:896 -#, c-format -msgid "Port: %s" -msgstr "Port : %s" - -#: ../properties/nm-openvpn.c:899 -#, c-format -msgid "Device: %s" -msgstr "Périphérique : %s" - -#: ../properties/nm-openvpn.c:899 -msgid "TAP" -msgstr "TAP" - -#: ../properties/nm-openvpn.c:899 -msgid "TUN" -msgstr "TUN" - -#: ../properties/nm-openvpn.c:902 -#, c-format -msgid "Protocol: %s" -msgstr "Protocole : %s" - -#: ../properties/nm-openvpn.c:902 -msgid "TCP" -msgstr "TCP" - -#: ../properties/nm-openvpn.c:902 -msgid "UDP" -msgstr "UDP" - -#: ../properties/nm-openvpn.c:906 -#, c-format -msgid "Routes: %s" -msgstr "Routes : %s" - -#: ../properties/nm-openvpn.c:910 -#, c-format -msgid "Use LZO Compression: %s" -msgstr "Utiliser la compression LZO : %s" - -#: ../properties/nm-openvpn.c:910 -msgid "Yes" -msgstr "Oui" - -#: ../properties/nm-openvpn.c:910 -msgid "No" -msgstr "Non" - -#: ../properties/nm-openvpn.c:914 -#, c-format -msgid "Cipher: %s" -msgstr "Chiffrement : %s" - -#: ../properties/nm-openvpn.c:919 -#, c-format -msgid "TLS auth: %s %s" -msgstr "Authentification TLS : %s %s" - -#: ../properties/nm-openvpn.c:923 -msgid "The connection details can be changed using the \"Edit\" button." -msgstr "" -"Les détails de la connexion peuvent être modifiés avec le bouton « Éditer »." +#: ../properties/auth-helpers.c:106 +msgid "Choose your private key..." +msgstr "Choisissez votre clé privée..." -#: ../properties/nm-openvpn.c:1153 -msgid "Cannot import settings" -msgstr "Impossible d'importer les paramètres de configuration" +#: ../properties/auth-helpers.c:159 +msgid "Choose an OpenVPN static key..." +msgstr "Choisissez une clé statique OpenVPN..." -#: ../properties/nm-openvpn.c:1155 -#, c-format -msgid "The VPN settings file '%s' does not contain valid data." -msgstr "" -"Le fichier de configuration VPN « %s » ne contient pas de données valides." +#: ../properties/auth-helpers.c:183 ../properties/auth-helpers.c:862 +msgid "None" +msgstr "Aucun" -#: ../properties/nm-openvpn.c:1202 -msgid "Select file to import" -msgstr "Importer un fichier" +#: ../properties/auth-helpers.c:518 +msgid "PEM certificates (*.pem, *.crt, *.key)" +msgstr "Certificats PEM (*.pem, *.crt, *.key)" -#: ../properties/nm-openvpn.c:1261 ../properties/nm-openvpn.c:1273 -#: ../properties/nm-openvpn.c:1276 -msgid "Select CA to use" -msgstr "Sélectionner l'autorité de certification à utiliser" +#: ../properties/auth-helpers.c:578 +msgid "OpenVPN Static Keys (*.key)" +msgstr "Clés statiques OpenVPN (*.key)" -#: ../properties/nm-openvpn.c:1264 ../properties/nm-openvpn.c:1279 -msgid "Select certificate to use" -msgstr "Sélectionner le certificat à utiliser" +#: ../properties/auth-helpers.c:689 +msgid "Default" +msgstr "Par défaut" -#: ../properties/nm-openvpn.c:1267 ../properties/nm-openvpn.c:1282 -msgid "Select key to use" -msgstr "Sélectionner la clé à utiliser" +#: ../properties/nm-openvpn.c:52 +msgid "OpenVPN" +msgstr "OpenVPN" -#: ../properties/nm-openvpn.c:1270 -msgid "Select shared key to use" -msgstr "Sélectionner la clé partagée à utiliser" +#: ../properties/nm-openvpn.c:53 +msgid "Compatible with the OpenVPN server." +msgstr "Compatible avec le serveur OpenVPN." -#: ../properties/nm-openvpn.c:1285 -msgid "Select TA to use" -msgstr "Sélectionner l'authentification TLS à utiliser" +#: ../properties/nm-openvpn.c:310 ../properties/nm-openvpn-dialog.glade.h:7 +msgid "Certificates (TLS)" +msgstr "Certificats (TLS)" -#. printf ("in impl_export\n"); -#: ../properties/nm-openvpn.c:1527 -msgid "Save as..." -msgstr "Enregistrer sous..." +#: ../properties/nm-openvpn.c:322 +msgid "Password" +msgstr "Mot de passe" -#: ../properties/nm-openvpn.c:1556 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Un fichier nommé « %s » existe déjà." +#: ../properties/nm-openvpn.c:336 +msgid "Password with Certificates (TLS)" +msgstr "Mot de passe avec certificats (TLS)" -#: ../properties/nm-openvpn.c:1559 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Voulez-vous le remplacer avec celui que vous avez enregistré ?" - -#: ../properties/nm-openvpn.c:1573 -msgid "Failed to export configuration" -msgstr "L'exportation de la configuration a échoué" - -#: ../properties/nm-openvpn.c:1575 -#, c-format -msgid "Failed to save file %s" -msgstr "L'enregistrement du fichier %s a échoué" +#: ../properties/nm-openvpn.c:348 +msgid "Static Key" +msgstr "Clé statique" #: ../properties/nm-openvpn-dialog.glade.h:1 -msgid "(Default: 1194)" -msgstr "(par défaut : 1194)" +msgid " " +msgstr " " #: ../properties/nm-openvpn-dialog.glade.h:2 -msgid "65536" -msgstr "65536" +msgid "<b>Authentication</b>" +msgstr "<b>Authentification</b>" #: ../properties/nm-openvpn-dialog.glade.h:3 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>exemple : 172.16.0.0/16 10.11.12.0/24</i>" +msgid "<b>General</b>" +msgstr "<b>Général</b>" #: ../properties/nm-openvpn-dialog.glade.h:4 -msgid "Ad_vanced" -msgstr "A_vancé" +msgid "" +"<i>If key direction is used, it must be the opposite of that used on the VPN " +"peer. For example, if the peer uses '1', this connection must use '0'. If " +"you are unsure what value to use, contact your system administrator.</i>" +msgstr "" +"<i>Si une direction de clé est utilisée, elle doit être l'opposé de celle " +"utilisée sur le pair VPN. Par exemple, si le pair utilise « 1 », cette " +"connexion doit être « 0 ». Si vous n'êtes pas certain de la valeur à " +"utiliser, contactez votre administrateur système.</i>" #: ../properties/nm-openvpn-dialog.glade.h:5 -msgid "C_A file:" -msgstr "Fichier _AC :" +msgid "Ad_vanced..." +msgstr "A_vancé..." #: ../properties/nm-openvpn-dialog.glade.h:6 -msgid "C_ertificate:" -msgstr "C_ertificat :" - -#: ../properties/nm-openvpn-dialog.glade.h:7 -msgid "Co_nnection type:" -msgstr "Type de co_nnexion :" +msgid "CA Certificate:" +msgstr "Certificat du CA :" #: ../properties/nm-openvpn-dialog.glade.h:8 -msgid "Connection na_me:" -msgstr "No_m de la connexion :" +msgid "Cipher:" +msgstr "Chiffrement :" #: ../properties/nm-openvpn-dialog.glade.h:9 -msgid "Direction:" -msgstr "Direction :" +msgid "General" +msgstr "Général" #: ../properties/nm-openvpn-dialog.glade.h:10 -msgid "Import _Saved Configuration..." -msgstr "Importer la configuration enregi_strée..." +msgid "Key Direction:" +msgstr "Direction de la clé :" #: ../properties/nm-openvpn-dialog.glade.h:11 -msgid "" -"Name used to identify the connection to the private network, e.g. \"Campus " -"VPN\" or \"Corporate Network\"" -msgstr "" -"Nom utilisé pour identifier la connexion au réseau privé, p. ex. « VPN du " -"Campus » ou « Réseau de l'entreprise »" +msgid "Key File:" +msgstr "Fichier de clé :" #: ../properties/nm-openvpn-dialog.glade.h:12 -msgid "Network" -msgstr "Réseau" +msgid "Local IP Address:" +msgstr "Adresse IP locale :" #: ../properties/nm-openvpn-dialog.glade.h:13 -msgid "Only use _VPN connection for these addresses:" -msgstr "Utiliser _uniquement une connexion VPN pour ces adresses :" - -#: ../properties/nm-openvpn-dialog.glade.h:14 msgid "OpenVPN Advanced Options" msgstr "Options avancées OpenVPN" +#: ../properties/nm-openvpn-dialog.glade.h:14 +msgid "Private Key:" +msgstr "Clé privée :" + #: ../properties/nm-openvpn-dialog.glade.h:15 -msgid "OpenVPN Configuration" -msgstr "Configuration OpenVPN" +msgid "Static Key:" +msgstr "Clé statique :" #: ../properties/nm-openvpn-dialog.glade.h:16 -msgid "" -"Please enter the information provided by your system administrator below. Do " -"not enter your password here as you will be prompted when connecting." -msgstr "" -"Veuillez saisir ci-dessous les informations fournies par votre " -"administrateur système. N'entrez pas votre mot de passe avant d'y être " -"invité." +msgid "Type:" +msgstr "Type :" #: ../properties/nm-openvpn-dialog.glade.h:17 -msgid "" -"Please note that the file you import is not an OpenVPN configuration file. " -"Ask your administrator for the file." -msgstr "" -"Veuillez noter que le fichier importé n'est pas un fichier de configuration " -"OpenVPN. Demandez ce fichier à votre administrateur." +msgid "Use L_ZO data compression" +msgstr "Utiliser la compression de données L_ZO" #: ../properties/nm-openvpn-dialog.glade.h:18 -msgid "Shared _key:" -msgstr "Clé _partagée :" +msgid "Use a TA_P device" +msgstr "Utiliser un périphérique TA_P" #: ../properties/nm-openvpn-dialog.glade.h:19 -msgid "TLS-Auth" -msgstr "Authentification TLS" +msgid "Use a _TCP connection" +msgstr "Utiliser une connexion _TCP" #: ../properties/nm-openvpn-dialog.glade.h:20 -msgid "Use L_ZO compression" -msgstr "Utiliser la compression L_ZO" +msgid "Use additional TLS authentication" +msgstr "Utiliser une authentification TLS supplémentaire" #: ../properties/nm-openvpn-dialog.glade.h:21 -msgid "Use TA_P device" -msgstr "Utiliser le périphérique TA_P" +msgid "Use custom gateway p_ort:" +msgstr "Utiliser un p_ort de passerelle personnalisé :" #: ../properties/nm-openvpn-dialog.glade.h:22 -msgid "Use _TCP connection" -msgstr "Utiliser une connexion _TCP" +msgid "User Certificate:" +msgstr "Certificat de l'utilisateur :" #: ../properties/nm-openvpn-dialog.glade.h:23 -msgid "Use _TLS auth:" -msgstr "Utiliser une authentification _TLS :" +msgid "User name:" +msgstr "Nom d'utilisateur :" #: ../properties/nm-openvpn-dialog.glade.h:24 -msgid "Use cip_her:" -msgstr "Utiliser le chi_ffrement :" - -#: ../properties/nm-openvpn-dialog.glade.h:25 -msgid "" -"X.509 Certificates\n" -"Pre-shared key\n" -"Password Authentication\n" -"X.509 with Password Authentication" -msgstr "" -"Certificats X.509\n" -"Clé pré-partagée\n" -"Authentification par mot de passe\n" -"X.509 avec mot de passe d'authentification" - -#: ../properties/nm-openvpn-dialog.glade.h:29 -msgid "_0" -msgstr "_0" - -#: ../properties/nm-openvpn-dialog.glade.h:30 -msgid "_1" -msgstr "_1" - -#: ../properties/nm-openvpn-dialog.glade.h:31 -msgid "_Gateway address:" -msgstr "Adresse de la _passerelle :" - -#: ../properties/nm-openvpn-dialog.glade.h:32 -msgid "_Gateway port:" -msgstr "Port de la _passerelle :" - -#: ../properties/nm-openvpn-dialog.glade.h:33 -msgid "_Key:" -msgstr "_Clé :" - -#: ../properties/nm-openvpn-dialog.glade.h:34 -msgid "_Local IP:" -msgstr "Adresse IP _locale :" - -#: ../properties/nm-openvpn-dialog.glade.h:35 -msgid "_Remote IP:" -msgstr "Adresse IP _distante :" - -#: ../properties/nm-openvpn-dialog.glade.h:36 -msgid "_User name:" -msgstr "Nom d'_utilisateur :" +msgid "_Gateway:" +msgstr "_Passerelle :" -#: ../properties/nm-openvpn-dialog.glade.h:37 -msgid "_none" -msgstr "aucu_n" diff --git a/vpn-daemons/openvpn/po/ru.po b/vpn-daemons/openvpn/po/ru.po index 2f180740f7..9d588bb528 100644 --- a/vpn-daemons/openvpn/po/ru.po +++ b/vpn-daemons/openvpn/po/ru.po @@ -1,18 +1,18 @@ -# translation of ru.po to +# translation of ru.po to Russian # Ukrainian translation of NetworkManager openvpn # Copyright (C) Free Software Foundation, 2005 # This file is distributed under the same license as the NetworkManager package. # # Maxim Dziumanenko <dziumanenko@gmail.com>, 2005-2007. -# Leonid Kanter <leon@asplinux.ru>, 2007. +# Leonid Kanter <leon@asplinux.ru>, 2007, 2008. msgid "" msgstr "" "Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-02-16 17:14+0200\n" -"PO-Revision-Date: 2007-06-19 12:32+0300\n" +"POT-Creation-Date: 2008-08-08 14:53+0300\n" +"PO-Revision-Date: 2008-08-08 15:13+0300\n" "Last-Translator: Leonid Kanter <leon@asplinux.ru>\n" -"Language-Team: <gnome-cyr@gnome.org>\n" +"Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -51,384 +51,193 @@ msgstr "_Запомнить пароль для этого сеанса" msgid "_Save password in keyring" msgstr "_Сохранить пароль на брелоке" -#: ../auth-dialog/main.c:214 +#: ../auth-dialog/main.c:187 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "Для доступа к виртуальной частной сети '%s' требуется аутентификация." -#: ../auth-dialog/main.c:215 +#: ../auth-dialog/main.c:188 msgid "Authenticate VPN" msgstr "Аутентификация VPN" -#: ../auth-dialog/main.c:227 +#: ../auth-dialog/main.c:201 msgid "Certificate pass_word:" msgstr "Па_роль сертификата:" -#: ../auth-dialog/main.c:252 +#: ../auth-dialog/main.c:216 msgid "Certificate password:" msgstr "Пароль сертификата:" -#: ../nm-openvpn.desktop.in.h:1 -msgid "Add, Remove, and Edit VPN Connections" -msgstr "Добавление, изменение и удаление соединений VPN" +#: ../properties/auth-helpers.c:68 +msgid "Choose a Certificate Authority certificate..." +msgstr "Выберите сертификат Центра сертификации..." -#: ../nm-openvpn.desktop.in.h:2 -msgid "VPN Connection Manager (OpenVPN)" -msgstr "Менеджер соединений VPN (OpenVPN)" +#: ../properties/auth-helpers.c:87 +msgid "Choose your personal certificate..." +msgstr "Выберите ваш персональный сертификат..." -#: ../properties/nm-openvpn.c:130 -msgid "OpenVPN Client" -msgstr "Клиент OpenVPN" +#: ../properties/auth-helpers.c:105 +msgid "Choose your private key..." +msgstr "Выберите ваш личный ключ..." -#: ../properties/nm-openvpn.c:729 -msgid "The following OpenVPN connection will be created:" -msgstr "Будет создано следующее соединение OpenVPN:" +#: ../properties/auth-helpers.c:158 +msgid "Choose an OpenVPN static key..." +msgstr "Выберите статический ключ OpenVPN..." -#: ../properties/nm-openvpn.c:731 -#, c-format -msgid "Name: %s" -msgstr "Имя: %s" - -#: ../properties/nm-openvpn.c:739 -msgid "Connection Type: X.509 Certificates" -msgstr "Тип соединения: Сертификаты X.509" - -#: ../properties/nm-openvpn.c:742 ../properties/nm-openvpn.c:769 -#: ../properties/nm-openvpn.c:781 -#, c-format -msgid "CA: %s" -msgstr "CA: %s" - -#: ../properties/nm-openvpn.c:745 ../properties/nm-openvpn.c:784 -#, c-format -msgid "Cert: %s" -msgstr "Сертификат: %s" - -#: ../properties/nm-openvpn.c:748 ../properties/nm-openvpn.c:787 -#, c-format -msgid "Key: %s" -msgstr "Ключ: %s" - -#: ../properties/nm-openvpn.c:752 -msgid "Connection Type: Shared Key" -msgstr "Тип соединения: общий ключ" - -#: ../properties/nm-openvpn.c:755 -#, c-format -msgid "Shared Key: %s" -msgstr "Общий ключ: %s" - -#: ../properties/nm-openvpn.c:758 -#, c-format -msgid "Local IP: %s" -msgstr "Локальный IP: %s" - -#: ../properties/nm-openvpn.c:761 -#, c-format -msgid "Remote IP: %s" -msgstr "IP сервера: %s" - -#: ../properties/nm-openvpn.c:766 -msgid "Connection Type: Password" -msgstr "Тип соединения: Пароль" - -#: ../properties/nm-openvpn.c:772 ../properties/nm-openvpn.c:790 -#, c-format -msgid "Username: %s" -msgstr "Имя пользователя: %s" - -#: ../properties/nm-openvpn.c:778 -msgid "Connection Type: X.509 with Password Authentication" -msgstr "Тип соединения: Аутентификация X.509 с паролем" - -#: ../properties/nm-openvpn.c:796 -#, c-format -msgid "Remote: %s" -msgstr "Удалённый узел: %s" - -#: ../properties/nm-openvpn.c:799 -#, c-format -msgid "Device: %s" -msgstr "Устройство: %s" - -#: ../properties/nm-openvpn.c:799 -msgid "TAP" -msgstr "TAP" - -#: ../properties/nm-openvpn.c:799 -msgid "TUN" -msgstr "TUN" - -#: ../properties/nm-openvpn.c:802 -#, c-format -msgid "Protocol: %s" -msgstr "Протокол: %s" - -#: ../properties/nm-openvpn.c:802 -msgid "TCP" -msgstr "TCP" - -#: ../properties/nm-openvpn.c:802 -msgid "UDP" -msgstr "UDP" - -#: ../properties/nm-openvpn.c:806 -#, c-format -msgid "Routes: %s" -msgstr "Маршрутизатор: %s" - -#: ../properties/nm-openvpn.c:810 -#, c-format -msgid "Use LZO Compression: %s" -msgstr "Использовать сжатие LZO: %s" - -#: ../properties/nm-openvpn.c:810 -msgid "Yes" -msgstr "Да" - -#: ../properties/nm-openvpn.c:810 -msgid "No" +#: ../properties/auth-helpers.c:176 ../properties/auth-helpers.c:886 +msgid "None" msgstr "Нет" -#: ../properties/nm-openvpn.c:814 -#, c-format -msgid "Cipher: %s" -msgstr "Шифр: %s" +#: ../properties/auth-helpers.c:519 +msgid "PEM certificates (*.pem, *.crt, *.key)" +msgstr "Сертификаты PEM (*.pem, *.crt, *.key)" -#: ../properties/nm-openvpn.c:819 -#, c-format -msgid "TLS auth: %s %s" -msgstr "Аутентификация TLS: %s %s" +#: ../properties/auth-helpers.c:579 +msgid "OpenVPN Static Keys (*.key)" +msgstr "Статические ключи OpenVPN (*.key)" -#: ../properties/nm-openvpn.c:823 -msgid "The connection details can be changed using the \"Edit\" button." -msgstr "Параметры соединения можно изменить, нажав кнопку \"Правка\"." +#: ../properties/auth-helpers.c:711 +msgid "Default" +msgstr "По умолчанию" -#: ../properties/nm-openvpn.c:1003 -msgid "Cannot import settings" -msgstr "Не удаётся импортировать параметры" +#: ../properties/nm-openvpn.c:53 +msgid "OpenVPN" +msgstr "OpenVPN" -#: ../properties/nm-openvpn.c:1005 -#, c-format -msgid "The VPN settings file '%s' does not contain valid data." -msgstr "Файл параметров VPN '%s' содержит некорректные данные." +#: ../properties/nm-openvpn.c:54 +msgid "Compatible with the OpenVPN server." +msgstr "Совместим с сервером OpenVPN." -#: ../properties/nm-openvpn.c:1042 -msgid "Select file to import" -msgstr "Выберите файл для импорта" +#: ../properties/nm-openvpn.c:308 ../properties/nm-openvpn-dialog.glade.h:7 +msgid "Certificates (TLS)" +msgstr "Сертификаты (TLS)" -#: ../properties/nm-openvpn.c:1122 ../properties/nm-openvpn.c:1134 -msgid "Select CA to use" -msgstr "Выберите CA" - -#: ../properties/nm-openvpn.c:1125 -msgid "Select certificate to use" -msgstr "Выберите сертификат" - -#: ../properties/nm-openvpn.c:1128 -msgid "Select key to use" -msgstr "Выберите ключ" - -#: ../properties/nm-openvpn.c:1131 -msgid "Select shared key to use" -msgstr "Выберите общий ключ" - -#: ../properties/nm-openvpn.c:1137 -msgid "Select TA to use" -msgstr "Выберите TA" - -#. printf ("in impl_export\n"); -#: ../properties/nm-openvpn.c:1326 -msgid "Save as..." -msgstr "Сохранить как..." - -#: ../properties/nm-openvpn.c:1356 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Файл с именем \"%s\" уже существует." +#: ../properties/nm-openvpn.c:320 +msgid "Password" +msgstr "Пароль" -#: ../properties/nm-openvpn.c:1359 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Вы действительно хотите заменить его сохраняемым вами файлом?" +#: ../properties/nm-openvpn.c:334 +msgid "Password with Certificates (TLS)" +msgstr "Пароль с сертификатами (TLS)" -#: ../properties/nm-openvpn.c:1373 -msgid "Failed to export configuration" -msgstr "Сбой при экспорте конфигурации" - -#: ../properties/nm-openvpn.c:1375 -#, c-format -msgid "Failed to save file %s" -msgstr "Ошибка при сохранении файла %s" +#: ../properties/nm-openvpn.c:346 +msgid "Static Key" +msgstr "Статический ключ" #: ../properties/nm-openvpn-dialog.glade.h:1 -msgid "0" -msgstr "0" +msgid " " +msgstr " " #: ../properties/nm-openvpn-dialog.glade.h:2 -msgid "1" -msgstr "1" +msgid "<b>Authentication</b>" +msgstr "<b>Аутентификация</b>" #: ../properties/nm-openvpn-dialog.glade.h:3 -msgid "<b>Connection Name</b>" -msgstr "<b>Имя соединения</b>" +msgid "<b>General</b>" +msgstr "<b>Общие</b>" #: ../properties/nm-openvpn-dialog.glade.h:4 -msgid "<b>Optional Information</b>" -msgstr "<b>Дополнительная информация</b>" +msgid "" +"<i>If key direction is used, it must be the opposite of that used on the VPN " +"peer. For example, if the peer uses '1', this connection must use '0'. If " +"you are unsure what value to use, contact your system administrator.</i>" +msgstr "" +"<i>Если используется направление ключа, оно должно быть противоположно направлению, которое " +"использует вторая сторона. Например, если вторая сторона использует \"1\", это соединение должно использовать \"0\". Если вы не уверены, какое значение использовать, свяжитесь с системным администратором.</i>" #: ../properties/nm-openvpn-dialog.glade.h:5 -msgid "<b>Required Information</b>" -msgstr "<b>Требуемая информация</b>" +msgid "Ad_vanced..." +msgstr "_Дополнительно..." #: ../properties/nm-openvpn-dialog.glade.h:6 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>пример: 172.16.0.0/16 10.11.12.0/24</i>" - -#: ../properties/nm-openvpn-dialog.glade.h:7 -msgid "CA file:" -msgstr "Файл CA:" +msgid "CA Certificate:" +msgstr "Сертификат CA:" #: ../properties/nm-openvpn-dialog.glade.h:8 -msgid "CA file:" -msgstr "Файл CA:" +msgid "Cipher:" +msgstr "Шифр:" #: ../properties/nm-openvpn-dialog.glade.h:9 -msgid "Certificate:" -msgstr "Сертификат:" +msgid "General" +msgstr "Общие" #: ../properties/nm-openvpn-dialog.glade.h:10 -msgid "Connection Type:" -msgstr "Тип соединения:" +msgid "Key Direction:" +msgstr "Направление ключа:" #: ../properties/nm-openvpn-dialog.glade.h:11 -msgid "Direction:" -msgstr "Направление:" +msgid "Key File:" +msgstr "Направление ключа:" #: ../properties/nm-openvpn-dialog.glade.h:12 -msgid "Key:" -msgstr "Ключ:" +msgid "OpenVPN Advanced Options" +msgstr "Дополнительные параметры OpenVPN" #: ../properties/nm-openvpn-dialog.glade.h:13 -msgid "Local IP:" -msgstr "Локальный IP:" +msgid "Private Key:" +msgstr "Личный ключ:" #: ../properties/nm-openvpn-dialog.glade.h:14 -msgid "Password" -msgstr "Пароль" +msgid "Static Key:" +msgstr "Статический ключ:" #: ../properties/nm-openvpn-dialog.glade.h:15 -msgid "" -"Please enter the information provided by your system administrator below. Do " -"not enter your password here as you will be prompted when connecting." -msgstr "Введите ниже информацию, предоставленную вашим системным администратором. Не вводите пароль - он будет запрошен при соединении." +msgid "Type:" +msgstr "Тип:" #: ../properties/nm-openvpn-dialog.glade.h:16 -msgid "" -"Please note that the file you import is not an OpenVPN configuration file. " -"Ask your administrator for the file." -msgstr "Импортируемый файл не фвляется файлом конфигурации OpenVPN. Попросите системного администратора предоставить вам требуемый файл." +msgid "Use L_ZO data compression" +msgstr "Использовать сжатие L_ZO" #: ../properties/nm-openvpn-dialog.glade.h:17 -msgid "Remote IP:" -msgstr "IP-адрес сервера:" +msgid "Use a TA_P device" +msgstr "Использовать устройство TA_P" #: ../properties/nm-openvpn-dialog.glade.h:18 -msgid "Shared Key:" -msgstr "Общий ключ:" +msgid "Use a _TCP connection" +msgstr "Использовать соединение _TCP" #: ../properties/nm-openvpn-dialog.glade.h:19 -msgid "Shared key" -msgstr "Общий ключ" +msgid "Use additional TLS authentication" +msgstr "Дополнительная аутентификация TLS" #: ../properties/nm-openvpn-dialog.glade.h:20 -msgid "Use LZO compression" -msgstr "Использовать сжатие LZO" +msgid "Use custom gateway p_ort:" +msgstr "Использовать другой _порт шлюза:" #: ../properties/nm-openvpn-dialog.glade.h:21 -msgid "Use TAP device" -msgstr "Использовать устройство TAP" +msgid "User Certificate:" +msgstr "Сертификат пользователя:" #: ../properties/nm-openvpn-dialog.glade.h:22 -msgid "Use TCP connection" -msgstr "Использовать соединение TCP" +msgid "User name:" +msgstr "Имя пользователя:" #: ../properties/nm-openvpn-dialog.glade.h:23 -msgid "Use TLS auth:" -msgstr "Использовать аутентификацию TLS:" +msgid "_Gateway:" +msgstr "_Шлюз:" #: ../properties/nm-openvpn-dialog.glade.h:24 -msgid "Use cipher:" -msgstr "Использовать шифр:" +msgid "gtk-cancel" +msgstr "gtk-cancel" #: ../properties/nm-openvpn-dialog.glade.h:25 -msgid "Username:" -msgstr "Пользователь:" +msgid "gtk-ok" +msgstr "gtk-ok" #: ../properties/nm-openvpn-dialog.glade.h:26 -msgid "X.509" -msgstr "X.509" +msgid "page 1" +msgstr "страница 1" #: ../properties/nm-openvpn-dialog.glade.h:27 -msgid "" -"X.509 Certificates\n" -"Pre-shared key\n" -"Password Authentication\n" -"X.509 with Password Authentication" -msgstr "" -"Сертификаты X.509\n" -"Общий ключ\n" -"Пароль\n" -"X.509 з паролем" - -#: ../properties/nm-openvpn-dialog.glade.h:31 -msgid "_Gateway:" -msgstr "_Шлюз:" - -#: ../properties/nm-openvpn-dialog.glade.h:32 -msgid "_Import Saved Configuration..." -msgstr "_Импорт сохранённой конфигурации..." - -#: ../properties/nm-openvpn-dialog.glade.h:33 -msgid "" -"_Name used to identify the connection to the private network, e.g. \"Campus " -"VPN\" or \"Corporate Network\"" -msgstr "_Имя, которое используется для подключения к частной сети, например, \"Campus VPN\" или \"Corporate Network\"" +msgid "page 2" +msgstr "страница 2" -#: ../properties/nm-openvpn-dialog.glade.h:34 -msgid "_Only use VPN connection for these addresses" -msgstr "Использовать VPN _только для этих адресов" - -#: ../properties/nm-openvpn-dialog.glade.h:35 -msgid "none" -msgstr "нет" - -#: ../src/nm-openvpn-service.c:127 -msgid "" -"The VPN login failed because the user name and password were not accepted or " -"the certificate password was wrong." -msgstr "Сбой подключения к VPN: имя пользователя или пароль не были приняты, или пароль сертификата неверный." - -#: ../src/nm-openvpn-service.c:129 -msgid "The VPN login failed because the VPN program could not be started." -msgstr "Сбой подключения к VPN: не удаётся запустить программу VPN." - -#: ../src/nm-openvpn-service.c:131 -msgid "" -"The VPN login failed because the VPN program could not connect to the VPN " -"server." -msgstr "Произошёл сбой подключения к VPN, поскольку программа VPN не смогла подключиться к серверу VPN." - -#: ../src/nm-openvpn-service.c:133 -msgid "The VPN login failed because the VPN configuration options were invalid." -msgstr "Произошёл сбой подключения к VPN, поскольку конфигурация VPN была неверной." - -#: ../src/nm-openvpn-service.c:135 -msgid "" -"The VPN login failed because the VPN program received an invalid " -"configuration from the VPN server." -msgstr "Произошёл сбой подключения к VPN, поскольу программа VPN получила неправильную конфигурацию от сервера VPN." +#: ../properties/nm-openvpn-dialog.glade.h:28 +msgid "page 3" +msgstr "страница 3" -#: ../src/nm-openvpn-service.c:137 -msgid "VPN connection failed" -msgstr "Сбой соединения VPN" +#: ../properties/nm-openvpn-dialog.glade.h:29 +msgid "page 4" +msgstr "страница 4" diff --git a/vpn-daemons/openvpn/properties/auth-helpers.c b/vpn-daemons/openvpn/properties/auth-helpers.c index 19f7572f2c..b3e6dcdfb3 100644 --- a/vpn-daemons/openvpn/properties/auth-helpers.c +++ b/vpn-daemons/openvpn/properties/auth-helpers.c @@ -30,6 +30,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <errno.h> #include <glib/gi18n-lib.h> @@ -40,14 +41,14 @@ void tls_pw_init_auth_widget (GladeXML *xml, GtkSizeGroup *group, - NMSettingVPNProperties *s_vpn_props, - gint contype, + NMSettingVPN *s_vpn, + const char *contype, const char *prefix, ChangedCallback changed_cb, gpointer user_data) { GtkWidget *widget; - GValue *value; + const char *value; char *tmp; GtkFileFilter *filter; @@ -68,13 +69,13 @@ tls_pw_init_auth_widget (GladeXML *xml, _("Choose a Certificate Authority certificate...")); g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CA); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), g_value_get_string (value)); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CA); + if (value && strlen (value)) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); } - if (contype == NM_OPENVPN_CONTYPE_TLS || contype == NM_OPENVPN_CONTYPE_PASSWORD_TLS) { + if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS) || !strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { tmp = g_strdup_printf ("%s_user_cert_chooser", prefix); widget = glade_xml_get_widget (xml, tmp); g_free (tmp); @@ -87,10 +88,10 @@ tls_pw_init_auth_widget (GladeXML *xml, _("Choose your personal certificate...")); g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CERT); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), g_value_get_string (value)); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CERT); + if (value && strlen (value)) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); } tmp = g_strdup_printf ("%s_private_key_chooser", prefix); @@ -105,23 +106,23 @@ tls_pw_init_auth_widget (GladeXML *xml, _("Choose your private key...")); g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_KEY); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), g_value_get_string (value)); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_KEY); + if (value && strlen (value)) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); } } - if (contype == NM_OPENVPN_CONTYPE_PASSWORD || contype == NM_OPENVPN_CONTYPE_PASSWORD_TLS) { + if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD) || !strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { tmp = g_strdup_printf ("%s_username_entry", prefix); widget = glade_xml_get_widget (xml, tmp); g_free (tmp); gtk_size_group_add_widget (group, widget); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_USERNAME); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_USERNAME); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (changed_cb), user_data); } @@ -133,12 +134,12 @@ tls_pw_init_auth_widget (GladeXML *xml, void sk_init_auth_widget (GladeXML *xml, GtkSizeGroup *group, - NMSettingVPNProperties *s_vpn_props, + NMSettingVPN *s_vpn, ChangedCallback changed_cb, gpointer user_data) { GtkWidget *widget; - GValue *value = NULL; + const char *value = NULL; GtkListStore *store; GtkTreeIter iter; gint active = -1; @@ -158,18 +159,24 @@ sk_init_auth_widget (GladeXML *xml, _("Choose an OpenVPN static key...")); g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_SHARED_KEY); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), g_value_get_string (value)); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_STATIC_KEY); + if (value && strlen (value)) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); } store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_SHARED_KEY_DIRECTION); - if (value && G_VALUE_HOLDS_INT (value)) - direction = g_value_get_int (value); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION); + if (value && strlen (value)) { + long int tmp; + + errno = 0; + tmp = strtol (value, NULL, 10); + if (errno == 0 && (tmp == 0 || tmp == 1)) + direction = (guint32) tmp; + } } gtk_list_store_append (store, &iter); @@ -177,17 +184,13 @@ sk_init_auth_widget (GladeXML *xml, gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, SK_DIR_COL_NAME, "0", SK_DIR_COL_NUM, 0, -1); - if (value && G_VALUE_HOLDS_INT (value)) { - if (g_value_get_int (value) == 0) - active = 1; - } + if (direction == 0) + active = 1; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, SK_DIR_COL_NAME, "1", SK_DIR_COL_NUM, 1, -1); - if (value && G_VALUE_HOLDS_INT (value)) { - if (g_value_get_int (value) == 1) - active = 2; - } + if (direction == 1) + active = 2; widget = glade_xml_get_widget (xml, "sk_direction_combo"); gtk_size_group_add_widget (group, widget); @@ -198,6 +201,15 @@ sk_init_auth_widget (GladeXML *xml, widget = glade_xml_get_widget (xml, "sk_dir_help_label"); gtk_size_group_add_widget (group, widget); + + widget = glade_xml_get_widget (xml, "sk_local_address_entry"); + gtk_size_group_add_widget (group, widget); + g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (changed_cb), user_data); + if (s_vpn && s_vpn->data) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_LOCAL_IP); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); + } } static gboolean @@ -256,21 +268,17 @@ validate_tls (GladeXML *xml, const char *prefix, GError **error) } gboolean -auth_widget_check_validity (GladeXML *xml, gint contype, GError **error) +auth_widget_check_validity (GladeXML *xml, const char *contype, GError **error) { GtkWidget *widget; - gboolean is_valid = TRUE; const char *str; - switch (contype) { - case NM_OPENVPN_CONTYPE_TLS: - is_valid = validate_tls (xml, "tls", error); - break; - - case NM_OPENVPN_CONTYPE_PASSWORD_TLS: - is_valid = validate_tls (xml, "pw_tls", error); - if (!is_valid) - break; + if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS)) { + if (!validate_tls (xml, "tls", error)) + return FALSE; + } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { + if (!validate_tls (xml, "pw_tls", error)) + return FALSE; widget = glade_xml_get_widget (xml, "pw_tls_username_entry"); str = gtk_entry_get_text (GTK_ENTRY (widget)); @@ -279,18 +287,15 @@ auth_widget_check_validity (GladeXML *xml, gint contype, GError **error) OPENVPN_PLUGIN_UI_ERROR, OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, NM_OPENVPN_KEY_USERNAME); - is_valid = FALSE; + return FALSE; } - break; - - case NM_OPENVPN_CONTYPE_PASSWORD: + } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD)) { if (!validate_file_chooser (xml, "pw_ca_cert_chooser")) { g_set_error (error, OPENVPN_PLUGIN_UI_ERROR, OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, NM_OPENVPN_KEY_CA); - is_valid = FALSE; - break; + return FALSE; } widget = glade_xml_get_widget (xml, "pw_username_entry"); str = gtk_entry_get_text (GTK_ENTRY (widget)); @@ -299,26 +304,30 @@ auth_widget_check_validity (GladeXML *xml, gint contype, GError **error) OPENVPN_PLUGIN_UI_ERROR, OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, NM_OPENVPN_KEY_USERNAME); - is_valid = FALSE; + return FALSE; } - break; - - case NM_OPENVPN_CONTYPE_STATIC_KEY: + } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)) { if (!validate_file_chooser (xml, "sk_key_chooser")) { g_set_error (error, OPENVPN_PLUGIN_UI_ERROR, OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, - NM_OPENVPN_KEY_SHARED_KEY); - is_valid = FALSE; - break; + NM_OPENVPN_KEY_STATIC_KEY); + return FALSE; } - break; - default: + widget = glade_xml_get_widget (xml, "sk_local_address_entry"); + str = gtk_entry_get_text (GTK_ENTRY (widget)); + if (!str || !strlen (str)) { + g_set_error (error, + OPENVPN_PLUGIN_UI_ERROR, + OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, + NM_OPENVPN_KEY_LOCAL_IP); + return FALSE; + } + } else g_assert_not_reached (); - } - return is_valid; + return TRUE; } static void @@ -326,7 +335,7 @@ update_from_filechooser (GladeXML *xml, const char *key, const char *prefix, const char *widget_name, - NMSettingVPNProperties *s_vpn_props) + NMSettingVPN *s_vpn) { GtkWidget *widget; char *tmp, *filename; @@ -335,8 +344,8 @@ update_from_filechooser (GladeXML *xml, g_return_if_fail (key != NULL); g_return_if_fail (prefix != NULL); g_return_if_fail (widget_name != NULL); - g_return_if_fail (s_vpn_props != NULL); - g_return_if_fail (s_vpn_props->data != NULL); + g_return_if_fail (s_vpn != NULL); + g_return_if_fail (s_vpn->data != NULL); tmp = g_strdup_printf ("%s_%s", prefix, widget_name); widget = glade_xml_get_widget (xml, tmp); @@ -347,21 +356,21 @@ update_from_filechooser (GladeXML *xml, return; if (strlen (filename)) - g_hash_table_insert (s_vpn_props->data, g_strdup (key), str_to_gvalue (filename)); + g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup (filename)); g_free (filename); } static void -update_tls (GladeXML *xml, const char *prefix, NMSettingVPNProperties *s_vpn_props) +update_tls (GladeXML *xml, const char *prefix, NMSettingVPN *s_vpn) { - update_from_filechooser (xml, NM_OPENVPN_KEY_CA, prefix, "ca_cert_chooser", s_vpn_props); - update_from_filechooser (xml, NM_OPENVPN_KEY_CERT, prefix, "user_cert_chooser", s_vpn_props); - update_from_filechooser (xml, NM_OPENVPN_KEY_KEY, prefix, "private_key_chooser", s_vpn_props); + update_from_filechooser (xml, NM_OPENVPN_KEY_CA, prefix, "ca_cert_chooser", s_vpn); + update_from_filechooser (xml, NM_OPENVPN_KEY_CERT, prefix, "user_cert_chooser", s_vpn); + update_from_filechooser (xml, NM_OPENVPN_KEY_KEY, prefix, "private_key_chooser", s_vpn); } static void -update_username (GladeXML *xml, const char *prefix, NMSettingVPNProperties *s_vpn_props) +update_username (GladeXML *xml, const char *prefix, NMSettingVPN *s_vpn) { GtkWidget *widget; char *tmp; @@ -369,8 +378,8 @@ update_username (GladeXML *xml, const char *prefix, NMSettingVPNProperties *s_vp g_return_if_fail (xml != NULL); g_return_if_fail (prefix != NULL); - g_return_if_fail (s_vpn_props != NULL); - g_return_if_fail (s_vpn_props->data != NULL); + g_return_if_fail (s_vpn != NULL); + g_return_if_fail (s_vpn->data != NULL); tmp = g_strdup_printf ("%s_username_entry", prefix); widget = glade_xml_get_widget (xml, tmp); @@ -378,38 +387,31 @@ update_username (GladeXML *xml, const char *prefix, NMSettingVPNProperties *s_vp str = gtk_entry_get_text (GTK_ENTRY (widget)); if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_USERNAME), - str_to_gvalue (str)); + g_strdup (str)); } } gboolean auth_widget_update_connection (GladeXML *xml, - gint contype, - NMSettingVPNProperties *s_vpn_props) + const char *contype, + NMSettingVPN *s_vpn) { GtkTreeModel *model; GtkTreeIter iter; GtkWidget *widget; - switch (contype) { - case NM_OPENVPN_CONTYPE_TLS: - update_tls (xml, "tls", s_vpn_props); - break; - - case NM_OPENVPN_CONTYPE_PASSWORD: - update_from_filechooser (xml, NM_OPENVPN_KEY_CA, "pw", "ca_cert_chooser", s_vpn_props); - update_username (xml, "pw", s_vpn_props); - break; - - case NM_OPENVPN_CONTYPE_PASSWORD_TLS: - update_tls (xml, "pw_tls", s_vpn_props); - update_username (xml, "pw_tls", s_vpn_props); - break; - - case NM_OPENVPN_CONTYPE_STATIC_KEY: - update_from_filechooser (xml, NM_OPENVPN_KEY_SHARED_KEY, "sk", "key_chooser", s_vpn_props); + if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS)) { + update_tls (xml, "tls", s_vpn); + } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD)) { + update_from_filechooser (xml, NM_OPENVPN_KEY_CA, "pw", "ca_cert_chooser", s_vpn); + update_username (xml, "pw", s_vpn); + } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { + update_tls (xml, "pw_tls", s_vpn); + update_username (xml, "pw_tls", s_vpn); + } else if (!strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)) { + update_from_filechooser (xml, NM_OPENVPN_KEY_STATIC_KEY, "sk", "key_chooser", s_vpn); widget = glade_xml_get_widget (xml, "sk_direction_combo"); g_assert (widget); model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget)); @@ -418,16 +420,13 @@ auth_widget_update_connection (GladeXML *xml, gtk_tree_model_get (model, &iter, SK_DIR_COL_NUM, &direction, -1); if (direction > -1) { - g_hash_table_insert (s_vpn_props->data, - g_strdup (NM_OPENVPN_KEY_SHARED_KEY_DIRECTION), - int_to_gvalue (direction)); + g_hash_table_insert (s_vpn->data, + g_strdup (NM_OPENVPN_KEY_STATIC_KEY_DIRECTION), + g_strdup_printf ("%d", direction)); } } - break; - - default: + } else g_assert_not_reached (); - } return TRUE; } @@ -580,15 +579,6 @@ sk_file_chooser_filter_new (void) return filter; } -static void -nm_gvalue_destroy (gpointer data) -{ - GValue *value = (GValue *) data; - - g_value_unset (value); - g_slice_free (GValue, value); -} - static const char *advanced_keys[] = { NM_OPENVPN_KEY_PORT, NM_OPENVPN_KEY_COMP_LZO, @@ -604,26 +594,14 @@ static void copy_values (gpointer key, gpointer data, gpointer user_data) { GHashTable *hash = (GHashTable *) user_data; - GValue *value = (GValue *) data; + const char *value = (const char *) data; const char **i; for (i = &advanced_keys[0]; *i; i++) { if (strcmp ((const char *) key, *i)) continue; - if (G_VALUE_HOLDS_STRING (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - str_to_gvalue (g_value_get_string (value))); - } else if (G_VALUE_HOLDS_INT (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - int_to_gvalue (g_value_get_int (value))); - } else if (G_VALUE_HOLDS_BOOLEAN (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - bool_to_gvalue (g_value_get_boolean (value))); - } + g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup (value)); } } @@ -632,13 +610,13 @@ advanced_dialog_new_hash_from_connection (NMConnection *connection, GError **error) { GHashTable *hash; - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; - hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); + hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); - if (s_vpn_props && s_vpn_props->data) - g_hash_table_foreach (s_vpn_props->data, copy_values, hash); + s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); + if (s_vpn && s_vpn->data) + g_hash_table_foreach (s_vpn->data, copy_values, hash); return hash; } @@ -781,13 +759,13 @@ tls_auth_toggled_cb (GtkWidget *widget, gpointer user_data) #define TA_DIR_COL_NUM 1 GtkWidget * -advanced_dialog_new (GHashTable *hash, int contype) +advanced_dialog_new (GHashTable *hash, const char *contype) { GladeXML *xml; GtkWidget *dialog = NULL; char *glade_file = NULL; GtkWidget *widget; - GValue *value; + const char *value; g_return_val_if_fail (hash != NULL, NULL); @@ -811,12 +789,18 @@ advanced_dialog_new (GHashTable *hash, int contype) g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (port_toggled_cb), xml); value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_PORT); - if (value && G_VALUE_HOLDS_INT (value)) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); + if (value && strlen (value)) { + long int tmp; - widget = glade_xml_get_widget (xml, "port_spinbutton"); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), - (gdouble) g_value_get_int (value)); + errno = 0; + tmp = strtol (value, NULL, 10); + if (errno == 0 && tmp > 0 && tmp < 65536 && tmp != 1194) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); + + widget = glade_xml_get_widget (xml, "port_spinbutton"); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), + (gdouble) tmp); + } gtk_widget_set_sensitive (widget, TRUE); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); @@ -827,54 +811,46 @@ advanced_dialog_new (GHashTable *hash, int contype) } value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_COMP_LZO); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { + if (value && !strcmp (value, "yes")) { widget = glade_xml_get_widget (xml, "lzo_checkbutton"); - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); } value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_PROTO_TCP); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { + if (value && !strcmp (value, "yes")) { widget = glade_xml_get_widget (xml, "tcp_checkbutton"); - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); } value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_TAP_DEV); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { + if (value && !strcmp (value, "yes")) { widget = glade_xml_get_widget (xml, "tap_checkbutton"); - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); } - if (contype != NM_OPENVPN_CONTYPE_TLS && contype != NM_OPENVPN_CONTYPE_PASSWORD_TLS) { + if (strcmp (contype, NM_OPENVPN_CONTYPE_TLS) && strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { widget = glade_xml_get_widget (xml, "options_notebook"); gtk_notebook_remove_page (GTK_NOTEBOOK (widget), 1); } else { - char *user_cipher = NULL; GtkListStore *store; GtkTreeIter iter; int direction = -1, active = -1; widget = glade_xml_get_widget (xml, "cipher_combo"); value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_CIPHER); - if (value && G_VALUE_HOLDS_STRING (value)) - user_cipher = (char *) g_value_get_string (value); - populate_cipher_combo (GTK_COMBO_BOX (widget), user_cipher); + populate_cipher_combo (GTK_COMBO_BOX (widget), value); widget = glade_xml_get_widget (xml, "tls_auth_checkbutton"); value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_TA); - if (value && G_VALUE_HOLDS_STRING (value)) { - if (strlen (g_value_get_string (value))) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - } + if (value && strlen (value)) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (tls_auth_toggled_cb), xml); tls_auth_toggled_cb (widget, xml); widget = glade_xml_get_widget (xml, "direction_combo"); value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_TA_DIR); - if (value && G_VALUE_HOLDS_STRING (value)) { - direction = (int) strtol (g_value_get_string (value), NULL, 10); + if (value && strlen (value)) { + direction = (int) strtol (value, NULL, 10); /* If direction is not 0 or 1, use no direction */ if (direction != 0 && direction != 1) direction = -1; @@ -900,9 +876,9 @@ advanced_dialog_new (GHashTable *hash, int contype) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active < 0 ? 0 : active); value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_TA); - if (value && G_VALUE_HOLDS_STRING (value)) { + if (value && strlen (value)) { widget = glade_xml_get_widget (xml, "tls_auth_chooser"); - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), g_value_get_string (value)); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); } } @@ -917,7 +893,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) GHashTable *hash; GtkWidget *widget; GladeXML *xml; - int contype = NM_OPENVPN_CONTYPE_INVALID; + const char *contype = NULL; g_return_val_if_fail (dialog != NULL, NULL); if (error) @@ -926,7 +902,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) xml = g_object_get_data (G_OBJECT (dialog), "glade-xml"); g_return_val_if_fail (xml != NULL, NULL); - hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); + hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); widget = glade_xml_get_widget (xml, "port_checkbutton"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { @@ -934,23 +910,23 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) widget = glade_xml_get_widget (xml, "port_spinbutton"); port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); - g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PORT), int_to_gvalue (port)); + g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PORT), g_strdup_printf ("%d", port)); } widget = glade_xml_get_widget (xml, "lzo_checkbutton"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_COMP_LZO), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_COMP_LZO), g_strdup ("yes")); widget = glade_xml_get_widget (xml, "tcp_checkbutton"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PROTO_TCP), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PROTO_TCP), g_strdup ("yes")); widget = glade_xml_get_widget (xml, "tap_checkbutton"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TAP_DEV), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TAP_DEV), g_strdup ("yes")); - contype = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "connection-type")); - if (contype == NM_OPENVPN_CONTYPE_TLS || contype == NM_OPENVPN_CONTYPE_PASSWORD_TLS) { + contype = g_object_get_data (G_OBJECT (dialog), "connection-type"); + if (!strcmp (contype, NM_OPENVPN_CONTYPE_TLS) || !strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { GtkTreeModel *model; GtkTreeIter iter; @@ -964,8 +940,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) TLS_CIPHER_COL_NAME, &cipher, TLS_CIPHER_COL_DEFAULT, &is_default, -1); if (!is_default && cipher) { - g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_CIPHER), - str_to_gvalue (cipher)); + g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_CIPHER), g_strdup (cipher)); } } @@ -976,8 +951,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) widget = glade_xml_get_widget (xml, "tls_auth_chooser"); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); if (filename && strlen (filename)) { - g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TA), - str_to_gvalue (filename)); + g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TA), g_strdup (filename)); } g_free (filename); @@ -988,11 +962,8 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) gtk_tree_model_get (model, &iter, TA_DIR_COL_NUM, &direction, -1); if (direction >= 0) { - char str_dir[2] = { '0', '\0' }; - - str_dir[0] = (direction == 0) ? '0' : '1'; g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TA_DIR), - str_to_gvalue (str_dir)); + g_strdup_printf ("%d", direction)); } } } diff --git a/vpn-daemons/openvpn/properties/auth-helpers.h b/vpn-daemons/openvpn/properties/auth-helpers.h index 80c3955d3e..7168221627 100644 --- a/vpn-daemons/openvpn/properties/auth-helpers.h +++ b/vpn-daemons/openvpn/properties/auth-helpers.h @@ -28,35 +28,35 @@ #include <glade/glade.h> #include <nm-connection.h> -#include <nm-setting-vpn-properties.h> +#include <nm-setting-vpn.h> typedef void (*ChangedCallback) (GtkWidget *widget, gpointer user_data); void tls_pw_init_auth_widget (GladeXML *xml, GtkSizeGroup *group, - NMSettingVPNProperties *s_vpn_props, - gint contype, + NMSettingVPN *s_vpn, + const char *contype, const char *prefix, ChangedCallback changed_cb, gpointer user_data); void sk_init_auth_widget (GladeXML *xml, GtkSizeGroup *group, - NMSettingVPNProperties *s_vpn_props, + NMSettingVPN *s_vpn, ChangedCallback changed_cb, gpointer user_data); -gboolean auth_widget_check_validity (GladeXML *xml, gint contype, GError **error); +gboolean auth_widget_check_validity (GladeXML *xml, const char *contype, GError **error); gboolean auth_widget_update_connection (GladeXML *xml, - gint contype, - NMSettingVPNProperties *s_vpn_props); + const char *contype, + NMSettingVPN *s_vpn); GtkFileFilter *tls_file_chooser_filter_new (void); GtkFileFilter *sk_file_chooser_filter_new (void); -GtkWidget *advanced_dialog_new (GHashTable *hash, int contype); +GtkWidget *advanced_dialog_new (GHashTable *hash, const char *contype); GHashTable *advanced_dialog_new_hash_from_connection (NMConnection *connection, GError **error); diff --git a/vpn-daemons/openvpn/properties/import-export.c b/vpn-daemons/openvpn/properties/import-export.c index fa9251a25d..dfdc53d492 100644 --- a/vpn-daemons/openvpn/properties/import-export.c +++ b/vpn-daemons/openvpn/properties/import-export.c @@ -35,7 +35,6 @@ #include <glib/gi18n-lib.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> @@ -104,7 +103,7 @@ handle_path_item (const char *line, if (leftover && *file) *leftover = file + 1; - g_hash_table_insert (hash, g_strdup (key), str_to_gvalue (unquoted)); + g_hash_table_insert (hash, g_strdup (key), g_strdup (unquoted)); g_free (unquoted); out: @@ -143,9 +142,12 @@ handle_direction (const char *tag, const char *key, char *leftover, GHashTable * errno = 0; direction = strtol (leftover, NULL, 10); - if ((errno == 0) && ((direction == 0) || (direction == 1))) - g_hash_table_insert (hash, g_strdup (key), int_to_gvalue (direction)); - else + if (errno == 0) { + if (direction == 0) + g_hash_table_insert (hash, g_strdup (key), g_strdup ("0")); + else if (direction == 1) + g_hash_table_insert (hash, g_strdup (key), g_strdup ("1")); + } else g_warning ("%s: unknown %s direction '%s'", __func__, tag, leftover); } @@ -155,12 +157,11 @@ do_import (const char *path, char **lines, GError **error) NMConnection *connection = NULL; NMSettingConnection *s_con; NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; char *last_dot; char **line; gboolean have_client = FALSE, have_remote = FALSE; gboolean have_pass = FALSE, have_sk = FALSE; - int ctype = NM_OPENVPN_CONTYPE_INVALID; + const char *ctype = NULL; connection = nm_connection_new (); s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); @@ -168,10 +169,6 @@ do_import (const char *path, char **lines, GError **error) s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ()); s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_OPENVPN); - nm_connection_add_setting (connection, NM_SETTING (s_vpn)); - - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_setting_vpn_properties_new ()); - nm_connection_add_setting (connection, NM_SETTING (s_vpn_props)); s_con->id = g_path_get_basename (path); last_dot = strrchr (s_con->id, '.'); @@ -195,9 +192,9 @@ do_import (const char *path, char **lines, GError **error) if (strstr (*line, "tun")) { /* ignore; default is tun */ } else if (strstr (*line, "tap")) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_TAP_DEV), - bool_to_gvalue (TRUE)); + g_strdup ("yes")); } else g_warning ("%s: unknown dev option '%s'", __func__, *line); @@ -208,9 +205,9 @@ do_import (const char *path, char **lines, GError **error) if (strstr (*line, "udp")) { /* ignore; udp is default */ } else if (strstr (*line, "tcp")) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_PROTO_TCP), - bool_to_gvalue (TRUE)); + g_strdup ("yes")); } else g_warning ("%s: unknown proto option '%s'", __func__, *line); @@ -218,9 +215,9 @@ do_import (const char *path, char **lines, GError **error) } if (!strncmp (*line, COMP_TAG, strlen (COMP_TAG))) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_COMP_LZO), - bool_to_gvalue (TRUE)); + g_strdup ("yes")); continue; } @@ -230,9 +227,9 @@ do_import (const char *path, char **lines, GError **error) continue; if (g_strv_length (items) >= 1) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_REMOTE), - str_to_gvalue (items[0])); + g_strdup (items[0])); have_remote = TRUE; if (g_strv_length (items) >= 2) { @@ -241,44 +238,44 @@ do_import (const char *path, char **lines, GError **error) errno = 0; port = strtol (items[1], NULL, 10); if ((errno == 0) && (port > 0) && (port < 65536)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_PORT), - int_to_gvalue (port)); + g_strdup_printf ("%d", (guint32) port)); } else g_warning ("%s: invalid remote port in option '%s'", __func__, *line); } } g_strfreev (items); - if (!g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_REMOTE)) + if (!g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_REMOTE)) g_warning ("%s: unknown remote option '%s'", __func__, *line); continue; } - if (handle_path_item (*line, CA_TAG, NM_OPENVPN_KEY_CA, s_vpn_props->data, NULL)) + if (handle_path_item (*line, CA_TAG, NM_OPENVPN_KEY_CA, s_vpn->data, NULL)) continue; - if (handle_path_item (*line, CERT_TAG, NM_OPENVPN_KEY_CERT, s_vpn_props->data, NULL)) + if (handle_path_item (*line, CERT_TAG, NM_OPENVPN_KEY_CERT, s_vpn->data, NULL)) continue; - if (handle_path_item (*line, KEY_TAG, NM_OPENVPN_KEY_KEY, s_vpn_props->data, NULL)) + if (handle_path_item (*line, KEY_TAG, NM_OPENVPN_KEY_KEY, s_vpn->data, NULL)) continue; - if (handle_path_item (*line, SECRET_TAG, NM_OPENVPN_KEY_SHARED_KEY, - s_vpn_props->data, &leftover)) { + if (handle_path_item (*line, SECRET_TAG, NM_OPENVPN_KEY_STATIC_KEY, + s_vpn->data, &leftover)) { handle_direction ("secret", - NM_OPENVPN_KEY_SHARED_KEY_DIRECTION, + NM_OPENVPN_KEY_STATIC_KEY_DIRECTION, leftover, - s_vpn_props->data); + s_vpn->data); continue; } if (handle_path_item (*line, TLS_AUTH_TAG, NM_OPENVPN_KEY_TA, - s_vpn_props->data, &leftover)) { + s_vpn->data, &leftover)) { handle_direction ("tls-auth", NM_OPENVPN_KEY_TA_DIR, leftover, - s_vpn_props->data); + s_vpn->data); continue; } @@ -288,9 +285,9 @@ do_import (const char *path, char **lines, GError **error) continue; if (g_strv_length (items)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_CIPHER), - str_to_gvalue (items[0])); + g_strdup (items[0])); } g_strfreev (items); continue; @@ -302,12 +299,12 @@ do_import (const char *path, char **lines, GError **error) continue; if (g_strv_length (items) == 2) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_LOCAL_IP), - str_to_gvalue (items[0])); - g_hash_table_insert (s_vpn_props->data, + g_strdup (items[0])); + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_REMOTE_IP), - str_to_gvalue (items[1])); + g_strdup (items[1])); } else g_warning ("%s: unknown ifconfig option '%s'", __func__, *line); g_strfreev (items); @@ -318,7 +315,7 @@ do_import (const char *path, char **lines, GError **error) have_pass = TRUE; } - if (g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_SHARED_KEY)) + if (g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_STATIC_KEY)) have_sk = TRUE; if (!have_client && !have_sk) { @@ -338,12 +335,12 @@ do_import (const char *path, char **lines, GError **error) } else { gboolean have_certs = FALSE, have_ca = FALSE; - if (g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CA)) + if (g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CA)) have_ca = TRUE; if ( have_ca - && g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CERT) - && g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_KEY)) + && g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CERT) + && g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_KEY)) have_certs = TRUE; /* Determine connection type */ @@ -357,14 +354,15 @@ do_import (const char *path, char **lines, GError **error) } else if (have_sk) ctype = NM_OPENVPN_CONTYPE_STATIC_KEY; - if (ctype == NM_OPENVPN_CONTYPE_INVALID) + if (!ctype) ctype = NM_OPENVPN_CONTYPE_TLS; - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_CONNECTION_TYPE), - int_to_gvalue (ctype)); + g_strdup (ctype)); } + nm_connection_add_setting (connection, NM_SETTING (s_vpn)); return connection; } @@ -375,4 +373,3 @@ do_export (const char *path, NMConnection *connection, GError **error) } - diff --git a/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade b/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade index b2c6daa864..17a69e3727 100644 --- a/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade +++ b/vpn-daemons/openvpn/properties/nm-openvpn-dialog.glade @@ -241,7 +241,7 @@ <child> <widget class="GtkLabel" id="label14"> <property name="visible">True</property> - <property name="label" translatable="yes">page 1</property> + <property name="label">page 1</property> </widget> <packing> <property name="type">tab</property> @@ -322,7 +322,7 @@ <child> <widget class="GtkLabel" id="label15"> <property name="visible">True</property> - <property name="label" translatable="yes">page 2</property> + <property name="label">page 2</property> </widget> <packing> <property name="type">tab</property> @@ -466,7 +466,7 @@ <child> <widget class="GtkLabel" id="label16"> <property name="visible">True</property> - <property name="label" translatable="yes">page 3</property> + <property name="label">page 3</property> </widget> <packing> <property name="type">tab</property> @@ -477,7 +477,7 @@ <child> <widget class="GtkTable" id="table6"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> @@ -566,6 +566,36 @@ <property name="y_options"></property> </packing> </child> + <child> + <widget class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="label" translatable="yes">Local IP Address:</property> + </widget> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <widget class="GtkAlignment" id="alignment18"> + <property name="visible">True</property> + <property name="xalign">1</property> + <property name="xscale">0</property> + <child> + <widget class="GtkEntry" id="sk_local_address_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> <property name="position">3</property> @@ -574,7 +604,7 @@ <child> <widget class="GtkLabel" id="label17"> <property name="visible">True</property> - <property name="label" translatable="yes">page 4</property> + <property name="label">page 4</property> </widget> <packing> <property name="type">tab</property> @@ -786,6 +816,9 @@ <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> + <placeholder/> + </child> + <child> <widget class="GtkLabel" id="tls_auth_label"> <property name="visible">True</property> <property name="xalign">0</property> @@ -814,9 +847,6 @@ </packing> </child> <child> - <placeholder/> - </child> - <child> <widget class="GtkAlignment" id="alignment19"> <property name="visible">True</property> <property name="xalign">1</property> @@ -925,7 +955,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="label" translatable="yes">gtk-cancel</property> + <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="response_id">-6</property> </widget> @@ -935,7 +965,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="label" translatable="yes">gtk-ok</property> + <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="response_id">-5</property> </widget> diff --git a/vpn-daemons/openvpn/properties/nm-openvpn.c b/vpn-daemons/openvpn/properties/nm-openvpn.c index ad3f023943..c1a95759b3 100644 --- a/vpn-daemons/openvpn/properties/nm-openvpn.c +++ b/vpn-daemons/openvpn/properties/nm-openvpn.c @@ -41,7 +41,6 @@ #include <nm-vpn-plugin-ui-interface.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> @@ -133,7 +132,7 @@ check_validity (OpenvpnPluginUiWidget *self, GError **error) const char *str; GtkTreeModel *model; GtkTreeIter iter; - gint contype = NM_OPENVPN_CONTYPE_INVALID; + const char *contype = NULL; widget = glade_xml_get_widget (priv->xml, "gateway_entry"); str = gtk_entry_get_text (GTK_ENTRY (widget)); @@ -226,7 +225,7 @@ advanced_button_clicked_cb (GtkWidget *button, gpointer user_data) GtkWidget *dialog, *toplevel, *widget; GtkTreeModel *model; GtkTreeIter iter; - int contype = NM_OPENVPN_CONTYPE_INVALID; + const char *contype = NULL; toplevel = gtk_widget_get_toplevel (priv->widget); g_return_if_fail (GTK_WIDGET_TOPLEVEL (toplevel)); @@ -259,15 +258,15 @@ static gboolean init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError **error) { OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; GtkWidget *widget; GtkListStore *store; GtkTreeIter iter; int active = -1; - GValue *value; - gint contype = NM_OPENVPN_CONTYPE_TLS; + const char *value; + const char *contype = NM_OPENVPN_CONTYPE_TLS; - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); + s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); @@ -275,10 +274,10 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError ** if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, widget); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_REMOTE); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_REMOTE); + if (value) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -287,19 +286,22 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError ** return FALSE; gtk_size_group_add_widget (priv->group, widget); - store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT); + store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING); - if (s_vpn_props && s_vpn_props->data) { - value = g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CONNECTION_TYPE); - if (value && G_VALUE_HOLDS_INT (value)) { - contype = g_value_get_int (value); - if ((contype < NM_OPENVPN_CONTYPE_TLS) || (contype > NM_OPENVPN_CONTYPE_PASSWORD_TLS)) + if (s_vpn && s_vpn->data) { + contype = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CONNECTION_TYPE); + if (contype) { + if ( strcmp (contype, NM_OPENVPN_CONTYPE_TLS) + && strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY) + && strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD) + && strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) contype = NM_OPENVPN_CONTYPE_TLS; - } + } else + contype = NM_OPENVPN_CONTYPE_TLS; } /* TLS auth widget */ - tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn_props, + tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn, NM_OPENVPN_CONTYPE_TLS, "tls", stuff_changed_cb, self); @@ -311,7 +313,7 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError ** -1); /* Password auth widget */ - tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn_props, + tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn, NM_OPENVPN_CONTYPE_PASSWORD, "pw", stuff_changed_cb, self); @@ -321,11 +323,11 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError ** COL_AUTH_PAGE, 1, COL_AUTH_TYPE, NM_OPENVPN_CONTYPE_PASSWORD, -1); - if ((active < 0) && (contype == NM_OPENVPN_CONTYPE_PASSWORD)) + if ((active < 0) && !strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD)) active = 1; /* Password+TLS auth widget */ - tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn_props, + tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn, NM_OPENVPN_CONTYPE_PASSWORD_TLS, "pw_tls", stuff_changed_cb, self); @@ -335,11 +337,11 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError ** COL_AUTH_PAGE, 2, COL_AUTH_TYPE, NM_OPENVPN_CONTYPE_PASSWORD_TLS, -1); - if ((active < 0) && (contype == NM_OPENVPN_CONTYPE_PASSWORD_TLS)) + if ((active < 0) && !strcmp (contype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) active = 2; /* Static key auth widget */ - sk_init_auth_widget (priv->xml, priv->group, s_vpn_props, stuff_changed_cb, self); + sk_init_auth_widget (priv->xml, priv->group, s_vpn, stuff_changed_cb, self); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, @@ -347,7 +349,7 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError ** COL_AUTH_PAGE, 3, COL_AUTH_TYPE, NM_OPENVPN_CONTYPE_STATIC_KEY, -1); - if ((active < 0) && (contype == NM_OPENVPN_CONTYPE_STATIC_KEY)) + if ((active < 0) && !strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)) active = 3; gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store)); @@ -370,64 +372,13 @@ get_widget (NMVpnPluginUiWidgetInterface *iface) return G_OBJECT (priv->widget); } -GValue * -str_to_gvalue (const char *str) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_STRING); - g_value_set_string (value, str); - - return value; -} - -GValue * -bool_to_gvalue (gboolean b) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_BOOLEAN); - g_value_set_boolean (value, b); - - return value; -} - -GValue * -int_to_gvalue (gint i) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, i); - - return value; -} - static void hash_copy_advanced (gpointer key, gpointer data, gpointer user_data) { GHashTable *hash = (GHashTable *) user_data; - GValue *value = (GValue *) data; - - if (G_VALUE_HOLDS_STRING (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - str_to_gvalue (g_value_get_string (value))); - } else if (G_VALUE_HOLDS_INT (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - int_to_gvalue (g_value_get_int (value))); - } else if (G_VALUE_HOLDS_BOOLEAN (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - bool_to_gvalue (g_value_get_boolean (value))); - } else { - g_warning ("%s: unhandled key '%s' of type '%s'", - __func__, (const char *) key, G_VALUE_TYPE_NAME (value)); - } + const char *value = (const char *) data; + + g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup (value)); } static gboolean @@ -438,55 +389,42 @@ update_connection (NMVpnPluginUiWidgetInterface *iface, OpenvpnPluginUiWidget *self = OPENVPN_PLUGIN_UI_WIDGET (iface); OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; GtkWidget *widget; char *str; GtkTreeModel *model; GtkTreeIter iter; gboolean valid = FALSE; - int auth_type = NM_OPENVPN_CONTYPE_INVALID; + const char *auth_type = NULL; if (!check_validity (self, error)) return FALSE; s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ()); s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_OPENVPN); - nm_connection_add_setting (connection, NM_SETTING (s_vpn)); - - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_setting_vpn_properties_new ()); /* Gateway */ widget = glade_xml_get_widget (priv->xml, "gateway_entry"); str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_OPENVPN_KEY_REMOTE), - str_to_gvalue (str)); + g_strdup (str)); } widget = glade_xml_get_widget (priv->xml, "auth_combo"); model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget)); if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) { gtk_tree_model_get (model, &iter, COL_AUTH_TYPE, &auth_type, -1); - if ( (auth_type > NM_OPENVPN_CONTYPE_INVALID) - && (auth_type <= NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { - g_hash_table_insert (s_vpn_props->data, - g_strdup (NM_OPENVPN_KEY_CONNECTION_TYPE), - int_to_gvalue (auth_type)); - auth_widget_update_connection (priv->xml, auth_type, s_vpn_props); - } else { - g_set_error (error, - OPENVPN_PLUGIN_UI_ERROR, - OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, - NM_OPENVPN_KEY_CONNECTION_TYPE); - goto done; - } + g_hash_table_insert (s_vpn->data, + g_strdup (NM_OPENVPN_KEY_CONNECTION_TYPE), + g_strdup (auth_type)); + auth_widget_update_connection (priv->xml, auth_type, s_vpn); } if (priv->advanced) - g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn_props->data); + g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn->data); - nm_connection_add_setting (connection, NM_SETTING (s_vpn_props)); + nm_connection_add_setting (connection, NM_SETTING (s_vpn)); valid = TRUE; done: diff --git a/vpn-daemons/openvpn/properties/nm-openvpn.h b/vpn-daemons/openvpn/properties/nm-openvpn.h index 5d6c1739d6..b5ab3538a4 100644 --- a/vpn-daemons/openvpn/properties/nm-openvpn.h +++ b/vpn-daemons/openvpn/properties/nm-openvpn.h @@ -82,11 +82,5 @@ struct _OpenvpnPluginUiWidgetClass { GType openvpn_plugin_ui_widget_get_type (void); -GValue *int_to_gvalue (gint i); - -GValue *bool_to_gvalue (gboolean b); - -GValue *str_to_gvalue (const char *str); - #endif /* _NM_OPENVPN_H_ */ diff --git a/vpn-daemons/openvpn/src/nm-openvpn-service.c b/vpn-daemons/openvpn/src/nm-openvpn-service.c index fb9226aff9..9d0c7d443b 100644 --- a/vpn-daemons/openvpn/src/nm-openvpn-service.c +++ b/vpn-daemons/openvpn/src/nm-openvpn-service.c @@ -1,8 +1,8 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* nm-openvpn-service - openvpn integration with NetworkManager * * Tim Niemueller <tim@niemueller.de> - * Based on work by Dan Williams <dcbw@redhat.com> + * Dan Williams <dcbw@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,11 +44,11 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <ctype.h> +#include <errno.h> #include <NetworkManager.h> #include <NetworkManagerVPN.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include "nm-openvpn-service.h" #include "nm-utils.h" @@ -63,9 +63,6 @@ typedef struct { char *username; char *password; char *certpass; - gint child_stdin_fd; - gint child_stdout_fd; - gint child_stderr_fd; GIOChannel *socket_channel; guint socket_channel_eventid; } NMOpenvpnPluginIOData; @@ -80,39 +77,59 @@ typedef struct { typedef struct { const char *name; GType type; + gint int_min; + gint int_max; + gboolean address; } ValidProperty; static ValidProperty valid_properties[] = { - { NM_OPENVPN_KEY_CA, G_TYPE_STRING }, - { NM_OPENVPN_KEY_CERT, G_TYPE_STRING }, - { NM_OPENVPN_KEY_CIPHER, G_TYPE_STRING }, - { NM_OPENVPN_KEY_COMP_LZO, G_TYPE_BOOLEAN }, - { NM_OPENVPN_KEY_CONNECTION_TYPE, G_TYPE_INT }, - { NM_OPENVPN_KEY_TAP_DEV, G_TYPE_BOOLEAN }, - { NM_OPENVPN_KEY_KEY, G_TYPE_STRING }, - { NM_OPENVPN_KEY_LOCAL_IP, G_TYPE_STRING }, - { NM_OPENVPN_KEY_PROTO_TCP, G_TYPE_BOOLEAN }, - { NM_OPENVPN_KEY_PORT, G_TYPE_INT }, - { NM_OPENVPN_KEY_REMOTE, G_TYPE_STRING }, - { NM_OPENVPN_KEY_REMOTE_IP, G_TYPE_STRING }, - { NM_OPENVPN_KEY_SHARED_KEY, G_TYPE_STRING }, - { NM_OPENVPN_KEY_SHARED_KEY_DIRECTION, G_TYPE_INT }, - { NM_OPENVPN_KEY_TA, G_TYPE_STRING }, - { NM_OPENVPN_KEY_TA_DIR, G_TYPE_STRING }, - { NM_OPENVPN_KEY_USERNAME, G_TYPE_STRING }, - { NM_OPENVPN_KEY_PASSWORD, G_TYPE_STRING }, - { NM_OPENVPN_KEY_CERTPASS, G_TYPE_STRING }, - { NM_OPENVPN_KEY_NOSECRET, G_TYPE_STRING }, - { NULL, G_TYPE_NONE } + { NM_OPENVPN_KEY_CA, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_CERT, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_CIPHER, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_COMP_LZO, G_TYPE_BOOLEAN, 0, 0, FALSE }, + { NM_OPENVPN_KEY_CONNECTION_TYPE, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_TAP_DEV, G_TYPE_BOOLEAN, 0, 0, FALSE }, + { NM_OPENVPN_KEY_KEY, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_LOCAL_IP, G_TYPE_STRING, 0, 0, TRUE }, + { NM_OPENVPN_KEY_PROTO_TCP, G_TYPE_BOOLEAN, 0, 0, FALSE }, + { NM_OPENVPN_KEY_PORT, G_TYPE_INT, 1, 65535, FALSE }, + { NM_OPENVPN_KEY_REMOTE, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_REMOTE_IP, G_TYPE_STRING, 0, 0, TRUE }, + { NM_OPENVPN_KEY_STATIC_KEY, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_STATIC_KEY_DIRECTION, G_TYPE_INT, 0, 1, FALSE }, + { NM_OPENVPN_KEY_TA, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_TA_DIR, G_TYPE_INT, 0, 1, FALSE }, + { NM_OPENVPN_KEY_USERNAME, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_PASSWORD, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_CERTPASS, G_TYPE_STRING, 0, 0, FALSE }, + { NM_OPENVPN_KEY_NOSECRET, G_TYPE_STRING, 0, 0, FALSE }, + { NULL, G_TYPE_NONE, FALSE } }; +static gboolean +validate_address (const char *address) +{ + const char *p = address; + + if (!address || !strlen (address)) + return FALSE; + + /* Ensure it's a valid DNS name or IP address */ + while (*p) { + if (!isalnum (*p) && (*p != '-') && (*p != '.')) + return FALSE; + p++; + } + return TRUE; +} + static void -validate_one_property (gpointer key, gpointer val, gpointer user_data) +validate_one_property (gpointer key, gpointer value, gpointer user_data) { - gboolean *failed = (gboolean *) user_data; + GError **error = (GError **) user_data; int i; - if (*failed) + if (*error) return; /* 'name' is the setting name; always allowed but unused */ @@ -121,27 +138,79 @@ validate_one_property (gpointer key, gpointer val, gpointer user_data) for (i = 0; valid_properties[i].name; i++) { ValidProperty prop = valid_properties[i]; + long int tmp; + + if (strcmp (prop.name, (char *) key)) + continue; - if (!strcmp (prop.name, (char *) key) && prop.type == G_VALUE_TYPE ((GValue *) val)) - /* Property is ok */ - return; + switch (prop.type) { + case G_TYPE_STRING: + if (!prop.address || validate_address ((const char *) value)) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid address '%s'", + (const char *) key); + break; + case G_TYPE_INT: + errno = 0; + tmp = strtol ((char *) value, NULL, 10); + if (errno == 0 && tmp >= prop.int_min && tmp <= prop.int_max) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid integer property '%s' or out of range [%d -> %d]", + (const char *) key, prop.int_min, prop.int_max); + break; + case G_TYPE_BOOLEAN: + if (!strcmp ((char *) value, "yes") || !strcmp ((char *) value, "no")) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid boolean property '%s' (not yes or no)", + (const char *) key); + break; + default: + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "unhandled property '%s' type %s", + (const char *) key, g_type_name (prop.type)); + break; + } } /* Did not find the property from valid_properties or the type did not match */ - *failed = TRUE; + if (!valid_properties[i].name) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "property '%s' invalid or not supported", + (const char *) key); + } } static gboolean -nm_openvpn_properties_validate (GHashTable *properties) +nm_openvpn_properties_validate (GHashTable *properties, GError **error) { - gboolean failed = FALSE; - - if (g_hash_table_size (properties) < 1) - return failed; + if (g_hash_table_size (properties) < 1) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "No VPN configuration options."); + return FALSE; + } - g_hash_table_foreach (properties, validate_one_property, &failed); + g_hash_table_foreach (properties, validate_one_property, error); - return !failed; + return *error ? FALSE : TRUE; } static void @@ -166,6 +235,26 @@ nm_openvpn_disconnect_management_socket (NMOpenvpnPlugin *plugin) priv->io_data = NULL; } +static char * +ovpn_quote_string (const char *unquoted) +{ + char *quoted = NULL, *q; + char *u = (char *) unquoted; + + g_return_val_if_fail (unquoted != NULL, NULL); + + /* FIXME: use unpaged memory */ + quoted = q = g_malloc0 (strlen (unquoted) * 2); + while (*u) { + /* Escape certain characters */ + if (*u == ' ' || *u == '\\' || *u == '"') + *q++ = '\\'; + *q++ = *u++; + } + + return quoted; +} + static gboolean nm_openvpn_socket_data_cb (GIOChannel *source, GIOCondition condition, gpointer user_data) { @@ -189,10 +278,19 @@ nm_openvpn_socket_data_cb (GIOChannel *source, GIOCondition condition, gpointer if (sscanf (str, ">PASSWORD:Need '%a[^']'", &auth) > 0 ) { if (strcmp (auth, "Auth") == 0) { if (io_data->username != NULL && io_data->password != NULL) { - buf = g_strdup_printf ("username \"%s\" %s\n" - "password \"%s\" %s\n", - auth, io_data->username, - auth, io_data->password); + char *quser, *qpass; + + /* Quote strings passed back to openvpn */ + quser = ovpn_quote_string (io_data->username); + qpass = ovpn_quote_string (io_data->password); + buf = g_strdup_printf ("username \"%s\" \"%s\"\n" + "password \"%s\" \"%s\"\n", + auth, quser, + auth, qpass); + memset (qpass, 0, strlen (qpass)); + g_free (qpass); + g_free (quser); + /* Will always write everything in blocking channels (on success) */ g_io_channel_write_chars (source, buf, strlen (buf), &written, NULL); g_io_channel_flush (source, NULL); @@ -200,7 +298,14 @@ nm_openvpn_socket_data_cb (GIOChannel *source, GIOCondition condition, gpointer } } else if (!strcmp (auth, "Private Key")) { if (io_data->certpass) { - buf = g_strdup_printf ("password \"%s\" %s\n", auth, io_data->certpass); + char *qpass; + + /* Quote strings passed back to openvpn */ + qpass = ovpn_quote_string (io_data->certpass); + buf = g_strdup_printf ("password \"%s\" \"%s\"\n", auth, qpass); + memset (qpass, 0, strlen (qpass)); + g_free (qpass); + /* Will always write everything in blocking channels (on success) */ g_io_channel_write_chars (source, buf, strlen (buf), &written, NULL); g_io_channel_flush (source, NULL); @@ -213,12 +318,16 @@ nm_openvpn_socket_data_cb (GIOChannel *source, GIOCondition condition, gpointer nm_vpn_plugin_failure (NM_VPN_PLUGIN (plugin), NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED); nm_openvpn_disconnect_management_socket (plugin); } - } else if (strstr (str, ">PASSWORD:Verification Failed: ") == str) { nm_warning ("Password verification failed"); nm_vpn_plugin_failure (NM_VPN_PLUGIN (plugin), NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED); nm_openvpn_disconnect_management_socket (plugin); again = FALSE; + } else if (strstr (str, "private key password verification failed")) { + nm_warning ("Private key verification failed"); + nm_vpn_plugin_failure (NM_VPN_PLUGIN (plugin), NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED); + nm_openvpn_disconnect_management_socket (plugin); + again = FALSE; } out: @@ -261,8 +370,8 @@ nm_openvpn_connect_timer_cb (gpointer data) return FALSE; } } else { - GIOChannel *openvpn_socket_channel; - guint openvpn_socket_channel_eventid; + GIOChannel *openvpn_socket_channel; + guint openvpn_socket_channel_eventid; openvpn_socket_channel = g_io_channel_unix_new (socket_fd); openvpn_socket_channel_eventid = g_io_add_watch (openvpn_socket_channel, @@ -328,20 +437,21 @@ openvpn_watch_cb (GPid pid, gint status, gpointer user_data) nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED); } -static int +static const char * get_connection_type (GHashTable *properties) { - int connection_type = NM_OPENVPN_CONTYPE_INVALID; - gpointer tmp; - - tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CONNECTION_TYPE); - if (tmp) - connection_type = g_value_get_int ((GValue *) tmp); - - if (connection_type < NM_OPENVPN_CONTYPE_INVALID || connection_type > NM_OPENVPN_CONTYPE_PASSWORD_TLS) - connection_type = NM_OPENVPN_CONTYPE_INVALID; + const char *ctype; + + ctype = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CONNECTION_TYPE); + if (ctype) { + if ( !strcmp (ctype, NM_OPENVPN_CONTYPE_TLS) + || !strcmp (ctype, NM_OPENVPN_CONTYPE_STATIC_KEY) + || !strcmp (ctype, NM_OPENVPN_CONTYPE_PASSWORD) + || !strcmp (ctype, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) + return ctype; + } - return connection_type; + return NULL; } static const char * @@ -363,215 +473,275 @@ nm_find_openvpn (void) return *openvpn_binary; } -static gint -nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin, GHashTable *properties) +static void +free_openvpn_args (GPtrArray *args) +{ + g_ptr_array_foreach (args, (GFunc) g_free, NULL); + g_ptr_array_free (args, TRUE); +} + +static void +add_openvpn_arg (GPtrArray *args, const char *arg) +{ + g_return_if_fail (args != NULL); + g_return_if_fail (arg != NULL); + + g_ptr_array_add (args, (gpointer) g_strdup (arg)); +} + +static gboolean +add_openvpn_arg_int (GPtrArray *args, const char *arg) +{ + long int tmp_int; + + g_return_val_if_fail (args != NULL, FALSE); + g_return_val_if_fail (arg != NULL, FALSE); + + /* Convert -> int and back to string for security's sake since + * strtol() ignores some leading and trailing characters. + */ + errno = 0; + tmp_int = strtol (arg, NULL, 10); + if (errno != 0) + return FALSE; + g_ptr_array_add (args, (gpointer) g_strdup_printf ("%d", (guint32) tmp_int)); + return TRUE; +} + +static gboolean +nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin, + GHashTable *properties, + GError **error) { NMOpenvpnPluginPrivate *priv = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin); - GPid pid; - const char *openvpn_binary; - GPtrArray *openvpn_argv; + const char *openvpn_binary, *connection_type, *tmp; + GPtrArray *args; GSource *openvpn_watch; - gpointer tmp; - gint stdin_fd; - gint stdout_fd; - gint stderr_fd; - int connection_type; - GError *err = NULL; + GPid pid; /* Find openvpn */ openvpn_binary = nm_find_openvpn (); if (!openvpn_binary) { - nm_info ("Could not find openvpn binary."); - return -1; + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "Could not find the openvpn binary."); + return FALSE; } connection_type = get_connection_type (properties); - if (connection_type == NM_OPENVPN_CONTYPE_INVALID) - return -1; + if (!connection_type) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "Invalid connection type."); + return FALSE; + } - openvpn_argv = g_ptr_array_new (); - g_ptr_array_add (openvpn_argv, (gpointer) (openvpn_binary)); + args = g_ptr_array_new (); + add_openvpn_arg (args, openvpn_binary); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_REMOTE); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--remote"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--remote"); + add_openvpn_arg (args, tmp); } tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_COMP_LZO); - if (tmp && g_value_get_boolean ((GValue *) tmp)) - g_ptr_array_add (openvpn_argv, (gpointer) "--comp-lzo"); + if (tmp && !strcmp (tmp, "yes")) + add_openvpn_arg (args, "--comp-lzo"); - g_ptr_array_add (openvpn_argv, (gpointer) "--nobind"); + add_openvpn_arg (args, "--nobind"); /* Device, either tun or tap */ - g_ptr_array_add (openvpn_argv, (gpointer) "--dev"); + add_openvpn_arg (args, "--dev"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_TAP_DEV); - if (tmp && g_value_get_boolean ((GValue *) tmp)) - g_ptr_array_add (openvpn_argv, (gpointer) "tap"); + if (tmp && !strcmp (tmp, "yes")) + add_openvpn_arg (args, "tap"); else - g_ptr_array_add (openvpn_argv, (gpointer) "tun"); + add_openvpn_arg (args, "tun"); /* Protocol, either tcp or udp */ - g_ptr_array_add (openvpn_argv, (gpointer) "--proto"); + add_openvpn_arg (args, "--proto"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_PROTO_TCP); - if (tmp && g_value_get_boolean ((GValue *) tmp)) - g_ptr_array_add (openvpn_argv, (gpointer) "tcp-client"); + if (tmp && !strcmp (tmp, "yes")) + add_openvpn_arg (args, "tcp-client"); else - g_ptr_array_add (openvpn_argv, (gpointer) "udp"); + add_openvpn_arg (args, "udp"); /* Port */ - g_ptr_array_add (openvpn_argv, (gpointer) "--port"); + add_openvpn_arg (args, "--port"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_PORT); - if (tmp) - /* The string here is leaked, big deal. */ - g_ptr_array_add (openvpn_argv, g_strdup_printf ("%u", g_value_get_int ((GValue *) tmp))); - else + if (tmp && strlen (tmp)) { + if (!add_openvpn_arg_int (args, tmp)) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "Invalid port number '%s'.", + tmp); + free_openvpn_args (args); + return FALSE; + } + } else { /* Default to IANA assigned port 1194 */ - g_ptr_array_add (openvpn_argv, (GValue *) "1194"); + add_openvpn_arg (args, "1194"); + } /* Cipher */ tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CIPHER); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--cipher"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--cipher"); + add_openvpn_arg (args, tmp); } /* TA */ tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_TA); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--tls-auth"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--tls-auth"); + add_openvpn_arg (args, tmp); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_TA_DIR); - if (tmp && strlen (g_value_get_string (tmp))) - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) + add_openvpn_arg (args, tmp); } /* Syslog */ - g_ptr_array_add (openvpn_argv, (gpointer) "--syslog"); - g_ptr_array_add (openvpn_argv, (gpointer) "nm-openvpn"); + add_openvpn_arg (args, "--syslog"); + add_openvpn_arg (args, "nm-openvpn"); /* Up script, called when connection has been established or has been restarted */ - g_ptr_array_add (openvpn_argv, (gpointer) "--up"); - g_ptr_array_add (openvpn_argv, (gpointer) NM_OPENVPN_HELPER_PATH); - g_ptr_array_add (openvpn_argv, (gpointer) "--up-restart"); + add_openvpn_arg (args, "--up"); + add_openvpn_arg (args, NM_OPENVPN_HELPER_PATH); + add_openvpn_arg (args, "--up-restart"); /* Keep key and tun if restart is needed */ - g_ptr_array_add (openvpn_argv, (gpointer) "--persist-key"); - g_ptr_array_add (openvpn_argv, (gpointer) "--persist-tun"); + add_openvpn_arg (args, "--persist-key"); + add_openvpn_arg (args, "--persist-tun"); /* Management socket for localhost access to supply username and password */ - g_ptr_array_add (openvpn_argv, (gpointer) "--management"); - g_ptr_array_add (openvpn_argv, (gpointer) "127.0.0.1"); + add_openvpn_arg (args, "--management"); + add_openvpn_arg (args, "127.0.0.1"); /* with have nobind, thus 1194 should be free, it is the IANA assigned port */ - g_ptr_array_add (openvpn_argv, (gpointer) "1194"); + add_openvpn_arg (args, "1194"); /* Query on the management socket for user/pass */ - g_ptr_array_add (openvpn_argv, (gpointer) "--management-query-passwords"); + add_openvpn_arg (args, "--management-query-passwords"); /* do not let openvpn setup routes, NM will handle it */ - g_ptr_array_add (openvpn_argv, (gpointer) "--route-noexec"); + add_openvpn_arg (args, "--route-noexec"); /* Now append configuration options which are dependent on the configuration type */ - switch (connection_type) { - case NM_OPENVPN_CONTYPE_TLS: - g_ptr_array_add (openvpn_argv, (gpointer) "--client"); + if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_TLS)) { + add_openvpn_arg (args, "--client"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CA); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--ca"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--ca"); + add_openvpn_arg (args, tmp); } tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CERT); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--cert"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--cert"); + add_openvpn_arg (args, tmp); } tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_KEY); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--key"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--key"); + add_openvpn_arg (args, tmp); } - break; - - case NM_OPENVPN_CONTYPE_STATIC_KEY: - tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_SHARED_KEY); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--secret"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_STATIC_KEY)) { + tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_STATIC_KEY); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--secret"); + add_openvpn_arg (args, tmp); + + tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION); + if (tmp && strlen (tmp)) + add_openvpn_arg (args, tmp); } - g_ptr_array_add (openvpn_argv, (gpointer) "--ifconfig"); + add_openvpn_arg (args, "--ifconfig"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_LOCAL_IP); if (!tmp) { /* Insufficient data (FIXME: this should really be detected when validating the properties */ - g_ptr_array_free (openvpn_argv, TRUE); - return -1; + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "Missing required local IP address for static key mode."); + free_openvpn_args (args); + return FALSE; } - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + add_openvpn_arg (args, tmp); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_REMOTE_IP); if (!tmp) { /* Insufficient data (FIXME: this should really be detected when validating the properties */ - g_ptr_array_free (openvpn_argv, TRUE); - return -1; + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "Missing required remote IP address for static key mode."); + free_openvpn_args (args); + return FALSE; } - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); - break; - - case NM_OPENVPN_CONTYPE_PASSWORD: + add_openvpn_arg (args, tmp); + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD)) { /* Client mode */ - g_ptr_array_add (openvpn_argv, (gpointer) "--client"); + add_openvpn_arg (args, "--client"); /* Use user/path authentication */ - g_ptr_array_add (openvpn_argv, (gpointer) "--auth-user-pass"); + add_openvpn_arg (args, "--auth-user-pass"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CA); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--ca"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--ca"); + add_openvpn_arg (args, tmp); } - break; - - case NM_OPENVPN_CONTYPE_PASSWORD_TLS: - g_ptr_array_add (openvpn_argv, (gpointer) "--client"); + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { + add_openvpn_arg (args, "--client"); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CA); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--ca"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--ca"); + add_openvpn_arg (args, tmp); } tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CERT); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--cert"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--cert"); + add_openvpn_arg (args, tmp); } tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_KEY); - if (tmp) { - g_ptr_array_add (openvpn_argv, (gpointer) "--key"); - g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp)); + if (tmp && strlen (tmp)) { + add_openvpn_arg (args, "--key"); + add_openvpn_arg (args, tmp); } /* Use user/path authentication */ - g_ptr_array_add (openvpn_argv, (gpointer) "--auth-user-pass"); - break; + add_openvpn_arg (args, "--auth-user-pass"); + } else { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "Unknown connection type '%s'.", + connection_type); + free_openvpn_args (args); + return FALSE; } - g_ptr_array_add (openvpn_argv, NULL); + g_ptr_array_add (args, NULL); - if (!g_spawn_async_with_pipes (NULL, (char **) openvpn_argv->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &stdin_fd, - &stdout_fd, &stderr_fd, &err)) { - g_ptr_array_free (openvpn_argv, TRUE); - nm_warning ("openvpn failed to start. error: '%s'", err->message); - g_error_free (err); - return -1; + if (!g_spawn_async (NULL, (char **) args->pdata, NULL, + G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, error)) { + free_openvpn_args (args); + return FALSE; } - g_ptr_array_free (openvpn_argv, TRUE); + free_openvpn_args (args); nm_info ("openvpn started with pid %d", pid); @@ -586,72 +756,47 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin, GHashTable *properties X509USERPASS: Will require username and password and maybe certificate password X509: May require certificate password */ - if (connection_type == NM_OPENVPN_CONTYPE_PASSWORD || - connection_type == NM_OPENVPN_CONTYPE_PASSWORD_TLS || - connection_type == NM_OPENVPN_CONTYPE_TLS) { + if ( !strcmp (connection_type, NM_OPENVPN_CONTYPE_TLS) + || !strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD) + || !strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { + NMOpenvpnPluginIOData *io_data; - NMOpenvpnPluginIOData *io_data; - - io_data = g_new0 (NMOpenvpnPluginIOData, 1); - io_data->child_stdin_fd = stdin_fd; - io_data->child_stdout_fd = stdout_fd; - io_data->child_stderr_fd = stderr_fd; + io_data = g_new0 (NMOpenvpnPluginIOData, 1); tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_USERNAME); - if (tmp) - io_data->username = g_strdup ((char *) g_value_get_string ((GValue *) tmp)); + io_data->username = tmp ? g_strdup (tmp) : NULL; tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_PASSWORD); - if (tmp) - io_data->password = g_strdup ((char *) g_value_get_string ((GValue *) tmp)); + io_data->password = tmp ? g_strdup (tmp) : NULL; tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CERTPASS); - if (tmp) - io_data->certpass = g_strdup ((char *) g_value_get_string ((GValue *) tmp)); + io_data->certpass = tmp ? g_strdup (tmp) : NULL; priv->io_data = io_data; nm_openvpn_schedule_connect_timer (plugin); } - return stdin_fd; + return TRUE; } static gboolean real_connect (NMVPNPlugin *plugin, - NMConnection *connection, - GError **err) + NMConnection *connection, + GError **error) { - NMSettingVPNProperties *properties; - gint fd; - gboolean success = FALSE; - - properties = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); - if (!properties || !nm_openvpn_properties_validate (properties->data)) { - g_set_error (err, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, - "%s", - "Invalid arguments."); - goto out; - } + NMSettingVPN *s_vpn; - if ((fd = nm_openvpn_start_openvpn_binary (NM_OPENVPN_PLUGIN (plugin), properties->data)) < 0) { - g_set_error (err, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, - "%s", - "Could not start openvpn binary."); - goto out; - } + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); + g_assert (s_vpn); - success = TRUE; + if (!nm_openvpn_properties_validate (s_vpn->data, error)) + return FALSE; - out: - /* FIXME: It never did that but I guess it should? */ -/* close (fd); */ + if (!nm_openvpn_start_openvpn_binary (NM_OPENVPN_PLUGIN (plugin), s_vpn->data, error)) + return FALSE; - return success; + return TRUE; } static gboolean @@ -660,15 +805,15 @@ real_need_secrets (NMVPNPlugin *plugin, char **setting_name, GError **error) { - NMSettingVPNProperties *s_vpn_props; - int connection_type; + NMSettingVPN *s_vpn; + const char *connection_type; gboolean need_secrets = FALSE; g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); - if (!s_vpn_props) { + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); + if (!s_vpn) { g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, @@ -677,30 +822,28 @@ real_need_secrets (NMVPNPlugin *plugin, return FALSE; } - connection_type = get_connection_type (s_vpn_props->data); - switch (connection_type) { - case NM_OPENVPN_CONTYPE_PASSWORD_TLS: + connection_type = get_connection_type (s_vpn->data); + if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) { /* Will require username and password and maybe certificate password */ - if (!g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CERTPASS)) + if (!g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CERTPASS)) need_secrets = TRUE; - /* Fall through */ - case NM_OPENVPN_CONTYPE_PASSWORD: + + if (!g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_USERNAME) || + !g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_PASSWORD)) + need_secrets = TRUE; + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD)) { /* Will require username and password */ - if (!g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_USERNAME) || - !g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_PASSWORD)) + if (!g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_USERNAME) || + !g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_PASSWORD)) need_secrets = TRUE; - break; - case NM_OPENVPN_CONTYPE_TLS: + } else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_TLS)) { /* May require certificate password */ - if (!g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_CERTPASS)) + if (!g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CERTPASS)) need_secrets = TRUE; - break; - default: - break; } if (need_secrets) - *setting_name = NM_SETTING_VPN_PROPERTIES_SETTING_NAME; + *setting_name = NM_SETTING_VPN_SETTING_NAME; return need_secrets; } diff --git a/vpn-daemons/openvpn/src/nm-openvpn-service.h b/vpn-daemons/openvpn/src/nm-openvpn-service.h index ef7804c5e4..4a2378e8ce 100644 --- a/vpn-daemons/openvpn/src/nm-openvpn-service.h +++ b/vpn-daemons/openvpn/src/nm-openvpn-service.h @@ -38,29 +38,20 @@ #define NM_DBUS_INTERFACE_OPENVPN "org.freedesktop.NetworkManager.openvpn" #define NM_DBUS_PATH_OPENVPN "/org/freedesktop/NetworkManager/openvpn" -/* Do not change numbers, only add if needed! - See properties/nm-openvpn.c:connection_type_changed() for details - */ -#define NM_OPENVPN_CONTYPE_INVALID -1 -#define NM_OPENVPN_CONTYPE_TLS 0 -#define NM_OPENVPN_CONTYPE_STATIC_KEY 1 -#define NM_OPENVPN_CONTYPE_PASSWORD 2 -#define NM_OPENVPN_CONTYPE_PASSWORD_TLS 3 - #define NM_OPENVPN_KEY_CA "ca" #define NM_OPENVPN_KEY_CERT "cert" #define NM_OPENVPN_KEY_CIPHER "cipher" #define NM_OPENVPN_KEY_COMP_LZO "comp-lzo" #define NM_OPENVPN_KEY_CONNECTION_TYPE "connection-type" -#define NM_OPENVPN_KEY_TAP_DEV "dev" +#define NM_OPENVPN_KEY_TAP_DEV "tap-dev" #define NM_OPENVPN_KEY_KEY "key" #define NM_OPENVPN_KEY_LOCAL_IP "local-ip" -#define NM_OPENVPN_KEY_PROTO_TCP "proto" +#define NM_OPENVPN_KEY_PROTO_TCP "proto-tcp" #define NM_OPENVPN_KEY_PORT "port" #define NM_OPENVPN_KEY_REMOTE "remote" #define NM_OPENVPN_KEY_REMOTE_IP "remote-ip" -#define NM_OPENVPN_KEY_SHARED_KEY "shared-key" -#define NM_OPENVPN_KEY_SHARED_KEY_DIRECTION "shared-key-direction" +#define NM_OPENVPN_KEY_STATIC_KEY "static-key" +#define NM_OPENVPN_KEY_STATIC_KEY_DIRECTION "static-key-direction" #define NM_OPENVPN_KEY_TA "ta" #define NM_OPENVPN_KEY_TA_DIR "ta-dir" #define NM_OPENVPN_KEY_USERNAME "username" @@ -69,6 +60,11 @@ #define NM_OPENVPN_KEY_CERTPASS "cert-pass" #define NM_OPENVPN_KEY_NOSECRET "no-secret" +#define NM_OPENVPN_CONTYPE_TLS "tls" +#define NM_OPENVPN_CONTYPE_STATIC_KEY "static-key" +#define NM_OPENVPN_CONTYPE_PASSWORD "password" +#define NM_OPENVPN_CONTYPE_PASSWORD_TLS "password-tls" + typedef struct { NMVPNPlugin parent; } NMOpenvpnPlugin; diff --git a/vpn-daemons/pptp/ChangeLog b/vpn-daemons/pptp/ChangeLog index 530f610ac2..eb4e99f35a 100644 --- a/vpn-daemons/pptp/ChangeLog +++ b/vpn-daemons/pptp/ChangeLog @@ -1,3 +1,13 @@ +2008-08-11 Dan Williams <dcbw@redhat.com> + + Update to match NM svn3924 vpn setting changes; verify options better; + return more informative errors on VPN launch failures. + +2008-08-07 Dan Williams <dcbw@redhat.com> + + * src/nm-pptp-pppd-plugin.c + - (nm_ip_up): use correct option index (bgo #517468) + 2008-07-27 Dan Williams <dcbw@redhat.com> Patch from Michael Biebl <biebl@debian.org> diff --git a/vpn-daemons/pptp/auth-dialog/main.c b/vpn-daemons/pptp/auth-dialog/main.c index 3ddb9e727f..5d5d232743 100644 --- a/vpn-daemons/pptp/auth-dialog/main.c +++ b/vpn-daemons/pptp/auth-dialog/main.c @@ -30,7 +30,6 @@ #include <gnome-keyring.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include "../src/nm-pptp-service.h" #include "gnome-two-password-dialog.h" @@ -58,7 +57,7 @@ find_one_password (const char *vpn_id, vpn_id, KEYRING_SN_TAG, GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - NM_SETTING_VPN_PROPERTIES_SETTING_NAME, + NM_SETTING_VPN_SETTING_NAME, KEYRING_SK_TAG, GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, secret_name, @@ -105,7 +104,7 @@ save_vpn_password (const char *vpn_id, GnomeKeyringAttributeList *attrs = NULL; guint32 id = 0; - display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_PROPERTIES_SETTING_NAME, + display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_SETTING_NAME, secret_name, vpn_name, vpn_service); @@ -116,7 +115,7 @@ save_vpn_password (const char *vpn_id, vpn_id); gnome_keyring_attribute_list_append_string (attrs, KEYRING_SN_TAG, - NM_SETTING_VPN_PROPERTIES_SETTING_NAME); + NM_SETTING_VPN_SETTING_NAME); gnome_keyring_attribute_list_append_string (attrs, KEYRING_SK_TAG, secret_name); diff --git a/vpn-daemons/pptp/po/ChangeLog b/vpn-daemons/pptp/po/ChangeLog index ec2ad6b428..4468c3c51b 100644 --- a/vpn-daemons/pptp/po/ChangeLog +++ b/vpn-daemons/pptp/po/ChangeLog @@ -1,3 +1,24 @@ +2008-08-17 Claude Paroz <claude@2xlibre.net> + + * LINGUAS: Added missing fr. + * fr.po: Updated translation by Robert-André Mauchin and Claude Paroz. + +2008-08-14 Leonid Kanter <leon@asplinux.ru> + + * ru.po: Updated Russian translation + +2008-08-14 Jorge Gonzalez <jorgegonz@svn.gnome.org> + + * es.po: Updated Spanish translation + +2008-08-14 Ilkka Tuohela <hile@iki.fi> + + * fi.po: Updated Finnish translation. + +2008-08-07 Leonid Kanter <leon@asplinux.ru> + + * ru.po: Updated Russian translation + 2008-08-02 Alexander Shopov <ash@contact.bg> * bg.po: Updated Bulgarian translation by diff --git a/vpn-daemons/pptp/po/LINGUAS b/vpn-daemons/pptp/po/LINGUAS index 0c809f0703..0de49e332e 100644 --- a/vpn-daemons/pptp/po/LINGUAS +++ b/vpn-daemons/pptp/po/LINGUAS @@ -14,6 +14,7 @@ es et eu fi +fr gl he hu diff --git a/vpn-daemons/pptp/po/es.po b/vpn-daemons/pptp/po/es.po index 6256fbe241..358dceadba 100644 --- a/vpn-daemons/pptp/po/es.po +++ b/vpn-daemons/pptp/po/es.po @@ -9,12 +9,12 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager-pptp.HEAD\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-20 22:46+0000\n" -"PO-Revision-Date: 2008-07-25 10:56+0200\n" +"POT-Creation-Date: 2008-08-12 11:38+0000\n" +"PO-Revision-Date: 2008-08-14 09:23+0200\n" "Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n" "Language-Team: Español <gnome-es-list@gnome.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" @@ -51,12 +51,12 @@ msgstr "_Recordar las contraseñas para esta sesión" msgid "_Save passwords in keyring" msgstr "_Guardar las contraseña en el depósito de claves" -#: ../auth-dialog/main.c:169 +#: ../auth-dialog/main.c:168 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "Necesita autenticarse para acceder a la red privada virtual «%s»" -#: ../auth-dialog/main.c:170 +#: ../auth-dialog/main.c:169 msgid "Authenticate VPN" msgstr "Autenticar VPN" @@ -68,31 +68,31 @@ msgstr "Añadir, eliminar y editar conexiones VPN PPTP" msgid "PPTP VPN Connection Manager" msgstr "Gestor de conexiones VPN PPTP" -#: ../properties/advanced-dialog.c:173 +#: ../properties/advanced-dialog.c:147 msgid "All Available (Default)" msgstr "Todas las disponibles (predeterminado)" -#: ../properties/advanced-dialog.c:177 +#: ../properties/advanced-dialog.c:151 msgid "128-bit (most secure)" msgstr "128-bit (más seguro)" -#: ../properties/advanced-dialog.c:186 +#: ../properties/advanced-dialog.c:160 msgid "40-bit (less secure)" msgstr "40-bit (menos seguro)" -#: ../properties/advanced-dialog.c:257 +#: ../properties/advanced-dialog.c:231 msgid "PAP" msgstr "PAP" -#: ../properties/advanced-dialog.c:263 +#: ../properties/advanced-dialog.c:237 msgid "CHAP" msgstr "CHAP" -#: ../properties/advanced-dialog.c:269 +#: ../properties/advanced-dialog.c:243 msgid "MSCHAP" msgstr "MSCHAP" -#: ../properties/advanced-dialog.c:275 +#: ../properties/advanced-dialog.c:249 msgid "MSCHAPv2" msgstr "MSCHAPv2" @@ -121,16 +121,16 @@ msgid "Ad_vanced..." msgstr "A_vanzado..." #: ../properties/nm-pptp-dialog.glade.h:7 -msgid "Allow BSD data compression" -msgstr "Permitir compresión de datos BSD" +msgid "Allow _BSD data compression" +msgstr "Permitir compresión de datos _BSD" #: ../properties/nm-pptp-dialog.glade.h:8 -msgid "Allow Deflate data compression" -msgstr "Permitir compresión de datos Deflate" +msgid "Allow _Deflate data compression" +msgstr "Permitir compresión de datos _Deflate" #: ../properties/nm-pptp-dialog.glade.h:9 -msgid "Allow Stateful Encryption" -msgstr "Permitir cifrado de estado completo" +msgid "Allow st_ateful encryption" +msgstr "Permitir cifrado de est_ado completo" #: ../properties/nm-pptp-dialog.glade.h:10 msgid "Allow the following authentication methods:" @@ -145,42 +145,39 @@ msgid "Domain:" msgstr "Dominio:" #: ../properties/nm-pptp-dialog.glade.h:13 -msgid "Security:" -msgstr "Seguridad:" +msgid "Send PPP _echo packets" +msgstr "Mandar paquetes _eco PPP" #: ../properties/nm-pptp-dialog.glade.h:14 -msgid "Send PPP echo packets" -msgstr "Mandar paquetes eco PPP" +msgid "Use TCP _header compression" +msgstr "Usar compresión de _cabeceras TCP" #: ../properties/nm-pptp-dialog.glade.h:15 -msgid "Use Point-to-Point Encryption (MPPE)" -msgstr "Usar cifrado punto a punto (MPPE)" +msgid "Use _Point-to-Point encryption (MPPE)" +msgstr "Usar cifrado pun_to a punto (MPPE)" #: ../properties/nm-pptp-dialog.glade.h:16 -msgid "Use TCP header compression" -msgstr "Usar compresión de cabeceras TCP" - -#: ../properties/nm-pptp-dialog.glade.h:17 msgid "User name:" msgstr "Usuario:" -#: ../properties/nm-pptp-dialog.glade.h:18 +#: ../properties/nm-pptp-dialog.glade.h:17 msgid "_Gateway:" msgstr "_Pasarela:" -#: ../properties/nm-pptp-dialog.glade.h:19 -msgid "gtk-cancel" -msgstr "gtk-cancel" - -#: ../properties/nm-pptp-dialog.glade.h:20 -msgid "gtk-ok" -msgstr "gtk-ok" +#: ../properties/nm-pptp-dialog.glade.h:18 +msgid "_Security:" +msgstr "_Seguridad:" -#: ../properties/nm-pptp.c:50 +#: ../properties/nm-pptp.c:49 msgid "Point-to-Point Tunneling Protocol (PPTP)" msgstr "Protocolo de túnel punto a punto (PPTP)" -#: ../properties/nm-pptp.c:51 +#: ../properties/nm-pptp.c:50 msgid "Compatible with Microsoft and other PPTP VPN servers." msgstr "Compatible con servidores PPTP VPN de Microsoft y otros." +#~ msgid "gtk-cancel" +#~ msgstr "gtk-cancel" + +#~ msgid "gtk-ok" +#~ msgstr "gtk-ok" diff --git a/vpn-daemons/pptp/po/fi.po b/vpn-daemons/pptp/po/fi.po index f176ddb7b0..471ede3add 100644 --- a/vpn-daemons/pptp/po/fi.po +++ b/vpn-daemons/pptp/po/fi.po @@ -1,6 +1,6 @@ # Finnish messages for NetworkManager-pptp. -# Copyright (C) 2006 Ilkka Tuohela -# Ilkka Tuohela <hile@iki.fi>, 2006. +# Copyright (C) 2006-2008 Ilkka Tuohela +# Ilkka Tuohela <hile@iki.fi>, 2006-2008. # # Suomennos: http://gnome.fi/ # @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager-pptp\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-08-11 13:32+0300\n" -"PO-Revision-Date: 2007-01-31 10:57+0300\n" +"POT-Creation-Date: 2008-08-14 08:58+0300\n" +"PO-Revision-Date: 2008-08-14 08:00+0300\n" "Last-Translator: Ilkka Tuohela <hile@iki.fi>\n" "Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n" "MIME-Version: 1.0\n" @@ -17,562 +17,521 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:792 -msgid "Authentication Type:" -msgstr "Todentamistapa:" - -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:857 -#: ../auth-dialog-general/nm-ppp-auth.glade.h:11 -msgid "_Remember for this session" -msgstr "_Muista tämän istunnon ajan" - -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:859 -#: ../auth-dialog-general/nm-ppp-auth.glade.h:13 -msgid "_Save in keyring" -msgstr "_Tallenna avainrenkaaseen" - -#: ../auth-dialog-general/main.c:48 ../auth-dialog/main.c:140 -#, c-format -msgid "You need to authenticate to access '%s'." -msgstr "Yhteydenotto VPN-verkkoon \"%s\" vaatii todentamista." - -#: ../auth-dialog-general/main.c:51 ../auth-dialog/main.c:141 -msgid "Authenticate Connection" -msgstr "Todenna VPN-yhteys" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:2 -#, no-c-format -msgid "" -"<span weight=\"bold\" size=\"larger\">Authentication Information</span>\n" -"\n" -"The connection '%s' may need some form of authentication.\n" -"\n" -"Please select an appropriate authentication type and provide the necessary " -"credentials below:\n" -msgstr "" -"<span weight=\"bold\" size=\"larger\">Tietoja todentamisesta</span>\n" -"\n" -"Yhteys \"%s\" saattaa vaatia todentamista.\n" -"\n" -"Valitse sopiva todentamistapa ja syötä allaoleviin kenttiin tarvittavat " -"tiedot:\n" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:8 -msgid "Authentication Required" -msgstr "Todentaminen vaaditaan" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:9 -msgid "_Authentication Type:" -msgstr "_Todentamistapa:" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:10 -#: ../auth-dialog/gnome-two-password-dialog.c:263 -msgid "_Password:" -msgstr "_Salasana:" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:12 -msgid "_Remote name:" -msgstr "_Nimi palvelimella:" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:14 -#: ../auth-dialog/gnome-two-password-dialog.c:259 -msgid "_Username:" -msgstr "_Käyttäjätunnus:" - #: ../auth-dialog/gnome-two-password-dialog.c:144 msgid "_Secondary Password:" msgstr "_Toissijainen salasana:" -#: ../auth-dialog/gnome-two-password-dialog.c:261 +#: ../auth-dialog/gnome-two-password-dialog.c:258 +msgid "_Username:" +msgstr "_Käyttäjätunnus:" + +#: ../auth-dialog/gnome-two-password-dialog.c:260 msgid "_Domain:" msgstr "_Toimialue:" -#: ../auth-dialog/gnome-two-password-dialog.c:352 +#: ../auth-dialog/gnome-two-password-dialog.c:262 +msgid "_Password:" +msgstr "_Salasana:" + +#: ../auth-dialog/gnome-two-password-dialog.c:351 msgid "Connect _anonymously" msgstr "Yhdistä _anonyymisti" -#: ../auth-dialog/gnome-two-password-dialog.c:357 +#: ../auth-dialog/gnome-two-password-dialog.c:356 msgid "Connect as _user:" msgstr "Yhdistä _käyttäjänä:" -#: ../auth-dialog/gnome-two-password-dialog.c:466 -msgid "_Remember password for this session" +#: ../auth-dialog/gnome-two-password-dialog.c:465 +msgid "_Remember passwords for this session" msgstr "_Muista salasana istunnon ajan" -#: ../auth-dialog/gnome-two-password-dialog.c:468 -msgid "_Save password in keyring" +#: ../auth-dialog/gnome-two-password-dialog.c:467 +msgid "_Save passwords in keyring" msgstr "_Tallenna salasana avainrenkaaseen" -#: ../nm-ppp.desktop.in.h:1 -msgid "Add, Remove, and Edit VPN Connections" -msgstr "Lisää, poista tai muokkaa VPN-yhteyksiä" +#: ../auth-dialog/main.c:168 +#, c-format +msgid "You need to authenticate to access the Virtual Private Network '%s'." +msgstr "Yhteydenotto VPN-verkkoon \"%s\" vaatii todentamista." + +#: ../auth-dialog/main.c:169 +msgid "Authenticate VPN" +msgstr "Todenna VPN-yhteys" + +#: ../nm-pptp.desktop.in.h:1 +msgid "Add, Remove, and Edit PPTP VPN Connections" +msgstr "Lisää, poista tai muokkaa PPTP VPN -yhteyksiä" + +#: ../nm-pptp.desktop.in.h:2 +msgid "PPTP VPN Connection Manager" +msgstr "PPTP VPN -yhteyksien hallinta" + +#: ../properties/advanced-dialog.c:147 +msgid "All Available (Default)" +msgstr "Kaikki mahdolliset (oletus)" + +#: ../properties/advanced-dialog.c:151 +msgid "128-bit (most secure)" +msgstr "128-bittinen (turvallisempi)" + +#: ../properties/advanced-dialog.c:160 +msgid "40-bit (less secure)" +msgstr "40-bittinen (vähemmän turvallinen" + +#: ../properties/advanced-dialog.c:231 +msgid "PAP" +msgstr "PAP" -#: ../nm-ppp.desktop.in.h:2 -msgid "VPN Connection Manager (PPP generic)" -msgstr "VPN-yhteyksien hallinta (yleinen PPP)" +#: ../properties/advanced-dialog.c:237 +msgid "CHAP" +msgstr "CHAP" -#: ../properties/nm-ppp-dialog.glade.h:1 -msgid "00:00:00:00" -msgstr "00:00:00:00" +#: ../properties/advanced-dialog.c:243 +msgid "MSCHAP" +msgstr "MSCHAP" -#: ../properties/nm-ppp-dialog.glade.h:2 -msgid "<b>Compression</b>" -msgstr "<b>Pakkaus</b>" +#: ../properties/advanced-dialog.c:249 +msgid "MSCHAPv2" +msgstr "MSCHAPv2" -#: ../properties/nm-ppp-dialog.glade.h:3 -msgid "<b>Delays & Timeouts</b>" -msgstr "<b>Viiveet ja aikakatkaisut</b>" +#: ../properties/nm-pptp-dialog.glade.h:1 +msgid "<b>Authentication</b>" +msgstr "<b>Todentaminen</b>" -#: ../properties/nm-ppp-dialog.glade.h:4 -msgid "<b>Encryption</b>" -msgstr "<b>Salaus</b>" +#: ../properties/nm-pptp-dialog.glade.h:2 +msgid "<b>Echo</b>" +msgstr "<b>Kaiutus</b>" -#: ../properties/nm-ppp-dialog.glade.h:5 -msgid "<b>IP Options</b>" -msgstr "<b>IP-valitsimet</b>" +#: ../properties/nm-pptp-dialog.glade.h:3 +msgid "<b>General</b>" +msgstr "<b>Yleisasetukset</b>" -#: ../properties/nm-ppp-dialog.glade.h:6 -msgid "<b>Packet Parameters</b>" -msgstr "<b>Pakettiparameterit</b>" +#: ../properties/nm-pptp-dialog.glade.h:4 +msgid "<b>Optional</b>" +msgstr "<b>Lisävalinnat</b>" -#: ../properties/nm-ppp-dialog.glade.h:7 -msgid "<i>Example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>Esimerkki: 172.16.0.0/16 10.11.12.0/24</i>" +#: ../properties/nm-pptp-dialog.glade.h:5 +msgid "<b>Security and Compression</b>" +msgstr "<b>Salaus ja pakkaus</b>" -#: ../properties/nm-ppp-dialog.glade.h:8 -msgid "A list of extra options to pppd as would be typed on the command line" -msgstr "Lista valitsimista pppd:lle, komentoriviltä annettavassa muodossa" +#: ../properties/nm-pptp-dialog.glade.h:6 +msgid "Ad_vanced..." +msgstr "_Lisäasetukset..." -#: ../properties/nm-ppp-dialog.glade.h:9 -msgid "Allow B_SD Compression" -msgstr "Salli B_SD-pakkaus" +#: ../properties/nm-pptp-dialog.glade.h:7 +msgid "Allow _BSD data compression" +msgstr "Salli _BSD-pakkaus" -#: ../properties/nm-ppp-dialog.glade.h:10 -msgid "Allow _Deflate compression" +#: ../properties/nm-pptp-dialog.glade.h:8 +msgid "Allow _Deflate data compression" msgstr "Salli _deflate-pakkaus" -#: ../properties/nm-ppp-dialog.glade.h:11 -msgid "Authentication" -msgstr "Todentaminen" +#: ../properties/nm-pptp-dialog.glade.h:9 +msgid "Allow st_ateful encryption" +msgstr "Salli _tilallinen salaus" -#: ../properties/nm-ppp-dialog.glade.h:12 -msgid "C_hannel:" -msgstr "_Kanava:" +#: ../properties/nm-pptp-dialog.glade.h:10 +msgid "Allow the following authentication methods:" +msgstr "Salli seuraavat tunnistusmenetelmät:" -#: ../properties/nm-ppp-dialog.glade.h:13 -msgid "Co_nnect delay:" -msgstr "_Yhteysviive:" +#: ../properties/nm-pptp-dialog.glade.h:11 +msgid "Default" +msgstr "Oletus" -#: ../properties/nm-ppp-dialog.glade.h:14 -msgid "Compression & Encryption" -msgstr "Pakkaus ja salaus" +#: ../properties/nm-pptp-dialog.glade.h:12 +msgid "Domain:" +msgstr "Toimialue:" -#: ../properties/nm-ppp-dialog.glade.h:15 -msgid "Connection" -msgstr "Yhteys" +#: ../properties/nm-pptp-dialog.glade.h:13 +msgid "Send PPP _echo packets" +msgstr "Lähetä PPP:n _echo-paketteja" -#: ../properties/nm-ppp-dialog.glade.h:16 -msgid "Connection na_me:" -msgstr "Yhteyden ni_mi:" +#: ../properties/nm-pptp-dialog.glade.h:14 +msgid "Use TCP _header compression" +msgstr "Käytä TCP-_otsakkeiden pakkausta" -#: ../properties/nm-ppp-dialog.glade.h:17 -msgid "Context _number:" -msgstr "_Kontekstin numero:" +#: ../properties/nm-pptp-dialog.glade.h:15 +msgid "Use _Point-to-Point encryption (MPPE)" +msgstr "Käytä _Point-to-Point-salausta (MPPE)" -#: ../properties/nm-ppp-dialog.glade.h:18 -msgid "Custom _PPP options:" -msgstr "Omat _PPP-valitsimet:" +#: ../properties/nm-pptp-dialog.glade.h:16 +msgid "User name:" +msgstr "Käyttäjätunnus:" -#: ../properties/nm-ppp-dialog.glade.h:19 -msgid "Debug _output" -msgstr "_Vianetsintätuloste" +#: ../properties/nm-pptp-dialog.glade.h:17 +msgid "_Gateway:" +msgstr "_Yhdyskäytävä:" -#: ../properties/nm-ppp-dialog.glade.h:20 -msgid "Disconnect after this many LCP echo requests fail" -msgstr "Katkaise yhteys, kun näin monta LCP ECHO-pyyntö epäonnistuu" +#: ../properties/nm-pptp-dialog.glade.h:18 +msgid "_Security:" +msgstr "_Salaus:" -#: ../properties/nm-ppp-dialog.glade.h:21 -msgid "E_xclusive device access (UUCP-style lock)" -msgstr "Laite varataan käyttöön (UUCP-tyylinen lukko)" +#: ../properties/nm-pptp.c:49 +msgid "Point-to-Point Tunneling Protocol (PPTP)" +msgstr "Point-to-Point Tunneling Protocol (PPTP)" -#: ../properties/nm-ppp-dialog.glade.h:22 -msgid "Enable stateful _MPPE" -msgstr "Käytä tilallista _MPPE:tä" +#: ../properties/nm-pptp.c:50 +msgid "Compatible with Microsoft and other PPTP VPN servers." +msgstr "Yhteensopiva Microsoftin ja muiden PPTP VPN-palvelinten kanssa." -#: ../properties/nm-ppp-dialog.glade.h:23 -msgid "Find Device" -msgstr "Etsi laite" +#~ msgid "Authentication Type:" +#~ msgstr "Todentamistapa:" -#: ../properties/nm-ppp-dialog.glade.h:24 -msgid "" -"For security reasons, options entered in the box above are checked against a " -"list of allowed options before a connection is established. Currently there " -"are no options on the list." -msgstr "" -"Turvallisuussyistä ylläolevaan laatikkoon syötettyjä valitsimia verrataan " -"listaan sallituista valitsimista. Tällä hetkellä lista ei sisällä mitään " -"valitsimia." +#~ msgid "_Remember for this session" +#~ msgstr "_Muista tämän istunnon ajan" -#: ../properties/nm-ppp-dialog.glade.h:25 -msgid "GPRS Options" -msgstr "GPRS-valitsimet" +#~ msgid "_Save in keyring" +#~ msgstr "_Tallenna avainrenkaaseen" -#: ../properties/nm-ppp-dialog.glade.h:26 -msgid "Host name or IP address of the PPTP server" -msgstr "PPTP-palvelimen konenimi tai IP-osoite" +#~ msgid "Authenticate Connection" +#~ msgstr "Todenna VPN-yhteys" -#: ../properties/nm-ppp-dialog.glade.h:27 -msgid "IP a_ddress:" -msgstr "_IP-osoite:" +#~ msgid "" +#~ "<span weight=\"bold\" size=\"larger\">Authentication Information</span>\n" +#~ "\n" +#~ "The connection '%s' may need some form of authentication.\n" +#~ "\n" +#~ "Please select an appropriate authentication type and provide the " +#~ "necessary credentials below:\n" +#~ msgstr "" +#~ "<span weight=\"bold\" size=\"larger\">Tietoja todentamisesta</span>\n" +#~ "\n" +#~ "Yhteys \"%s\" saattaa vaatia todentamista.\n" +#~ "\n" +#~ "Valitse sopiva todentamistapa ja syötä allaoleviin kenttiin tarvittavat " +#~ "tiedot:\n" -#: ../properties/nm-ppp-dialog.glade.h:28 -msgid "" -"If BSD compression is not allowed the 'nobsdcomp' option is passed to pppd" -msgstr "" -"Jos BSD-pakkaus ei ole sallittu, annetaan pppd:lle valitsin 'nobsdcomp'" +#~ msgid "Authentication Required" +#~ msgstr "Todentaminen vaaditaan" -#: ../properties/nm-ppp-dialog.glade.h:29 -msgid "" -"If Deflate compression is not allowed the 'nodefate' option is passed to pppd" -msgstr "" -"Jos deflate-pakkaus ei ole sallittu, annetaan pppd:lle valitsin 'nodeflate'" +#~ msgid "_Authentication Type:" +#~ msgstr "_Todentamistapa:" -#: ../properties/nm-ppp-dialog.glade.h:30 -msgid "Maximum Receive Unit" -msgstr "MRU" +#~ msgid "_Remote name:" +#~ msgstr "_Nimi palvelimella:" -#: ../properties/nm-ppp-dialog.glade.h:31 -msgid "Maximum Transmit Unit" -msgstr "MTU" +#~ msgid "VPN Connection Manager (PPP generic)" +#~ msgstr "VPN-yhteyksien hallinta (yleinen PPP)" -#: ../properties/nm-ppp-dialog.glade.h:32 -msgid "PPP Options" -msgstr "PPP-valinnat" +#~ msgid "00:00:00:00" +#~ msgstr "00:00:00:00" -#: ../properties/nm-ppp-dialog.glade.h:33 -msgid "Refuse C_HAP" -msgstr "Kiellä C_HAP" +#~ msgid "<b>Delays & Timeouts</b>" +#~ msgstr "<b>Viiveet ja aikakatkaisut</b>" -#: ../properties/nm-ppp-dialog.glade.h:34 -msgid "Refuse _EAP" -msgstr "Kiellä _EAP" +#~ msgid "<b>Packet Parameters</b>" +#~ msgstr "<b>Pakettiparameterit</b>" -#: ../properties/nm-ppp-dialog.glade.h:35 -msgid "Refuse _MS CHAP" -msgstr "Kiellä _MS CHAP" +#~ msgid "<i>Example: 172.16.0.0/16 10.11.12.0/24</i>" +#~ msgstr "<i>Esimerkki: 172.16.0.0/16 10.11.12.0/24</i>" -#: ../properties/nm-ppp-dialog.glade.h:36 -msgid "Require 128 bit M_PPE encryption" -msgstr "Vaadi 128-bittinen M_PPE-salaus" +#~ msgid "" +#~ "A list of extra options to pppd as would be typed on the command line" +#~ msgstr "Lista valitsimista pppd:lle, komentoriviltä annettavassa muodossa" -#: ../properties/nm-ppp-dialog.glade.h:37 -msgid "Require MPPE _encryption" -msgstr "Vaadi MPPE-_salaus" +#~ msgid "Allow B_SD Compression" +#~ msgstr "Salli B_SD-pakkaus" -#: ../properties/nm-ppp-dialog.glade.h:38 -msgid "Require explicit IP _address" -msgstr "Vaadi erikseen määritelty IP-_osoite" +#~ msgid "C_hannel:" +#~ msgstr "_Kanava:" -#: ../properties/nm-ppp-dialog.glade.h:39 -msgid "Requires existing network connection" -msgstr "Vaatii olemassaolevan verkkoyhteyden" +#~ msgid "Co_nnect delay:" +#~ msgstr "_Yhteysviive:" -#: ../properties/nm-ppp-dialog.glade.h:40 -msgid "Routing" -msgstr "Reititys" +#~ msgid "Compression & Encryption" +#~ msgstr "Pakkaus ja salaus" -#: ../properties/nm-ppp-dialog.glade.h:41 -msgid "Serial Options" -msgstr "Sarjaportin valinnat" +#~ msgid "Connection" +#~ msgstr "Yhteys" -#: ../properties/nm-ppp-dialog.glade.h:42 -msgid "Service providers GPRS access point from device config" -msgstr "Palveluntarjoan GPRS APN laitteen asetuksista" +#~ msgid "Connection na_me:" +#~ msgstr "Yhteyden ni_mi:" -#: ../properties/nm-ppp-dialog.glade.h:43 -msgid "Service providers IP address" -msgstr "Palveluntarjoajan IP-osoite" +#~ msgid "Context _number:" +#~ msgstr "_Kontekstin numero:" -#: ../properties/nm-ppp-dialog.glade.h:44 -msgid "Telep_hone number:" -msgstr "_Puhelinnumero:" +#~ msgid "Custom _PPP options:" +#~ msgstr "Omat _PPP-valitsimet:" -#: ../properties/nm-ppp-dialog.glade.h:45 -msgid "" -"This is the friendly name that will be used to identify this network " -"connection, \n" -"e.g. \"Campus VPN\" or \"Corporate Network\"" -msgstr "" -"Nimi, jota käytetään verkkoyhteyden tunnistamiseen, esimerkiksi " -"\"Kampusverkko\" tai \"Yritysverkko\"." +#~ msgid "Debug _output" +#~ msgstr "_Vianetsintätuloste" -#: ../properties/nm-ppp-dialog.glade.h:47 -msgid "Time in seconds between echo requests" -msgstr "ECHO-pyyntöjen välissä oleva aika sekunteina" +#~ msgid "Disconnect after this many LCP echo requests fail" +#~ msgstr "Katkaise yhteys, kun näin monta LCP ECHO-pyyntö epäonnistuu" -#: ../properties/nm-ppp-dialog.glade.h:48 -msgid "Typ_e:" -msgstr "_Tyyppi:" +#~ msgid "E_xclusive device access (UUCP-style lock)" +#~ msgstr "Laite varataan käyttöön (UUCP-tyylinen lukko)" -#: ../properties/nm-ppp-dialog.glade.h:49 -msgid "Use peer _DNS" -msgstr "Käytä saatuja _DNS-asetuksia" +#~ msgid "Enable stateful _MPPE" +#~ msgstr "Käytä tilallista _MPPE:tä" -#: ../properties/nm-ppp-dialog.glade.h:50 -msgid "When checked the \"refuse-chap\" option is passed to pppd." -msgstr "Kun asetettu, annetaan pppd:lle valitsin 'refuse-chap'." +#~ msgid "Find Device" +#~ msgstr "Etsi laite" -#: ../properties/nm-ppp-dialog.glade.h:51 -msgid "When checked the \"refuse-eap\" option is passed to pppd." -msgstr "Kun asetettu, annetaan pppd:lle valitsin 'refuse-eap'." +#~ msgid "" +#~ "For security reasons, options entered in the box above are checked " +#~ "against a list of allowed options before a connection is established. " +#~ "Currently there are no options on the list." +#~ msgstr "" +#~ "Turvallisuussyistä ylläolevaan laatikkoon syötettyjä valitsimia verrataan " +#~ "listaan sallituista valitsimista. Tällä hetkellä lista ei sisällä mitään " +#~ "valitsimia." -#: ../properties/nm-ppp-dialog.glade.h:52 -msgid "When checked the \"refuse-mschap\" option is passed to pppd." -msgstr "Kun asetettu, annetaan pppd:lle valitsin 'refuse-mschap'" +#~ msgid "GPRS Options" +#~ msgstr "GPRS-valitsimet" -#: ../properties/nm-ppp-dialog.glade.h:53 -msgid "When checked the 'lock' option is passed to pppd" -msgstr "Kun asetettu, annetaan pppd:lle valitsin 'lock'" +#~ msgid "Host name or IP address of the PPTP server" +#~ msgstr "PPTP-palvelimen konenimi tai IP-osoite" -#: ../properties/nm-ppp-dialog.glade.h:54 -msgid "When checked the 'require-mppc' option is passed to pppd" -msgstr "Kun asetettu, annetaan pppd:lle valitsin 'require-mppc'" +#~ msgid "IP a_ddress:" +#~ msgstr "_IP-osoite:" -#: ../properties/nm-ppp-dialog.glade.h:55 -msgid "" -"When checked this sets the pppd 'debug' option and adds some extra " -"information from the NetworkManager plugin" -msgstr "" -"Kun asetettu, annetaan pppd:lle valtsin 'debug' ja NetworkManagerin " -"liitännäisestä kerätään joitakin lisätietoja" +#~ msgid "" +#~ "If BSD compression is not allowed the 'nobsdcomp' option is passed to pppd" +#~ msgstr "" +#~ "Jos BSD-pakkaus ei ole sallittu, annetaan pppd:lle valitsin 'nobsdcomp'" -#: ../properties/nm-ppp-dialog.glade.h:56 -msgid "When checked this sets the pppd 'noipdefault' option" -msgstr "Kun asetettu, tämä asettaa pppd:lle valitsimen 'nopidefault'" +#~ msgid "" +#~ "If Deflate compression is not allowed the 'nodefate' option is passed to " +#~ "pppd" +#~ msgstr "" +#~ "Jos deflate-pakkaus ei ole sallittu, annetaan pppd:lle valitsin " +#~ "'nodeflate'" -#: ../properties/nm-ppp-dialog.glade.h:57 -msgid "When checked this sets the pppd 'usepeerdns' option" -msgstr "Kun asetettu, tämä asettaa pppd:lle valitsimen 'usepeerdns'" +#~ msgid "Maximum Receive Unit" +#~ msgstr "MRU" -#: ../properties/nm-ppp-dialog.glade.h:58 -msgid "When this check box is cleared the \"noauth\" option is passed to pppd." -msgstr "Kun rastia ei ole, annetaan pppd:lle valitsin 'noauth'." +#~ msgid "Maximum Transmit Unit" +#~ msgstr "MTU" -#: ../properties/nm-ppp-dialog.glade.h:59 -msgid "_Access point name:" -msgstr "_APN:" +#~ msgid "PPP Options" +#~ msgstr "PPP-valinnat" -#: ../properties/nm-ppp-dialog.glade.h:60 -msgid "_Authenticate peer" -msgstr "Todenna _vastapää" +#~ msgid "Refuse C_HAP" +#~ msgstr "Kiellä C_HAP" -#: ../properties/nm-ppp-dialog.glade.h:61 -msgid "_Device address:" -msgstr "_Laiteosoite:" +#~ msgid "Refuse _EAP" +#~ msgstr "Kiellä _EAP" -#: ../properties/nm-ppp-dialog.glade.h:62 -msgid "_Gateway:" -msgstr "_Yhdyskäytävä:" +#~ msgid "Refuse _MS CHAP" +#~ msgstr "Kiellä _MS CHAP" -#: ../properties/nm-ppp-dialog.glade.h:63 -msgid "_Hardware RTS/CTS" -msgstr "_Laitetason RTS/CTS" +#~ msgid "Require 128 bit M_PPE encryption" +#~ msgstr "Vaadi 128-bittinen M_PPE-salaus" -#: ../properties/nm-ppp-dialog.glade.h:64 -msgid "_Import Saved Configuration..." -msgstr "Tuo tallennettu määrittely..." +#~ msgid "Require MPPE _encryption" +#~ msgstr "Vaadi MPPE-_salaus" -#: ../properties/nm-ppp-dialog.glade.h:65 -msgid "_Modem connection" -msgstr "_Modeemiyhteys" +#~ msgid "Require explicit IP _address" +#~ msgstr "Vaadi erikseen määritelty IP-_osoite" -#: ../properties/nm-ppp-dialog.glade.h:66 -msgid "_Only use VPN connection for these addresses:" -msgstr "_Käytä VPN-yhteyttä seuraaville osoitteille:" +#~ msgid "Requires existing network connection" +#~ msgstr "Vaatii olemassaolevan verkkoyhteyden" -#: ../properties/nm-ppp-dialog.glade.h:67 -msgid "_Packet type:" -msgstr "_Pakettityyppi:" +#~ msgid "Routing" +#~ msgstr "Reititys" -#: ../properties/nm-ppp-dialog.glade.h:68 -msgid "_Peer DNS through tunnel" -msgstr "_Yhteyden DNS-asetukset tunnelin kautta" +#~ msgid "Serial Options" +#~ msgstr "Sarjaportin valinnat" -#: ../properties/nm-ppp-dialog.glade.h:69 -msgid "_Require MPPC compression" -msgstr "_Vaadi MPPC-pakkaus" +#~ msgid "Service providers GPRS access point from device config" +#~ msgstr "Palveluntarjoan GPRS APN laitteen asetuksista" -#: ../properties/nm-ppp-properties.c:45 -msgid "pppd tunnel (PPTP, BTGPRS, Dialup)" -msgstr "pppd-tunneli (PPTP, BTGPRS, Dialup)" +#~ msgid "Service providers IP address" +#~ msgstr "Palveluntarjoajan IP-osoite" -#: ../properties/nm-ppp-properties.c:134 -msgid "Name" -msgstr "Nimi" +#~ msgid "Telep_hone number:" +#~ msgstr "_Puhelinnumero:" -#: ../properties/nm-ppp-properties.c:146 -msgid "PPTP Server" -msgstr "PPTP-palvelin" +#~ msgid "" +#~ "This is the friendly name that will be used to identify this network " +#~ "connection, \n" +#~ "e.g. \"Campus VPN\" or \"Corporate Network\"" +#~ msgstr "" +#~ "Nimi, jota käytetään verkkoyhteyden tunnistamiseen, esimerkiksi " +#~ "\"Kampusverkko\" tai \"Yritysverkko\"." -#: ../properties/nm-ppp-properties.c:151 -msgid "Telephone Number" -msgstr "Puhelinnumero" +#~ msgid "Time in seconds between echo requests" +#~ msgstr "ECHO-pyyntöjen välissä oleva aika sekunteina" -#: ../properties/nm-ppp-properties.c:156 -msgid "Bluetooth Address" -msgstr "Bluetooth-osoite" +#~ msgid "Typ_e:" +#~ msgstr "_Tyyppi:" -#: ../properties/nm-ppp-properties.c:161 -msgid "Bluetooth Channel" -msgstr "Bluetooth-kanava" +#~ msgid "Use peer _DNS" +#~ msgstr "Käytä saatuja _DNS-asetuksia" -#: ../properties/nm-ppp-properties.c:166 -msgid "GPRS APN" -msgstr "GPRS APN" +#~ msgid "When checked the \"refuse-chap\" option is passed to pppd." +#~ msgstr "Kun asetettu, annetaan pppd:lle valitsin 'refuse-chap'." -#: ../properties/nm-ppp-properties.c:171 -msgid "GPRS IP" -msgstr "GPRS-IP-osoite" +#~ msgid "When checked the \"refuse-eap\" option is passed to pppd." +#~ msgstr "Kun asetettu, annetaan pppd:lle valitsin 'refuse-eap'." -#: ../properties/nm-ppp-properties.c:176 -msgid "GPRS Context No." -msgstr "GPRS-kontekstin numero" +#~ msgid "When checked the \"refuse-mschap\" option is passed to pppd." +#~ msgstr "Kun asetettu, annetaan pppd:lle valitsin 'refuse-mschap'" -#: ../properties/nm-ppp-properties.c:181 -msgid "GPRS Packet Type" -msgstr "GPRS pakettityyppi" +#~ msgid "When checked the 'lock' option is passed to pppd" +#~ msgstr "Kun asetettu, annetaan pppd:lle valitsin 'lock'" -#: ../properties/nm-ppp-properties.c:186 -msgid "Use CTS/RTS flow control" -msgstr "Käytä CTS/RTS-vuonohjausta" +#~ msgid "When checked the 'require-mppc' option is passed to pppd" +#~ msgstr "Kun asetettu, annetaan pppd:lle valitsin 'require-mppc'" -#: ../properties/nm-ppp-properties.c:191 -msgid "Connect via a modem" -msgstr "Yhdistä modeemin avulla" +#~ msgid "" +#~ "When checked this sets the pppd 'debug' option and adds some extra " +#~ "information from the NetworkManager plugin" +#~ msgstr "" +#~ "Kun asetettu, annetaan pppd:lle valtsin 'debug' ja NetworkManagerin " +#~ "liitännäisestä kerätään joitakin lisätietoja" -#: ../properties/nm-ppp-properties.c:196 -msgid "Require IP to be provided" -msgstr "Vaadi annettu IP" +#~ msgid "When checked this sets the pppd 'noipdefault' option" +#~ msgstr "Kun asetettu, tämä asettaa pppd:lle valitsimen 'nopidefault'" -#: ../properties/nm-ppp-properties.c:201 -msgid "Use Peer DNS" -msgstr "Käytä saatua DNS-määrittelyä" +#~ msgid "When checked this sets the pppd 'usepeerdns' option" +#~ msgstr "Kun asetettu, tämä asettaa pppd:lle valitsimen 'usepeerdns'" -#: ../properties/nm-ppp-properties.c:206 -msgid "Use MPPE encryption" -msgstr "Käytä MPPE-salausta" +#~ msgid "" +#~ "When this check box is cleared the \"noauth\" option is passed to pppd." +#~ msgstr "Kun rastia ei ole, annetaan pppd:lle valitsin 'noauth'." -#: ../properties/nm-ppp-properties.c:211 -msgid "Use 128 bit MPPE encryption" -msgstr "Käytä 128-bittistä MPPE-salausta" +#~ msgid "_Access point name:" +#~ msgstr "_APN:" -#: ../properties/nm-ppp-properties.c:216 -msgid "Enable stateful MPPE" -msgstr "Käytä tilallista MPPE:tä" +#~ msgid "_Device address:" +#~ msgstr "_Laiteosoite:" -#: ../properties/nm-ppp-properties.c:221 -msgid "Use MPPC compression" -msgstr "Käytä MPPC-pakkausta" +#~ msgid "_Hardware RTS/CTS" +#~ msgstr "_Laitetason RTS/CTS" -#: ../properties/nm-ppp-properties.c:226 -msgid "Do not use deflate compression" -msgstr "Älä käytä deflate-pakkausta" +#~ msgid "_Import Saved Configuration..." +#~ msgstr "Tuo tallennettu määrittely..." -#: ../properties/nm-ppp-properties.c:231 -msgid "Do not use BSD compression" -msgstr "Älä käytä BSD-pakkausta" +#~ msgid "_Modem connection" +#~ msgstr "_Modeemiyhteys" -#: ../properties/nm-ppp-properties.c:236 -msgid "Exclusive device access by pppd" -msgstr "Varaa laite pppd:n käyttöön" +#~ msgid "_Only use VPN connection for these addresses:" +#~ msgstr "_Käytä VPN-yhteyttä seuraaville osoitteille:" -#: ../properties/nm-ppp-properties.c:241 -msgid "Authenticate remote peer" -msgstr "Todenna VPN-yhteys" +#~ msgid "_Packet type:" +#~ msgstr "_Pakettityyppi:" -#: ../properties/nm-ppp-properties.c:246 -msgid "Refuse EAP" -msgstr "Kiellä EAP" +#~ msgid "_Peer DNS through tunnel" +#~ msgstr "_Yhteyden DNS-asetukset tunnelin kautta" -#: ../properties/nm-ppp-properties.c:251 -msgid "Refuse CHAP" -msgstr "Kiellä CHAP" +#~ msgid "_Require MPPC compression" +#~ msgstr "_Vaadi MPPC-pakkaus" -#: ../properties/nm-ppp-properties.c:256 -msgid "Refuse MSCHAP" -msgstr "Kiellä MSCHAP" +#~ msgid "pppd tunnel (PPTP, BTGPRS, Dialup)" +#~ msgstr "pppd-tunneli (PPTP, BTGPRS, Dialup)" -#: ../properties/nm-ppp-properties.c:261 -msgid "Maximum transmit unit (in bytes)" -msgstr "Suurin lähetysyksikkö MTU (tavuina)" +#~ msgid "Name" +#~ msgstr "Nimi" -#: ../properties/nm-ppp-properties.c:266 -msgid "Maximum receive unit (in bytes)" -msgstr "Suurin vastaanottoyksikkö MRU (tavuina)" +#~ msgid "PPTP Server" +#~ msgstr "PPTP-palvelin" -#: ../properties/nm-ppp-properties.c:271 -msgid "Number of failed LCP echos to cause disconnect" -msgstr "Epäonnistuneiden LCP ECHO-viestien määrä, joka katkaisee yhteyden" +#~ msgid "Telephone Number" +#~ msgstr "Puhelinnumero" -#: ../properties/nm-ppp-properties.c:276 -msgid "Interval (in seconds) at which to issue LCP echos" -msgstr "LCP ECHO-viestien väli sekunteina" +#~ msgid "Bluetooth Address" +#~ msgstr "Bluetooth-osoite" -#: ../properties/nm-ppp-properties.c:281 -msgid "Interval (in milliseconds) to wait before connecting." -msgstr "Ennen yhteyden avausta odotettava aika millisekuntena." +#~ msgid "Bluetooth Channel" +#~ msgstr "Bluetooth-kanava" -#: ../properties/nm-ppp-properties.c:286 -msgid "Custom PPP options" -msgstr "Omat PPP-valitsimet" +#~ msgid "GPRS APN" +#~ msgstr "GPRS APN" -#: ../properties/nm-ppp-properties.c:296 -msgid "Use Peer DNS over the Tunnel" -msgstr "Käytä yhteyden DNS-asetuksia tunnelissa" +#~ msgid "GPRS IP" +#~ msgstr "GPRS-IP-osoite" -#: ../properties/nm-ppp-properties.c:302 -msgid "Specific networks available" -msgstr "Halutut verkot ovat saatavilla" +#~ msgid "GPRS Context No." +#~ msgstr "GPRS-kontekstin numero" -#: ../properties/nm-ppp-properties.c:308 -msgid "Limit to specific networks" -msgstr "Rajaa haluttuihin verkkoihin" +#~ msgid "GPRS Packet Type" +#~ msgstr "GPRS pakettityyppi" -#: ../properties/vpnui_impl.c:229 -#, c-format -msgid "The following '%s' connection will be created:" -msgstr "Seuraava \"%s\"-yhteys luodaan:" +#~ msgid "Use CTS/RTS flow control" +#~ msgstr "Käytä CTS/RTS-vuonohjausta" -#: ../properties/vpnui_impl.c:242 -#, c-format -msgid "\t%s: %s\n" -msgstr "\t%s: %s\n" +#~ msgid "Connect via a modem" +#~ msgstr "Yhdistä modeemin avulla" -#: ../properties/vpnui_impl.c:245 -msgid "The connection details can be changed using the \"Back\" button." -msgstr "Yhteyden yksityiskohtia voi muuttaa valitsemalla \"Takaisin\"." +#~ msgid "Require IP to be provided" +#~ msgstr "Vaadi annettu IP" -#: ../properties/vpnui_impl.c:317 -msgid "Select file to import" -msgstr "Valitse tuotava tiedosto" +#~ msgid "Use Peer DNS" +#~ msgstr "Käytä saatua DNS-määrittelyä" -#. printf ("in impl_export\n"); -#: ../properties/vpnui_impl.c:462 -msgid "Save as..." -msgstr "Tallenna nimellä..." +#~ msgid "Use 128 bit MPPE encryption" +#~ msgstr "Käytä 128-bittistä MPPE-salausta" -#: ../properties/vpnui_impl.c:491 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Tiedosto \"%s\" on jo olemassa." +#~ msgid "Enable stateful MPPE" +#~ msgstr "Käytä tilallista MPPE:tä" + +#~ msgid "Do not use deflate compression" +#~ msgstr "Älä käytä deflate-pakkausta" -#: ../properties/vpnui_impl.c:494 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Haluatko korvata sen tiedostolla jota olet tallentamassa?" +#~ msgid "Do not use BSD compression" +#~ msgstr "Älä käytä BSD-pakkausta" -#: ../src/nm-ppp-starter.c:140 -msgid "VPN Connection failed" -msgstr "VPN-yhteys epäonnistui" +#~ msgid "Exclusive device access by pppd" +#~ msgstr "Varaa laite pppd:n käyttöön" + +#~ msgid "Authenticate remote peer" +#~ msgstr "Todenna VPN-yhteys" + +#~ msgid "Refuse EAP" +#~ msgstr "Kiellä EAP" + +#~ msgid "Refuse CHAP" +#~ msgstr "Kiellä CHAP" + +#~ msgid "Maximum transmit unit (in bytes)" +#~ msgstr "Suurin lähetysyksikkö MTU (tavuina)" + +#~ msgid "Maximum receive unit (in bytes)" +#~ msgstr "Suurin vastaanottoyksikkö MRU (tavuina)" + +#~ msgid "Number of failed LCP echos to cause disconnect" +#~ msgstr "Epäonnistuneiden LCP ECHO-viestien määrä, joka katkaisee yhteyden" + +#~ msgid "Interval (in seconds) at which to issue LCP echos" +#~ msgstr "LCP ECHO-viestien väli sekunteina" + +#~ msgid "Interval (in milliseconds) to wait before connecting." +#~ msgstr "Ennen yhteyden avausta odotettava aika millisekuntena." + +#~ msgid "Custom PPP options" +#~ msgstr "Omat PPP-valitsimet" + +#~ msgid "Use Peer DNS over the Tunnel" +#~ msgstr "Käytä yhteyden DNS-asetuksia tunnelissa" + +#~ msgid "Specific networks available" +#~ msgstr "Halutut verkot ovat saatavilla" + +#~ msgid "Limit to specific networks" +#~ msgstr "Rajaa haluttuihin verkkoihin" + +#~ msgid "The following '%s' connection will be created:" +#~ msgstr "Seuraava \"%s\"-yhteys luodaan:" + +#~ msgid "\t%s: %s\n" +#~ msgstr "\t%s: %s\n" + +#~ msgid "The connection details can be changed using the \"Back\" button." +#~ msgstr "Yhteyden yksityiskohtia voi muuttaa valitsemalla \"Takaisin\"." + +#~ msgid "Select file to import" +#~ msgstr "Valitse tuotava tiedosto" + +#~ msgid "Save as..." +#~ msgstr "Tallenna nimellä..." + +#~ msgid "A file named \"%s\" already exists." +#~ msgstr "Tiedosto \"%s\" on jo olemassa." + +#~ msgid "Do you want to replace it with the one you are saving?" +#~ msgstr "Haluatko korvata sen tiedostolla jota olet tallentamassa?" #~ msgid "auth-chap-window" #~ msgstr "auth-chap-ikkuna" @@ -628,9 +587,6 @@ msgstr "VPN-yhteys epäonnistui" #~ msgid "Remote: %s" #~ msgstr "Palvelin: %s" -#~ msgid "TAP" -#~ msgstr "TAP" - #~ msgid "TUN" #~ msgstr "TUN" @@ -747,9 +703,6 @@ msgstr "VPN-yhteys epäonnistui" #~ msgid "Use cipher:" #~ msgstr "Käytä salausmenetelmää:" -#~ msgid "Username:" -#~ msgstr "Käyttäjätunnus:" - #~ msgid "X.509" #~ msgstr "X.509" diff --git a/vpn-daemons/pptp/po/fr.po b/vpn-daemons/pptp/po/fr.po index a533f68598..900817b210 100644 --- a/vpn-daemons/pptp/po/fr.po +++ b/vpn-daemons/pptp/po/fr.po @@ -3,14 +3,14 @@ # This file is distributed under the same license as the evolution package. # # Jonathan Ernst <jonathan@ernstfamily.ch>, 2007. -# Robert-André Mauchin <zebob.m@pengzone.org>, 2007. +# Robert-André Mauchin <zebob.m@pengzone.org>, 2007-2008. # msgid "" msgstr "" "Project-Id-Version: NetworkManager-pptp\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-01-19 15:59+0100\n" -"PO-Revision-Date: 2008-01-19 16:01+0100\n" +"POT-Creation-Date: 2008-08-15 20:17+0200\n" +"PO-Revision-Date: 2008-08-13 11:40+0200\n" "Last-Translator: Robert-André Mauchin <zebob.m@pengzone.org>\n" "Language-Team: GNOME French Team <gnomefr@traduc.org>\n" "MIME-Version: 1.0\n" @@ -18,585 +18,161 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n>1;\n" -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:792 -msgid "Authentication Type:" -msgstr "Type d'authentification :" - -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:857 -#: ../auth-dialog-general/nm-ppp-auth.glade.h:11 -msgid "_Remember for this session" -msgstr "_Se souvenir pour cette session" - -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:859 -#: ../auth-dialog-general/nm-ppp-auth.glade.h:13 -msgid "_Save in keyring" -msgstr "_Enregistrer dans le trousseau" - -#: ../auth-dialog-general/main.c:48 ../auth-dialog/main.c:140 -#, c-format -msgid "You need to authenticate to access '%s'." -msgstr "Vous devez vous authentifier pour accéder à « %s »" - -#: ../auth-dialog-general/main.c:51 ../auth-dialog/main.c:141 -msgid "Authenticate Connection" -msgstr "Authentifier la connexion" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:2 -#, no-c-format -msgid "" -"<span weight=\"bold\" size=\"larger\">Authentication Information</span>\n" -"\n" -"The connection '%s' may need some form of authentication.\n" -"\n" -"Please select an appropriate authentication type and provide the necessary " -"credentials below:\n" -msgstr "" -"<span weight=\"bold\" size=\"larger\">Informations d'authentification</" -"span>\n" -"\n" -"La connexion à « %s » peut nécessiter une authentification.\n" -"\n" -"Sélectionnez un type d'authentification adéquat et fournissez les " -"informations nécessaires ci-dessous :\n" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:8 -msgid "Authentication Required" -msgstr "Authentification requise" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:9 -msgid "_Authentication Type:" -msgstr "Type d'_authentification :" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:10 -#: ../auth-dialog/gnome-two-password-dialog.c:263 -msgid "_Password:" -msgstr "_Mot de passe :" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:12 -msgid "_Remote name:" -msgstr "Nom _distant :" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:14 -#: ../auth-dialog/gnome-two-password-dialog.c:259 -msgid "_Username:" -msgstr "_Nom d'utilisateur :" - #: ../auth-dialog/gnome-two-password-dialog.c:144 msgid "_Secondary Password:" msgstr "Mot de passe _secondaire :" -#: ../auth-dialog/gnome-two-password-dialog.c:261 +#: ../auth-dialog/gnome-two-password-dialog.c:258 +msgid "_Username:" +msgstr "_Nom d'utilisateur :" + +#: ../auth-dialog/gnome-two-password-dialog.c:260 msgid "_Domain:" msgstr "_Domaine :" -#: ../auth-dialog/gnome-two-password-dialog.c:352 +#: ../auth-dialog/gnome-two-password-dialog.c:262 +msgid "_Password:" +msgstr "_Mot de passe :" + +#: ../auth-dialog/gnome-two-password-dialog.c:351 msgid "Connect _anonymously" msgstr "Se connecter _anonymement" -#: ../auth-dialog/gnome-two-password-dialog.c:357 +#: ../auth-dialog/gnome-two-password-dialog.c:356 msgid "Connect as _user:" msgstr "Se connecter en _tant que :" -#: ../auth-dialog/gnome-two-password-dialog.c:466 -msgid "_Remember password for this session" -msgstr "_Se souvenir du mot de passe pour cette session" - -#: ../auth-dialog/gnome-two-password-dialog.c:468 -msgid "_Save password in keyring" -msgstr "_Enregistrer le mot de passe dans le trousseau" - -#: ../nm-ppp.desktop.in.h:1 -msgid "Add, Remove, and Edit VPN Connections" -msgstr "Ajoute, supprime et édite des connexions VPN" - -#: ../nm-ppp.desktop.in.h:2 -msgid "VPN Connection Manager (PPP generic)" -msgstr "Gestionnaire de connexions VPN (générique PPP)" - -#: ../properties/nm-ppp-dialog.glade.h:1 -msgid "00:00:00:00" -msgstr "00:00:00:00" - -#: ../properties/nm-ppp-dialog.glade.h:2 -msgid "<b>Compression</b>" -msgstr "<b>Compression</b>" - -#: ../properties/nm-ppp-dialog.glade.h:3 -msgid "<b>Delays & Timeouts</b>" -msgstr "<b>Délais et expirations</b>" - -#: ../properties/nm-ppp-dialog.glade.h:4 -msgid "<b>Encryption</b>" -msgstr "<b>Chiffrement</b>" - -#: ../properties/nm-ppp-dialog.glade.h:5 -msgid "<b>IP Options</b>" -msgstr "<b>Options IP</b>" - -#: ../properties/nm-ppp-dialog.glade.h:6 -msgid "<b>Packet Parameters</b>" -msgstr "<b>Paramètres des paquets</b>" - -#: ../properties/nm-ppp-dialog.glade.h:7 -msgid "<i>Example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>Exemple : 172.16.0.0/16 10.11.12.0/24</i>" +#: ../auth-dialog/gnome-two-password-dialog.c:465 +msgid "_Remember passwords for this session" +msgstr "_Se souvenir des mots de passe pour cette session" -#: ../properties/nm-ppp-dialog.glade.h:8 -msgid "A list of extra options to pppd as would be typed on the command line" -msgstr "" -"Une liste d'options supplémentaires pour pppd telles que celles utilisées en " -"ligne de commande" - -#: ../properties/nm-ppp-dialog.glade.h:9 -msgid "Allow B_SD Compression" -msgstr "Permettre la compression BSD" - -#: ../properties/nm-ppp-dialog.glade.h:10 -msgid "Allow _Deflate compression" -msgstr "Permettre la compression « _Deflate »" - -#: ../properties/nm-ppp-dialog.glade.h:11 -msgid "Authentication" -msgstr "Authentification" - -#: ../properties/nm-ppp-dialog.glade.h:12 -msgid "C_hannel:" -msgstr "_Canal :" - -#: ../properties/nm-ppp-dialog.glade.h:13 -msgid "Co_nnect delay:" -msgstr "Délai de co_nnexion :" - -#: ../properties/nm-ppp-dialog.glade.h:14 -msgid "Compression & Encryption" -msgstr "Compression et chiffrement" - -#: ../properties/nm-ppp-dialog.glade.h:15 -msgid "Connection" -msgstr "Connexion" - -#: ../properties/nm-ppp-dialog.glade.h:16 -msgid "Connection na_me:" -msgstr "No_m de la connexion :" - -#: ../properties/nm-ppp-dialog.glade.h:17 -msgid "Context _number:" -msgstr "_Numéro de contexte :" - -#: ../properties/nm-ppp-dialog.glade.h:18 -msgid "Custom _PPP options:" -msgstr "Options _PPP personnalisées :" - -#: ../properties/nm-ppp-dialog.glade.h:19 -msgid "Debug _output" -msgstr "Sortie de débogage" - -#: ../properties/nm-ppp-dialog.glade.h:20 -msgid "Disconnect after this many LCP echo requests fail" -msgstr "Se déconnecter après ce nombre d'échecs à des requêtes echo LCP" - -#: ../properties/nm-ppp-dialog.glade.h:21 -msgid "E_xclusive device access (UUCP-style lock)" -msgstr "Accès e_xclusif au périphérique (verrouillage de type UUCP)" - -#: ../properties/nm-ppp-dialog.glade.h:22 -msgid "Enable stateful _MPPE" -msgstr "Activer le _MPPE avec état" - -#: ../properties/nm-ppp-dialog.glade.h:23 -msgid "Find Device" -msgstr "Chercher un périphérique" +#: ../auth-dialog/gnome-two-password-dialog.c:467 +msgid "_Save passwords in keyring" +msgstr "_Enregistrer les mots de passe dans le trousseau" -#: ../properties/nm-ppp-dialog.glade.h:24 -msgid "" -"For security reasons, options entered in the box above are checked against a " -"list of allowed options before a connection is established. Currently there " -"are no options on the list." -msgstr "" -"Pour des raisons de sécurité, les options saisies dans le champ ci-dessus " -"sont vérifiées à l'aide d'une liste d'options autorisées avant qu'une " -"connexion ne soit établie. Actuellement il n'y a pas d'options dans cette " -"liste." - -#: ../properties/nm-ppp-dialog.glade.h:25 -msgid "GPRS Options" -msgstr "Options GPRS" - -#: ../properties/nm-ppp-dialog.glade.h:26 -msgid "Host name or IP address of the PPTP server" -msgstr "Nom d'hôte ou adresse IP du serveur PPTP" - -#: ../properties/nm-ppp-dialog.glade.h:27 -msgid "IP a_ddress:" -msgstr "A_dresse _IP :" - -#: ../properties/nm-ppp-dialog.glade.h:28 -msgid "" -"If BSD compression is not allowed the 'nobsdcomp' option is passed to pppd" -msgstr "" -"Si la compression BSD n'est pas autorisée l'option « nobsdcomp » est fournie " -"à pppd" - -#: ../properties/nm-ppp-dialog.glade.h:29 -msgid "" -"If Deflate compression is not allowed the 'nodefate' option is passed to pppd" +#: ../auth-dialog/main.c:168 +#, c-format +msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "" -"Si la compression « Deflate » n'est pas autorisée l'option « nodeflate » est " -"fournie à pppd" - -#: ../properties/nm-ppp-dialog.glade.h:30 -msgid "Maximum Receive Unit" -msgstr "Unité de réception maximale" - -#: ../properties/nm-ppp-dialog.glade.h:31 -msgid "Maximum Transmit Unit" -msgstr "Unité de transmission maximale" - -#: ../properties/nm-ppp-dialog.glade.h:32 -msgid "PPP Options" -msgstr "Options PPP" - -#: ../properties/nm-ppp-dialog.glade.h:33 -msgid "Refuse C_HAP" -msgstr "Refuser C_HAP" +"Vous devez vous authentifier pour accéder au réseau privé virtuel (VPN) « %" +"s »." -#: ../properties/nm-ppp-dialog.glade.h:34 -msgid "Refuse _EAP" -msgstr "Refuser _EAP" +#: ../auth-dialog/main.c:169 +msgid "Authenticate VPN" +msgstr "Authentifier le VPN" -#: ../properties/nm-ppp-dialog.glade.h:35 -msgid "Refuse _MS CHAP" -msgstr "Refuser _MS CHAP" +#: ../nm-pptp.desktop.in.h:1 +msgid "Add, Remove, and Edit PPTP VPN Connections" +msgstr "Ajoute, supprime et modifie des connexions VPN PPTP" -#: ../properties/nm-ppp-dialog.glade.h:36 -msgid "Require 128 bit M_PPE encryption" -msgstr "Exiger le chiffrement M_PPE 128 bits" +#: ../nm-pptp.desktop.in.h:2 +msgid "PPTP VPN Connection Manager" +msgstr "Gestionnaire de connexions VPN PPTP" -#: ../properties/nm-ppp-dialog.glade.h:37 -msgid "Require MPPE _encryption" -msgstr "Exiger le chi_ffrement MPPE" +#: ../properties/advanced-dialog.c:147 +msgid "All Available (Default)" +msgstr "Selon la disponibilité (par défaut)" -#: ../properties/nm-ppp-dialog.glade.h:38 -msgid "Require explicit IP _address" -msgstr "Exiger une _adresse IP explicite" +#: ../properties/advanced-dialog.c:151 +msgid "128-bit (most secure)" +msgstr "128-bit (le plus sécurisé)" -#: ../properties/nm-ppp-dialog.glade.h:39 -msgid "Requires existing network connection" -msgstr "Exiger une connexion au réseau existante" +#: ../properties/advanced-dialog.c:160 +msgid "40-bit (less secure)" +msgstr "40-bit (le moins sécurisé)" -#: ../properties/nm-ppp-dialog.glade.h:40 -msgid "Routing" -msgstr "Routage" +#: ../properties/advanced-dialog.c:231 +msgid "PAP" +msgstr "PAP" -#: ../properties/nm-ppp-dialog.glade.h:41 -msgid "Serial Options" -msgstr "Options série" +#: ../properties/advanced-dialog.c:237 +msgid "CHAP" +msgstr "CHAP" -#: ../properties/nm-ppp-dialog.glade.h:42 -msgid "Service providers GPRS access point from device config" -msgstr "" -"Point d'accès GPRS du fournisseur de service depuis la configuration du " -"périphérique" - -#: ../properties/nm-ppp-dialog.glade.h:43 -msgid "Service providers IP address" -msgstr "Adresse IP du fournisseur de service" +#: ../properties/advanced-dialog.c:243 +msgid "MSCHAP" +msgstr "MSCHAP" -#: ../properties/nm-ppp-dialog.glade.h:44 -msgid "Telep_hone number:" -msgstr "Numéro de télép_hone :" +#: ../properties/advanced-dialog.c:249 +msgid "MSCHAPv2" +msgstr "MSCHAPv2" -#: ../properties/nm-ppp-dialog.glade.h:45 -msgid "" -"This is the friendly name that will be used to identify this network " -"connection, \n" -"e.g. \"Campus VPN\" or \"Corporate Network\"" -msgstr "" -"Nom utilisé pour identifier la connexion au réseau (par ex. « VPN du " -"campus » ou « Réseau de l'entreprise »)" +#: ../properties/nm-pptp-dialog.glade.h:1 +msgid "<b>Authentication</b>" +msgstr "<b>Authentification</b>" -#: ../properties/nm-ppp-dialog.glade.h:47 -msgid "Time in seconds between echo requests" -msgstr "Durée en secondes entre deux requêtes echo" +#: ../properties/nm-pptp-dialog.glade.h:2 +msgid "<b>Echo</b>" +msgstr "<b>Écho</b>" -#: ../properties/nm-ppp-dialog.glade.h:48 -msgid "Typ_e:" -msgstr "Typ_e :" +#: ../properties/nm-pptp-dialog.glade.h:3 +msgid "<b>General</b>" +msgstr "<b>Général</b>" -#: ../properties/nm-ppp-dialog.glade.h:49 -msgid "Use peer _DNS" -msgstr "Utiliser un _DNS pair" +#: ../properties/nm-pptp-dialog.glade.h:4 +msgid "<b>Optional</b>" +msgstr "<b>Facultatif</b>" -#: ../properties/nm-ppp-dialog.glade.h:50 -msgid "When checked the \"refuse-chap\" option is passed to pppd." -msgstr "Lorsque cochée, l'option « refuse-chap » est fournie à pppd." +#: ../properties/nm-pptp-dialog.glade.h:5 +msgid "<b>Security and Compression</b>" +msgstr "<b>Sécurité et compression</b>" -#: ../properties/nm-ppp-dialog.glade.h:51 -msgid "When checked the \"refuse-eap\" option is passed to pppd." -msgstr "Lorsque cochée, l'option « refuse-eap » est fournie à pppd." +#: ../properties/nm-pptp-dialog.glade.h:6 +msgid "Ad_vanced..." +msgstr "A_vancé..." -#: ../properties/nm-ppp-dialog.glade.h:52 -msgid "When checked the \"refuse-mschap\" option is passed to pppd." -msgstr "Lorsque cochée, l'option « refuse-mschap » est fournie à pppd." +#: ../properties/nm-pptp-dialog.glade.h:7 +msgid "Allow _BSD data compression" +msgstr "Permettre la compression de données _BSD" -#: ../properties/nm-ppp-dialog.glade.h:53 -msgid "When checked the 'lock' option is passed to pppd" -msgstr "Lorsque cochée, l'option « lock » est fournie à pppd." +#: ../properties/nm-pptp-dialog.glade.h:8 +msgid "Allow _Deflate data compression" +msgstr "Permettre la compression de données _Deflate" -#: ../properties/nm-ppp-dialog.glade.h:54 -msgid "When checked the 'require-mppc' option is passed to pppd" -msgstr "Lorsque cochée, l'option « refuse-chap » est fournie à pppd." +#: ../properties/nm-pptp-dialog.glade.h:9 +msgid "Allow st_ateful encryption" +msgstr "Permettre le _chiffrement avec état" -#: ../properties/nm-ppp-dialog.glade.h:55 -msgid "" -"When checked this sets the pppd 'debug' option and adds some extra " -"information from the NetworkManager plugin" -msgstr "" -"Lorsque cochée, l'option « debug » de pppd est activée et des informations " -"supplémentaires sont ajoutées par le greffon NetworkManager" +#: ../properties/nm-pptp-dialog.glade.h:10 +msgid "Allow the following authentication methods:" +msgstr "Permettre les méthodes d'authentification suivantes :" -#: ../properties/nm-ppp-dialog.glade.h:56 -msgid "When checked this sets the pppd 'noipdefault' option" -msgstr "Lorsque cochée, l'option « noipdefault » de pppd est activée" +#: ../properties/nm-pptp-dialog.glade.h:11 +msgid "Default" +msgstr "Par défaut" -#: ../properties/nm-ppp-dialog.glade.h:57 -msgid "When checked this sets the pppd 'usepeerdns' option" -msgstr "Lorsque cochée, l'option « usepeerdns » de pppd est activée" +#: ../properties/nm-pptp-dialog.glade.h:12 +msgid "Domain:" +msgstr "Domaine :" -#: ../properties/nm-ppp-dialog.glade.h:58 -msgid "When this check box is cleared the \"noauth\" option is passed to pppd." -msgstr "Lorsque décochée, l'option « noauth » est fournie à pppd." +#: ../properties/nm-pptp-dialog.glade.h:13 +msgid "Send PPP _echo packets" +msgstr "Envoyer les pa_quets d'écho PPP" -#: ../properties/nm-ppp-dialog.glade.h:59 -msgid "_Access point name:" -msgstr "Nom du point d'_accès :" +#: ../properties/nm-pptp-dialog.glade.h:14 +msgid "Use TCP _header compression" +msgstr "Utiliser la compression d'en-_têtes TCP" -#: ../properties/nm-ppp-dialog.glade.h:60 -msgid "_Authenticate peer" -msgstr "_Authentifier le pair" +#: ../properties/nm-pptp-dialog.glade.h:15 +msgid "Use _Point-to-Point encryption (MPPE)" +msgstr "Utiliser le chiffrement _Point-to-Point (MPPE)" -#: ../properties/nm-ppp-dialog.glade.h:61 -msgid "_Device address:" -msgstr "A_dresse du périphérique :" +#: ../properties/nm-pptp-dialog.glade.h:16 +msgid "User name:" +msgstr "Nom d'utilisateur :" -#: ../properties/nm-ppp-dialog.glade.h:62 +#: ../properties/nm-pptp-dialog.glade.h:17 msgid "_Gateway:" msgstr "_Passerelle :" -#: ../properties/nm-ppp-dialog.glade.h:63 -msgid "_Hardware RTS/CTS" -msgstr "RTS/CTS ma_tériel" - -#: ../properties/nm-ppp-dialog.glade.h:64 -msgid "_Import Saved Configuration..." -msgstr "_Importer une configuration enregistrée..." - -#: ../properties/nm-ppp-dialog.glade.h:65 -msgid "_Modem connection" -msgstr "Connexion par _modem" - -#: ../properties/nm-ppp-dialog.glade.h:66 -msgid "_Only use VPN connection for these addresses:" -msgstr "Utiliser _uniquement la connexion VPN pour ces adresses" - -#: ../properties/nm-ppp-dialog.glade.h:67 -msgid "_Packet type:" -msgstr "Type de _paquet :" - -#: ../properties/nm-ppp-dialog.glade.h:68 -msgid "_Peer DNS through tunnel" -msgstr "DNS _pair via tunnel" - -#: ../properties/nm-ppp-dialog.glade.h:69 -msgid "_Require MPPC compression" -msgstr "E_xiger la compression MPPC" - -#: ../properties/nm-ppp-properties.c:45 -msgid "pppd tunnel (PPTP, BTGPRS, Dialup)" -msgstr "tunnel pppd (PPTP, BTGPRS, Dialup)" - -#: ../properties/nm-ppp-properties.c:134 -msgid "Name" -msgstr "Nom" - -#: ../properties/nm-ppp-properties.c:146 -msgid "PPTP Server" -msgstr "Serveur PPTP" - -#: ../properties/nm-ppp-properties.c:151 -msgid "Telephone Number" -msgstr "Numéro de téléphone" - -#: ../properties/nm-ppp-properties.c:156 -msgid "Bluetooth Address" -msgstr "Adresse Bluetooth" - -#: ../properties/nm-ppp-properties.c:161 -msgid "Bluetooth Channel" -msgstr "Canal Bluetooth" - -#: ../properties/nm-ppp-properties.c:166 -msgid "GPRS APN" -msgstr "APN GPRS" - -#: ../properties/nm-ppp-properties.c:171 -msgid "GPRS IP" -msgstr "IP GPRS" - -#: ../properties/nm-ppp-properties.c:176 -msgid "GPRS Context No." -msgstr "N° de contexte GPRS" - -#: ../properties/nm-ppp-properties.c:181 -msgid "GPRS Packet Type" -msgstr "Type de paquets GPRS" - -#: ../properties/nm-ppp-properties.c:186 -msgid "Use CTS/RTS flow control" -msgstr "Utiliser le contrôle de flux CTS/RTS" - -#: ../properties/nm-ppp-properties.c:191 -msgid "Connect via a modem" -msgstr "Se connecter à l'aide d'un modem" - -#: ../properties/nm-ppp-properties.c:196 -msgid "Require IP to be provided" -msgstr "Nécessite de fournir une adresse IP" - -#: ../properties/nm-ppp-properties.c:201 -msgid "Use Peer DNS" -msgstr "Utiliser un DNS pair" - -#: ../properties/nm-ppp-properties.c:206 -msgid "Use MPPE encryption" -msgstr "Utiliser le chiffrement MPPE" - -#: ../properties/nm-ppp-properties.c:211 -msgid "Use 128 bit MPPE encryption" -msgstr "Utiliser le chiffrement MPPE 128 bits" - -#: ../properties/nm-ppp-properties.c:216 -msgid "Enable stateful MPPE" -msgstr "Activer le MPPE avec état" - -#: ../properties/nm-ppp-properties.c:221 -msgid "Use MPPC compression" -msgstr "Utiliser la compression MPPC" - -#: ../properties/nm-ppp-properties.c:226 -msgid "Do not use deflate compression" -msgstr "Ne pas utiliser la compression « deflate »" - -#: ../properties/nm-ppp-properties.c:231 -msgid "Do not use BSD compression" -msgstr "Ne pas utiliser la compression BSD" - -#: ../properties/nm-ppp-properties.c:236 -msgid "Exclusive device access by pppd" -msgstr "Accès exclusif au périphérique par pppd" - -#: ../properties/nm-ppp-properties.c:241 -msgid "Authenticate remote peer" -msgstr "Authentifier l'hôte distant" - -#: ../properties/nm-ppp-properties.c:246 -msgid "Refuse EAP" -msgstr "Refuser EAP" - -#: ../properties/nm-ppp-properties.c:251 -msgid "Refuse CHAP" -msgstr "Refuser CHAP" - -#: ../properties/nm-ppp-properties.c:256 -msgid "Refuse MSCHAP" -msgstr "Refuser MSCHAP" - -#: ../properties/nm-ppp-properties.c:261 -msgid "Maximum transmit unit (in bytes)" -msgstr "Unité de transmission maximale (en octets)" - -#: ../properties/nm-ppp-properties.c:266 -msgid "Maximum receive unit (in bytes)" -msgstr "Unité de réception maximale (en octets)" - -#: ../properties/nm-ppp-properties.c:271 -msgid "Number of failed LCP echos to cause disconnect" -msgstr "Nombre d'echos LCP échoués avant de se déconnecter" - -#: ../properties/nm-ppp-properties.c:276 -msgid "Interval (in seconds) at which to issue LCP echos" -msgstr "Intervalle (en secondes) auquel envoyer des echos LCP" - -#: ../properties/nm-ppp-properties.c:281 -msgid "Interval (in milliseconds) to wait before connecting." -msgstr "Intervalle (en millisecondes) à attendre avant de se connecter." - -#: ../properties/nm-ppp-properties.c:286 -msgid "Custom PPP options" -msgstr "Options PPP personnalisées" - -#: ../properties/nm-ppp-properties.c:296 -msgid "Use Peer DNS over the Tunnel" -msgstr "Utiliser le DNS pair via un tunnel" - -#: ../properties/nm-ppp-properties.c:302 -msgid "Specific networks available" -msgstr "Réseaux spécifiques disponibles" - -#: ../properties/nm-ppp-properties.c:308 -msgid "Limit to specific networks" -msgstr "Limiter aux réseaux spécifiques" - -#: ../properties/vpnui_impl.c:229 -#, c-format -msgid "The following '%s' connection will be created:" -msgstr "La connexion « %s » suivante va être créée :" - -#: ../properties/vpnui_impl.c:242 -#, c-format -msgid "\t%s: %s\n" -msgstr "\t%s : %s\n" - -#: ../properties/vpnui_impl.c:245 -msgid "The connection details can be changed using the \"Back\" button." -msgstr "" -"Les détails de connexion peuvent être modifiés en utilisant le bouton " -"« Retour »." - -#: ../properties/vpnui_impl.c:317 -msgid "Select file to import" -msgstr "Sélectionnez le fichier à importer" - -#. printf ("in impl_export\n"); -#: ../properties/vpnui_impl.c:462 -msgid "Save as..." -msgstr "Enregistrer sous..." - -#: ../properties/vpnui_impl.c:491 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Un fichier nommé « %s » existe déjà." - -#: ../properties/vpnui_impl.c:494 -msgid "Do you want to replace it with the one you are saving?" -msgstr "" -"Souhaitez-vous le remplacer par celui que vous êtes en train d'enregistrer ?" - -#: ../src/nm-ppp-starter.c:141 -msgid "VPN Connection failed" -msgstr "La connexion VPN a échoué" - -#~ msgid "auth-chap-window" -#~ msgstr "auth-chap-window" - -#~ msgid "auth-mschapv2-window" -#~ msgstr "auth-mschapv2-window" - -#~ msgid "auth-none-window" -#~ msgstr "auth-none-window" +#: ../properties/nm-pptp-dialog.glade.h:18 +msgid "_Security:" +msgstr "_Sécurité :" -#~ msgid "<b>Connection Name</b>" -#~ msgstr "<b>Nom de la connexion</b>" +#: ../properties/nm-pptp.c:49 +msgid "Point-to-Point Tunneling Protocol (PPTP)" +msgstr "Protocole de tunnel Point-to-Point (PPTP)" -#~ msgid "Telephone number to dial" -#~ msgstr "Numéro de téléphone à composer" +#: ../properties/nm-pptp.c:50 +msgid "Compatible with Microsoft and other PPTP VPN servers." +msgstr "Compatible avec Microsoft et d'autres serveurs VPN PPTP." diff --git a/vpn-daemons/pptp/po/ru.po b/vpn-daemons/pptp/po/ru.po index ed70e2ae20..52be288b0f 100644 --- a/vpn-daemons/pptp/po/ru.po +++ b/vpn-daemons/pptp/po/ru.po @@ -1,568 +1,176 @@ -# translation of ru.po to +# translation of ru.po to Russian # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# This file is distributed under the same license as the NetworkManager package. # -# Leonid Kanter <leon@asplinux.ru>, 2007. +# Leonid Kanter <leon@asplinux.ru>, 2007, 2008. msgid "" msgstr "" "Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-02-28 11:34+0200\n" -"PO-Revision-Date: 2007-03-03 16:49+0200\n" +"POT-Creation-Date: 2008-08-14 17:22+0300\n" +"PO-Revision-Date: 2008-08-14 17:23+0300\n" "Last-Translator: Leonid Kanter <leon@asplinux.ru>\n" -"Language-Team: <gnome-cyr@gnome.org>\n" +"Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:792 -msgid "Authentication Type:" -msgstr "Тип аутентификации:" - -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:857 -#: ../auth-dialog-general/nm-ppp-auth.glade.h:11 -msgid "_Remember for this session" -msgstr "_Запомнить для этого сеанса" - -#: ../auth-dialog-general/gnome-generic-auth-dialog.c:859 -#: ../auth-dialog-general/nm-ppp-auth.glade.h:13 -msgid "_Save in keyring" -msgstr "_Сохранить на брелоке" - -#: ../auth-dialog-general/main.c:48 ../auth-dialog/main.c:140 -#, c-format -msgid "You need to authenticate to access '%s'." -msgstr "Необходима аутентификация для доступа к \"%s\"." - -#: ../auth-dialog-general/main.c:51 ../auth-dialog/main.c:141 -msgid "Authenticate Connection" -msgstr "Аутентификация соединения" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:2 -#, no-c-format -msgid "" -"<span weight=\"bold\" size=\"larger\">Authentication Information</span>\n" -"\n" -"The connection '%s' may need some form of authentication.\n" -"\n" -"Please select an appropriate authentication type and provide the necessary " -"credentials below:\n" -msgstr "" -"<span weight=\"bold\" size=\"larger\">Сведения аутентификации</span>\n" -"\n" -"Для соединения '%s' могут потребоваться некоторые сведения аутентификации.\n" -"\n" -"Выберите подходящий тип аутентификации и предоставьте необходимые параметры ниже:\n" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:8 -msgid "Authentication Required" -msgstr "Требуется аутентификация" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:9 -msgid "_Authentication Type:" -msgstr "Тип _Аутентификации:" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:10 -#: ../auth-dialog/gnome-two-password-dialog.c:272 -msgid "_Password:" -msgstr "_Пароль:" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:12 -msgid "_Remote name:" -msgstr "_Удалённое имя:" +#: ../auth-dialog/gnome-two-password-dialog.c:144 +msgid "_Secondary Password:" +msgstr "_Вторичный пароль:" -#: ../auth-dialog-general/nm-ppp-auth.glade.h:14 -#: ../auth-dialog/gnome-two-password-dialog.c:268 +#: ../auth-dialog/gnome-two-password-dialog.c:258 msgid "_Username:" msgstr "П_ользователь:" -#: ../auth-dialog-general/nm-ppp-auth.glade.h:15 -msgid "auth-chap-window" -msgstr "auth-chap-window" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:16 -msgid "auth-mschapv2-window" -msgstr "auth-mschapv2-window" - -#: ../auth-dialog-general/nm-ppp-auth.glade.h:17 -msgid "auth-none-window" -msgstr "auth-none-window" - -#: ../auth-dialog/gnome-two-password-dialog.c:147 -msgid "_Secondary Password:" -msgstr "_Вторичный пароль:" - -#: ../auth-dialog/gnome-two-password-dialog.c:270 +#: ../auth-dialog/gnome-two-password-dialog.c:260 msgid "_Domain:" msgstr "_Домен:" -#: ../auth-dialog/gnome-two-password-dialog.c:355 +#: ../auth-dialog/gnome-two-password-dialog.c:262 +msgid "_Password:" +msgstr "_Пароль:" + +#: ../auth-dialog/gnome-two-password-dialog.c:351 msgid "Connect _anonymously" msgstr "Подключиться _анонимно" -#: ../auth-dialog/gnome-two-password-dialog.c:360 +#: ../auth-dialog/gnome-two-password-dialog.c:356 msgid "Connect as _user:" msgstr "Подключиться как _пользователь:" -#: ../auth-dialog/gnome-two-password-dialog.c:466 -msgid "_Remember password for this session" +#: ../auth-dialog/gnome-two-password-dialog.c:465 +msgid "_Remember passwords for this session" msgstr "_Запомнить пароль для этого сеанса" -#: ../auth-dialog/gnome-two-password-dialog.c:468 -msgid "_Save password in keyring" +#: ../auth-dialog/gnome-two-password-dialog.c:467 +msgid "_Save passwords in keyring" msgstr "_Сохранить пароль на брелоке" -#: ../nm-ppp.desktop.in.h:1 -msgid "Add, Remove, and Edit VPN Connections" -msgstr "Добавить, изменить или удалить соединения VPN" - -#: ../nm-ppp.desktop.in.h:2 -msgid "VPN Connection Manager (PPP generic)" -msgstr "Менеджер соединений VPN (PPP generic)" - -#: ../properties/nm-ppp-dialog.glade.h:1 -msgid "00:00:00:00" -msgstr "00:00:00:00" - -#: ../properties/nm-ppp-dialog.glade.h:2 -msgid "<b>Compression</b>" -msgstr "<b>Сжатие</b>" - -#: ../properties/nm-ppp-dialog.glade.h:3 -msgid "<b>Connection Name</b>" -msgstr "<b>Имя соединения</b>" - -#: ../properties/nm-ppp-dialog.glade.h:4 -msgid "<b>Delays and TImeouts</b>" -msgstr "<b>Задержки и таймауты</b>" - -#: ../properties/nm-ppp-dialog.glade.h:5 -msgid "<b>Encryption</b>" -msgstr "<b>Шифрование</b>" - -#: ../properties/nm-ppp-dialog.glade.h:6 -msgid "<b>IP Options</b>" -msgstr "<b>Параметры IP</b>" - -#: ../properties/nm-ppp-dialog.glade.h:7 -msgid "<b>Packet Parameters</b>" -msgstr "<b>Параметры пакетов" - -#: ../properties/nm-ppp-dialog.glade.h:8 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>пример: 172.16.0.0/16 10.11.12.0/24</i>" - -#: ../properties/nm-ppp-dialog.glade.h:9 -msgid "A list of extra options to pppd as would be typed on the command line" -msgstr "Список дополнительных параметров pppd, как если бы он был введен в командной строке" - -#: ../properties/nm-ppp-dialog.glade.h:10 -msgid "Allow BSD Compression" -msgstr "Резрешить компрессию BSD" - -#: ../properties/nm-ppp-dialog.glade.h:11 -msgid "Allow Deflate compression" -msgstr "Разрешить компрессию Deflate" - -#: ../properties/nm-ppp-dialog.glade.h:12 -msgid "Authenticate Peer" -msgstr "Аутентифицировать вторую сторону" +#: ../auth-dialog/main.c:168 +#, c-format +msgid "You need to authenticate to access the Virtual Private Network '%s'." +msgstr "Необходима аутентификация для доступа к виртуальной частной сети «%s».." -#: ../properties/nm-ppp-dialog.glade.h:13 -msgid "Authentication" -msgstr "Аутентификация" +#: ../auth-dialog/main.c:169 +msgid "Authenticate VPN" +msgstr "Аутентификация VPN" -#: ../properties/nm-ppp-dialog.glade.h:14 -msgid "Compression & Encryption" -msgstr "Компрессия и шифрование" +#: ../nm-pptp.desktop.in.h:1 +msgid "Add, Remove, and Edit PPTP VPN Connections" +msgstr "Добавить, удалить или изменить PPTP VPN соединения" -#: ../properties/nm-ppp-dialog.glade.h:15 -msgid "Connection" -msgstr "Соединение" +#: ../nm-pptp.desktop.in.h:2 +msgid "PPTP VPN Connection Manager" +msgstr "Менеджер соединений PPTP VPN" -#: ../properties/nm-ppp-dialog.glade.h:16 -msgid "Debug Output" -msgstr "Отладочный вывод" +#: ../properties/advanced-dialog.c:147 +msgid "All Available (Default)" +msgstr "Любое доступное (по умолчанию)" -#: ../properties/nm-ppp-dialog.glade.h:17 -msgid "Disconnect after this many LCP echo requests fail" -msgstr "Разрывать соединение после указанного количества сбоев LCP echo" +#: ../properties/advanced-dialog.c:151 +msgid "128-bit (most secure)" +msgstr "128 бит (самое защищёное)" -#: ../properties/nm-ppp-dialog.glade.h:18 -#: ../properties/nm-ppp-properties.c:216 -msgid "Enable stateful MPPE" -msgstr "Включить stateful MPPE" +#: ../properties/advanced-dialog.c:160 +msgid "40-bit (less secure)" +msgstr "40 бит (менее защищённое)" -#: ../properties/nm-ppp-dialog.glade.h:19 -msgid "Exclusive device access (UUCP-style lock)" -msgstr "Исключительный доступ к устройству (блокировка в стиле UUCP)" +#: ../properties/advanced-dialog.c:231 +msgid "PAP" +msgstr "PAP" -#: ../properties/nm-ppp-dialog.glade.h:20 -msgid "Find Device" -msgstr "Поиск устройства" +#: ../properties/advanced-dialog.c:237 +msgid "CHAP" +msgstr "CHAP" -#: ../properties/nm-ppp-dialog.glade.h:21 -msgid "" -"For security reasons, options entered in the box above are checked against a " -"list of allowed options before a connection is established. Currently there " -"are no options on the list." -msgstr "В" - -#: ../properties/nm-ppp-dialog.glade.h:22 -msgid "GPRS Options" -msgstr "Параметры GPRS" - -#: ../properties/nm-ppp-dialog.glade.h:23 -msgid "Hardware RTS/CTS" -msgstr "Аппаратный RTS/CTS" - -#: ../properties/nm-ppp-dialog.glade.h:24 -msgid "Host name or IP address of the PPTP server" -msgstr "Имя узла или IP-адрес сервера PPTP" - -#: ../properties/nm-ppp-dialog.glade.h:25 -msgid "If BSD compression is not allowed the 'nobsdcomp' option is passed to pppd" -msgstr "Если компрессия BSD не разрешена, демону pppd передаётся параметр 'nobsdcomp'" - -#: ../properties/nm-ppp-dialog.glade.h:26 -msgid "If Deflate compression is not allowed the 'nodefate' option is passed to pppd" -msgstr "Если компрессия Deflate нежалательна, демону pppd будет передаваться параметр 'nodefate'" - -#: ../properties/nm-ppp-dialog.glade.h:27 -msgid "Maximum Receive Unit" -msgstr "MRU" - -#: ../properties/nm-ppp-dialog.glade.h:28 -msgid "Maximum Transmit Unit" -msgstr "MTU" - -#: ../properties/nm-ppp-dialog.glade.h:29 -msgid "Modem Connection" -msgstr "Модемное соединение" - -#: ../properties/nm-ppp-dialog.glade.h:30 -msgid "PPP Options" -msgstr "Параметры PPP" - -#: ../properties/nm-ppp-dialog.glade.h:31 -msgid "Peer DNS through tunnel" -msgstr "Получать DNS через туннель" - -#: ../properties/nm-ppp-dialog.glade.h:32 -#: ../properties/nm-ppp-properties.c:251 -msgid "Refuse CHAP" -msgstr "Отвергать CHAP" - -#: ../properties/nm-ppp-dialog.glade.h:33 -#: ../properties/nm-ppp-properties.c:246 -msgid "Refuse EAP" -msgstr "Отвергать EAP" - -#: ../properties/nm-ppp-dialog.glade.h:34 -msgid "Refuse MS CHAP" -msgstr "Отвергать MS CHAP" - -#: ../properties/nm-ppp-dialog.glade.h:35 -msgid "Require 128 bit MPPE encryption" -msgstr "Требовать шифрование MPPE 128 бит" - -#: ../properties/nm-ppp-dialog.glade.h:36 -msgid "Require Explicit IP Addr" -msgstr "Требовать исключительный адрес IP" - -#: ../properties/nm-ppp-dialog.glade.h:37 -msgid "Require MPPC Compression" -msgstr "Требовать сжатие MPPC" - -#: ../properties/nm-ppp-dialog.glade.h:38 -msgid "Require MPPE encryption" -msgstr "Требовать шифрование MPPE" - -#: ../properties/nm-ppp-dialog.glade.h:39 -msgid "Requires existing network connection" -msgstr "Требуется наличие существующего сетевого соединения" - -#: ../properties/nm-ppp-dialog.glade.h:40 -msgid "Routing" -msgstr "Маршрутизация" - -#: ../properties/nm-ppp-dialog.glade.h:41 -msgid "Serial Options" -msgstr "Параметры последовательного соединения" - -#: ../properties/nm-ppp-dialog.glade.h:42 -msgid "Service providers GPRS access point from device config" -msgstr "Использовать настройку точки доступа GPRS из конфигурации устройства" - -#: ../properties/nm-ppp-dialog.glade.h:43 -msgid "Service providers IP address" -msgstr "IP-адрес провайдера" - -#: ../properties/nm-ppp-dialog.glade.h:44 -msgid "Telephone number to dial" -msgstr "Номер телефона" - -#: ../properties/nm-ppp-dialog.glade.h:45 -msgid "" -"This is the friendly name that will be used to identify this network " -"connection, \n" -"e.g. \"Campus VPN\" or \"Corporate Network\"" -msgstr "Запоминающееся имя для этого соединения, например, \"Корпоративная сеть\"" +#: ../properties/advanced-dialog.c:243 +msgid "MSCHAP" +msgstr "MSCHAP" -#: ../properties/nm-ppp-dialog.glade.h:47 -msgid "Time in seconds between echo requests" -msgstr "Время в секундах между эхо-запросами" +#: ../properties/advanced-dialog.c:249 +msgid "MSCHAPv2" +msgstr "MSCHAPv2" -#: ../properties/nm-ppp-dialog.glade.h:48 -msgid "Type:" -msgstr "Тип:" +#: ../properties/nm-pptp-dialog.glade.h:1 +msgid "<b>Authentication</b>" +msgstr "<b>Аутентификация</b>" -#: ../properties/nm-ppp-dialog.glade.h:49 -#: ../properties/nm-ppp-properties.c:201 -msgid "Use Peer DNS" -msgstr "Получать адреса серверов DNS" +#: ../properties/nm-pptp-dialog.glade.h:2 +msgid "<b>Echo</b>" +msgstr "<b>Эхо</b>" -#: ../properties/nm-ppp-dialog.glade.h:50 -msgid "When checked the \"refuse-chap\" option is passed to pppd." -msgstr "Передавать демону pppd параметр \"refuse-chap\"" +#: ../properties/nm-pptp-dialog.glade.h:3 +msgid "<b>General</b>" +msgstr "<b>Общие</b>" -#: ../properties/nm-ppp-dialog.glade.h:51 -msgid "When checked the \"refuse-eap\" option is passed to pppd." -msgstr "Передавать демону pppd параметр \"refuse-eap\"" +#: ../properties/nm-pptp-dialog.glade.h:4 +msgid "<b>Optional</b>" +msgstr "<b>Дополнительные</b>" -#: ../properties/nm-ppp-dialog.glade.h:52 -msgid "When checked the \"refuse-mschap\" option is passed to pppd." -msgstr "Передавать демону pppd параметр \"refuse-mschap\"" +#: ../properties/nm-pptp-dialog.glade.h:5 +msgid "<b>Security and Compression</b>" +msgstr "<b>Шифрование и сжатие</b>" -#: ../properties/nm-ppp-dialog.glade.h:53 -msgid "When checked the 'lock' option is passed to pppd" -msgstr "Передавать демону pppd параметр \"lock\"" +#: ../properties/nm-pptp-dialog.glade.h:6 +msgid "Ad_vanced..." +msgstr "_Дополнительно..." -#: ../properties/nm-ppp-dialog.glade.h:54 -msgid "When checked the 'require-mppc' option is passed to pppd" -msgstr "Передавать демону pppd параметр \"require-mppc\"" +#: ../properties/nm-pptp-dialog.glade.h:7 +msgid "Allow _BSD data compression" +msgstr "Включить компрессию _BSD" -#: ../properties/nm-ppp-dialog.glade.h:55 -msgid "" -"When checked this sets the pppd 'debug' option and adds some extra " -"information from the NetworkManager plugin" -msgstr "Если этот параметр установлен, демону pppd передаётся параметр 'debug' и добавляется некоторая дополнительная информация от модуля NetworkManager" +#: ../properties/nm-pptp-dialog.glade.h:8 +msgid "Allow _Deflate data compression" +msgstr "Включить компрессию _Deflate" -#: ../properties/nm-ppp-dialog.glade.h:56 -msgid "When checked this sets the pppd 'noipdefault' option" -msgstr "Передавать демону pppd параметр \"noipdefault\"" +#: ../properties/nm-pptp-dialog.glade.h:9 +msgid "Allow st_ateful encryption" +msgstr "Включить _Stateful Encryption" -#: ../properties/nm-ppp-dialog.glade.h:57 -msgid "When checked this sets the pppd 'usepeerdns' option" -msgstr "Передавать демону pppd параметр \"usepeerdns\"" +#: ../properties/nm-pptp-dialog.glade.h:10 +msgid "Allow the following authentication methods:" +msgstr "Разешить следующие методы аутентификации:" -#: ../properties/nm-ppp-dialog.glade.h:58 -msgid "When this check box is cleared the \"noauth\" option is passed to pppd." -msgstr "Передавать демону pppd параметр \"noauth\"" +#: ../properties/nm-pptp-dialog.glade.h:11 +msgid "Default" +msgstr "По умолчанию" -#: ../properties/nm-ppp-dialog.glade.h:59 -msgid "_Access Point Name:" -msgstr "_Имя точки доступа:" +#: ../properties/nm-pptp-dialog.glade.h:12 +msgid "Domain:" +msgstr "Домен:" -#: ../properties/nm-ppp-dialog.glade.h:60 -msgid "_Channel:" -msgstr "_Канал:" +#: ../properties/nm-pptp-dialog.glade.h:13 +msgid "Send PPP _echo packets" +msgstr "Посылать _эхо-пакеты PPP" -#: ../properties/nm-ppp-dialog.glade.h:61 -msgid "_Context Num" -msgstr "_Номер контекста" +#: ../properties/nm-pptp-dialog.glade.h:14 +msgid "Use TCP _header compression" +msgstr "Использовать сжатие _заголовков TCP" -#: ../properties/nm-ppp-dialog.glade.h:62 -msgid "_Custom PPP options:" -msgstr "_Дополнительные параметры PPP:" +#: ../properties/nm-pptp-dialog.glade.h:15 +msgid "Use _Point-to-Point encryption (MPPE)" +msgstr "Использовать шифрование _MPPE" -#: ../properties/nm-ppp-dialog.glade.h:63 -msgid "_Device Address:" -msgstr "_Адрес устройства:" +#: ../properties/nm-pptp-dialog.glade.h:16 +msgid "User name:" +msgstr "Имя пользователя:" -#: ../properties/nm-ppp-dialog.glade.h:64 +#: ../properties/nm-pptp-dialog.glade.h:17 msgid "_Gateway:" msgstr "_Шлюз:" -#: ../properties/nm-ppp-dialog.glade.h:65 -msgid "_IP Address:" -msgstr "_IP-адрес:" - -#: ../properties/nm-ppp-dialog.glade.h:66 -msgid "_Import Saved Configuration..." -msgstr "_Импорт сохранённой конфигурации..." - -#: ../properties/nm-ppp-dialog.glade.h:67 -msgid "_Only use VPN connection for these addresses" -msgstr "_Использовать соединение VPN только для этих адресов" - -#: ../properties/nm-ppp-dialog.glade.h:68 -msgid "_Packet Type" -msgstr "_Тип пакета" - -#: ../properties/nm-ppp-dialog.glade.h:69 -msgid "_Telephone Number:" -msgstr "_Номер телефона:" - -#: ../properties/nm-ppp-dialog.glade.h:70 -msgid "connect-delay" -msgstr "connect-delay" - -#: ../properties/nm-ppp-properties.c:45 -msgid "pppd tunnel (PPTP, BTGPRS, Dialup)" -msgstr "Туннель pppd (PPTP, BTGPRS, Dialup)" - -#: ../properties/nm-ppp-properties.c:134 -msgid "Name" -msgstr "Имя" - -#: ../properties/nm-ppp-properties.c:146 -msgid "PPTP Server" -msgstr "Сервер PPTP" - -#: ../properties/nm-ppp-properties.c:151 -msgid "Telephone Number" -msgstr "Номер телефона" - -#: ../properties/nm-ppp-properties.c:156 -msgid "Bluetooth Address" -msgstr "Адрес Bluetooth" - -#: ../properties/nm-ppp-properties.c:161 -msgid "Bluetooth Channel" -msgstr "Канал Bluetooth" - -#: ../properties/nm-ppp-properties.c:166 -msgid "GPRS APN" -msgstr "GPRS APN" - -#: ../properties/nm-ppp-properties.c:171 -msgid "GPRS IP" -msgstr "GPRS IP" - -#: ../properties/nm-ppp-properties.c:176 -msgid "GPRS Context No." -msgstr "Номер контекста GPRS" - -#: ../properties/nm-ppp-properties.c:181 -msgid "GPRS Packet Type" -msgstr "Тип пакетов GPRS" - -#: ../properties/nm-ppp-properties.c:186 -msgid "Use CTS/RTS flow control" -msgstr "Использовать управление потоком CTS/RTS" - -#: ../properties/nm-ppp-properties.c:191 -msgid "Connect via a modem" -msgstr "Подключиться при помощи модема" - -#: ../properties/nm-ppp-properties.c:196 -msgid "Require IP to be provided" -msgstr "Требовать предоставляния IP" - -#: ../properties/nm-ppp-properties.c:206 -msgid "Use MPPE encryption" -msgstr "Использовать шифрование MPPE" - -#: ../properties/nm-ppp-properties.c:211 -msgid "Use 128 bit MPPE encryption" -msgstr "Использовать шифрование MPPE 128 бит" - -#: ../properties/nm-ppp-properties.c:221 -msgid "Use MPPC compression" -msgstr "Использовать компрессию MPPC" - -#: ../properties/nm-ppp-properties.c:226 -msgid "Do not use deflate compression" -msgstr "Не использовать компрессию deflate" - -#: ../properties/nm-ppp-properties.c:231 -msgid "Do not use BSD compression" -msgstr "Не использовать компрессию BSD" - -#: ../properties/nm-ppp-properties.c:236 -msgid "Exclusive device access by pppd" -msgstr "Исключительный доступ к устройству демоном pppd" - -#: ../properties/nm-ppp-properties.c:241 -msgid "Authenticate remote peer" -msgstr "Аутентифицировать вторую сторону" - -#: ../properties/nm-ppp-properties.c:256 -msgid "Refuse MSCHAP" -msgstr "Отклонять MSCHAP" - -#: ../properties/nm-ppp-properties.c:261 -msgid "Maximum transmit unit (in bytes)" -msgstr "Maximum transmit unit (в байтах)" - -#: ../properties/nm-ppp-properties.c:266 -msgid "Maximum receive unit (in bytes)" -msgstr "Maximum receive unit (в байтах)" - -#: ../properties/nm-ppp-properties.c:271 -msgid "Number of failed LCP echos to cause disconnect" -msgstr "Количество сбоев LCP echo, необходимое для разрыва соединения" - -#: ../properties/nm-ppp-properties.c:276 -msgid "Interval (in seconds) at which to issue LCP echos" -msgstr "Интервал (в секундах) между передачей LCP echo" - -#: ../properties/nm-ppp-properties.c:281 -msgid "Interval (in milliseconds) to wait before connecting." -msgstr "Итервал (в миллисекундах) ожидания перед соединением." - -#: ../properties/nm-ppp-properties.c:286 -msgid "Custom PPP options" -msgstr "Дополнительные параметры PPP" - -#: ../properties/nm-ppp-properties.c:296 -msgid "Use Peer DNS over the Tunnel" -msgstr "Получать адреса серверов DNS" - -#: ../properties/nm-ppp-properties.c:302 -msgid "Specific networks available" -msgstr "Доступны указанные сети" - -#: ../properties/nm-ppp-properties.c:308 -msgid "Limit to specific networks" -msgstr "Только для указанных сетей" - -#: ../properties/vpnui_impl.c:229 -#, c-format -msgid "The following '%s' connection will be created:" -msgstr "Следующее соединение \"%s\" будет создано:" - -#: ../properties/vpnui_impl.c:242 -#, c-format -msgid "\t%s: %s\n" -msgstr "\t%s: %s\n" - -#: ../properties/vpnui_impl.c:245 -msgid "The connection details can be changed using the \"Back\" button." -msgstr "Сведения о соединении можно изменить, если нажать кнопку \"Назад\"." - -#: ../properties/vpnui_impl.c:317 -msgid "Select file to import" -msgstr "Выберите файл для импорта" - -#. printf ("in impl_export\n"); -#: ../properties/vpnui_impl.c:462 -msgid "Save as..." -msgstr "Сохранить как..." - -#: ../properties/vpnui_impl.c:491 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Файл с именем \"%s\" уже существует." +#: ../properties/nm-pptp-dialog.glade.h:18 +msgid "_Security:" +msgstr "_Шифрование:" -#: ../properties/vpnui_impl.c:494 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Вы действительно хотите заменить его?" +#: ../properties/nm-pptp.c:49 +msgid "Point-to-Point Tunneling Protocol (PPTP)" +msgstr "Point-to-Point Tunneling Protocol (PPTP)" -#: ../src/nm-ppp-starter.c:140 -msgid "VPN Connection failed" -msgstr "Сбой соединения VPN" +#: ../properties/nm-pptp.c:50 +msgid "Compatible with Microsoft and other PPTP VPN servers." +msgstr "Совместим с серверами Microsoft и другими серверами PPTP VPN." diff --git a/vpn-daemons/pptp/properties/advanced-dialog.c b/vpn-daemons/pptp/properties/advanced-dialog.c index 7ab8b9b17b..7b03c07190 100644 --- a/vpn-daemons/pptp/properties/advanced-dialog.c +++ b/vpn-daemons/pptp/properties/advanced-dialog.c @@ -29,6 +29,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <errno.h> #include <glib.h> #include <glib/gi18n-lib.h> @@ -36,7 +37,6 @@ #include <nm-connection.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include "advanced-dialog.h" #include "nm-pptp.h" @@ -51,15 +51,6 @@ #define TAG_MSCHAP 2 #define TAG_MSCHAPV2 3 -static void -nm_gvalue_destroy (gpointer data) -{ - GValue *value = (GValue *) data; - - g_value_unset (value); - g_slice_free (GValue, value); -} - static const char *advanced_keys[] = { NM_PPTP_KEY_REFUSE_EAP, NM_PPTP_KEY_REFUSE_PAP, @@ -82,30 +73,13 @@ static void copy_values (gpointer key, gpointer data, gpointer user_data) { GHashTable *hash = (GHashTable *) user_data; - GValue *value = (GValue *) data; const char **i; for (i = &advanced_keys[0]; *i; i++) { if (strcmp ((const char *) key, *i)) continue; - if (G_VALUE_HOLDS_STRING (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - str_to_gvalue (g_value_get_string (value))); - } else if (G_VALUE_HOLDS_INT (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - int_to_gvalue (g_value_get_int (value))); - } else if (G_VALUE_HOLDS_UINT (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - uint_to_gvalue (g_value_get_uint (value))); - } else if (G_VALUE_HOLDS_BOOLEAN (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - bool_to_gvalue (g_value_get_boolean (value))); - } + g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup ((const char *) data)); } } @@ -114,13 +88,13 @@ advanced_dialog_new_hash_from_connection (NMConnection *connection, GError **error) { GHashTable *hash; - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; - hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); + hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); - if (s_vpn_props && s_vpn_props->data) - g_hash_table_foreach (s_vpn_props->data, copy_values, hash); + s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); + if (s_vpn && s_vpn->data) + g_hash_table_foreach (s_vpn->data, copy_values, hash); return hash; } @@ -159,7 +133,7 @@ setup_security_combo (GladeXML *xml, GHashTable *hash) GtkListStore *store; GtkTreeIter iter; int active = -1; - GValue *value; + const char *value; g_return_if_fail (xml != NULL); g_return_if_fail (hash != NULL); @@ -177,7 +151,7 @@ setup_security_combo (GladeXML *xml, GHashTable *hash) gtk_list_store_set (store, &iter, 0, _("128-bit (most secure)"), -1); if (active < 0) { value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE_128); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (value && !strcmp (value, "yes")) active = SEC_INDEX_MPPE_128; } @@ -186,7 +160,7 @@ setup_security_combo (GladeXML *xml, GHashTable *hash) gtk_list_store_set (store, &iter, 0, _("40-bit (less secure)"), -1); if (active < 0) { value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE_40); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (value && !strcmp (value, "yes")) active = SEC_INDEX_MPPE_40; } @@ -225,7 +199,7 @@ auth_methods_setup (GladeXML *xml, GHashTable *hash) GtkWidget *widget; GtkListStore *store; GtkTreeIter iter; - GValue *value; + const char *value; gboolean allowed; gboolean use_mppe = FALSE; GtkCellRendererToggle *check_renderer; @@ -237,40 +211,40 @@ auth_methods_setup (GladeXML *xml, GHashTable *hash) /* Check for MPPE */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (value && !strcmp (value, "yes")) use_mppe = TRUE; /* Or MPPE-128 */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE_128); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (value && !strcmp (value, "yes")) use_mppe = TRUE; /* Or MPPE-40 */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE_40); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (value && !strcmp (value, "yes")) use_mppe = TRUE; /* PAP */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REFUSE_PAP); - allowed = (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) ? FALSE : TRUE; + allowed = (value && !strcmp (value, "yes")) ? FALSE : TRUE; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, _("PAP"), COL_VALUE, allowed, COL_TAG, TAG_PAP, -1); /* CHAP */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REFUSE_CHAP); - allowed = (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) ? FALSE : TRUE; + allowed = (value && !strcmp (value, "yes")) ? FALSE : TRUE; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, _("CHAP"), COL_VALUE, allowed, COL_TAG, TAG_CHAP, -1); /* MSCHAP */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REFUSE_MSCHAP); - allowed = (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) ? FALSE : TRUE; + allowed = (value && !strcmp (value, "yes")) ? FALSE : TRUE; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, _("MSCHAP"), COL_VALUE, allowed, COL_TAG, TAG_MSCHAP, -1); /* PAP */ value = g_hash_table_lookup (hash, NM_PPTP_KEY_REFUSE_MSCHAPV2); - allowed = (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) ? FALSE : TRUE; + allowed = (value && !strcmp (value, "yes")) ? FALSE : TRUE; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, _("MSCHAPv2"), COL_VALUE, allowed, COL_TAG, TAG_MSCHAPV2, -1); @@ -306,7 +280,7 @@ advanced_dialog_new (GHashTable *hash) GtkWidget *dialog = NULL; char *glade_file = NULL; GtkWidget *widget; - GValue *value; + const char *value; g_return_val_if_fail (hash != NULL, NULL); @@ -332,47 +306,41 @@ advanced_dialog_new (GHashTable *hash) g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (mppe_toggled_cb), xml); value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - } + if (value && !strcmp (value, "yes")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); mppe_toggled_cb (widget, xml); + widget = glade_xml_get_widget (xml, "ppp_allow_stateful_mppe"); value = g_hash_table_lookup (hash, NM_PPTP_KEY_MPPE_STATEFUL); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { - widget = glade_xml_get_widget (xml, "ppp_allow_stateful_mppe"); - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - } + if (value && !strcmp (value, "yes")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); widget = glade_xml_get_widget (xml, "ppp_allow_bsdcomp"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); value = g_hash_table_lookup (hash, NM_PPTP_KEY_NOBSDCOMP); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - } + if (value && !strcmp (value, "yes")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); widget = glade_xml_get_widget (xml, "ppp_allow_deflate"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); value = g_hash_table_lookup (hash, NM_PPTP_KEY_NODEFLATE); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - } + if (value && !strcmp (value, "yes")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); widget = glade_xml_get_widget (xml, "ppp_usevj"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); value = g_hash_table_lookup (hash, NM_PPTP_KEY_NO_VJ_COMP); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { - if (g_value_get_boolean (value)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - } + if (value && !strcmp (value, "yes")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); + widget = glade_xml_get_widget (xml, "ppp_send_echo_packets"); value = g_hash_table_lookup (hash, NM_PPTP_KEY_LCP_ECHO_INTERVAL); - if (value && G_VALUE_HOLDS_UINT (value)) { - widget = glade_xml_get_widget (xml, "ppp_send_echo_packets"); - if (g_value_get_uint (value)) + if (value && strlen (value)) { + long int tmp_int; + + errno = 0; + tmp_int = strtol (value, NULL, 10); + if (errno == 0 && tmp_int > 0) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); } @@ -400,7 +368,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) xml = g_object_get_data (G_OBJECT (dialog), "glade-xml"); g_return_val_if_fail (xml != NULL, NULL); - hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); + hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); widget = glade_xml_get_widget (xml, "ppp_use_mppe"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { @@ -408,37 +376,37 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) widget = glade_xml_get_widget (xml, "ppp_mppe_security_combo"); switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) { case SEC_INDEX_MPPE_128: - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE_128), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE_128), g_strdup ("yes")); break; case SEC_INDEX_MPPE_40: - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE_40), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE_40), g_strdup ("yes")); break; default: - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE), g_strdup ("yes")); break; } widget = glade_xml_get_widget (xml, "ppp_allow_stateful_mppe"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_MPPE_STATEFUL), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_MPPE_STATEFUL), g_strdup ("yes")); } widget = glade_xml_get_widget (xml, "ppp_allow_bsdcomp"); if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NOBSDCOMP), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NOBSDCOMP), g_strdup ("yes")); widget = glade_xml_get_widget (xml, "ppp_allow_deflate"); if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NODEFLATE), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NODEFLATE), g_strdup ("yes")); widget = glade_xml_get_widget (xml, "ppp_usevj"); if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NO_VJ_COMP), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NO_VJ_COMP), g_strdup ("yes")); widget = glade_xml_get_widget (xml, "ppp_send_echo_packets"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_LCP_ECHO_FAILURE), uint_to_gvalue (5)); - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_LCP_ECHO_INTERVAL), uint_to_gvalue (30)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_LCP_ECHO_FAILURE), g_strdup_printf ("%d", 5)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_LCP_ECHO_INTERVAL), g_strdup_printf ("%d", 30)); } widget = glade_xml_get_widget (xml, "ppp_auth_methods"); @@ -452,19 +420,19 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error) switch (tag) { case TAG_PAP: if (!allowed) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_PAP), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_PAP), g_strdup ("yes")); break; case TAG_CHAP: if (!allowed) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_CHAP), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_CHAP), g_strdup ("yes")); break; case TAG_MSCHAP: if (!allowed) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_MSCHAP), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_MSCHAP), g_strdup ("yes")); break; case TAG_MSCHAPV2: if (!allowed) - g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_MSCHAPV2), bool_to_gvalue (TRUE)); + g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REFUSE_MSCHAPV2), g_strdup ("yes")); break; default: break; diff --git a/vpn-daemons/pptp/properties/import-export.c b/vpn-daemons/pptp/properties/import-export.c index 5715368941..356a6de5c3 100644 --- a/vpn-daemons/pptp/properties/import-export.c +++ b/vpn-daemons/pptp/properties/import-export.c @@ -35,7 +35,6 @@ #include <glib/gi18n-lib.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> diff --git a/vpn-daemons/pptp/properties/nm-pptp-dialog.glade b/vpn-daemons/pptp/properties/nm-pptp-dialog.glade index 5c746f3784..3216bfe616 100644 --- a/vpn-daemons/pptp/properties/nm-pptp-dialog.glade +++ b/vpn-daemons/pptp/properties/nm-pptp-dialog.glade @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--*- mode: xml -*--> +<!--Generated with glade3 3.4.4 on Tue Aug 12 07:11:36 2008 --> <glade-interface> <widget class="GtkWindow" id="pptp-widget"> <property name="title" translatable="yes">window1</property> @@ -32,9 +32,8 @@ <child> <widget class="GtkTable" id="table2"> <property name="visible">True</property> - <property name="n_rows">1</property> <property name="n_columns">2</property> - <property name="column_spacing">6</property> + <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> <widget class="GtkLabel" id="label23"> @@ -45,7 +44,7 @@ <property name="mnemonic_widget">gateway_entry</property> </widget> <packing> - <property name="x_options">GTK_FILL</property> + <property name="x_options">GTK_SHRINK | GTK_FILL</property> <property name="y_options"></property> </packing> </child> @@ -97,7 +96,7 @@ <property name="visible">True</property> <property name="n_rows">2</property> <property name="n_columns">2</property> - <property name="column_spacing">6</property> + <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> <widget class="GtkLabel" id="label26"> @@ -106,44 +105,44 @@ <property name="label" translatable="yes">User name:</property> </widget> <packing> - <property name="x_options">GTK_FILL</property> + <property name="x_options">GTK_SHRINK | GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkEntry" id="user_entry"> + <widget class="GtkLabel" id="label27"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Domain:</property> </widget> <packing> - <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="x_options">GTK_SHRINK | GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label27"> + <widget class="GtkEntry" id="domain_entry"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Domain:</property> + <property name="can_focus">True</property> </widget> <packing> + <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="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkEntry" id="domain_entry"> + <widget class="GtkEntry" id="user_entry"> <property name="visible">True</property> <property name="can_focus">True</property> </widget> <packing> <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"></property> </packing> </child> @@ -170,7 +169,6 @@ <widget class="GtkButton" id="advanced_button"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> <property name="response_id">0</property> <child> <widget class="GtkHBox" id="hbox2"> @@ -229,8 +227,8 @@ <child> <widget class="GtkVBox" id="PppPage"> <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">16</property> + <property name="border_width">5</property> + <property name="spacing">18</property> <child> <widget class="GtkVBox" id="vbox2"> <property name="visible">True</property> @@ -317,14 +315,16 @@ <child> <widget class="GtkVBox" id="vbox6"> <property name="visible">True</property> + <property name="spacing">6</property> <child> <widget class="GtkVBox" id="vbox7"> <property name="visible">True</property> + <property name="spacing">6</property> <child> <widget class="GtkCheckButton" id="ppp_use_mppe"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Use Point-to-Point Encryption (MPPE)</property> + <property name="label" translatable="yes">Use _Point-to-Point encryption (MPPE)</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> @@ -341,18 +341,21 @@ <child> <widget class="GtkVBox" id="vbox1"> <property name="visible">True</property> + <property name="spacing">6</property> <child> <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> + <property name="spacing">12</property> <child> <widget class="GtkLabel" id="ppp_mppe_security_label"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Security:</property> + <property name="label" translatable="yes">_Security:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">ppp_mppe_security_combo</property> </widget> <packing> <property name="expand">False</property> - <property name="padding">6</property> </packing> </child> <child> @@ -361,6 +364,7 @@ <property name="items" translatable="yes">Default</property> </widget> <packing> + <property name="expand">False</property> <property name="position">1</property> </packing> </child> @@ -370,7 +374,7 @@ <widget class="GtkCheckButton" id="ppp_allow_stateful_mppe"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow Stateful Encryption</property> + <property name="label" translatable="yes">Allow st_ateful encryption</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> @@ -398,7 +402,7 @@ <widget class="GtkCheckButton" id="ppp_allow_bsdcomp"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow BSD data compression</property> + <property name="label" translatable="yes">Allow _BSD data compression</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> @@ -413,7 +417,7 @@ <widget class="GtkCheckButton" id="ppp_allow_deflate"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Allow Deflate data compression</property> + <property name="label" translatable="yes">Allow _Deflate data compression</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> @@ -428,7 +432,7 @@ <widget class="GtkCheckButton" id="ppp_usevj"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Use TCP header compression</property> + <property name="label" translatable="yes">Use TCP _header compression</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> @@ -477,7 +481,7 @@ <widget class="GtkCheckButton" id="ppp_send_echo_packets"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Send PPP echo packets</property> + <property name="label" translatable="yes">Send PPP _echo packets</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> @@ -507,8 +511,7 @@ <widget class="GtkButton" id="cancel_button"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="label" translatable="yes">gtk-cancel</property> + <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="response_id">-6</property> </widget> @@ -517,8 +520,7 @@ <widget class="GtkButton" id="ok_button"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="label" translatable="yes">gtk-ok</property> + <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="response_id">-5</property> </widget> diff --git a/vpn-daemons/pptp/properties/nm-pptp.c b/vpn-daemons/pptp/properties/nm-pptp.c index 756c249ced..31df478118 100644 --- a/vpn-daemons/pptp/properties/nm-pptp.c +++ b/vpn-daemons/pptp/properties/nm-pptp.c @@ -38,7 +38,6 @@ #include <nm-vpn-plugin-ui-interface.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> @@ -213,14 +212,14 @@ static gboolean init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **error) { PptpPluginUiWidgetPrivate *priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; GtkWidget *widget; GtkListStore *store; GtkTreeIter iter; int active = -1; - GValue *value; + const char *value; - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); + s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); @@ -228,10 +227,10 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, widget); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_GATEWAY); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_GATEWAY); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -239,10 +238,10 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, widget); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_USER); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_USER); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -250,10 +249,10 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, widget); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_DOMAIN); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_DOMAIN); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -272,76 +271,12 @@ get_widget (NMVpnPluginUiWidgetInterface *iface) return G_OBJECT (priv->widget); } -GValue * -str_to_gvalue (const char *str) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_STRING); - g_value_set_string (value, str); - - return value; -} - -GValue * -bool_to_gvalue (gboolean b) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_BOOLEAN); - g_value_set_boolean (value, b); - - return value; -} - -GValue * -int_to_gvalue (gint i) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, i); - - return value; -} - -GValue * -uint_to_gvalue (guint32 u) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_UINT); - g_value_set_uint (value, u); - - return value; -} - static void hash_copy_advanced (gpointer key, gpointer data, gpointer user_data) { GHashTable *hash = (GHashTable *) user_data; - GValue *value = (GValue *) data; - - if (G_VALUE_HOLDS_STRING (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - str_to_gvalue (g_value_get_string (value))); - } else if (G_VALUE_HOLDS_INT (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - int_to_gvalue (g_value_get_int (value))); - } else if (G_VALUE_HOLDS_BOOLEAN (value)) { - g_hash_table_insert (hash, - g_strdup ((const char *) key), - bool_to_gvalue (g_value_get_boolean (value))); - } else { - g_warning ("%s: unhandled key '%s' of type '%s'", - __func__, (const char *) key, G_VALUE_TYPE_NAME (value)); - } + + g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup ((const char *) data)); } static gboolean @@ -352,9 +287,8 @@ update_connection (NMVpnPluginUiWidgetInterface *iface, PptpPluginUiWidget *self = PPTP_PLUGIN_UI_WIDGET (iface); PptpPluginUiWidgetPrivate *priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (self); NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; GtkWidget *widget; - char *str; + const char *str; GtkTreeModel *model; GtkTreeIter iter; gboolean valid = FALSE; @@ -364,41 +298,29 @@ update_connection (NMVpnPluginUiWidgetInterface *iface, s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ()); s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_PPTP); - nm_connection_add_setting (connection, NM_SETTING (s_vpn)); - - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_setting_vpn_properties_new ()); /* Gateway */ widget = glade_xml_get_widget (priv->xml, "gateway_entry"); - str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); - if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, - g_strdup (NM_PPTP_KEY_GATEWAY), - str_to_gvalue (str)); - } + str = gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) + g_hash_table_insert (s_vpn->data, g_strdup (NM_PPTP_KEY_GATEWAY), g_strdup (str)); /* Username */ widget = glade_xml_get_widget (priv->xml, "user_entry"); - str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); - if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, - g_strdup (NM_PPTP_KEY_USER), - str_to_gvalue (str)); - } + str = gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) + g_hash_table_insert (s_vpn->data, g_strdup (NM_PPTP_KEY_USER), g_strdup (str)); /* Domain */ widget = glade_xml_get_widget (priv->xml, "domain_entry"); - str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); - if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, - g_strdup (NM_PPTP_KEY_DOMAIN), - str_to_gvalue (str)); - } + str = gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) + g_hash_table_insert (s_vpn->data, g_strdup (NM_PPTP_KEY_DOMAIN), g_strdup (str)); if (priv->advanced) - g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn_props->data); + g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn->data); - nm_connection_add_setting (connection, NM_SETTING (s_vpn_props)); + nm_connection_add_setting (connection, NM_SETTING (s_vpn)); valid = TRUE; done: diff --git a/vpn-daemons/pptp/properties/nm-pptp.h b/vpn-daemons/pptp/properties/nm-pptp.h index 9ff8b9fb04..5877f06f37 100644 --- a/vpn-daemons/pptp/properties/nm-pptp.h +++ b/vpn-daemons/pptp/properties/nm-pptp.h @@ -82,13 +82,5 @@ struct _PptpPluginUiWidgetClass { GType pptp_plugin_ui_widget_get_type (void); -GValue *int_to_gvalue (gint i); - -GValue *uint_to_gvalue (guint32 u); - -GValue *bool_to_gvalue (gboolean b); - -GValue *str_to_gvalue (const char *str); - #endif /* _NM_PPTP_H_ */ diff --git a/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c b/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c index bfaae5ac16..29cc70b851 100644 --- a/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c +++ b/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c @@ -154,8 +154,8 @@ value_destroy (gpointer data) static void nm_ip_up (void *data, int arg) { - ipcp_options opts = ipcp_gotoptions[ifunit]; - ipcp_options peer_opts = ipcp_hisoptions[ifunit]; + ipcp_options opts = ipcp_gotoptions[0]; + ipcp_options peer_opts = ipcp_hisoptions[0]; GHashTable *hash; GArray *array; GValue *val; diff --git a/vpn-daemons/pptp/src/nm-pptp-service.c b/vpn-daemons/pptp/src/nm-pptp-service.c index 5d81a27783..771858f4b7 100644 --- a/vpn-daemons/pptp/src/nm-pptp-service.c +++ b/vpn-daemons/pptp/src/nm-pptp-service.c @@ -46,7 +46,6 @@ #include <linux/if_ppp.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include <nm-utils.h> #include "nm-pptp-service.h" @@ -228,8 +227,6 @@ nm_pptp_ppp_service_cache_credentials (NMPptpPppService *self, { NMPptpPppServicePrivate *priv = NM_PPTP_PPP_SERVICE_GET_PRIVATE (self); NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; - GValue *value; const char *username, *password; g_return_val_if_fail (self != NULL, FALSE); @@ -239,7 +236,7 @@ nm_pptp_ppp_service_cache_credentials (NMPptpPppService *self, memset (priv->password, 0, sizeof (priv->password)); s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); - if (!s_vpn) { + if (!s_vpn || !s_vpn->data) { g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, @@ -248,20 +245,9 @@ nm_pptp_ppp_service_cache_credentials (NMPptpPppService *self, return FALSE; } - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); - if (!s_vpn_props || !s_vpn_props->data) { - g_set_error (error, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, - "%s", - "Could not find secrets (connection invalid, no vpn-properties setting)."); - return FALSE; - } - /* Username; try PPTP specific username first, then generic username */ - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_USER); - if (value && G_VALUE_HOLDS_STRING (value)) { - username = g_value_get_string (value); + username = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_USER); + if (username && strlen (username)) { if (!username || !strlen (username)) { g_set_error (error, NM_VPN_PLUGIN_ERROR, @@ -282,23 +268,13 @@ nm_pptp_ppp_service_cache_credentials (NMPptpPppService *self, } } - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_PASSWORD); - if (!value || !G_VALUE_HOLDS_STRING (value)) { - g_set_error (error, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, - "%s", - "Missing VPN password."); - return FALSE; - } - - password = g_value_get_string (value); + password = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_PASSWORD); if (!password || !strlen (password)) { g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, "%s", - "Invalid VPN password."); + "Missing or invalid VPN password."); return FALSE; } @@ -407,9 +383,8 @@ static ValidProperty valid_properties[] = { }; static gboolean -validate_gateway (GValue *value) +validate_gateway (const char *gateway) { - const char *gateway = g_value_get_string (value); const char *p = gateway; if (!gateway || !strlen (gateway)) @@ -426,12 +401,12 @@ validate_gateway (GValue *value) } static void -validate_one_property (gpointer key, gpointer val, gpointer user_data) +validate_one_property (gpointer key, gpointer value, gpointer user_data) { - gboolean *failed = (gboolean *) user_data; + GError **error = (GError **) user_data; int i; - if (*failed) + if (*error) return; /* 'name' is the setting name; always allowed but unused */ @@ -440,47 +415,100 @@ validate_one_property (gpointer key, gpointer val, gpointer user_data) for (i = 0; valid_properties[i].name; i++) { ValidProperty prop = valid_properties[i]; + long int tmp; + + if (strcmp (prop.name, (char *) key)) + continue; - if (!strcmp (prop.name, (char *) key) && prop.type == G_VALUE_TYPE ((GValue *) val)) { - if (!strcmp (prop.name, NM_PPTP_KEY_GATEWAY)) { - if (!validate_gateway ((GValue *) val)) - goto failed; + switch (prop.type) { + case G_TYPE_STRING: + if ( !strcmp (prop.name, NM_PPTP_KEY_GATEWAY) + && !validate_gateway (value)) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid gateway '%s'", + (const char *) key); + return; } - /* Property is ok */ - return; + return; /* valid */ + case G_TYPE_UINT: + errno = 0; + tmp = strtol ((char *) value, NULL, 10); + if (errno == 0) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid integer property '%s'", + (const char *) key); + break; + case G_TYPE_BOOLEAN: + if (!strcmp ((char *) value, "yes") || !strcmp ((char *) value, "no")) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid boolean property '%s' (not yes or no)", + (const char *) key); + break; + default: + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "unhandled property '%s' type %s", + (const char *) key, g_type_name (prop.type)); + break; } } -failed: /* Did not find the property from valid_properties or the type did not match */ - g_warning ("VPN property '%s' failed validation.", (char *) key); - *failed = TRUE; + if (!valid_properties[i].name) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "property '%s' invalid or not supported", + (const char *) key); + } } static gboolean -nm_pptp_properties_validate (GHashTable *properties) +nm_pptp_properties_validate (GHashTable *properties, GError **error) { - gboolean failed = FALSE; int i; - if (g_hash_table_size (properties) < 1) - return failed; + if (g_hash_table_size (properties) < 1) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "No VPN configuration options."); + return FALSE; + } - g_hash_table_foreach (properties, validate_one_property, &failed); - if (failed) + g_hash_table_foreach (properties, validate_one_property, error); + if (*error) return FALSE; /* Ensure required properties exist */ for (i = 0; valid_properties[i].name; i++) { ValidProperty prop = valid_properties[i]; - GValue *value; + const char *value; if (!prop.required) continue; value = g_hash_table_lookup (properties, prop.name); - if (!value || (G_VALUE_TYPE (value) != prop.type)) + if (!value || !strlen (value)) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "Missing required option '%s'.", + prop.name); return FALSE; + } } return TRUE; @@ -602,13 +630,11 @@ free_pppd_args (GPtrArray *args) static GPtrArray * construct_pppd_args (NMPptpPlugin *plugin, NMSettingVPN *s_vpn, - NMSettingVPNProperties *s_vpn_props, const char *pppd, GError **error) { GPtrArray *args = NULL; - GValue *value; - const char *pptp_binary; + const char *value, *pptp_binary; char *ipparam, *tmp; pptp_binary = nm_find_pptp (); @@ -625,8 +651,8 @@ construct_pppd_args (NMPptpPlugin *plugin, g_ptr_array_add (args, (gpointer) g_strdup (pppd)); /* PPTP options */ - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_GATEWAY); - if (!value || !G_VALUE_HOLDS_STRING (value)) { + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_GATEWAY); + if (!value || !strlen (value)) { g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, @@ -638,8 +664,7 @@ construct_pppd_args (NMPptpPlugin *plugin, ipparam = g_strdup_printf ("nm-pptp-service-%d", getpid ()); g_ptr_array_add (args, (gpointer) g_strdup ("pty")); - tmp = g_strdup_printf ("%s %s --nolaunchpppd --logstring %s", - pptp_binary, g_value_get_string (value), ipparam); + tmp = g_strdup_printf ("%s %s --nolaunchpppd --logstring %s", pptp_binary, value, ipparam); g_ptr_array_add (args, (gpointer) tmp); /* PPP options */ @@ -651,66 +676,82 @@ construct_pppd_args (NMPptpPlugin *plugin, g_ptr_array_add (args, (gpointer) g_strdup ("usepeerdns")); g_ptr_array_add (args, (gpointer) g_strdup ("noipdefault")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REFUSE_EAP); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_EAP); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("refuse-eap")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REFUSE_PAP); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_PAP); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("refuse-pap")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REFUSE_CHAP); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_CHAP); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("refuse-chap")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REFUSE_MSCHAP); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_MSCHAP); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("refuse-mschap")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REFUSE_MSCHAPV2); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_MSCHAPV2); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("refuse-mschap-v2")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REQUIRE_MPPE); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REQUIRE_MPPE); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("require-mppe")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REQUIRE_MPPE_40); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REQUIRE_MPPE_40); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("require-mppe-40")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_REQUIRE_MPPE_128); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REQUIRE_MPPE_128); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("require-mppe-128")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_MPPE_STATEFUL); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_MPPE_STATEFUL); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("mppe-stateful")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_NOBSDCOMP); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_NOBSDCOMP); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("nobsdcomp")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_NODEFLATE); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_NODEFLATE); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("nodeflate")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_NO_VJ_COMP); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_NO_VJ_COMP); + if (value && !strcmp (value, "yes")) g_ptr_array_add (args, (gpointer) g_strdup ("novj")); - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_LCP_ECHO_FAILURE); - if (value && G_VALUE_HOLDS_UINT (value) && g_value_get_uint (value)) { - g_ptr_array_add (args, (gpointer) g_strdup ("lcp-echo-failure")); - tmp = g_strdup_printf ("%d", g_value_get_uint (value)); - g_ptr_array_add (args, (gpointer) tmp); + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_LCP_ECHO_FAILURE); + if (value && strlen (value)) { + long int tmp_int; + + /* Convert to integer and then back to string for security's sake + * because strtol ignores some leading and trailing characters. + */ + errno = 0; + tmp_int = strtol (value, NULL, 10); + if (errno == 0) { + g_ptr_array_add (args, (gpointer) g_strdup ("lcp-echo-failure")); + g_ptr_array_add (args, (gpointer) g_strdup_printf ("%ld", tmp_int)); + } } - value = g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_LCP_ECHO_INTERVAL); - if (value && G_VALUE_HOLDS_UINT (value) && g_value_get_uint (value)) { - g_ptr_array_add (args, (gpointer) g_strdup ("lcp-echo-interval")); - tmp = g_strdup_printf ("%d", g_value_get_uint (value)); - g_ptr_array_add (args, (gpointer) tmp); + value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_LCP_ECHO_INTERVAL); + if (value && strlen (value)) { + long int tmp_int; + + /* Convert to integer and then back to string for security's sake + * because strtol ignores some leading and trailing characters. + */ + errno = 0; + tmp_int = strtol (value, NULL, 10); + if (errno == 0) { + g_ptr_array_add (args, (gpointer) g_strdup ("lcp-echo-interval")); + g_ptr_array_add (args, (gpointer) g_strdup_printf ("%ld", tmp_int)); + } } g_ptr_array_add (args, (gpointer) g_strdup ("plugin")); @@ -728,29 +769,30 @@ error: static gboolean nm_pptp_start_pppd_binary (NMPptpPlugin *plugin, NMSettingVPN *s_vpn, - NMSettingVPNProperties *s_vpn_props) + GError **error) { NMPptpPluginPrivate *priv = NM_PPTP_PLUGIN_GET_PRIVATE (plugin); GPid pid; const char *pppd_binary; GPtrArray *pppd_argv; - GError *err = NULL; pppd_binary = nm_find_pppd (); if (!pppd_binary) { - nm_info ("Could not find pppd binary."); + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, + "%s", + "Could not find the pppd binary."); return FALSE; } - pppd_argv = construct_pppd_args (plugin, s_vpn, s_vpn_props, pppd_binary, &err); + pppd_argv = construct_pppd_args (plugin, s_vpn, pppd_binary, error); if (!pppd_argv) return FALSE; if (!g_spawn_async (NULL, (char **) pppd_argv->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &err)) { + G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, error)) { g_ptr_array_free (pppd_argv, TRUE); - nm_warning ("pppd failed to start. error: '%s'", err->message); - g_error_free (err); return FALSE; } free_pppd_args (pppd_argv); @@ -814,24 +856,15 @@ service_ip4_config_cb (NMPptpPppService *service, static gboolean real_connect (NMVPNPlugin *plugin, NMConnection *connection, - GError **err) + GError **error) { NMPptpPluginPrivate *priv = NM_PPTP_PLUGIN_GET_PRIVATE (plugin); NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; - - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); - if (!s_vpn_props || !nm_pptp_properties_validate (s_vpn_props->data)) { - g_set_error (err, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, - "%s", - "Invalid arguments."); - return FALSE; - } s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); g_assert (s_vpn); + if (!nm_pptp_properties_validate (s_vpn->data, error)) + return FALSE; /* Start our pppd plugin helper service */ if (priv->service) @@ -839,7 +872,7 @@ real_connect (NMVPNPlugin *plugin, priv->service = nm_pptp_ppp_service_new (); if (!priv->service) { - g_set_error (err, + g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, "%s", @@ -853,17 +886,11 @@ real_connect (NMVPNPlugin *plugin, /* Cache the username and password so we can relay the secrets to the pppd * plugin when it asks for them. */ - if (!nm_pptp_ppp_service_cache_credentials (priv->service, connection, err)) + if (!nm_pptp_ppp_service_cache_credentials (priv->service, connection, error)) return FALSE; - if (!nm_pptp_start_pppd_binary (NM_PPTP_PLUGIN (plugin), s_vpn, s_vpn_props)) { - g_set_error (err, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, - "%s", - "Could not start pppd binary."); + if (!nm_pptp_start_pppd_binary (NM_PPTP_PLUGIN (plugin), s_vpn, error)) return FALSE; - } return TRUE; } @@ -874,13 +901,13 @@ real_need_secrets (NMVPNPlugin *plugin, char **setting_name, GError **error) { - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); - if (!s_vpn_props) { + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); + if (!s_vpn) { g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, @@ -889,8 +916,8 @@ real_need_secrets (NMVPNPlugin *plugin, return FALSE; } - if (!g_hash_table_lookup (s_vpn_props->data, NM_PPTP_KEY_PASSWORD)) { - *setting_name = NM_SETTING_VPN_PROPERTIES_SETTING_NAME; + if (!g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_PASSWORD)) { + *setting_name = NM_SETTING_VPN_SETTING_NAME; return TRUE; } diff --git a/vpn-daemons/vpnc/ChangeLog b/vpn-daemons/vpnc/ChangeLog index 0d254c57e6..948591e927 100644 --- a/vpn-daemons/vpnc/ChangeLog +++ b/vpn-daemons/vpnc/ChangeLog @@ -1,3 +1,8 @@ +2008-08-11 Dan Williams <dcbw@redhat.com> + + Update to match NM svn3924 vpn setting changes; verify options better; + return more informative errors on VPN launch failures. + 2008-08-06 Dan Williams <dcbw@redhat.com> * src/nm-vpnc-service-vpnc-helper.c diff --git a/vpn-daemons/vpnc/auth-dialog/main.c b/vpn-daemons/vpnc/auth-dialog/main.c index 451c8c3367..312ed0c897 100644 --- a/vpn-daemons/vpnc/auth-dialog/main.c +++ b/vpn-daemons/vpnc/auth-dialog/main.c @@ -30,7 +30,6 @@ #include <gnome-keyring.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include "../src/nm-vpnc-service.h" #include "gnome-two-password-dialog.h" @@ -58,7 +57,7 @@ find_one_password (const char *vpn_id, vpn_id, KEYRING_SN_TAG, GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - NM_SETTING_VPN_PROPERTIES_SETTING_NAME, + NM_SETTING_VPN_SETTING_NAME, KEYRING_SK_TAG, GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, secret_name, @@ -115,7 +114,7 @@ save_vpn_password (const char *vpn_id, GnomeKeyringAttributeList *attrs = NULL; guint32 id = 0; - display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_PROPERTIES_SETTING_NAME, + display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_SETTING_NAME, secret_name, vpn_name, vpn_service); @@ -126,7 +125,7 @@ save_vpn_password (const char *vpn_id, vpn_id); gnome_keyring_attribute_list_append_string (attrs, KEYRING_SN_TAG, - NM_SETTING_VPN_PROPERTIES_SETTING_NAME); + NM_SETTING_VPN_SETTING_NAME); gnome_keyring_attribute_list_append_string (attrs, KEYRING_SK_TAG, secret_name); diff --git a/vpn-daemons/vpnc/po/ChangeLog b/vpn-daemons/vpnc/po/ChangeLog index e5b1cad9ea..efd820d70c 100644 --- a/vpn-daemons/vpnc/po/ChangeLog +++ b/vpn-daemons/vpnc/po/ChangeLog @@ -1,3 +1,15 @@ +2008-08-17 Claude Paroz <claude@2xlibre.net> + + * fr.po: Updated French translation by Robert-André Mauchin. + +2008-08-14 Ilkka Tuohela <hile@iki.fi> + + * fi.po: Updated Finnish translation. + +2008-08-08 Leonid Kanter <leon@asplinux.ru> + + * ru.po: Updated Russian translation + 2008-08-02 Alexander Shopov <ash@contact.bg> * bg.po: Updated Bulgarian translation by diff --git a/vpn-daemons/vpnc/po/fi.po b/vpn-daemons/vpnc/po/fi.po index 0cd5bc78d2..8f39c2cde9 100644 --- a/vpn-daemons/vpnc/po/fi.po +++ b/vpn-daemons/vpnc/po/fi.po @@ -1,6 +1,6 @@ # Finnish messages for NetworkManager-openvpn. -# Copyright (C) 2006 Ilkka Tuohela -# Ilkka Tuohela <hile@iki.fi>, 2006. +# Copyright (C) 2006-2008 Free Software Foundation, Inc. +# Ilkka Tuohela <hile@iki.fi>, 2006-2008. # # Suomennos: http://gnome.fi/ # @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: NetworkManager-openvpn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-02-19 08:05+0300\n" -"PO-Revision-Date: 2007-03-06 06:05+0300\n" +"POT-Creation-Date: 2008-08-14 09:04+0300\n" +"PO-Revision-Date: 2008-08-14 09:00+0300\n" "Last-Translator: Ilkka Tuohela <hile@iki.fi>\n" "Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n" "MIME-Version: 1.0\n" @@ -49,16 +49,16 @@ msgstr "_Muista salasana istunnon ajan" msgid "_Save passwords in keyring" msgstr "_Tallenna salasana avainrenkaaseen" -#: ../auth-dialog/main.c:172 +#: ../auth-dialog/main.c:181 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "Yhteydenotto VPN-verkkoon \"%s\" vaatii kirjautumista." -#: ../auth-dialog/main.c:173 +#: ../auth-dialog/main.c:182 msgid "Authenticate VPN" msgstr "Todenna VPN-yhteyden avaus" -#: ../auth-dialog/main.c:180 +#: ../auth-dialog/main.c:189 msgid "_Group Password:" msgstr "_Ryhmän salasana:" @@ -70,68 +70,47 @@ msgstr "Lisää, poista tai muokkaa VPN-yhteyksiä" msgid "VPN Connection Manager (vpnc)" msgstr "VPN-yhteysohjelmisto (vpnc)" -#: ../properties/nm-vpnc.c:98 -msgid "Compatible Cisco VPN client (vpnc)" +#: ../properties/nm-vpnc.c:50 +msgid "Cisco Compatible VPN (vpnc)" msgstr "Cisco-yhteensopiva VPN-asiakas (vpnc)" -#: ../properties/nm-vpnc.c:543 -msgid "The following vpnc VPN connection will be created:" -msgstr "Seuraava vpnc-yhteys luodaan:" - -#: ../properties/nm-vpnc.c:545 -#, c-format -msgid "Name: %s" -msgstr "Nimi: %s" - -#: ../properties/nm-vpnc.c:548 -#, c-format -msgid "Gateway: %s" -msgstr "Yhdyskäytävä: %s" - -#: ../properties/nm-vpnc.c:550 -#, c-format -msgid "Group Name: %s" -msgstr "Ryhmän nimi: %s" - -#: ../properties/nm-vpnc.c:554 -#, c-format -msgid "Username: %s" -msgstr "Käyttäjätunnus: %s" +#: ../properties/nm-vpnc.c:51 +msgid "" +"Compatible with various Cisco, Juniper, Netscreen, and Sonicwall IPSec-based " +"VPN gateways." +msgstr "" +"Yhteensopiva useiden esimerkiksi Ciscon, Juniperin, Netscreenin ja Sonicwallin " +"valmistamien IPSec-pohjaisten VPN-yhdyskäytävien kanssa." -#: ../properties/nm-vpnc.c:559 -#, c-format -msgid "Domain: %s" -msgstr "Toimialue: %s" +#: ../properties/nm-vpnc.c:203 +msgid "Secure (default)" +msgstr "Turvallinen (oletus)" -#: ../properties/nm-vpnc.c:564 -#, c-format -msgid "Routes: %s" -msgstr "Reitit: %s" +#: ../properties/nm-vpnc.c:206 +msgid "Weak (use with caution)" +msgstr "Heikko (käytä varoen)" -#: ../properties/nm-vpnc.c:568 -#, c-format -msgid "NAT-Keepalive packet interval: %s" -msgstr "NAT-keepalive -pakettien aikaväli: %s" +#: ../properties/nm-vpnc.c:214 +msgid "None (completely insecure)" +msgstr "Ei salausta (täysin turvaton)" -#: ../properties/nm-vpnc.c:572 -#, c-format -msgid "Enable Single DES" -msgstr "Single-DES -salaus" +#: ../properties/nm-vpnc.c:254 +msgid "NAT-T (default)" +msgstr "NAT-T (oletus)" -#: ../properties/nm-vpnc.c:576 -#, c-format -msgid "Disable NAT Traversal" -msgstr "Poista NAT-läpäisy käytöstä" +#: ../properties/nm-vpnc.c:261 +msgid "Cisco UDP" +msgstr "Cisco UDP" -#: ../properties/nm-vpnc.c:580 -msgid "The connection details can be changed using the \"Edit\" button." -msgstr "Yhteyden yksityiskohtia voi muuttaa valitsemalla \"Muokkaa\"." +#: ../properties/nm-vpnc.c:268 +msgid "Disabled" +msgstr "Ei käytössä" -#: ../properties/nm-vpnc.c:665 +#: ../properties/nm-vpnc.c:658 msgid "TCP tunneling not supported" msgstr "TCP-tunnelointi ei ole tuettu" -#: ../properties/nm-vpnc.c:667 +#: ../properties/nm-vpnc.c:660 #, c-format msgid "" "The VPN settings file '%s' specifies that VPN traffic should be tunneled " @@ -146,330 +125,43 @@ msgstr "" "Yhteys voidaan edelleen luoda ilman TCP-tunnelointia, mutta se ei ehkä toimi " "kuten oli tarkoitus." -#: ../properties/nm-vpnc.c:687 -msgid "Settings import incomplete" -msgstr "Tuodut asetukset olivat vajavaiset" - -#: ../properties/nm-vpnc.c:689 -#, c-format -msgid "" -"The VPN settings file '%s' is incomplete. You may not be able to connect " -"without providing further information." -msgstr "" -"VPN-asetustiedosto \"%s\" ei sisällä kaikkia vaadittavia asetuksia. Voi " -"olla, ettet voi ottaa yhteyttä antamatta lisätietoja." - -#: ../properties/nm-vpnc.c:709 -msgid "Cannot import settings" -msgstr "Asetuksia ei voi tuoda" - -#: ../properties/nm-vpnc.c:711 -#, c-format -msgid "The VPN settings file '%s' could not be read or is invalid." -msgstr "VPN-asetustiedostoa \"%s\" ei voitu lukea tai se on viallinen." - -#: ../properties/nm-vpnc.c:726 -msgid "Select file to import" -msgstr "Valitse tuotava tiedosto" - -#: ../properties/nm-vpnc.c:908 -msgid "Save as..." -msgstr "Tallenna nimellä..." - -#: ../properties/nm-vpnc.c:937 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Tiedosto \"%s\" on jo olemassa." - -#: ../properties/nm-vpnc.c:940 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Haluatko korvata sen tiedostolla jota olet tallentamassa?" - -#: ../properties/nm-vpnc.c:954 -msgid "Failed to export configuration" -msgstr "Asetuksia ei voitu viedä" - -#: ../properties/nm-vpnc.c:956 -#, c-format -msgid "Failed to save file %s" -msgstr "Tiedostoa \"%s\" ei voitu tallentaa" - #: ../properties/nm-vpnc-dialog.glade.h:1 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>esimerkki: 172.16.0.0/16 10.11.12.0/24</i>" +msgid " " +msgstr " " #: ../properties/nm-vpnc-dialog.glade.h:2 -msgid "Connection na_me:" -msgstr "Yhteyden ni_mi:" +msgid "<b>General</b>" +msgstr "<b>Yleisasetukset</b>" #: ../properties/nm-vpnc-dialog.glade.h:3 -msgid "Disable NAT _traversal" -msgstr "Poista NAT-_läpäisy käytöstä" +msgid "<b>Optional</b>" +msgstr "<b>Lisäasetukset</b>" #: ../properties/nm-vpnc-dialog.glade.h:4 -msgid "Enable _weak single DES encryption" -msgstr "Käytä _heikkoa single-DES -salausta" +msgid "Disable Dead Peer Detection" +msgstr "Älä havaitse vastapaan katoamista" #: ../properties/nm-vpnc-dialog.glade.h:5 -msgid "G_roup name:" -msgstr "_Ryhmän nimi:" +msgid "Domain:" +msgstr "Toimialue:" #: ../properties/nm-vpnc-dialog.glade.h:6 -msgid "Import _Saved Configuration..." -msgstr "Tuo _tallennettu määrittely..." +msgid "Encryption Method:" +msgstr "Salausmenetelmä:" #: ../properties/nm-vpnc-dialog.glade.h:7 -msgid "Interval:" -msgstr "Aikaväli:" +msgid "G_roup Name:" +msgstr "_Ryhmän nimi:" #: ../properties/nm-vpnc-dialog.glade.h:8 -msgid "" -"Name used to identify the connection to the private network, e.g. \"Campus " -"VPN\" or \"Corporate Network\"" -msgstr "" -"Yksilöllinen VPN-verkon nimi, esimerkiksi \"Kampusverkko\" tai \"Työpaikan " -"verkko\"." +msgid "NAT Traversal:" +msgstr "NAT-läpäisytapa:" #: ../properties/nm-vpnc-dialog.glade.h:9 -msgid "Optional" -msgstr "Valinnaiset tiedot" +msgid "User name:" +msgstr "Käyttäjätunnus:" #: ../properties/nm-vpnc-dialog.glade.h:10 -msgid "Override _user name" -msgstr "Itsemääritelty _käyttäjätunnus" - -#: ../properties/nm-vpnc-dialog.glade.h:11 -msgid "" -"Please enter the information provided by your system administrator below. Do " -"not enter your password here as you will be prompted when connecting." -msgstr "" -"Syötä järjestelmän ylläpitäjältä saamasi tiedot alla oleviin kohtiin. Älä " -"syötä tähän salasanaasi, sillä se kysytään vasta otettaessa yhteyttä." - -#: ../properties/nm-vpnc-dialog.glade.h:12 -msgid "" -"Please note that the file you import is not a Cisco VPN or VPNC " -"configuration file. Ask your adminstrator for the file." -msgstr "" -"Huomaa, että tuotava tiedosto ei ole Cisco VPN tai vpnc-asetustiedosto. Kysy " -"ylläpitäjältäsi oikeaa tiedostoa." - -#: ../properties/nm-vpnc-dialog.glade.h:13 -msgid "Required" -msgstr "Vaaditut" - -#: ../properties/nm-vpnc-dialog.glade.h:14 -msgid "Use NAT _keepalive packets" -msgstr "Käytä NAT-_keepalive -paketteja" - -#: ../properties/nm-vpnc-dialog.glade.h:15 -msgid "Use _domain for authentication" -msgstr "Käytä _aluenimeä tunnistautumiseen" - -#: ../properties/nm-vpnc-dialog.glade.h:16 msgid "_Gateway:" msgstr "_Yhdyskäytävä:" -#: ../properties/nm-vpnc-dialog.glade.h:17 -msgid "_Only use VPN connection for these addresses" -msgstr "_Käytä VPN-yhteyttä seuraaville osoitteille" - -#~ msgid "" -#~ "The VPN login failed because the user name and password were not accepted." -#~ msgstr "" -#~ "VPN-kirjautuminen ei onnistunut, koska käyttäjätunnusta ja salasanaa ei " -#~ "hyväksytty." - -#~ msgid "The VPN login failed because the VPN program could not be started." -#~ msgstr "" -#~ "VPN-kirjautuminen epäonnistui, koska VPN-ohjelmaa ei voitu käynnistää." - -#~ msgid "" -#~ "The VPN login failed because the VPN program could not connect to the VPN " -#~ "server." -#~ msgstr "" -#~ "VPN-kirjatuminen epäonnistui, koska VPN-ohjelma ei saanut yhteyttä VPN-" -#~ "palvelimeen." - -#~ msgid "" -#~ "The VPN login failed because the VPN configuration options were invalid." -#~ msgstr "" -#~ "VPN-kirjautuminen epäonnistui, koska VPN-asetuksten valinnat olivat " -#~ "virheelliset." - -#~ msgid "" -#~ "The VPN login failed because the VPN program received an invalid " -#~ "configuration from the VPN server." -#~ msgstr "" -#~ "VPN-kirjautumien epäonnstui, koska VPN-ohjelma sai epäyhteensopivat " -#~ "asetukset VPN-palvelimelta." - -#~ msgid "<b>Connection Information</b>" -#~ msgstr "<b>Tietoja yhteydestä</b>" - -#~ msgid "<b>Connection Name</b>" -#~ msgstr "<b>Yhteyden nimi</b>" - -#~ msgid "O_ptional Information" -#~ msgstr "_Lisätiedot" - -#~ msgid "Certificate password:" -#~ msgstr "Varmennettu salasana:" - -#~ msgid "OpenVPN Client" -#~ msgstr "OpenVPN-asiakas" - -#~ msgid "Connection Type: X.509 Certificates" -#~ msgstr "Yhteyden tyyppi: X.509-varmenteet" - -#~ msgid "CA: %s" -#~ msgstr "CA: %s" - -#~ msgid "Cert: %s" -#~ msgstr "Varmenne: %s" - -#~ msgid "Key: %s" -#~ msgstr "Avain: %s" - -#~ msgid "Connection Type: Shared Key" -#~ msgstr "Yhteyden tyyppi: jaettu avain" - -#~ msgid "Shared Key: %s" -#~ msgstr "Jaettu avain: %s" - -#~ msgid "Local IP: %s" -#~ msgstr "Oma IP-osoite: %s" - -#~ msgid "Remote IP: %s" -#~ msgstr "Palvelimen IP-osoite: %s" - -#~ msgid "Connection Type: Password" -#~ msgstr "Yhteyden tyyppi: Salasana" - -#~ msgid "Connection Type: X.509 with Password Authentication" -#~ msgstr "Yhteyden tyyppi: X.509 salasanalla todennuksella" - -#~ msgid "Remote: %s" -#~ msgstr "Palvelin: %s" - -#~ msgid "Device: %s" -#~ msgstr "Laite: %s" - -#~ msgid "TAP" -#~ msgstr "TAP" - -#~ msgid "TUN" -#~ msgstr "TUN" - -#~ msgid "Protocol: %s" -#~ msgstr "Protokolla: %s" - -#~ msgid "TCP" -#~ msgstr "TCP" - -#~ msgid "UDP" -#~ msgstr "UDP" - -#~ msgid "Use LZO Compression: %s" -#~ msgstr "Käytä LZO-pakkausta: %s" - -#~ msgid "Yes" -#~ msgstr "Kyllä" - -#~ msgid "No" -#~ msgstr "Ei" - -#~ msgid "Cipher: %s" -#~ msgstr "Salausmenetelmä: %s" - -#~ msgid "TLS auth: %s %s" -#~ msgstr "TLS-todentaminen: %s %s" - -#~ msgid "Select CA to use" -#~ msgstr "Valitse käytettävä CA" - -#~ msgid "Select certificate to use" -#~ msgstr "Valitse käytettävä varmenne" - -#~ msgid "Select key to use" -#~ msgstr "Valitse käytettävä avain" - -#~ msgid "Select shared key to use" -#~ msgstr "Valitse käytettävä jaettu avain" - -#~ msgid "Select TA to use" -#~ msgstr "Valitse käytettävä TA" - -#~ msgid "0" -#~ msgstr "0" - -#~ msgid "1" -#~ msgstr "1" - -#~ msgid "CA file:" -#~ msgstr "CA-tiedosto:" - -#~ msgid "Certificate:" -#~ msgstr "Varmenne:" - -#~ msgid "Connection Type:" -#~ msgstr "Yhteyden tyyppi:" - -#~ msgid "Direction:" -#~ msgstr "Suunta:" - -#~ msgid "Key:" -#~ msgstr "Avain:" - -#~ msgid "Local IP:" -#~ msgstr "Paikallinen IP-osoite:" - -#~ msgid "Password" -#~ msgstr "Salasana" - -#~ msgid "Remote IP:" -#~ msgstr "Palvelimen IP-osoite:" - -#~ msgid "Shared Key:" -#~ msgstr "Jaettu avain:" - -#~ msgid "Shared key" -#~ msgstr "Jaettu avain" - -#~ msgid "Use LZO compression" -#~ msgstr "Käytä LZO-pakkausta" - -#~ msgid "Use TAP device" -#~ msgstr "Käytä TAP-laitetta" - -#~ msgid "Use TCP connection" -#~ msgstr "Käytä TCP-yhteyttä" - -#~ msgid "Use TLS auth:" -#~ msgstr "Käytä TLS-todentamista:" - -#~ msgid "Use cipher:" -#~ msgstr "Käytä salausmenetelmää:" - -#~ msgid "Username:" -#~ msgstr "Käyttäjätunnus:" - -#~ msgid "X.509" -#~ msgstr "X.509" - -#~ msgid "" -#~ "X.509 Certificates\n" -#~ "Pre-shared key\n" -#~ "Password Authentication\n" -#~ "X.509 with Password Authentication" -#~ msgstr "" -#~ "X.509-varmenteet\n" -#~ "Jaettu avain\n" -#~ "Salasanalla todentaminen\n" -#~ "X.509 salasanatodennuksella" - -#~ msgid "none" -#~ msgstr "ei mitään" - -#~ msgid "VPN connection failed" -#~ msgstr "VPN-yhteys epäonnistui" diff --git a/vpn-daemons/vpnc/po/fr.po b/vpn-daemons/vpnc/po/fr.po index 2eb44cf4a1..cf5ff2223c 100644 --- a/vpn-daemons/vpnc/po/fr.po +++ b/vpn-daemons/vpnc/po/fr.po @@ -4,14 +4,14 @@ # # Jonathan Ernst <jonathan@ernstfamily.ch>, 2007. # Claude Paroz <claude@2xlibre.net>, 2007. -# Robert-André Mauchin <zebob.m@pengzone.org>, 2007. +# Robert-André Mauchin <zebob.m@pengzone.org>, 2007-2008. # msgid "" msgstr "" "Project-Id-Version: NetworkManager-vpnc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-01-19 15:55+0100\n" -"PO-Revision-Date: 2008-01-19 15:56+0100\n" +"POT-Creation-Date: 2008-08-17 20:46+0200\n" +"PO-Revision-Date: 2008-08-13 11:15:43+0200\n" "Last-Translator: Robert-André Mauchin <zebob.m@pengzone.org>\n" "Language-Team: GNOME French Team <gnomefr@traduc.org>\n" "MIME-Version: 1.0\n" @@ -51,92 +51,69 @@ msgstr "_Conserver les mots de passe pour cette session" msgid "_Save passwords in keyring" msgstr "_Enregistrer les mots de passe dans le trousseau" -#: ../auth-dialog/main.c:172 +#: ../auth-dialog/main.c:181 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "" "Vous devez vous authentifier pour accéder au réseau privé virtuel « %s »." -#: ../auth-dialog/main.c:173 +#: ../auth-dialog/main.c:182 msgid "Authenticate VPN" msgstr "Authentifier le VPN" -#: ../auth-dialog/main.c:180 +#: ../auth-dialog/main.c:189 msgid "_Group Password:" msgstr "Mot de passe du _groupe :" #: ../nm-vpnc.desktop.in.h:1 msgid "Add, Remove, and Edit VPN Connections" -msgstr "Ajoute, supprime et édite des connexions VPN" +msgstr "Ajoute, supprime et modifie des connexions VPN" #: ../nm-vpnc.desktop.in.h:2 msgid "VPN Connection Manager (vpnc)" msgstr "Gestionnaire de connexions VPN (vpnc)" -#: ../properties/nm-vpnc.c:98 -msgid "Compatible Cisco VPN client (vpnc)" -msgstr "Client VPN compatible Cisco (vpnc)" +#: ../properties/nm-vpnc.c:50 +msgid "Cisco Compatible VPN (vpnc)" +msgstr "VPN compatible Cisco (vpnc)" -#: ../properties/nm-vpnc.c:543 -msgid "The following vpnc VPN connection will be created:" -msgstr "La connexion VPN vpnc suivante sera créée :" - -#: ../properties/nm-vpnc.c:545 -#, c-format -msgid "Name: %s" -msgstr "Nom : %s" - -#: ../properties/nm-vpnc.c:548 -#, c-format -msgid "Gateway: %s" -msgstr "Passerelle : %s" - -#: ../properties/nm-vpnc.c:550 -#, c-format -msgid "Group Name: %s" -msgstr "Nom du groupe : %s" - -#: ../properties/nm-vpnc.c:554 -#, c-format -msgid "Username: %s" -msgstr "Nom d'utilisateur : %s" +#: ../properties/nm-vpnc.c:51 +msgid "" +"Compatible with various Cisco, Juniper, Netscreen, and Sonicwall IPSec-based " +"VPN gateways." +msgstr "" +"Compatible avec de nombreuses passerelles VPN basées sur IPSec de Cisco, " +"Juniper, Netscreen et Sonicwall." -#: ../properties/nm-vpnc.c:559 -#, c-format -msgid "Domain: %s" -msgstr "Domaine : %s" +#: ../properties/nm-vpnc.c:203 +msgid "Secure (default)" +msgstr "Sécurisé (par défaut)" -#: ../properties/nm-vpnc.c:564 -#, c-format -msgid "Routes: %s" -msgstr "Routes : %s" +#: ../properties/nm-vpnc.c:206 +msgid "Weak (use with caution)" +msgstr "Faible (à utiliser avec précaution)" -#: ../properties/nm-vpnc.c:568 -#, c-format -msgid "NAT-Keepalive packet interval: %s" -msgstr "Intervalle des paquets NAT-Keepalive : %s" +#: ../properties/nm-vpnc.c:214 +msgid "None (completely insecure)" +msgstr "Aucun (complètement non sécurisé)" -#: ../properties/nm-vpnc.c:572 -#, c-format -msgid "Enable Single DES" -msgstr "Activer le DES unique" +#: ../properties/nm-vpnc.c:254 +msgid "NAT-T (default)" +msgstr "NAT-T (par défaut)" -#: ../properties/nm-vpnc.c:576 -#, c-format -msgid "Disable NAT Traversal" -msgstr "Désactiver la traversée du NAT" +#: ../properties/nm-vpnc.c:261 +msgid "Cisco UDP" +msgstr "UDP Cisco" -#: ../properties/nm-vpnc.c:580 -msgid "The connection details can be changed using the \"Edit\" button." -msgstr "" -"Les détails de connexion peuvent être modifiés en utilisant le bouton " -"« Modifier »." +#: ../properties/nm-vpnc.c:268 +msgid "Disabled" +msgstr "Désactivé" -#: ../properties/nm-vpnc.c:665 +#: ../properties/nm-vpnc.c:658 msgid "TCP tunneling not supported" msgstr "Utilisation d'un tunnel TCP non pris en charge" -#: ../properties/nm-vpnc.c:667 +#: ../properties/nm-vpnc.c:660 #, c-format msgid "" "The VPN settings file '%s' specifies that VPN traffic should be tunneled " @@ -152,172 +129,42 @@ msgstr "" "La connexion sera néanmoins créée sans tunnel TCP ; pour cette raison, la " "connexion pourrait ne pas fonctionner comme prévu." -#: ../properties/nm-vpnc.c:687 -msgid "Settings import incomplete" -msgstr "" - -#: ../properties/nm-vpnc.c:689 -#, c-format -msgid "" -"The VPN settings file '%s' is incomplete. You may not be able to connect " -"without providing further information." -msgstr "" - -#: ../properties/nm-vpnc.c:709 -msgid "Cannot import settings" -msgstr "Impossible d'importer les paramètres" - -#: ../properties/nm-vpnc.c:711 -#, fuzzy, c-format -msgid "The VPN settings file '%s' could not be read or is invalid." -msgstr "" -"Le fichier de configuration VPN « %s » ne contient pas de données valides." - -#: ../properties/nm-vpnc.c:726 -msgid "Select file to import" -msgstr "Sélectionnez le fichier à importer" - -#: ../properties/nm-vpnc.c:908 -msgid "Save as..." -msgstr "Enregistrer sous..." - -#: ../properties/nm-vpnc.c:937 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Un fichier nommé « %s » existe déjà." - -#: ../properties/nm-vpnc.c:940 -msgid "Do you want to replace it with the one you are saving?" -msgstr "" -"Souhaitez-vous le remplacer par celui que vous êtes en train d'enregistrer ?" - -#: ../properties/nm-vpnc.c:954 -msgid "Failed to export configuration" -msgstr "L'exportation de la configuration a échoué" - -#: ../properties/nm-vpnc.c:956 -#, c-format -msgid "Failed to save file %s" -msgstr "L'enregistrement du fichier %s a échoué" - #: ../properties/nm-vpnc-dialog.glade.h:1 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>exemple : 172.16.0.0/16 10.11.12.0/24</i>" +msgid " " +msgstr " " #: ../properties/nm-vpnc-dialog.glade.h:2 -msgid "Connection na_me:" -msgstr "Nom de la connexion :" +msgid "<b>General</b>" +msgstr "<b>Général</b>" #: ../properties/nm-vpnc-dialog.glade.h:3 -msgid "Disable NAT _traversal" -msgstr "Désactiver la _traversée du NAT" +msgid "<b>Optional</b>" +msgstr "<b>Facultatif</b>" #: ../properties/nm-vpnc-dialog.glade.h:4 -msgid "Enable _weak single DES encryption" -msgstr "Activer le chiffrement DES unique faible" +msgid "Disable Dead Peer Detection" +msgstr "Désactiver la détection des pairs bloqués" #: ../properties/nm-vpnc-dialog.glade.h:5 -msgid "G_roup name:" -msgstr "Nom de _groupe :" +msgid "Domain:" +msgstr "Domaine :" #: ../properties/nm-vpnc-dialog.glade.h:6 -msgid "Import _Saved Configuration..." -msgstr "Importer des paramètres _enregistrés..." +msgid "Encryption Method:" +msgstr "Méthode de chiffrement :" #: ../properties/nm-vpnc-dialog.glade.h:7 -msgid "Interval:" -msgstr "Intervalle :" +msgid "G_roup Name:" +msgstr "Nom de g_roupe :" #: ../properties/nm-vpnc-dialog.glade.h:8 -msgid "" -"Name used to identify the connection to the private network, e.g. \"Campus " -"VPN\" or \"Corporate Network\"" -msgstr "" -"Nom utilisé pour identifier la connexion au réseau privé (par ex. « VPN du " -"campus » ou « Réseau de l'entreprise »)" +msgid "NAT Traversal:" +msgstr "Traversée du NAT :" #: ../properties/nm-vpnc-dialog.glade.h:9 -msgid "Optional" -msgstr "Facultatives" +msgid "User name:" +msgstr "Nom d'utilisateur :" #: ../properties/nm-vpnc-dialog.glade.h:10 -msgid "Override _user name" -msgstr "Remplacer le nom d'_utilisateur" - -#: ../properties/nm-vpnc-dialog.glade.h:11 -msgid "" -"Please enter the information provided by your system administrator below. Do " -"not enter your password here as you will be prompted when connecting." -msgstr "" -"Veuillez saisir ci-dessous les informations fournies par votre " -"administrateur système. Ne saisissez pas votre mot de passe ici, car celui-" -"ci vous sera demandé lors de la connexion." - -#: ../properties/nm-vpnc-dialog.glade.h:12 -msgid "" -"Please note that the file you import is not a Cisco VPN or VPNC " -"configuration file. Ask your adminstrator for the file." -msgstr "" -"Veuillez prendre note que le fichier que vous importez n'est pas un fichier " -"de configuration VPN Cisco ou VPNC. Demandez ce fichier à votre " -"administrateur." - -#: ../properties/nm-vpnc-dialog.glade.h:13 -msgid "Required" -msgstr "Obligatoires" - -#: ../properties/nm-vpnc-dialog.glade.h:14 -msgid "Use NAT _keepalive packets" -msgstr "Utiliser des paquets NAT _keepalive" - -#: ../properties/nm-vpnc-dialog.glade.h:15 -msgid "Use _domain for authentication" -msgstr "Utiliser le _domaine pour l'authentification" - -#: ../properties/nm-vpnc-dialog.glade.h:16 msgid "_Gateway:" msgstr "_Passerelle :" - -#: ../properties/nm-vpnc-dialog.glade.h:17 -msgid "_Only use VPN connection for these addresses" -msgstr "Utiliser _uniquement la connexion VPN pour ces adresses" - -#~ msgid "<b>Connection Information</b>" -#~ msgstr "<b>Informations de connexion</b>" - -#~ msgid "<b>Connection Name</b>" -#~ msgstr "<b>Nom de la connexion</b>" - -#~ msgid "" -#~ "The VPN login failed because the user name and password were not accepted." -#~ msgstr "" -#~ "La connexion au VPN a échoué parce que le nom d'utilisateur et le mot de " -#~ "passe n'ont pas été acceptés." - -#~ msgid "The VPN login failed because the VPN program could not be started." -#~ msgstr "" -#~ "La connexion au VPN a échoué parce que le programme VPN n'a pas pu être " -#~ "démarré." - -#~ msgid "" -#~ "The VPN login failed because the VPN program could not connect to the VPN " -#~ "server." -#~ msgstr "" -#~ "La connexion au VPN a échoué parce que le programme VPN n'a pas pu se " -#~ "connecter au serveur VPN." - -#~ msgid "" -#~ "The VPN login failed because the VPN configuration options were invalid." -#~ msgstr "" -#~ "La connexion au VPN a échoué parce que les options de configuration VPN " -#~ "n'étaient pas valides." - -#~ msgid "" -#~ "The VPN login failed because the VPN program received an invalid " -#~ "configuration from the VPN server." -#~ msgstr "" -#~ "La connexion au VPN a échoué parce que le programme VPN a reçu une " -#~ "configuration non valide du serveur VPN." - -#~ msgid "O_ptional Information" -#~ msgstr "Informations _facultatives" diff --git a/vpn-daemons/vpnc/po/ru.po b/vpn-daemons/vpnc/po/ru.po index 9db9fe2a24..d5545e4885 100644 --- a/vpn-daemons/vpnc/po/ru.po +++ b/vpn-daemons/vpnc/po/ru.po @@ -1,18 +1,19 @@ +# translation of ru.po to Russian # translation of ru.po to # Ukrainian translation of NetworkManager openvpn # Copyright (C) Free Software Foundation, 2005 # This file is distributed under the same license as the NetworkManager package. # # Maxim Dziumanenko <dziumanenko@gmail.com>, 2005-2007. -# Leonid Kanter <leon@asplinux.ru>, 2007. +# Leonid Kanter <leon@asplinux.ru>, 2007, 2008. msgid "" msgstr "" -"Project-Id-Version: ru1\n" +"Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-06-19 17:40+0300\n" -"PO-Revision-Date: 2007-06-19 18:45+0300\n" +"POT-Creation-Date: 2008-08-08 15:14+0300\n" +"PO-Revision-Date: 2008-08-08 15:19+0300\n" "Last-Translator: Leonid Kanter <leon@asplinux.ru>\n" -"Language-Team: <gnome-cyr@gnome.org>\n" +"Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -51,16 +52,16 @@ msgstr "_Запомнить пароли для этого сеанса" msgid "_Save passwords in keyring" msgstr "_Сохранить пароли на брелоке" -#: ../auth-dialog/main.c:161 +#: ../auth-dialog/main.c:182 #, c-format msgid "You need to authenticate to access the Virtual Private Network '%s'." msgstr "Для доступа к виртуальной частной сети '%s' требуется аутентификация." -#: ../auth-dialog/main.c:162 +#: ../auth-dialog/main.c:183 msgid "Authenticate VPN" msgstr "Аутентификация VPN" -#: ../auth-dialog/main.c:169 +#: ../auth-dialog/main.c:190 msgid "_Group Password:" msgstr "_Пароль группы:" @@ -72,66 +73,45 @@ msgstr "Добавление, изменение и удаление соеди msgid "VPN Connection Manager (vpnc)" msgstr "Менеджер соединений VPN (vpnc)" -#: ../properties/nm-vpnc.c:91 -msgid "Compatible Cisco VPN client (vpnc)" -msgstr "Совместимый клиент Cisco VPN (vpnc)" +#: ../properties/nm-vpnc.c:51 +msgid "Cisco Compatible VPN (vpnc)" +msgstr "Cisco-совместимый VPN (vpnc)" -#: ../properties/nm-vpnc.c:510 -msgid "The following vpnc VPN connection will be created:" -msgstr "Будет создано следующее соединение vpnc VPN:" - -#: ../properties/nm-vpnc.c:512 -#, c-format -msgid "Name: %s" -msgstr "Имя: %s" - -#: ../properties/nm-vpnc.c:515 -#, c-format -msgid "Gateway: %s" -msgstr "Шлюз: %s" - -#: ../properties/nm-vpnc.c:517 -#, c-format -msgid "Group Name: %s" -msgstr "Имя группы: %s" - -#: ../properties/nm-vpnc.c:521 -#, c-format -msgid "Username: %s" -msgstr "Имя пользователя: %s" +#: ../properties/nm-vpnc.c:52 +msgid "" +"Compatible with various Cisco, Juniper, Netscreen, and Sonicwall IPSec-based " +"VPN gateways." +msgstr "Совместим с различными роутерами Cisco, Juniper, Netscreen, Sonicwall." -#: ../properties/nm-vpnc.c:526 -#, c-format -msgid "Domain: %s" -msgstr "Домен: %s" +#: ../properties/nm-vpnc.c:204 +msgid "Secure (default)" +msgstr "Строгое (по умолчанию)" -#: ../properties/nm-vpnc.c:531 -#, c-format -msgid "Routes: %s" -msgstr "Маршрутизатор: %s" +#: ../properties/nm-vpnc.c:207 +msgid "Weak (use with caution)" +msgstr "Слабое (использовать с осторожностью)" -#: ../properties/nm-vpnc.c:535 -#, c-format -msgid "NAT-Keepalive packet interval: %s" -msgstr "Интервал пакетов NAT Keepalive: %s" +#: ../properties/nm-vpnc.c:215 +msgid "None (completely insecure)" +msgstr "Нет (без шифрования)" -#: ../properties/nm-vpnc.c:539 -msgid "Enable Single DES" -msgstr "Включить Single DES" +#: ../properties/nm-vpnc.c:260 +msgid "NAT-T (default)" +msgstr "NAT-T (по умолчанию)" -#: ../properties/nm-vpnc.c:543 -msgid "Disable NAT Traversal" -msgstr "Отключить Traversal NAT" +#: ../properties/nm-vpnc.c:267 +msgid "Cisco UDP" +msgstr "Cisco UDP" -#: ../properties/nm-vpnc.c:547 -msgid "The connection details can be changed using the \"Edit\" button." -msgstr "Параметры соединения можно изменить, нажав кнопку \"Правка\"." +#: ../properties/nm-vpnc.c:274 +msgid "Disabled" +msgstr "Выключено" -#: ../properties/nm-vpnc.c:625 +#: ../properties/nm-vpnc.c:697 msgid "TCP tunneling not supported" msgstr "Туннелирование TCP не поддерживается" -#: ../properties/nm-vpnc.c:627 +#: ../properties/nm-vpnc.c:699 #, c-format msgid "" "The VPN settings file '%s' specifies that VPN traffic should be tunneled " @@ -140,151 +120,50 @@ msgid "" "The connection can still be created, with TCP tunneling disabled, however it " "may not work as expected." msgstr "" -"Файл параметров VPN \"%s\" указывает, что трафик VPN должен быть туннелирован через TCP. Эта функция сейчас не поддерживается программой vpnc.\n" +"Файл параметров VPN \"%s\" указывает, что трафик VPN должен быть " +"туннелирован через TCP. Эта функция сейчас не поддерживается программой " +"vpnc.\n" "\n" -"Подключение может быть создано с отключенным туннелированием TCP, но оно может работать не так, как ожидается." - -#: ../properties/nm-vpnc.c:648 -msgid "Cannot import settings" -msgstr "Не удаётся импортировать параметры" - -#: ../properties/nm-vpnc.c:650 -#, c-format -msgid "The VPN settings file '%s' does not contain valid data." -msgstr "Файл параметров VPN '%s' содержит некорректные данные." - -#: ../properties/nm-vpnc.c:667 -msgid "Select file to import" -msgstr "Выберите файл для импорта" - -#. printf ("in impl_export\n"); -#: ../properties/nm-vpnc.c:840 -msgid "Save as..." -msgstr "Сохранить как..." - -#: ../properties/nm-vpnc.c:870 -#, c-format -msgid "A file named \"%s\" already exists." -msgstr "Файл с именем \"%s\" уже существует." - -#: ../properties/nm-vpnc.c:873 -msgid "Do you want to replace it with the one you are saving?" -msgstr "Вы действительно хотите заменить его сохраняемым вами файлом?" - -#: ../properties/nm-vpnc.c:887 -msgid "Failed to export configuration" -msgstr "Сбой при экспорте конфигурации" - -#: ../properties/nm-vpnc.c:889 -#, c-format -msgid "Failed to save file %s" -msgstr "Ошибка при сохранении файла %s" +"Подключение может быть создано с отключенным туннелированием TCP, но оно " +"может работать не так, как ожидается." #: ../properties/nm-vpnc-dialog.glade.h:1 -msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>" -msgstr "<i>пример: 172.16.0.0/16 10.11.12.0/24</i>" +msgid " " +msgstr " " #: ../properties/nm-vpnc-dialog.glade.h:2 -msgid "Connection na_me:" -msgstr "И_мя соединения:" +msgid "<b>General</b>" +msgstr "<b>Общие</b>" #: ../properties/nm-vpnc-dialog.glade.h:3 -msgid "Disable NAT _traversal" -msgstr "Отключить NAT _traversal" +msgid "<b>Optional</b>" +msgstr "<b>Необязательные</b>" #: ../properties/nm-vpnc-dialog.glade.h:4 -msgid "Enable _weak single DES encryption" -msgstr "Включить _уязвимое шифрование single DES" +msgid "Disable Dead Peer Detection" +msgstr "Отключить Dead Peer Detection" #: ../properties/nm-vpnc-dialog.glade.h:5 -msgid "G_roup name:" -msgstr "Имя г_руппы:" +msgid "Domain:" +msgstr "Домен:" #: ../properties/nm-vpnc-dialog.glade.h:6 -msgid "Import _Saved Configuration..." -msgstr "Импорт _сохранённой конфигурации..." +msgid "Encryption Method:" +msgstr "Метод шифрования:" #: ../properties/nm-vpnc-dialog.glade.h:7 -msgid "Interval:" -msgstr "Интервал:" +msgid "G_roup Name:" +msgstr "Имя г_руппы:" #: ../properties/nm-vpnc-dialog.glade.h:8 -msgid "" -"Name used to identify the connection to the private network, e.g. \"Campus " -"VPN\" or \"Corporate Network\"" -msgstr "" -"Имя, которое используется для подключения к частной сети, например, " -"\"Campus VPN\" или \"Corporate Network\"" +msgid "NAT Traversal:" +msgstr "Traversal NAT:" #: ../properties/nm-vpnc-dialog.glade.h:9 -msgid "Optional" -msgstr "Необязательные" +msgid "User name:" +msgstr "Имя пользователя:" #: ../properties/nm-vpnc-dialog.glade.h:10 -msgid "Override _user name" -msgstr "_Переопределять имя пользователя" - -#: ../properties/nm-vpnc-dialog.glade.h:11 -msgid "" -"Please enter the information provided by your system administrator below. Do " -"not enter your password here as you will be prompted when connecting." -msgstr "" -"Введите ниже информацию, предоставленную вашим системным администратором. Не " -"вводите пароль - он будет запрошен при соединении." - -#: ../properties/nm-vpnc-dialog.glade.h:12 -msgid "" -"Please note that the file you import is not a Cisco VPN or VPNC " -"configuration file. Ask your adminstrator for the file." -msgstr "" -"Импортируемый файл не фвляется файлом конфигурации Cisco VPN или VPNC. Попросите " -"системного администратора предоставить вам требуемый файл." - -#: ../properties/nm-vpnc-dialog.glade.h:13 -msgid "Required" -msgstr "Обязательные" - -#: ../properties/nm-vpnc-dialog.glade.h:14 -msgid "Use NAT _keepalive packets" -msgstr "Использовать пакеты NAT _keepalive" - -#: ../properties/nm-vpnc-dialog.glade.h:15 -msgid "Use _domain for authentication" -msgstr "Использовать _домен для аутентификации" - -#: ../properties/nm-vpnc-dialog.glade.h:16 msgid "_Gateway:" msgstr "_Шлюз:" -#: ../properties/nm-vpnc-dialog.glade.h:17 -msgid "_Only use VPN connection for these addresses" -msgstr "Использовать VPN _только для этих адресов" - -#: ../src/nm-vpnc-service.c:119 -msgid "The VPN login failed because the user name and password were not accepted." -msgstr "Сбой подключения к VPN: имя пользователя или пароль не были приняты/" - -#: ../src/nm-vpnc-service.c:121 -msgid "The VPN login failed because the VPN program could not be started." -msgstr "Сбой подключения к VPN: не удаётся запустить программу VPN." - -#: ../src/nm-vpnc-service.c:123 -msgid "" -"The VPN login failed because the VPN program could not connect to the VPN " -"server." -msgstr "" -"Произошёл сбой подключения к VPN, поскольку программа VPN не смогла " -"подключиться к серверу VPN." - -#: ../src/nm-vpnc-service.c:125 -msgid "The VPN login failed because the VPN configuration options were invalid." -msgstr "Произошёл сбой подключения к VPN, поскольку конфигурация VPN была неверной." - -#: ../src/nm-vpnc-service.c:127 -msgid "" -"The VPN login failed because the VPN program received an invalid " -"configuration from the VPN server." -msgstr "" -"Произошёл сбой подключения к VPN, поскольу программа VPN получила " -"неправильную конфигурацию от сервера VPN." - diff --git a/vpn-daemons/vpnc/properties/nm-vpnc.c b/vpn-daemons/vpnc/properties/nm-vpnc.c index 8a97e2f399..2db4f7e8b8 100644 --- a/vpn-daemons/vpnc/properties/nm-vpnc.c +++ b/vpn-daemons/vpnc/properties/nm-vpnc.c @@ -40,7 +40,6 @@ #include <nm-vpn-plugin-ui-interface.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> @@ -159,15 +158,15 @@ static gboolean init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **error) { VpncPluginUiWidgetPrivate *priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; GtkWidget *widget; GtkListStore *store; GtkTreeIter iter; + char *value; int active = -1; - GValue *value; const char *natt_mode = NULL; - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); + s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); @@ -175,10 +174,10 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_GATEWAY); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_GATEWAY); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -186,10 +185,10 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_ID); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_ID); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -205,17 +204,17 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, _("Weak (use with caution)"), -1); - if ((active < 0) && s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_SINGLE_DES); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (s_vpn && (active < 0)) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_SINGLE_DES); + if (value && !strcmp (value, "yes")) active = 1; } gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, _("None (completely insecure)"), -1); - if ((active < 0) && s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_NO_ENCRYPTION); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + if (s_vpn && (active < 0)) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_NO_ENCRYPTION); + if (value && !strcmp (value, "yes")) active = 2; } @@ -228,12 +227,10 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_XAUTH_USER); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); - else { - } + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_XAUTH_USER); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); @@ -241,20 +238,17 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err if (!widget) return FALSE; gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_DOMAIN); - if (value && G_VALUE_HOLDS_STRING (value)) - gtk_entry_set_text (GTK_ENTRY (widget), g_value_get_string (value)); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DOMAIN); + if (value && strlen (value)) + gtk_entry_set_text (GTK_ENTRY (widget), value); } g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); active = -1; store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_NAT_TRAVERSAL_MODE); - if (value && G_VALUE_HOLDS_STRING (value)) - natt_mode = g_value_get_string (value); - } + if (s_vpn) + natt_mode = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_NAT_TRAVERSAL_MODE); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, _("NAT-T (default)"), 1, NM_VPNC_NATT_MODE_NATT, -1); @@ -289,10 +283,16 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err widget = glade_xml_get_widget (priv->xml, "disable_dpd_checkbutton"); if (!widget) return FALSE; - if (s_vpn_props) { - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_DPD_IDLE_TIMEOUT); - if (value && G_VALUE_HOLDS_INT (value)) { - priv->orig_dpd_timeout = g_value_get_int (value); + if (s_vpn) { + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DPD_IDLE_TIMEOUT); + if (value) { + long int tmp; + + errno = 0; + tmp = strtol (value, NULL, 10); + if (tmp >= 0 && tmp <= G_MAXUINT32 && errno == 0) + priv->orig_dpd_timeout = (guint32) tmp; + if (priv->orig_dpd_timeout == 0) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); } @@ -311,42 +311,6 @@ get_widget (NMVpnPluginUiWidgetInterface *iface) return G_OBJECT (priv->widget); } -static GValue * -str_to_gvalue (const char *str) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_STRING); - g_value_set_string (value, str); - - return value; -} - -static GValue * -bool_to_gvalue (gboolean b) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_BOOLEAN); - g_value_set_boolean (value, b); - - return value; -} - -static GValue * -int_to_gvalue (gint i) -{ - GValue *value; - - value = g_slice_new0 (GValue); - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, i); - - return value; -} - static gboolean update_connection (NMVpnPluginUiWidgetInterface *iface, NMConnection *connection, @@ -355,7 +319,6 @@ update_connection (NMVpnPluginUiWidgetInterface *iface, VpncPluginUiWidget *self = VPNC_PLUGIN_UI_WIDGET (iface); VpncPluginUiWidgetPrivate *priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (self); NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; GtkWidget *widget; char *str; GtkTreeModel *model; @@ -366,55 +329,52 @@ update_connection (NMVpnPluginUiWidgetInterface *iface, s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ()); s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_VPNC); - nm_connection_add_setting (connection, NM_SETTING (s_vpn)); - - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_setting_vpn_properties_new ()); /* Gateway */ widget = glade_xml_get_widget (priv->xml, "gateway_entry"); str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_GATEWAY), - str_to_gvalue (str)); + g_strdup (str)); } /* Group name */ widget = glade_xml_get_widget (priv->xml, "group_entry"); str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_ID), - str_to_gvalue (str)); + g_strdup (str)); } widget = glade_xml_get_widget (priv->xml, "user_entry"); str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_XAUTH_USER), - str_to_gvalue (str)); + g_strdup (str)); } widget = glade_xml_get_widget (priv->xml, "domain_entry"); str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); if (str && strlen (str)) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_DOMAIN), - str_to_gvalue (str)); + g_strdup (str)); } widget = glade_xml_get_widget (priv->xml, "encryption_combo"); switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) { case ENC_TYPE_WEAK: - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_SINGLE_DES), - bool_to_gvalue (TRUE)); + g_strdup ("yes")); break; case ENC_TYPE_NONE: - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_NO_ENCRYPTION), - bool_to_gvalue (TRUE)); + g_strdup ("yes")); break; case ENC_TYPE_SECURE: default: @@ -427,27 +387,27 @@ update_connection (NMVpnPluginUiWidgetInterface *iface, const char *mode; gtk_tree_model_get (model, &iter, 1, &mode, -1); - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE), - str_to_gvalue (mode)); + g_strdup (mode)); } else { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE), - str_to_gvalue (NM_VPNC_NATT_MODE_NATT)); + g_strdup (NM_VPNC_NATT_MODE_NATT)); } widget = glade_xml_get_widget (priv->xml, "disable_dpd_checkbutton"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT), - int_to_gvalue (0)); + g_strdup ("0")); } else { - g_hash_table_insert (s_vpn_props->data, + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT), - int_to_gvalue (priv->orig_dpd_timeout)); + g_strdup_printf ("%d", priv->orig_dpd_timeout)); } - nm_connection_add_setting (connection, NM_SETTING (s_vpn_props)); + nm_connection_add_setting (connection, NM_SETTING (s_vpn)); return TRUE; } @@ -591,7 +551,6 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) NMConnection *connection; NMSettingConnection *s_con; NMSettingVPN *s_vpn; - NMSettingVPNProperties *s_vpn_props; GHashTable *pcf; const char *buf; gboolean have_value; @@ -611,9 +570,6 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) s_vpn->service_type = g_strdup (VPNC_PLUGIN_SERVICE); nm_connection_add_setting (connection, NM_SETTING (s_vpn)); - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_setting_vpn_properties_new ()); - nm_connection_add_setting (connection, NM_SETTING (s_vpn_props)); - /* Connection name */ if ((buf = pcf_file_lookup_value (pcf, "main", "Description"))) s_con->id = g_strdup (buf); @@ -626,7 +582,7 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) /* Gateway */ if ((buf = pcf_file_lookup_value (pcf, "main", "Host"))) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_GATEWAY), str_to_gvalue (buf)); + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_GATEWAY), g_strdup (buf)); else { g_set_error (error, 0, 0, "does not look like a %s VPN connection (no Host)", VPNC_PLUGIN_NAME); @@ -636,7 +592,7 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) /* Group name */ if ((buf = pcf_file_lookup_value (pcf, "main", "GroupName"))) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_ID), str_to_gvalue (buf)); + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_ID), g_strdup (buf)); else { g_set_error (error, 0, 0, "does not look like a %s VPN connection (no GroupName)", VPNC_PLUGIN_NAME); @@ -649,29 +605,34 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) buf = pcf_file_lookup_value (pcf, "main", "UserName"); have_value = buf == NULL ? FALSE : strlen (buf) > 0; if (have_value) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_XAUTH_USER), str_to_gvalue (buf)); + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_XAUTH_USER), g_strdup (buf)); buf = pcf_file_lookup_value (pcf, "main", "NTDomain"); have_value = buf == NULL ? FALSE : strlen (buf) > 0; if (have_value) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_DOMAIN), str_to_gvalue (buf)); + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_DOMAIN), g_strdup (buf)); buf = pcf_file_lookup_value (pcf, "main", "SingleDES"); have_value = (buf == NULL ? FALSE : strcmp (buf, "0") != 0); if (have_value) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_SINGLE_DES), bool_to_gvalue (TRUE)); + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_SINGLE_DES), g_strdup ("yes")); /* Default is enabled, only disabled if explicit EnableNat=0 exists */ buf = pcf_file_lookup_value (pcf, "main", "EnableNat"); have_value = (buf ? strncmp (buf, "0", 1) == 0 : FALSE); if (have_value) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE), str_to_gvalue (NM_VPNC_NATT_MODE_NATT)); + g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE), g_strdup (NM_VPNC_NATT_MODE_NATT)); if ((buf = pcf_file_lookup_value (pcf, "main", "PeerTimeout"))) { - gulong val = strtol (buf, NULL, 10); + long int val; - if ((val == 0) || ((val > 10) && (val < 86400))) - g_hash_table_insert (s_vpn_props->data, g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT), int_to_gvalue ((gint) val)); + errno = 0; + val = strtol (buf, NULL, 10); + if ((errno == 0) && ((val == 0) || ((val >= 10) && (val <= 86400)))) { + g_hash_table_insert (s_vpn->data, + g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT), + g_strdup_printf ("%d", (gint) val)); + } } buf = pcf_file_lookup_value (pcf, "main", "X-NM-Routes"); @@ -715,25 +676,25 @@ export (NMVpnPluginUiInterface *iface, GError **error) { NMSettingConnection *s_con; - NMSettingVPNProperties *s_vpn_props; NMSettingIP4Config *s_ip4; + NMSettingVPN *s_vpn; FILE *f; - GValue *value; + const char *value; const char *gateway = NULL; gboolean enablenat = TRUE; gboolean singledes = FALSE; const char *groupname = NULL; const char *username = NULL; const char *domain = NULL; - int peertimeout = 0; + const char *peertimeout = NULL; GString *routes = NULL; gboolean success = FALSE; s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES); - if (!s_vpn_props || !s_vpn_props->data) { + s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); + if (!s_vpn || !s_vpn->data) { g_set_error (error, 0, 0, "connection was incomplete"); return FALSE; } @@ -744,43 +705,41 @@ export (NMVpnPluginUiInterface *iface, return FALSE; } - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_GATEWAY); - if (value && G_VALUE_HOLDS_STRING (value)) - gateway = g_value_get_string (value); + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_GATEWAY); + if (value && strlen (value)) + gateway = value; else { g_set_error (error, 0, 0, "connection was incomplete (missing gateway)"); goto done; } - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_ID); - if (value && G_VALUE_HOLDS_STRING (value)) - groupname = g_value_get_string (value); + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_ID); + if (value && strlen (value)) + groupname = value; else { g_set_error (error, 0, 0, "connection was incomplete (missing group)"); goto done; } - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_XAUTH_USER); - if (value && G_VALUE_HOLDS_STRING (value)) - username = g_value_get_string (value); + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_XAUTH_USER); + if (value && strlen (value)) + username = value; - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_DOMAIN); - if (value && G_VALUE_HOLDS_STRING (value)) - domain = g_value_get_string (value); + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DOMAIN); + if (value && strlen (value)) + domain = value; - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_SINGLE_DES); - if (value && G_VALUE_HOLDS_BOOLEAN (value) && g_value_get_boolean (value)) + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_SINGLE_DES); + if (value && !strcmp (value, "yes")) singledes = TRUE; - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_NAT_TRAVERSAL_MODE); - if (value && G_VALUE_HOLDS_STRING (value)) { - if (strlen (g_value_get_string (value))) - enablenat = TRUE; - } + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_NAT_TRAVERSAL_MODE); + if (value && strlen (value) && strcmp (value, NM_VPNC_NATT_MODE_NONE)) + enablenat = TRUE; - value = g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_DPD_IDLE_TIMEOUT); - if (value && G_VALUE_HOLDS_INT (value)) - peertimeout = g_value_get_int (value); + value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DPD_IDLE_TIMEOUT); + if (value && strlen (value)) + peertimeout = value; routes = g_string_new (""); if (s_ip4 && s_ip4->routes) { @@ -831,7 +790,7 @@ export (NMVpnPluginUiInterface *iface, "MSLogonType=0\n" "TunnelingMode=0\n" "TcpTunnelingPort=10000\n" - "PeerTimeout=%d\n" + "PeerTimeout=%s\n" "EnableLocalLAN=1\n" "SendCertChain=0\n" "VerifyCertDN=\n" @@ -845,7 +804,7 @@ export (NMVpnPluginUiInterface *iface, /* Username */ username != NULL ? username : "", /* EnableNat */ enablenat ? "1" : "0", /* NTDomain */ domain != NULL ? domain : "", - /* PeerTimeout */ peertimeout, + /* PeerTimeout */ peertimeout != NULL ? peertimeout : "0", /* SingleDES */ singledes ? "1" : "0", /* X-NM-Routes */ routes->str ? routes->str : ""); diff --git a/vpn-daemons/vpnc/src/nm-vpnc-service.c b/vpn-daemons/vpnc/src/nm-vpnc-service.c index 65d695cf20..0d90e74d7d 100644 --- a/vpn-daemons/vpnc/src/nm-vpnc-service.c +++ b/vpn-daemons/vpnc/src/nm-vpnc-service.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ #include <stdio.h> #include <string.h> @@ -8,9 +8,9 @@ #include <signal.h> #include <sys/stat.h> #include <sys/wait.h> +#include <errno.h> #include <nm-setting-vpn.h> -#include <nm-setting-vpn-properties.h> #include "nm-vpnc-service.h" #include "nm-utils.h" @@ -36,37 +36,39 @@ static const char *vpnc_binary_paths[] = typedef struct { const char *name; GType type; + gint int_min; + gint int_max; } ValidProperty; #define LEGACY_NAT_KEEPALIVE "NAT-Keepalive packet interval" static ValidProperty valid_properties[] = { - { NM_VPNC_KEY_GATEWAY, G_TYPE_STRING }, - { NM_VPNC_KEY_ID, G_TYPE_STRING }, - { NM_VPNC_KEY_SECRET, G_TYPE_STRING }, - { NM_VPNC_KEY_XAUTH_USER, G_TYPE_STRING }, - { NM_VPNC_KEY_XAUTH_PASSWORD, G_TYPE_STRING }, - { NM_VPNC_KEY_DOMAIN, G_TYPE_STRING }, - { NM_VPNC_KEY_DHGROUP, G_TYPE_STRING }, - { NM_VPNC_KEY_PERFECT_FORWARD, G_TYPE_STRING }, - { NM_VPNC_KEY_APP_VERSION, G_TYPE_STRING }, - { NM_VPNC_KEY_SINGLE_DES, G_TYPE_BOOLEAN }, - { NM_VPNC_KEY_NO_ENCRYPTION, G_TYPE_BOOLEAN }, - { NM_VPNC_KEY_DPD_IDLE_TIMEOUT, G_TYPE_INT }, - { NM_VPNC_KEY_NAT_TRAVERSAL_MODE, G_TYPE_STRING }, - { NM_VPNC_KEY_CISCO_UDP_ENCAPS_PORT, G_TYPE_INT }, + { NM_VPNC_KEY_GATEWAY, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_ID, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_SECRET, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_XAUTH_USER, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_XAUTH_PASSWORD, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_DOMAIN, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_DHGROUP, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_PERFECT_FORWARD, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_APP_VERSION, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_SINGLE_DES, G_TYPE_BOOLEAN, 0, 0 }, + { NM_VPNC_KEY_NO_ENCRYPTION, G_TYPE_BOOLEAN, 0, 0 }, + { NM_VPNC_KEY_DPD_IDLE_TIMEOUT, G_TYPE_INT, 0, 86400 }, + { NM_VPNC_KEY_NAT_TRAVERSAL_MODE, G_TYPE_STRING, 0, 0 }, + { NM_VPNC_KEY_CISCO_UDP_ENCAPS_PORT, G_TYPE_INT, 0, 65535 }, /* Legacy options that are ignored */ - { LEGACY_NAT_KEEPALIVE, G_TYPE_STRING }, - { NULL, G_TYPE_NONE } + { LEGACY_NAT_KEEPALIVE, G_TYPE_STRING, 0, 0 }, + { NULL, G_TYPE_NONE, 0, 0 } }; static void -validate_one_property (gpointer key, gpointer val, gpointer user_data) +validate_one_property (gpointer key, gpointer value, gpointer user_data) { - gboolean *failed = (gboolean *) user_data; + GError **error = (GError **) user_data; int i; - if (*failed) + if (*error) return; /* 'name' is the setting name; always allowed but unused */ @@ -75,28 +77,71 @@ validate_one_property (gpointer key, gpointer val, gpointer user_data) for (i = 0; valid_properties[i].name; i++) { ValidProperty prop = valid_properties[i]; - - if (!strcmp (prop.name, (char *) key) && prop.type == G_VALUE_TYPE ((GValue *) val)) - /* Property is ok */ - return; + long int tmp; + + if (strcmp (prop.name, (char *) key)) + continue; + + switch (prop.type) { + case G_TYPE_STRING: + return; /* valid */ + case G_TYPE_INT: + errno = 0; + tmp = strtol ((char *) value, NULL, 10); + if (errno == 0 && tmp >= prop.int_min && tmp <= prop.int_max) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid integer property '%s' or out of range [%d -> %d]", + (const char *) key, prop.int_min, prop.int_max); + break; + case G_TYPE_BOOLEAN: + if (!strcmp ((char *) value, "yes") || !strcmp ((char *) value, "no")) + return; /* valid */ + + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "invalid boolean property '%s' (not yes or no)", + (const char *) key); + break; + default: + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "unhandled property '%s' type %s", + (const char *) key, g_type_name (prop.type)); + break; + } } /* Did not find the property from valid_properties or the type did not match */ - g_warning ("VPN property '%s' failed validation.", (char *) key); - *failed = TRUE; + if (!valid_properties[i].name) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "property '%s' invalid or not supported", + (const char *) key); + } } static gboolean -nm_vpnc_properties_validate (GHashTable *properties) +nm_vpnc_properties_validate (GHashTable *properties, GError **error) { - gboolean failed = FALSE; - - if (g_hash_table_size (properties) < 1) - return failed; + if (g_hash_table_size (properties) < 1) { + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "%s", + "No VPN configuration options."); + return FALSE; + } - g_hash_table_foreach (properties, validate_one_property, &failed); + g_hash_table_foreach (properties, validate_one_property, error); - return !failed; + return *error ? FALSE : TRUE; } static void @@ -140,12 +185,11 @@ vpnc_watch_cb (GPid pid, gint status, gpointer user_data) } static gint -nm_vpnc_start_vpnc_binary (NMVPNCPlugin *plugin) +nm_vpnc_start_vpnc_binary (NMVPNCPlugin *plugin, GError **error) { GPid pid; const char **vpnc_binary = NULL; GPtrArray *vpnc_argv; - GError *err = NULL; GSource *vpnc_watch; gint stdin_fd; @@ -158,7 +202,11 @@ nm_vpnc_start_vpnc_binary (NMVPNCPlugin *plugin) } if (!*vpnc_binary) { - nm_info ("Could not find vpnc binary."); + g_set_error (error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, + "%s", + "Could not find vpnc binary."); return -1; } @@ -171,10 +219,9 @@ nm_vpnc_start_vpnc_binary (NMVPNCPlugin *plugin) if (!g_spawn_async_with_pipes (NULL, (char **) vpnc_argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &stdin_fd, - NULL, NULL, &err)) { + NULL, NULL, error)) { g_ptr_array_free (vpnc_argv, TRUE); - nm_warning ("vpnc failed to start. error: '%s'", err->message); - g_error_free (err); + nm_warning ("vpnc failed to start. error: '%s'", (*error)->message); return -1; } g_ptr_array_free (vpnc_argv, TRUE); @@ -204,37 +251,79 @@ write_config_option (int fd, const char *format, ...) va_end (args); } +typedef struct { + int fd; + GError *error; +} WriteConfigInfo; + static void -write_one_property (gpointer key, gpointer val, gpointer user_data) +write_one_property (gpointer key, gpointer value, gpointer user_data) { - gint vpnc_fd = GPOINTER_TO_INT (user_data); - GValue *value = (GValue *) val; - GType type; + WriteConfigInfo *info = (WriteConfigInfo *) user_data; + GType type = G_TYPE_INVALID; + int i; + + if (info->error) + return; + + /* Find the value in the table to get its type */ + for (i = 0; valid_properties[i].name; i++) { + ValidProperty prop = valid_properties[i]; + + if (!strcmp (prop.name, (char *) key)) { + /* Property is ok */ + type = prop.type; + break; + } + } + + if (type == G_TYPE_INVALID) { + g_set_error (&info->error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "Config option '%s' invalid or unknown.", + (const char *) key); + } - type = G_VALUE_TYPE (value); if (type == G_TYPE_STRING) - write_config_option (vpnc_fd, "%s %s\n", (char *) key, g_value_get_string (value)); - else if (type == G_TYPE_BOOLEAN) - write_config_option (vpnc_fd, "%s\n", (char *) key); - else if (type == G_TYPE_INT) - write_config_option (vpnc_fd, "%s %d\n", (char *) key, g_value_get_int (value)); - else if (type == DBUS_TYPE_G_UCHAR_ARRAY) { - char *tmp; - - tmp = nm_utils_garray_to_string ((GArray *) g_value_get_boxed (value)); - write_config_option (vpnc_fd, "%s %s\n", tmp); - g_free (tmp); + write_config_option (info->fd, "%s %s\n", (char *) key, (char *) value); + else if (type == G_TYPE_BOOLEAN) { + if (!strcmp (value, "yes")) + write_config_option (info->fd, "%s\n", (char *) key); + } else if (type == G_TYPE_INT) { + long int tmp_int; + char *tmp_str; + + /* Convert -> int and back to string for security's sake since + * strtol() ignores leading and trailing characters. + */ + errno = 0; + tmp_int = strtol (value, NULL, 10); + if (errno == 0) { + tmp_str = g_strdup_printf ("%ld", tmp_int); + write_config_option (info->fd, "%s %s\n", (char *) key, tmp_str); + g_free (tmp_str); + } else { + g_set_error (&info->error, + NM_VPN_PLUGIN_ERROR, + NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, + "Config option '%s' not an integer.", + (const char *) key); + } } else { + /* Just ignore unknown properties */ nm_warning ("Don't know how to write property '%s' with type %s", (char *) key, g_type_name (type)); } } -static void +static gboolean nm_vpnc_config_write (gint vpnc_fd, const char *default_user_name, - GHashTable *properties) + GHashTable *properties, + GError **error) { + WriteConfigInfo *info; const char *props_user_name; const char *props_natt_mode; @@ -262,45 +351,42 @@ nm_vpnc_config_write (gint vpnc_fd, NM_VPNC_NATT_MODE_NATT); } - g_hash_table_foreach (properties, write_one_property, GINT_TO_POINTER (vpnc_fd)); + info = g_malloc0 (sizeof (WriteConfigInfo)); + info->fd = vpnc_fd; + g_hash_table_foreach (properties, write_one_property, info); + *error = info->error; + g_free (info); + + return *error ? FALSE : TRUE; } static gboolean real_connect (NMVPNPlugin *plugin, - NMConnection *connection, - GError **err) + NMConnection *connection, + GError **error) { NMSettingVPN *s_vpn; - NMSettingVPNProperties *properties; - gint vpnc_fd; - - properties = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); - if (!properties || !nm_vpnc_properties_validate (properties->data)) { - g_set_error (err, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, - "%s", - "Invalid arguments."); - return FALSE; - } + gint vpnc_fd = -1; + gboolean success = FALSE; s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); g_assert (s_vpn); + if (!nm_vpnc_properties_validate (s_vpn->data, error)) + goto out; - if ((vpnc_fd = nm_vpnc_start_vpnc_binary (NM_VPNC_PLUGIN (plugin))) >= 0) - nm_vpnc_config_write (vpnc_fd, s_vpn->user_name, properties->data); - else { - g_set_error (err, - NM_VPN_PLUGIN_ERROR, - NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, - "%s", - "Could not start vpnc binary."); - close (vpnc_fd); - return FALSE; - } + vpnc_fd = nm_vpnc_start_vpnc_binary (NM_VPNC_PLUGIN (plugin), error); + if (vpnc_fd < 0) + goto out; - close (vpnc_fd); - return TRUE; + if (!nm_vpnc_config_write (vpnc_fd, s_vpn->user_name, s_vpn->data, error)) + goto out; + + success = TRUE; + +out: + if (vpnc_fd >= 0) + close (vpnc_fd); + return success; } static gboolean @@ -309,13 +395,13 @@ real_need_secrets (NMVPNPlugin *plugin, char **setting_name, GError **error) { - NMSettingVPNProperties *s_vpn_props; + NMSettingVPN *s_vpn; g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); - s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); - if (!s_vpn_props) { + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); + if (!s_vpn) { g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, @@ -326,12 +412,12 @@ real_need_secrets (NMVPNPlugin *plugin, // FIXME: there are some configurations where both passwords are not // required. Make sure they work somehow. - if (!g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_SECRET)) { - *setting_name = NM_SETTING_VPN_PROPERTIES_SETTING_NAME; + if (!g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_SECRET)) { + *setting_name = NM_SETTING_VPN_SETTING_NAME; return TRUE; } - if (!g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_XAUTH_PASSWORD)) { - *setting_name = NM_SETTING_VPN_PROPERTIES_SETTING_NAME; + if (!g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_XAUTH_PASSWORD)) { + *setting_name = NM_SETTING_VPN_SETTING_NAME; return TRUE; } |