network-manager-applet r649 - in trunk: . src src/connection-editor src/gconf-helpers src/vpn-properties src/wireless-security
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r649 - in trunk: . src src/connection-editor src/gconf-helpers src/vpn-properties src/wireless-security
- Date: Thu, 3 Apr 2008 19:53:40 +0100 (BST)
Author: dcbw
Date: Thu Apr 3 19:53:39 2008
New Revision: 649
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=649&view=rev
Log:
2008-04-03 Dan Williams <dcbw redhat com>
Switch keyring tagging of passwords to use the connection ID, not the
connection's name, so secrets are associated with the same connection
across connection renames.
* src/gconf-helpers/gconf-helpers.c
src/gconf-helpers/gconf-helpers.h
- (nm_gconf_add_keyring_item): take a connection ID argument and use
that when setting the keyring item, instead of using the connection
name
- (copy_one_setting_value_to_gconf, write_one_password,
nm_gconf_write_connection): pass the connection ID on to
nm_gconf_add_keyring_item()
- (nm_gconf_get_keyring_items): take a connection ID argument
* src/gconf-helpers/gconf-upgrade.c
src/gconf-helpers/gconf-upgrade.h
- (nm_gconf_migrate_0_7_keyring_items): migrate keyring items to new
tagging style
- (nm_gconf_write_0_6_connection, try_convert_leap,
copy_keyring_to_8021x, nm_gconf_migrate_0_7_wireless_security): pass
connection ID along
* src/wireless-dialog.c
src/wired-dialog.c
src/vpn-properties/nm-vpn-properties.c
src/connection-editor/page-wireless-security.c
src/connection-editor/nm-connection-list.c
src/connection-editor/nm-connection-editor.c
src/applet-dbus-settings.c
- Get/set the connection ID based on the connection's GConf path, and
pass that to UI bits as appropriate
* src/wireless-security/eap-method-leap.c
src/wireless-security/eap-method-leap.h
src/wireless-security/eap-method-peap.c
src/wireless-security/eap-method-peap.h
src/wireless-security/eap-method-simple.c
src/wireless-security/eap-method-simple.h
src/wireless-security/eap-method-tls.c
src/wireless-security/eap-method-tls.h
src/wireless-security/eap-method-ttls.c
src/wireless-security/eap-method-ttls.h
src/wireless-security/wireless-security.c
src/wireless-security/wireless-security.h
src/wireless-security/ws-dynamic-wep.c
src/wireless-security/ws-dynamic-wep.h
src/wireless-security/ws-leap.c
src/wireless-security/ws-leap.h
src/wireless-security/ws-wep-key.c
src/wireless-security/ws-wep-key.h
src/wireless-security/ws-wpa-eap.c
src/wireless-security/ws-wpa-eap.h
src/wireless-security/ws-wpa-psk.c
src/wireless-security/ws-wpa-psk.h
- Take a connection ID to the xxxx_new () functions to be passed along
to nm_gconf_get_keyring_items()
Modified:
trunk/ChangeLog
trunk/src/applet-dbus-settings.c
trunk/src/connection-editor/nm-connection-editor.c
trunk/src/connection-editor/nm-connection-list.c
trunk/src/connection-editor/page-wireless-security.c
trunk/src/gconf-helpers/gconf-helpers.c
trunk/src/gconf-helpers/gconf-helpers.h
trunk/src/gconf-helpers/gconf-upgrade.c
trunk/src/gconf-helpers/gconf-upgrade.h
trunk/src/vpn-properties/nm-vpn-properties.c
trunk/src/wired-dialog.c
trunk/src/wireless-dialog.c
trunk/src/wireless-security/eap-method-leap.c
trunk/src/wireless-security/eap-method-leap.h
trunk/src/wireless-security/eap-method-peap.c
trunk/src/wireless-security/eap-method-peap.h
trunk/src/wireless-security/eap-method-simple.c
trunk/src/wireless-security/eap-method-simple.h
trunk/src/wireless-security/eap-method-tls.c
trunk/src/wireless-security/eap-method-tls.h
trunk/src/wireless-security/eap-method-ttls.c
trunk/src/wireless-security/eap-method-ttls.h
trunk/src/wireless-security/wireless-security.c
trunk/src/wireless-security/wireless-security.h
trunk/src/wireless-security/ws-dynamic-wep.c
trunk/src/wireless-security/ws-dynamic-wep.h
trunk/src/wireless-security/ws-leap.c
trunk/src/wireless-security/ws-leap.h
trunk/src/wireless-security/ws-wep-key.c
trunk/src/wireless-security/ws-wep-key.h
trunk/src/wireless-security/ws-wpa-eap.c
trunk/src/wireless-security/ws-wpa-eap.h
trunk/src/wireless-security/ws-wpa-psk.c
trunk/src/wireless-security/ws-wpa-psk.h
Modified: trunk/src/applet-dbus-settings.c
==============================================================================
--- trunk/src/applet-dbus-settings.c (original)
+++ trunk/src/applet-dbus-settings.c Thu Apr 3 19:53:39 2008
@@ -53,9 +53,6 @@
static const char *applet_exported_connection_get_gconf_path (AppletExportedConnection *exported);
-static AppletExportedConnection *applet_dbus_settings_get_by_gconf_path (AppletDbusSettings *applet_settings,
- const char *path);
-
static gboolean applet_exported_connection_changed (AppletExportedConnection *connection,
GConfEntry *entry);
@@ -497,6 +494,27 @@
context);
}
+static AppletExportedConnection *
+applet_dbus_settings_get_by_gconf_path (AppletDbusSettings *applet_settings,
+ const char *path)
+{
+ GSList *elt;
+
+ g_return_val_if_fail (APPLET_IS_DBUS_SETTINGS (applet_settings), NULL);
+ g_return_val_if_fail (path != NULL, NULL);
+
+ for (elt = applet_settings->connections; elt; elt = g_slist_next (elt)) {
+ AppletExportedConnection *exported = APPLET_EXPORTED_CONNECTION (elt->data);
+ const char *gconf_path;
+
+ gconf_path = applet_exported_connection_get_gconf_path (exported);
+ if (gconf_path && !strcmp (gconf_path, path))
+ return exported;
+ }
+
+ return NULL;
+}
+
static void
connections_changed_cb (GConfClient *conf_client,
guint cnxn_id,
@@ -636,27 +654,6 @@
return NULL;
}
-static AppletExportedConnection *
-applet_dbus_settings_get_by_gconf_path (AppletDbusSettings *applet_settings,
- const char *path)
-{
- GSList *elt;
-
- g_return_val_if_fail (APPLET_IS_DBUS_SETTINGS (applet_settings), NULL);
- g_return_val_if_fail (path != NULL, NULL);
-
- for (elt = applet_settings->connections; elt; elt = g_slist_next (elt)) {
- AppletExportedConnection *exported = APPLET_EXPORTED_CONNECTION (elt->data);
- const char *gconf_path;
-
- gconf_path = applet_exported_connection_get_gconf_path (exported);
- if (gconf_path && !strcmp (gconf_path, path))
- return exported;
- }
-
- return NULL;
-}
-
static GSList *
get_connections (AppletDbusSettings *applet_settings)
{
@@ -847,23 +844,45 @@
}
static void
-applet_exported_connection_finalize (GObject *object)
+applet_exported_connection_dispose (GObject *object)
{
AppletExportedConnection *exported = APPLET_EXPORTED_CONNECTION (object);
+ NMConnection *connection;
if (exported->conf_client) {
g_object_unref (exported->conf_client);
exported->conf_client = NULL;
}
- if (exported->conf_dir) {
- g_free (exported->conf_dir);
- exported->conf_dir = NULL;
- }
+ connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (exported));
+ if (connection)
+ g_object_set_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG, NULL);
+
+ G_OBJECT_CLASS (applet_exported_connection_parent_class)->dispose (object);
+}
+
+static void
+applet_exported_connection_finalize (GObject *object)
+{
+ AppletExportedConnection *exported = APPLET_EXPORTED_CONNECTION (object);
+
+ g_free (exported->conf_dir);
+ exported->conf_dir = NULL;
+
+ g_free (exported->id);
+ exported->id = NULL;
G_OBJECT_CLASS (applet_exported_connection_parent_class)->finalize (object);
}
+static const char *
+real_get_id (NMExportedConnection *connection)
+{
+ AppletExportedConnection *exported = APPLET_EXPORTED_CONNECTION (connection);
+
+ return exported->id;
+}
+
static void
applet_exported_connection_class_init (AppletExportedConnectionClass *exported_class)
{
@@ -871,10 +890,12 @@
NMExportedConnectionClass *connection_class = NM_EXPORTED_CONNECTION_CLASS (exported_class);
/* virtual methods */
+ object_class->dispose = applet_exported_connection_dispose;
object_class->finalize = applet_exported_connection_finalize;
connection_class->get_settings = applet_exported_connection_get_settings;
connection_class->get_secrets = applet_exported_connection_get_secrets;
+ connection_class->get_id = real_get_id;
/* Signals */
connection_signals[CONNECTION_NEW_SECRETS_REQUESTED] =
@@ -980,6 +1001,9 @@
NULL);
exported->conf_client = g_object_ref (conf_client);
exported->conf_dir = g_strdup (conf_dir);
+ exported->id = g_path_get_basename (conf_dir);
+ g_object_set_data (G_OBJECT (gconf_connection),
+ NMA_CONNECTION_ID_TAG, exported->id);
utils_fill_connection_certs (gconf_connection);
if (!nm_connection_verify (gconf_connection)) {
@@ -1014,7 +1038,8 @@
connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (exported));
nm_gconf_write_connection (connection,
exported->conf_client,
- exported->conf_dir);
+ exported->conf_dir,
+ exported->id);
gconf_client_notify (exported->conf_client, exported->conf_dir);
gconf_client_suggest_sync (exported->conf_client, NULL);
}
@@ -1044,6 +1069,9 @@
NULL);
exported->conf_client = g_object_ref (conf_client);
exported->conf_dir = g_strdup (conf_dir);
+ exported->id = g_path_get_basename (conf_dir);
+ g_object_set_data (G_OBJECT (connection),
+ NMA_CONNECTION_ID_TAG, exported->id);
fill_vpn_user_name (connection);
@@ -1102,6 +1130,7 @@
GHashTable *secrets = NULL;
NMSettingConnection *s_con;
NMSetting *setting;
+ const char *id = NULL;
g_return_if_fail (APPLET_IS_EXPORTED_CONNECTION (exported));
g_return_if_fail (setting_name != NULL);
@@ -1150,7 +1179,8 @@
settings = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) g_hash_table_destroy);
- secrets = nm_gconf_get_keyring_items (connection, setting_name, &error);
+ id = nm_exported_connection_get_id (parent);
+ secrets = nm_gconf_get_keyring_items (connection, id, setting_name, &error);
if (!secrets) {
if (error) {
nm_warning ("Error getting secrets: %s", error->message);
Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c (original)
+++ trunk/src/connection-editor/nm-connection-editor.c Thu Apr 3 19:53:39 2008
@@ -448,13 +448,21 @@
break;
}
};
+ g_assert (editor->gconf_path);
+ g_object_set_data_full (G_OBJECT (editor->connection),
+ NMA_CONNECTION_ID_TAG, g_path_get_basename (editor->gconf_path),
+ (GDestroyNotify) g_free);
}
if (editor->gconf_path) {
+ const char *id;
+
+ id = g_object_get_data (G_OBJECT (editor->connection), NMA_CONNECTION_ID_TAG);
/* Save the connection back to GConf */
nm_gconf_write_connection (editor->connection,
editor->gconf_client,
- editor->gconf_path);
+ editor->gconf_path,
+ id);
gconf_client_notify (editor->gconf_client, editor->gconf_path);
gconf_client_suggest_sync (editor->gconf_client, NULL);
} else
Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c (original)
+++ trunk/src/connection-editor/nm-connection-list.c Thu Apr 3 19:53:39 2008
@@ -443,6 +443,10 @@
connection = nm_gconf_read_connection (list->client, dir);
if (connection) {
g_object_set_data_full (G_OBJECT (connection),
+ NMA_CONNECTION_ID_TAG, g_path_get_basename (dir),
+ (GDestroyNotify) g_free);
+
+ g_object_set_data_full (G_OBJECT (connection),
CE_GCONF_PATH_TAG,
g_strdup (dir),
(GDestroyNotify) g_free);
Modified: trunk/src/connection-editor/page-wireless-security.c
==============================================================================
--- trunk/src/connection-editor/page-wireless-security.c (original)
+++ trunk/src/connection-editor/page-wireless-security.c Thu Apr 3 19:53:39 2008
@@ -35,6 +35,7 @@
#include "page-wireless.h"
#include "page-wireless-security.h"
#include "nm-connection-editor.h"
+#include "gconf-helpers.h"
G_DEFINE_TYPE (CEPageWirelessSecurity, ce_page_wireless_security, CE_TYPE_PAGE)
@@ -181,6 +182,9 @@
int item = 0;
const char *glade_file = GLADEDIR "/applet.glade";
GtkComboBox *combo;
+ const char *connection_id;
+
+ connection_id = g_object_get_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG);
self = CE_PAGE_WIRELESS_SECURITY (g_object_new (CE_TYPE_PAGE_WIRELESS_SECURITY, NULL));
parent = CE_PAGE (self);
@@ -249,9 +253,9 @@
WEPKeyType default_wep_type = WEP_KEY_TYPE_PASSPHRASE;
if (default_type == NMU_SEC_STATIC_WEP)
- default_wep_type = ws_wep_guess_key_type (connection);
+ default_wep_type = ws_wep_guess_key_type (connection, connection_id);
- ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_PASSPHRASE);
+ ws_wep = ws_wep_key_new (glade_file, connection, connection_id, WEP_KEY_TYPE_PASSPHRASE);
if (ws_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 128-bit Passphrase"));
@@ -260,7 +264,7 @@
item++;
}
- ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_HEX);
+ ws_wep = ws_wep_key_new (glade_file, connection, connection_id, WEP_KEY_TYPE_HEX);
if (ws_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit Hexadecimal"));
@@ -269,7 +273,7 @@
item++;
}
- ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_ASCII);
+ ws_wep = ws_wep_key_new (glade_file, connection, connection_id, WEP_KEY_TYPE_ASCII);
if (ws_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit ASCII"));
@@ -282,7 +286,7 @@
if (nm_utils_security_valid (NMU_SEC_LEAP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
WirelessSecurityLEAP *ws_leap;
- ws_leap = ws_leap_new (glade_file, connection);
+ ws_leap = ws_leap_new (glade_file, connection, connection_id);
if (ws_leap) {
add_security_item (self, WIRELESS_SECURITY (ws_leap), sec_model,
&iter, _("LEAP"));
@@ -295,7 +299,7 @@
if (nm_utils_security_valid (NMU_SEC_DYNAMIC_WEP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
WirelessSecurityDynamicWEP *ws_dynamic_wep;
- ws_dynamic_wep = ws_dynamic_wep_new (glade_file, connection);
+ ws_dynamic_wep = ws_dynamic_wep_new (glade_file, connection, connection_id);
if (ws_dynamic_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
&iter, _("Dynamic WEP (802.1x)"));
@@ -309,7 +313,7 @@
|| nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
WirelessSecurityWPAPSK *ws_wpa_psk;
- ws_wpa_psk = ws_wpa_psk_new (glade_file, connection);
+ ws_wpa_psk = ws_wpa_psk_new (glade_file, connection, connection_id);
if (ws_wpa_psk) {
add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
&iter, _("WPA & WPA2 Personal"));
@@ -323,7 +327,7 @@
|| nm_utils_security_valid (NMU_SEC_WPA2_ENTERPRISE, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
WirelessSecurityWPAEAP *ws_wpa_eap;
- ws_wpa_eap = ws_wpa_eap_new (glade_file, connection);
+ ws_wpa_eap = ws_wpa_eap_new (glade_file, connection, connection_id);
if (ws_wpa_eap) {
add_security_item (self, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
&iter, _("WPA & WPA2 Enterprise"));
Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c (original)
+++ trunk/src/gconf-helpers/gconf-helpers.c Thu Apr 3 19:53:39 2008
@@ -560,11 +560,13 @@
return TRUE;
}
+#include <unistd.h>
GSList *
nm_gconf_get_all_connections (GConfClient *client)
{
GSList *connections;
+ nm_gconf_migrate_0_7_keyring_items (client);
nm_gconf_migrate_0_7_connection_names (client);
nm_gconf_migrate_0_7_vpn_connections (client);
nm_gconf_migrate_0_7_wireless_security (client);
@@ -791,6 +793,7 @@
void
nm_gconf_add_keyring_item (const char *connection_id,
+ const char *connection_name,
const char *setting_name,
const char *setting_key,
const char *secret)
@@ -806,19 +809,19 @@
g_return_if_fail (secret != NULL);
display_name = g_strdup_printf ("Network secret for %s/%s/%s",
- connection_id,
+ connection_name,
setting_name,
setting_key);
attrs = gnome_keyring_attribute_list_new ();
gnome_keyring_attribute_list_append_string (attrs,
- "connection-name",
+ KEYRING_CID_TAG,
connection_id);
gnome_keyring_attribute_list_append_string (attrs,
- "setting-name",
+ KEYRING_SN_TAG,
setting_name);
gnome_keyring_attribute_list_append_string (attrs,
- "setting-key",
+ KEYRING_SK_TAG,
setting_key);
ret = gnome_keyring_item_create_sync (NULL,
@@ -838,6 +841,7 @@
GConfClient *client;
const char *dir;
const char *connection_id;
+ const char *connection_name;
} CopyOneSettingValueInfo;
static void
@@ -871,8 +875,13 @@
const char *str_val = g_value_get_string (value);
if (str_val) {
if (secret) {
- if (strlen (str_val))
- nm_gconf_add_keyring_item (info->connection_id, setting->name, key, str_val);
+ if (strlen (str_val)) {
+ nm_gconf_add_keyring_item (info->connection_id,
+ info->connection_name,
+ setting->name,
+ key,
+ str_val);
+ }
} else
nm_gconf_set_string_helper (info->client, info->dir, key, setting->name, str_val);
}
@@ -969,6 +978,7 @@
value = g_object_get_data (G_OBJECT (info->connection), tag);
if (value) {
nm_gconf_add_keyring_item (info->connection_id,
+ info->connection_name,
NM_SETTING_802_1X_SETTING_NAME,
tag,
value);
@@ -1013,23 +1023,26 @@
void
nm_gconf_write_connection (NMConnection *connection,
GConfClient *client,
- const char *dir)
+ const char *dir,
+ const char *connection_id)
{
- NMSettingConnection *s_connection;
+ NMSettingConnection *s_con;
CopyOneSettingValueInfo info;
g_return_if_fail (NM_IS_CONNECTION (connection));
g_return_if_fail (client != NULL);
g_return_if_fail (dir != NULL);
+ g_return_if_fail (connection_id != NULL);
- s_connection = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
- if (!s_connection)
+ s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+ if (!s_con)
return;
info.connection = connection;
info.client = client;
info.dir = dir;
- info.connection_id = s_connection->id;
+ info.connection_id = connection_id;
+ info.connection_name = s_con->id;
nm_connection_for_each_setting_value (connection,
copy_one_setting_value_to_gconf,
&info);
@@ -1130,6 +1143,7 @@
GHashTable *
nm_gconf_get_keyring_items (NMConnection *connection,
+ const char *connection_id,
const char *setting_name,
GError **error)
{
@@ -1138,8 +1152,10 @@
GList *found_list = NULL;
GnomeKeyringResult ret;
GList *iter;
+ const char *connection_name;
g_return_val_if_fail (connection != NULL, NULL);
+ g_return_val_if_fail (connection_id != NULL, NULL);
g_return_val_if_fail (setting_name != NULL, NULL);
g_return_val_if_fail (error != NULL, NULL);
g_return_val_if_fail (*error == NULL, NULL);
@@ -1147,13 +1163,14 @@
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
g_assert (s_con);
g_assert (s_con->id);
+ connection_name = s_con->id;
ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
&found_list,
- "connection-name",
+ KEYRING_CID_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
- s_con->id,
- "setting-name",
+ connection_id,
+ KEYRING_SN_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
setting_name,
NULL);
@@ -1182,7 +1199,7 @@
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - Internal error; keyring item '%s/%s' didn't "
"have a 'setting-key' attribute.",
- __FILE__, __LINE__, s_con->id, setting_name);
+ __FILE__, __LINE__, connection_name, setting_name);
break;
}
@@ -1197,7 +1214,7 @@
if (!*error) {
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - %s/%s unknown error from get_one_private_key().",
- __FILE__, __LINE__, s_con->id, setting_name);
+ __FILE__, __LINE__, connection_name, setting_name);
}
break;
}
Modified: trunk/src/gconf-helpers/gconf-helpers.h
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.h (original)
+++ trunk/src/gconf-helpers/gconf-helpers.h Thu Apr 3 19:53:39 2008
@@ -43,6 +43,12 @@
#define NMA_PATH_PHASE2_PRIVATE_KEY_TAG "nma-path-phase2-private-key"
#define NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG "nma-phase2-private-key-password"
+#define KEYRING_CID_TAG "connection-id"
+#define KEYRING_SN_TAG "setting-name"
+#define KEYRING_SK_TAG "setting-key"
+
+#define NMA_CONNECTION_ID_TAG "nma-connection-id"
+
gboolean
nm_gconf_get_int_helper (GConfClient *client,
const char *path,
@@ -151,16 +157,19 @@
void
nm_gconf_write_connection (NMConnection *connection,
GConfClient *client,
- const char *dir);
+ const char *dir,
+ const char *connection_id);
void
nm_gconf_add_keyring_item (const char *connection_id,
+ const char *connection_name,
const char *setting_name,
const char *setting_key,
const char *secret);
GHashTable *
nm_gconf_get_keyring_items (NMConnection *connection,
+ const char *connection_id,
const char *setting_name,
GError **error);
Modified: trunk/src/gconf-helpers/gconf-upgrade.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-upgrade.c (original)
+++ trunk/src/gconf-helpers/gconf-upgrade.c Thu Apr 3 19:53:39 2008
@@ -566,10 +566,13 @@
nm_gconf_write_0_6_connection (NMConnection *conn, GConfClient *client, int n)
{
char *dir;
+ char *id;
dir = g_strdup_printf ("%s/%d", GCONF_PATH_CONNECTIONS, n);
- nm_gconf_write_connection (conn, client, dir);
+ id = g_strdup_printf ("%d", n);
+ nm_gconf_write_connection (conn, client, dir, id);
g_free (dir);
+ g_free (id);
}
#define GCONF_PATH_0_6_WIRELESS_NETWORKS "/system/networking/wireless/networks"
@@ -725,7 +728,7 @@
}
static gboolean
-try_convert_leap (GConfClient *client, const char *dir)
+try_convert_leap (GConfClient *client, const char *dir, const char *connection_id)
{
char *val = NULL;
GnomeKeyringResult ret;
@@ -794,13 +797,13 @@
/* Copy the LEAP password */
ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
&found_list,
- "connection-name",
+ KEYRING_CID_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
val,
- "setting-name",
+ KEYRING_SN_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- "setting-key",
+ KEYRING_SK_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
"password",
NULL);
@@ -808,7 +811,8 @@
goto done;
found = (GnomeKeyringFound *) found_list->data;
- nm_gconf_add_keyring_item (val,
+ nm_gconf_add_keyring_item (connection_id,
+ val,
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
found->secret);
@@ -821,9 +825,12 @@
}
static void
-copy_keyring_to_8021x (GConfClient *client, const char *dir, const char *key)
+copy_keyring_to_8021x (GConfClient *client,
+ const char *dir,
+ const char *connection_id,
+ const char *key)
{
- char *id = NULL;
+ char *name = NULL;
GnomeKeyringResult ret;
GList *found_list = NULL;
GnomeKeyringFound *found;
@@ -831,19 +838,19 @@
if (!nm_gconf_get_string_helper (client, dir,
"id",
NM_SETTING_CONNECTION_SETTING_NAME,
- &id))
+ &name))
return;
/* Copy the LEAP password */
ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
&found_list,
- "connection-name",
+ KEYRING_CID_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
- id,
- "setting-name",
+ connection_id,
+ KEYRING_SN_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- "setting-key",
+ KEYRING_SK_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
key,
NULL);
@@ -851,12 +858,12 @@
goto done;
found = (GnomeKeyringFound *) found_list->data;
- nm_gconf_add_keyring_item (id, NM_SETTING_802_1X_SETTING_NAME, key, found->secret);
+ nm_gconf_add_keyring_item (connection_id, name, NM_SETTING_802_1X_SETTING_NAME, key, found->secret);
gnome_keyring_item_delete_sync (found->keyring, found->item_id);
done:
- g_free (id);
+ g_free (name);
gnome_keyring_found_list_free (found_list);
}
@@ -869,23 +876,24 @@
for (iter = connections; iter; iter = iter->next) {
char *key_mgmt = NULL;
GSList *eap = NULL;
+ char *id = g_path_get_basename ((const char *) iter->data);
if (!nm_gconf_get_string_helper (client, iter->data,
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
&key_mgmt))
- continue;
+ goto next;
/* Only convert 802.1x-based connections */
if (strcmp (key_mgmt, "ieee8021x") && strcmp (key_mgmt, "wpa-eap")) {
g_free (key_mgmt);
- continue;
+ goto next;
}
g_free (key_mgmt);
/* Leap gets converted differently */
- if (try_convert_leap (client, iter->data))
- continue;
+ if (try_convert_leap (client, iter->data, id))
+ goto next;
/* Otherwise straight 802.1x */
if (nm_gconf_get_stringlist_helper (client, iter->data,
@@ -895,7 +903,7 @@
/* Already converted */
g_slist_foreach (eap, (GFunc) g_free, NULL);
g_slist_free (eap);
- continue;
+ goto next;
}
copy_stringlist_to_8021x (client, iter->data, NM_SETTING_802_1X_EAP);
@@ -918,14 +926,79 @@
copy_bool_to_8021x (client, iter->data, NMA_CA_CERT_IGNORE_TAG);
copy_bool_to_8021x (client, iter->data, NMA_PHASE2_CA_CERT_IGNORE_TAG);
- copy_keyring_to_8021x (client, iter->data, NM_SETTING_802_1X_PASSWORD);
- copy_keyring_to_8021x (client, iter->data, NM_SETTING_802_1X_PIN);
- copy_keyring_to_8021x (client, iter->data, NM_SETTING_802_1X_PSK);
- copy_keyring_to_8021x (client, iter->data, NMA_PRIVATE_KEY_PASSWORD_TAG);
- copy_keyring_to_8021x (client, iter->data, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG);
+ copy_keyring_to_8021x (client, iter->data, id, NM_SETTING_802_1X_PASSWORD);
+ copy_keyring_to_8021x (client, iter->data, id, NM_SETTING_802_1X_PIN);
+ copy_keyring_to_8021x (client, iter->data, id, NM_SETTING_802_1X_PSK);
+ copy_keyring_to_8021x (client, iter->data, id, NMA_PRIVATE_KEY_PASSWORD_TAG);
+ copy_keyring_to_8021x (client, iter->data, id, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG);
+
+next:
+ g_free (id);
}
free_slist (connections);
gconf_client_suggest_sync (client, NULL);
}
+/*
+ * Move all keyring items to use 'connection-id' instead of 'connection-name'
+ */
+void
+nm_gconf_migrate_0_7_keyring_items (GConfClient *client)
+{
+ GSList *connections;
+ GSList *iter;
+
+ connections = gconf_client_all_dirs (client, GCONF_PATH_CONNECTIONS, NULL);
+ for (iter = connections; iter; iter = g_slist_next (iter)) {
+ GnomeKeyringResult ret;
+ GList *found_list = NULL, *elt;
+ char *name = NULL;
+ char *id = g_path_get_basename (iter->data);
+
+ if (!nm_gconf_get_string_helper (client, iter->data,
+ "id",
+ NM_SETTING_CONNECTION_SETTING_NAME,
+ &name))
+ goto next;
+
+ ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
+ &found_list,
+ "connection-name",
+ GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+ name,
+ NULL);
+ if ((ret != GNOME_KEYRING_RESULT_OK) || (g_list_length (found_list) == 0))
+ goto next;
+
+ for (elt = found_list; elt; elt = g_list_next (elt)) {
+ GnomeKeyringFound *found = (GnomeKeyringFound *) elt->data;
+ char *setting_name = NULL;
+ char *setting_key = NULL;
+ int i;
+
+ for (i = 0; found->attributes && (i < found->attributes->len); i++) {
+ GnomeKeyringAttribute *attr;
+
+ attr = &(gnome_keyring_attribute_list_index (found->attributes, i));
+ if (!strcmp (attr->name, KEYRING_SN_TAG) && (attr->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING))
+ setting_name = attr->value.string;
+ else if (!strcmp (attr->name, KEYRING_SK_TAG) && (attr->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING))
+ setting_key = attr->value.string;
+ }
+
+ if (setting_name && setting_key) {
+ nm_gconf_add_keyring_item (id, name, setting_name, setting_key, found->secret);
+ ret = gnome_keyring_item_delete_sync (found->keyring, found->item_id);
+ }
+ }
+ gnome_keyring_found_list_free (found_list);
+
+ next:
+ g_free (name);
+ g_free (id);
+ }
+
+
+}
+
Modified: trunk/src/gconf-helpers/gconf-upgrade.h
==============================================================================
--- trunk/src/gconf-helpers/gconf-upgrade.h (original)
+++ trunk/src/gconf-helpers/gconf-upgrade.h Thu Apr 3 19:53:39 2008
@@ -32,5 +32,7 @@
void nm_gconf_migrate_0_7_wireless_security (GConfClient *client);
+void nm_gconf_migrate_0_7_keyring_items (GConfClient *client);
+
#endif /* GCONF_UPGRADE_H */
Modified: trunk/src/vpn-properties/nm-vpn-properties.c
==============================================================================
--- trunk/src/vpn-properties/nm-vpn-properties.c (original)
+++ trunk/src/vpn-properties/nm-vpn-properties.c Thu Apr 3 19:53:39 2008
@@ -178,6 +178,7 @@
write_vpn_connection_to_gconf (NMConnection *connection)
{
const char *path;
+ const char *id;
g_return_val_if_fail (connection != NULL, FALSE);
@@ -188,7 +189,8 @@
path = g_object_get_data (G_OBJECT (connection), "gconf-path");
g_assert (path);
- nm_gconf_write_connection (connection, gconf_client, path);
+ id = g_object_get_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG);
+ nm_gconf_write_connection (connection, gconf_client, path, id);
gconf_client_suggest_sync (gconf_client, NULL);
return TRUE;
@@ -232,6 +234,10 @@
"gconf-path", path,
(GDestroyNotify) g_free);
+ g_object_set_data_full (G_OBJECT (connection),
+ NMA_CONNECTION_ID_TAG, g_path_get_basename (path),
+ (GDestroyNotify) g_free);
+
write_vpn_connection_to_gconf (connection);
gtk_list_store_append (vpn_conn_list, &iter);
@@ -816,6 +822,10 @@
"gconf-path", g_strdup (dir),
(GDestroyNotify) g_free);
+ g_object_set_data_full (G_OBJECT (connection),
+ NMA_CONNECTION_ID_TAG, g_path_get_basename (dir),
+ (GDestroyNotify) g_free);
+
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
if (!s_con || strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME)) {
g_object_unref (connection);
Modified: trunk/src/wired-dialog.c
==============================================================================
--- trunk/src/wired-dialog.c (original)
+++ trunk/src/wired-dialog.c Thu Apr 3 19:53:39 2008
@@ -12,6 +12,7 @@
#include "wired-dialog.h"
#include "wireless-security.h"
#include "applet-dialogs.h"
+#include "gconf-helpers.h"
static void
stuff_changed_cb (WirelessSecurity *sec, gpointer user_data)
@@ -40,8 +41,10 @@
GList *children;
GList *iter;
WirelessSecurity *security;
+ const char *id;
- security = (WirelessSecurity *) ws_wpa_eap_new (glade_file, connection);
+ id = g_object_get_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG);
+ security = (WirelessSecurity *) ws_wpa_eap_new (glade_file, connection, id);
/* Remove any previous wireless security widgets */
children = gtk_container_get_children (GTK_CONTAINER (box));
Modified: trunk/src/wireless-dialog.c
==============================================================================
--- trunk/src/wireless-dialog.c (original)
+++ trunk/src/wireless-dialog.c Thu Apr 3 19:53:39 2008
@@ -41,6 +41,7 @@
#include "wireless-dialog.h"
#include "wireless-security.h"
#include "utils.h"
+#include "gconf-helpers.h"
#define NEW_ADHOC_TAG "user-created-adhoc"
@@ -420,6 +421,7 @@
int item = 0;
NMSettingWireless *s_wireless = NULL;
gboolean is_adhoc = user_created_adhoc;
+ char *connection_id = NULL;
g_return_val_if_fail (combo != NULL, FALSE);
g_return_val_if_fail (glade_file != NULL, FALSE);
@@ -450,6 +452,8 @@
wsec = NULL;
if (wsec)
default_type = get_default_type_for_security (wsec, ap_flags, dev_caps);
+
+ connection_id = g_object_get_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG);
}
sec_model = gtk_list_store_new (2, G_TYPE_STRING, wireless_security_get_g_type ());
@@ -471,7 +475,7 @@
&& ((!ap_wpa && !ap_rsn) || !(dev_caps & (NM_802_11_DEVICE_CAP_WPA | NM_802_11_DEVICE_CAP_RSN)))) {
WirelessSecurityWEPKey *ws_wep;
- ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_PASSPHRASE);
+ ws_wep = ws_wep_key_new (glade_file, connection, connection_id, WEP_KEY_TYPE_PASSPHRASE);
if (ws_wep) {
add_security_item (dialog, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 128-bit Passphrase"));
@@ -480,7 +484,7 @@
item++;
}
- ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_HEX);
+ ws_wep = ws_wep_key_new (glade_file, connection, connection_id, WEP_KEY_TYPE_HEX);
if (ws_wep) {
add_security_item (dialog, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit Hexadecimal"));
@@ -489,7 +493,7 @@
item++;
}
- ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_ASCII);
+ ws_wep = ws_wep_key_new (glade_file, connection, connection_id, WEP_KEY_TYPE_ASCII);
if (ws_wep) {
add_security_item (dialog, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit ASCII"));
@@ -506,7 +510,7 @@
&& ((!ap_wpa && !ap_rsn) || !(dev_caps & (NM_802_11_DEVICE_CAP_WPA | NM_802_11_DEVICE_CAP_RSN)))) {
WirelessSecurityLEAP *ws_leap;
- ws_leap = ws_leap_new (glade_file, connection);
+ ws_leap = ws_leap_new (glade_file, connection, connection_id);
if (ws_leap) {
add_security_item (dialog, WIRELESS_SECURITY (ws_leap), sec_model,
&iter, _("LEAP"));
@@ -519,7 +523,7 @@
if (nm_utils_security_valid (NMU_SEC_DYNAMIC_WEP, dev_caps, !!cur_ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)) {
WirelessSecurityDynamicWEP *ws_dynamic_wep;
- ws_dynamic_wep = ws_dynamic_wep_new (glade_file, connection);
+ ws_dynamic_wep = ws_dynamic_wep_new (glade_file, connection, connection_id);
if (ws_dynamic_wep) {
add_security_item (dialog, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
&iter, _("Dynamic WEP (802.1x)"));
@@ -533,7 +537,7 @@
|| nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, !!cur_ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)) {
WirelessSecurityWPAPSK *ws_wpa_psk;
- ws_wpa_psk = ws_wpa_psk_new (glade_file, connection);
+ ws_wpa_psk = ws_wpa_psk_new (glade_file, connection, connection_id);
if (ws_wpa_psk) {
add_security_item (dialog, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
&iter, _("WPA & WPA2 Personal"));
@@ -547,7 +551,7 @@
|| nm_utils_security_valid (NMU_SEC_WPA2_ENTERPRISE, dev_caps, !!cur_ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)) {
WirelessSecurityWPAEAP *ws_wpa_eap;
- ws_wpa_eap = ws_wpa_eap_new (glade_file, connection);
+ ws_wpa_eap = ws_wpa_eap_new (glade_file, connection, connection_id);
if (ws_wpa_eap) {
add_security_item (dialog, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
&iter, _("WPA & WPA2 Enterprise"));
Modified: trunk/src/wireless-security/eap-method-leap.c
==============================================================================
--- trunk/src/wireless-security/eap-method-leap.c (original)
+++ trunk/src/wireless-security/eap-method-leap.c Thu Apr 3 19:53:39 2008
@@ -112,13 +112,16 @@
EAPMethodLEAP *
eap_method_leap_new (const char *glade_file,
WirelessSecurity *parent,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
EAPMethodLEAP *method;
GtkWidget *widget;
GladeXML *xml;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "eap_leap_notebook", NULL);
if (xml == NULL) {
@@ -169,7 +172,7 @@
GError *error = NULL;
GValue *value;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_802_1X_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_802_1X_SETTING_NAME, &error);
if (secrets) {
value = g_hash_table_lookup (secrets, NM_SETTING_802_1X_PASSWORD);
if (value)
Modified: trunk/src/wireless-security/eap-method-leap.h
==============================================================================
--- trunk/src/wireless-security/eap-method-leap.h (original)
+++ trunk/src/wireless-security/eap-method-leap.h Thu Apr 3 19:53:39 2008
@@ -31,7 +31,8 @@
EAPMethodLEAP * eap_method_leap_new (const char *glade_file,
WirelessSecurity *parent,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* EAP_METHOD_LEAP_H */
Modified: trunk/src/wireless-security/eap-method-peap.c
==============================================================================
--- trunk/src/wireless-security/eap-method-peap.c (original)
+++ trunk/src/wireless-security/eap-method-peap.c Thu Apr 3 19:53:39 2008
@@ -289,7 +289,8 @@
static GtkWidget *
inner_auth_combo_init (EAPMethodPEAP *method,
const char *glade_file,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
GladeXML *xml = EAP_METHOD (method)->xml;
GtkWidget *combo;
@@ -303,6 +304,7 @@
em_mschap_v2 = eap_method_simple_new (glade_file,
method->sec_parent,
connection,
+ connection_id,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -314,6 +316,7 @@
em_md5 = eap_method_simple_new (glade_file,
method->sec_parent,
connection,
+ connection_id,
EAP_METHOD_SIMPLE_TYPE_MD5);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -338,7 +341,8 @@
EAPMethodPEAP *
eap_method_peap_new (const char *glade_file,
WirelessSecurity *parent,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
EAPMethodPEAP *method;
GtkWidget *widget;
@@ -349,6 +353,8 @@
const char *filename;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "eap_peap_notebook", NULL);
if (xml == NULL) {
@@ -408,7 +414,7 @@
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
}
- widget = inner_auth_combo_init (method, glade_file, connection);
+ widget = inner_auth_combo_init (method, glade_file, connection, connection_id);
inner_auth_combo_changed_cb (widget, (gpointer) method);
widget = glade_xml_get_widget (xml, "eap_peap_version_combo");
Modified: trunk/src/wireless-security/eap-method-peap.h
==============================================================================
--- trunk/src/wireless-security/eap-method-peap.h (original)
+++ trunk/src/wireless-security/eap-method-peap.h Thu Apr 3 19:53:39 2008
@@ -35,7 +35,8 @@
EAPMethodPEAP * eap_method_peap_new (const char *glade_file,
WirelessSecurity *parent,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* EAP_METHOD_PEAP_H */
Modified: trunk/src/wireless-security/eap-method-simple.c
==============================================================================
--- trunk/src/wireless-security/eap-method-simple.c (original)
+++ trunk/src/wireless-security/eap-method-simple.c Thu Apr 3 19:53:39 2008
@@ -128,6 +128,7 @@
eap_method_simple_new (const char *glade_file,
WirelessSecurity *parent,
NMConnection *connection,
+ const char *connection_id,
EAPMethodSimpleType type)
{
EAPMethodSimple *method;
@@ -135,6 +136,8 @@
GladeXML *xml;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "eap_simple_notebook", NULL);
if (xml == NULL) {
@@ -187,7 +190,7 @@
GError *error = NULL;
GValue *value;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_802_1X_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_802_1X_SETTING_NAME, &error);
if (secrets) {
value = g_hash_table_lookup (secrets, NM_SETTING_802_1X_PASSWORD);
if (value)
Modified: trunk/src/wireless-security/eap-method-simple.h
==============================================================================
--- trunk/src/wireless-security/eap-method-simple.h (original)
+++ trunk/src/wireless-security/eap-method-simple.h Thu Apr 3 19:53:39 2008
@@ -41,6 +41,7 @@
EAPMethodSimple * eap_method_simple_new (const char *glade_file,
WirelessSecurity *parent,
NMConnection *connection,
+ const char *connection_id,
EAPMethodSimpleType type);
#endif /* EAP_METHOD_SIMPLE_H */
Modified: trunk/src/wireless-security/eap-method-tls.c
==============================================================================
--- trunk/src/wireless-security/eap-method-tls.c (original)
+++ trunk/src/wireless-security/eap-method-tls.c Thu Apr 3 19:53:39 2008
@@ -338,6 +338,7 @@
eap_method_tls_new (const char *glade_file,
WirelessSecurity *parent,
NMConnection *connection,
+ const char *connection_id,
gboolean phase2)
{
EAPMethodTLS *method;
@@ -347,6 +348,8 @@
NMSetting8021x *s_8021x = NULL;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "eap_tls_notebook", NULL);
if (xml == NULL) {
@@ -410,7 +413,7 @@
GError *error = NULL;
GValue *value;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_802_1X_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_802_1X_SETTING_NAME, &error);
if (secrets) {
value = g_hash_table_lookup (secrets, NMA_PRIVATE_KEY_PASSWORD_TAG);
if (value)
Modified: trunk/src/wireless-security/eap-method-tls.h
==============================================================================
--- trunk/src/wireless-security/eap-method-tls.h (original)
+++ trunk/src/wireless-security/eap-method-tls.h Thu Apr 3 19:53:39 2008
@@ -35,6 +35,7 @@
EAPMethodTLS * eap_method_tls_new (const char *glade_file,
WirelessSecurity *parent,
NMConnection *connection,
+ const char *connection_id,
gboolean phase2);
#endif /* EAP_METHOD_TLS_H */
Modified: trunk/src/wireless-security/eap-method-ttls.c
==============================================================================
--- trunk/src/wireless-security/eap-method-ttls.c (original)
+++ trunk/src/wireless-security/eap-method-ttls.c Thu Apr 3 19:53:39 2008
@@ -276,7 +276,8 @@
static GtkWidget *
inner_auth_combo_init (EAPMethodTTLS *method,
const char *glade_file,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
GladeXML *xml = EAP_METHOD (method)->xml;
GtkWidget *combo;
@@ -292,6 +293,7 @@
em_pap = eap_method_simple_new (glade_file,
method->sec_parent,
connection,
+ connection_id,
EAP_METHOD_SIMPLE_TYPE_PAP);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -303,6 +305,7 @@
em_mschap = eap_method_simple_new (glade_file,
method->sec_parent,
connection,
+ connection_id,
EAP_METHOD_SIMPLE_TYPE_MSCHAP);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -314,6 +317,7 @@
em_mschap_v2 = eap_method_simple_new (glade_file,
method->sec_parent,
connection,
+ connection_id,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -325,6 +329,7 @@
em_chap = eap_method_simple_new (glade_file,
method->sec_parent,
connection,
+ connection_id,
EAP_METHOD_SIMPLE_TYPE_CHAP);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -349,7 +354,8 @@
EAPMethodTTLS *
eap_method_ttls_new (const char *glade_file,
WirelessSecurity *parent,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
EAPMethodTTLS *method;
GtkWidget *widget;
@@ -360,6 +366,8 @@
const char *filename;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "eap_ttls_notebook", NULL);
if (xml == NULL) {
@@ -423,7 +431,7 @@
if (s_8021x && s_8021x->anonymous_identity)
gtk_entry_set_text (GTK_ENTRY (widget), s_8021x->anonymous_identity);
- widget = inner_auth_combo_init (method, glade_file, connection);
+ widget = inner_auth_combo_init (method, glade_file, connection, connection_id);
inner_auth_combo_changed_cb (widget, (gpointer) method);
return method;
Modified: trunk/src/wireless-security/eap-method-ttls.h
==============================================================================
--- trunk/src/wireless-security/eap-method-ttls.h (original)
+++ trunk/src/wireless-security/eap-method-ttls.h Thu Apr 3 19:53:39 2008
@@ -35,7 +35,8 @@
EAPMethodTTLS * eap_method_ttls_new (const char *glade_file,
WirelessSecurity *parent,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* EAP_METHOD_TLS_H */
Modified: trunk/src/wireless-security/wireless-security.c
==============================================================================
--- trunk/src/wireless-security/wireless-security.c (original)
+++ trunk/src/wireless-security/wireless-security.c Thu Apr 3 19:53:39 2008
@@ -276,7 +276,8 @@
const char *glade_file,
const char *combo_name,
GCallback auth_combo_changed_cb,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
GtkWidget *combo;
GtkListStore *auth_model;
@@ -288,6 +289,9 @@
const char *default_method = NULL;
int active = -1;
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
+
/* Grab the default EAP method out of the security object */
if (connection) {
NMSettingWireless *s_wireless;
@@ -304,7 +308,7 @@
auth_model = gtk_list_store_new (2, G_TYPE_STRING, eap_method_get_g_type ());
- em_tls = eap_method_tls_new (glade_file, sec, connection, FALSE);
+ em_tls = eap_method_tls_new (glade_file, sec, connection, connection_id, FALSE);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("TLS"),
@@ -314,7 +318,7 @@
if (default_method && (active < 0) && !strcmp (default_method, "tls"))
active = 0;
- em_leap = eap_method_leap_new (glade_file, sec, connection);
+ em_leap = eap_method_leap_new (glade_file, sec, connection, connection_id);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("LEAP"),
@@ -324,7 +328,7 @@
if (default_method && (active < 0) && !strcmp (default_method, "leap"))
active = 1;
- em_ttls = eap_method_ttls_new (glade_file, sec, connection);
+ em_ttls = eap_method_ttls_new (glade_file, sec, connection, connection_id);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("Tunneled TLS"),
@@ -334,7 +338,7 @@
if (default_method && (active < 0) && !strcmp (default_method, "ttls"))
active = 2;
- em_peap = eap_method_peap_new (glade_file, sec, connection);
+ em_peap = eap_method_peap_new (glade_file, sec, connection, connection_id);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("Protected EAP (PEAP)"),
Modified: trunk/src/wireless-security/wireless-security.h
==============================================================================
--- trunk/src/wireless-security/wireless-security.h (original)
+++ trunk/src/wireless-security/wireless-security.h Thu Apr 3 19:53:39 2008
@@ -106,7 +106,8 @@
const char *glade_file,
const char *combo_name,
GCallback auth_combo_changed_cb,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
void ws_802_1x_auth_combo_changed (GtkWidget *combo,
WirelessSecurity *sec,
Modified: trunk/src/wireless-security/ws-dynamic-wep.c
==============================================================================
--- trunk/src/wireless-security/ws-dynamic-wep.c (original)
+++ trunk/src/wireless-security/ws-dynamic-wep.c Thu Apr 3 19:53:39 2008
@@ -97,13 +97,17 @@
}
WirelessSecurityDynamicWEP *
-ws_dynamic_wep_new (const char *glade_file, NMConnection *connection)
+ws_dynamic_wep_new (const char *glade_file,
+ NMConnection *connection,
+ const char *connection_id)
{
WirelessSecurityDynamicWEP *sec;
GtkWidget *widget;
GladeXML *xml;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "dynamic_wep_notebook", NULL);
if (xml == NULL) {
@@ -136,7 +140,8 @@
glade_file,
"dynamic_wep_auth_combo",
(GCallback) auth_combo_changed_cb,
- connection);
+ connection,
+ connection_id);
auth_combo_changed_cb (widget, (gpointer) sec);
return sec;
Modified: trunk/src/wireless-security/ws-dynamic-wep.h
==============================================================================
--- trunk/src/wireless-security/ws-dynamic-wep.h (original)
+++ trunk/src/wireless-security/ws-dynamic-wep.h Thu Apr 3 19:53:39 2008
@@ -29,7 +29,8 @@
} WirelessSecurityDynamicWEP;
WirelessSecurityDynamicWEP * ws_dynamic_wep_new (const char *glade_file,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* WS_DYNAMIC_WEP_H */
Modified: trunk/src/wireless-security/ws-leap.c
==============================================================================
--- trunk/src/wireless-security/ws-leap.c (original)
+++ trunk/src/wireless-security/ws-leap.c Thu Apr 3 19:53:39 2008
@@ -111,7 +111,7 @@
}
WirelessSecurityLEAP *
-ws_leap_new (const char *glade_file, NMConnection *connection)
+ws_leap_new (const char *glade_file, NMConnection *connection, const char *connection_id)
{
WirelessSecurityLEAP *sec;
GtkWidget *widget;
@@ -119,6 +119,8 @@
NMSettingWirelessSecurity *wsec = NULL;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "leap_notebook", NULL);
if (xml == NULL) {
@@ -164,7 +166,7 @@
GError *error = NULL;
GValue *value;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
if (secrets) {
value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD);
if (value)
Modified: trunk/src/wireless-security/ws-leap.h
==============================================================================
--- trunk/src/wireless-security/ws-leap.h (original)
+++ trunk/src/wireless-security/ws-leap.h Thu Apr 3 19:53:39 2008
@@ -28,7 +28,8 @@
} WirelessSecurityLEAP;
WirelessSecurityLEAP * ws_leap_new (const char *glade_file,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* WS_LEAP_H */
Modified: trunk/src/wireless-security/ws-wep-key.c
==============================================================================
--- trunk/src/wireless-security/ws-wep-key.c (original)
+++ trunk/src/wireless-security/ws-wep-key.c Thu Apr 3 19:53:39 2008
@@ -267,6 +267,7 @@
WirelessSecurityWEPKey *
ws_wep_key_new (const char *glade_file,
NMConnection *connection,
+ const char *connection_id,
WEPKeyType type)
{
WirelessSecurityWEPKey *sec;
@@ -276,6 +277,8 @@
guint8 default_key_idx = 0;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "wep_key_notebook", NULL);
if (xml == NULL) {
@@ -312,7 +315,7 @@
GError *error = NULL;
GValue *value;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
if (secrets) {
value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
if (value)
@@ -415,7 +418,7 @@
}
WEPKeyType
-ws_wep_guess_key_type (NMConnection *connection)
+ws_wep_guess_key_type (NMConnection *connection, const char *connection_id)
{
GHashTable *secrets;
GError *error = NULL;
@@ -425,7 +428,7 @@
if (!connection)
return WEP_KEY_TYPE_PASSPHRASE;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
if (!secrets || (g_hash_table_size (secrets) == 0))
return WEP_KEY_TYPE_PASSPHRASE;
Modified: trunk/src/wireless-security/ws-wep-key.h
==============================================================================
--- trunk/src/wireless-security/ws-wep-key.h (original)
+++ trunk/src/wireless-security/ws-wep-key.h Thu Apr 3 19:53:39 2008
@@ -38,9 +38,10 @@
WirelessSecurityWEPKey * ws_wep_key_new (const char *glade_file,
NMConnection *connection,
+ const char *connection_id,
WEPKeyType type);
-WEPKeyType ws_wep_guess_key_type (NMConnection *connection);
+WEPKeyType ws_wep_guess_key_type (NMConnection *connection, const char *connection_id);
#endif /* WS_WEP_KEY_H */
Modified: trunk/src/wireless-security/ws-wpa-eap.c
==============================================================================
--- trunk/src/wireless-security/ws-wpa-eap.c (original)
+++ trunk/src/wireless-security/ws-wpa-eap.c Thu Apr 3 19:53:39 2008
@@ -94,7 +94,8 @@
WirelessSecurityWPAEAP *
ws_wpa_eap_new (const char *glade_file,
- NMConnection *connection)
+ NMConnection *connection,
+ const char *connection_id)
{
WirelessSecurityWPAEAP *sec;
GtkWidget *widget;
@@ -133,7 +134,8 @@
glade_file,
"wpa_eap_auth_combo",
(GCallback) auth_combo_changed_cb,
- connection);
+ connection,
+ connection_id);
auth_combo_changed_cb (widget, (gpointer) sec);
return sec;
Modified: trunk/src/wireless-security/ws-wpa-eap.h
==============================================================================
--- trunk/src/wireless-security/ws-wpa-eap.h (original)
+++ trunk/src/wireless-security/ws-wpa-eap.h Thu Apr 3 19:53:39 2008
@@ -29,7 +29,8 @@
} WirelessSecurityWPAEAP;
WirelessSecurityWPAEAP * ws_wpa_eap_new (const char *glade_file,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* WS_WPA_EAP_H */
Modified: trunk/src/wireless-security/ws-wpa-psk.c
==============================================================================
--- trunk/src/wireless-security/ws-wpa-psk.c (original)
+++ trunk/src/wireless-security/ws-wpa-psk.c Thu Apr 3 19:53:39 2008
@@ -148,13 +148,15 @@
}
WirelessSecurityWPAPSK *
-ws_wpa_psk_new (const char *glade_file, NMConnection *connection)
+ws_wpa_psk_new (const char *glade_file, NMConnection *connection, const char *connection_id)
{
WirelessSecurityWPAPSK *sec;
GtkWidget *widget;
GladeXML *xml;
g_return_val_if_fail (glade_file != NULL, NULL);
+ if (connection)
+ g_return_val_if_fail (connection_id != NULL, NULL);
xml = glade_xml_new (glade_file, "wpa_psk_notebook", NULL);
if (xml == NULL) {
@@ -193,7 +195,7 @@
GError *error = NULL;
GValue *value;
- secrets = nm_gconf_get_keyring_items (connection, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
+ secrets = nm_gconf_get_keyring_items (connection, connection_id, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &error);
if (secrets) {
value = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_PSK);
if (value)
Modified: trunk/src/wireless-security/ws-wpa-psk.h
==============================================================================
--- trunk/src/wireless-security/ws-wpa-psk.h (original)
+++ trunk/src/wireless-security/ws-wpa-psk.h Thu Apr 3 19:53:39 2008
@@ -28,7 +28,8 @@
} WirelessSecurityWPAPSK;
WirelessSecurityWPAPSK * ws_wpa_psk_new (const char *glade_file,
- NMConnection *connection);
+ NMConnection *connection,
+ const char *connection_id);
#endif /* WS_WEP_KEY_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]