2005-08-04 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-info.c gnome/applet/applet-dbus-info.h - (nmi_dbus_update_network_auth_method->nmi_save_network_info): generalize to store key, key type, and auth method rather than just auth method - (nmi_dbus_update_network_info): new function - (nmi_dbus_info_message_handler): updateNetworkAuthMethod -> updateNetworkInfo * gnome/applet/passphrase-dialog.c - (nmi_passphrase_dialog_ok_clicked): call nmi_save_network_info() instead of saving the info ourselves * gnome/libnm_glib/libnm_glib.c - Remove the stupid version check for dbus * src/NetworkManagerAP.c src/NetworkManagerAP.h - (nm_ap_get_enc_key_source): return 'const char *' rather than 'char *' * src/NetworkManagerDbus.c src/NetworkManagerDbus.h - (nm_dbus_update_network_auth_method -> nm_dbus_update_network_info): Update more than just the auth method * src/NetworkManagerDevice.c - Update network info at the appropriate times git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@817 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
28
ChangeLog
28
ChangeLog
@@ -1,3 +1,31 @@
|
|||||||
|
2005-08-04 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* gnome/applet/applet-dbus-info.c
|
||||||
|
gnome/applet/applet-dbus-info.h
|
||||||
|
- (nmi_dbus_update_network_auth_method->nmi_save_network_info): generalize
|
||||||
|
to store key, key type, and auth method rather than just auth method
|
||||||
|
- (nmi_dbus_update_network_info): new function
|
||||||
|
- (nmi_dbus_info_message_handler): updateNetworkAuthMethod -> updateNetworkInfo
|
||||||
|
|
||||||
|
* gnome/applet/passphrase-dialog.c
|
||||||
|
- (nmi_passphrase_dialog_ok_clicked): call nmi_save_network_info() instead
|
||||||
|
of saving the info ourselves
|
||||||
|
|
||||||
|
* gnome/libnm_glib/libnm_glib.c
|
||||||
|
- Remove the stupid version check for dbus
|
||||||
|
|
||||||
|
* src/NetworkManagerAP.c
|
||||||
|
src/NetworkManagerAP.h
|
||||||
|
- (nm_ap_get_enc_key_source): return 'const char *' rather than 'char *'
|
||||||
|
|
||||||
|
* src/NetworkManagerDbus.c
|
||||||
|
src/NetworkManagerDbus.h
|
||||||
|
- (nm_dbus_update_network_auth_method -> nm_dbus_update_network_info): Update
|
||||||
|
more than just the auth method
|
||||||
|
|
||||||
|
* src/NetworkManagerDevice.c
|
||||||
|
- Update network info at the appropriate times
|
||||||
|
|
||||||
2005-07-29 Ray Strode <rstrode@redhat.com>
|
2005-07-29 Ray Strode <rstrode@redhat.com>
|
||||||
|
|
||||||
* src/NetworkManager.c (nm_info_handler): don't use input as format
|
* src/NetworkManager.c (nm_info_handler): don't use input as format
|
||||||
|
@@ -804,52 +804,114 @@ static DBusMessage *nmi_dbus_get_vpn_connection_routes (NMWirelessApplet *applet
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nmi_dbus_update_network_auth_method
|
* nmi_save_network_info
|
||||||
*
|
*
|
||||||
* Update a network's authentication method entry in gconf
|
* Save information about a wireless network in gconf and the gnome keyring.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static DBusMessage *nmi_dbus_update_network_auth_method (NMWirelessApplet *applet, DBusMessage *message)
|
void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
|
||||||
|
const NMEncKeyType enc_key_type, const NMDeviceAuthMethod auth_method)
|
||||||
{
|
{
|
||||||
DBusMessage *reply_message = NULL;
|
|
||||||
char *network = NULL;
|
|
||||||
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
|
||||||
char * key;
|
char * key;
|
||||||
GConfValue *value;
|
GConfEntry * gconf_entry;
|
||||||
DBusError error;
|
|
||||||
char * escaped_network;
|
char * escaped_network;
|
||||||
|
|
||||||
g_return_val_if_fail (applet != NULL, NULL);
|
g_return_if_fail (applet != NULL);
|
||||||
g_return_val_if_fail (message != NULL, NULL);
|
g_return_if_fail (essid != NULL);
|
||||||
|
|
||||||
dbus_error_init (&error);
|
escaped_network = gconf_escape_key (essid, strlen (essid));
|
||||||
if ( !dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INT32, &auth_method, DBUS_TYPE_INVALID)
|
key = g_strdup_printf ("%s/%s", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
||||||
|| (strlen (network) <= 0)
|
gconf_entry = gconf_client_get_entry (applet->gconf_client, key, NULL, TRUE, NULL);
|
||||||
|| (auth_method == NM_DEVICE_AUTH_METHOD_UNKNOWN))
|
|
||||||
{
|
|
||||||
reply_message = nmwa_dbus_create_error_message (message, NMI_DBUS_INTERFACE, "InvalidArguments",
|
|
||||||
"NetworkManagerInfo::updateNetworkAuthMethod called with invalid arguments.");
|
|
||||||
return (reply_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure the access point exists in GConf */
|
|
||||||
escaped_network = gconf_escape_key (network, strlen (network));
|
|
||||||
key = g_strdup_printf ("%s/%s/essid", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
|
||||||
value = gconf_client_get (applet->gconf_client, key, NULL);
|
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
if (value && (value->type == GCONF_VALUE_STRING))
|
if (gconf_entry)
|
||||||
|
{
|
||||||
|
GnomeKeyringAttributeList *attributes;
|
||||||
|
GnomeKeyringAttribute attr;
|
||||||
|
GnomeKeyringResult ret;
|
||||||
|
const char *name;
|
||||||
|
guint32 item_id;
|
||||||
|
|
||||||
|
if (enc_key_source && strlen (enc_key_source)
|
||||||
|
&& (enc_key_type != NM_ENC_TYPE_UNKNOWN) && (enc_key_type != NM_ENC_TYPE_NONE))
|
||||||
|
{
|
||||||
|
/* Setup a request to the keyring to save the network passphrase */
|
||||||
|
name = g_strdup_printf (_("Passphrase for wireless network %s"), essid);
|
||||||
|
attributes = gnome_keyring_attribute_list_new ();
|
||||||
|
attr.name = g_strdup ("essid"); /* FIXME: Do we need to free this ? */
|
||||||
|
attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
|
||||||
|
attr.value.string = g_strdup (essid);
|
||||||
|
g_array_append_val (attributes, attr);
|
||||||
|
|
||||||
|
ret = gnome_keyring_item_create_sync (NULL,
|
||||||
|
GNOME_KEYRING_ITEM_GENERIC_SECRET,
|
||||||
|
name,
|
||||||
|
attributes,
|
||||||
|
enc_key_source,
|
||||||
|
TRUE,
|
||||||
|
&item_id);
|
||||||
|
if (ret != GNOME_KEYRING_RESULT_OK)
|
||||||
|
g_warning ("Error saving passphrase in keyring. Ret=%d", ret);
|
||||||
|
else
|
||||||
|
gnome_keyring_attribute_list_free (attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
gconf_entry_unref (gconf_entry);
|
||||||
|
|
||||||
|
key = g_strdup_printf ("%s/%s/essid", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
||||||
|
gconf_client_set_string (applet->gconf_client, key, essid, NULL);
|
||||||
|
g_free (key);
|
||||||
|
|
||||||
|
key = g_strdup_printf ("%s/%s/key_type", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
||||||
|
gconf_client_set_int (applet->gconf_client, key, (int)enc_key_type, NULL);
|
||||||
|
g_free (key);
|
||||||
|
|
||||||
|
if (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN)
|
||||||
{
|
{
|
||||||
key = g_strdup_printf ("%s/%s/auth_method", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
key = g_strdup_printf ("%s/%s/auth_method", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
||||||
gconf_client_set_int (applet->gconf_client, key, auth_method, NULL);
|
gconf_client_set_int (applet->gconf_client, key, auth_method, NULL);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
}
|
}
|
||||||
if (value)
|
}
|
||||||
gconf_value_free (value);
|
|
||||||
|
|
||||||
g_free (escaped_network);
|
g_free (escaped_network);
|
||||||
|
}
|
||||||
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nmi_dbus_update_network_info
|
||||||
|
*
|
||||||
|
* Update a network's authentication method and encryption key in gconf & the keyring
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void nmi_dbus_update_network_info (NMWirelessApplet *applet, DBusMessage *message)
|
||||||
|
{
|
||||||
|
DBusMessage * reply_message = NULL;
|
||||||
|
char * network = NULL;
|
||||||
|
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
||||||
|
char * enc_key_source = NULL;
|
||||||
|
int enc_key_type = -1;
|
||||||
|
char * key;
|
||||||
|
GConfValue * value;
|
||||||
|
DBusError error;
|
||||||
|
char * escaped_network;
|
||||||
|
dbus_bool_t args_good;
|
||||||
|
|
||||||
|
g_return_if_fail (applet != NULL);
|
||||||
|
g_return_if_fail (message != NULL);
|
||||||
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
args_good = dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network,
|
||||||
|
DBUS_TYPE_STRING, &enc_key_source,
|
||||||
|
DBUS_TYPE_INT32, &enc_key_type,
|
||||||
|
DBUS_TYPE_INT32, &auth_method,
|
||||||
|
DBUS_TYPE_INVALID);
|
||||||
|
if (!args_good || (strlen (network) <= 0) || (auth_method == NM_DEVICE_AUTH_METHOD_UNKNOWN))
|
||||||
|
return;
|
||||||
|
if (enc_key_source && strlen (enc_key_source) && ((enc_key_type == NM_ENC_TYPE_UNKNOWN) || (enc_key_type == NM_ENC_TYPE_NONE)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
nmi_save_network_info (applet, network, enc_key_source, (NMEncKeyType) enc_key_type, auth_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -999,8 +1061,8 @@ DBusHandlerResult nmi_dbus_info_message_handler (DBusConnection *connection, DBu
|
|||||||
reply = nmi_dbus_get_networks (applet, message);
|
reply = nmi_dbus_get_networks (applet, message);
|
||||||
else if (strcmp ("getNetworkProperties", method) == 0)
|
else if (strcmp ("getNetworkProperties", method) == 0)
|
||||||
reply = nmi_dbus_get_network_properties (applet, message);
|
reply = nmi_dbus_get_network_properties (applet, message);
|
||||||
else if (strcmp ("updateNetworkAuthMethod", method) == 0)
|
else if (strcmp ("updateNetworkInfo", method) == 0)
|
||||||
nmi_dbus_update_network_auth_method (applet, message);
|
nmi_dbus_update_network_info (applet, message);
|
||||||
else if (strcmp ("addNetworkAddress", method) == 0)
|
else if (strcmp ("addNetworkAddress", method) == 0)
|
||||||
nmi_dbus_add_network_address (applet, message);
|
nmi_dbus_add_network_address (applet, message);
|
||||||
else if (strcmp ("getVPNConnections", method) == 0)
|
else if (strcmp ("getVPNConnections", method) == 0)
|
||||||
|
@@ -38,4 +38,8 @@ void nmi_dbus_signal_update_network (DBusConnection *connection, const char
|
|||||||
|
|
||||||
void nmi_dbus_signal_update_vpn_connection (DBusConnection *connection, const char *name);
|
void nmi_dbus_signal_update_vpn_connection (DBusConnection *connection, const char *name);
|
||||||
|
|
||||||
|
void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
|
||||||
|
const NMEncKeyType enc_key_type, const NMDeviceAuthMethod auth_method);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -191,10 +191,7 @@ static void nmi_passphrase_dialog_ok_clicked (GtkWidget *ok_button, gpointer use
|
|||||||
NetworkDevice * dev = g_object_get_data (G_OBJECT (dialog), "device");
|
NetworkDevice * dev = g_object_get_data (G_OBJECT (dialog), "device");
|
||||||
WirelessNetwork * net = g_object_get_data (G_OBJECT (dialog), "network");
|
WirelessNetwork * net = g_object_get_data (G_OBJECT (dialog), "network");
|
||||||
DBusMessage * message = g_object_get_data (G_OBJECT (dialog), "dbus-message");
|
DBusMessage * message = g_object_get_data (G_OBJECT (dialog), "dbus-message");
|
||||||
char * key = NULL;
|
|
||||||
NMEncKeyType key_type_return = NM_ENC_TYPE_UNKNOWN;
|
NMEncKeyType key_type_return = NM_ENC_TYPE_UNKNOWN;
|
||||||
GConfEntry * gconf_entry;
|
|
||||||
char * escaped_network;
|
|
||||||
|
|
||||||
g_return_if_fail ((dialog_xml = get_dialog_xml (dialog)) != NULL);
|
g_return_if_fail ((dialog_xml = get_dialog_xml (dialog)) != NULL);
|
||||||
|
|
||||||
@@ -220,53 +217,7 @@ static void nmi_passphrase_dialog_ok_clicked (GtkWidget *ok_button, gpointer use
|
|||||||
|
|
||||||
/* Tell NetworkManager about the key the user typed in */
|
/* Tell NetworkManager about the key the user typed in */
|
||||||
nmi_dbus_return_user_key (applet->connection, message, passphrase, key_type_return);
|
nmi_dbus_return_user_key (applet->connection, message, passphrase, key_type_return);
|
||||||
|
nmi_save_network_info (applet, wireless_network_get_essid(net), passphrase, key_type_return, NM_DEVICE_AUTH_METHOD_UNKNOWN);
|
||||||
/* Update GConf with the new user key */
|
|
||||||
escaped_network = gconf_escape_key (wireless_network_get_essid (net), strlen (wireless_network_get_essid (net)));
|
|
||||||
key = g_strdup_printf ("%s/%s", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
|
||||||
gconf_entry = gconf_client_get_entry (applet->gconf_client, key, NULL, TRUE, NULL);
|
|
||||||
g_free (key);
|
|
||||||
if (gconf_entry)
|
|
||||||
{
|
|
||||||
GnomeKeyringAttributeList *attributes;
|
|
||||||
GnomeKeyringAttribute attr;
|
|
||||||
GnomeKeyringResult ret;
|
|
||||||
const char *essid, *name;
|
|
||||||
guint32 item_id;
|
|
||||||
|
|
||||||
/* Setup a request to the keyring to save the network passphrase */
|
|
||||||
essid = wireless_network_get_essid (net);
|
|
||||||
name = g_strdup_printf (_("Passphrase for wireless network %s"), essid);
|
|
||||||
attributes = gnome_keyring_attribute_list_new ();
|
|
||||||
attr.name = g_strdup ("essid"); /* FIXME: Do we need to free this ? */
|
|
||||||
attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
|
|
||||||
attr.value.string = g_strdup (essid);
|
|
||||||
g_array_append_val (attributes, attr);
|
|
||||||
|
|
||||||
ret = gnome_keyring_item_create_sync (NULL,
|
|
||||||
GNOME_KEYRING_ITEM_GENERIC_SECRET,
|
|
||||||
name,
|
|
||||||
attributes,
|
|
||||||
passphrase,
|
|
||||||
TRUE,
|
|
||||||
&item_id);
|
|
||||||
if (ret != GNOME_KEYRING_RESULT_OK)
|
|
||||||
g_warning ("Error saving passphrase in keyring. Ret=%d", ret);
|
|
||||||
else
|
|
||||||
gnome_keyring_attribute_list_free (attributes);
|
|
||||||
|
|
||||||
gconf_entry_unref (gconf_entry);
|
|
||||||
|
|
||||||
key = g_strdup_printf ("%s/%s/essid", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
|
||||||
gconf_client_set_string (applet->gconf_client, key, essid, NULL);
|
|
||||||
g_free (key);
|
|
||||||
|
|
||||||
key = g_strdup_printf ("%s/%s/key_type", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
|
||||||
gconf_client_set_int (applet->gconf_client, key, key_type_return, NULL);
|
|
||||||
g_free (key);
|
|
||||||
}
|
|
||||||
g_free (escaped_network);
|
|
||||||
|
|
||||||
nmi_passphrase_dialog_clear (dialog);
|
nmi_passphrase_dialog_clear (dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -200,7 +200,6 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
|
|||||||
dbus_connection_disconnect (ctx->dbus_con);
|
dbus_connection_disconnect (ctx->dbus_con);
|
||||||
libnm_glib_schedule_dbus_watcher (ctx);
|
libnm_glib_schedule_dbus_watcher (ctx);
|
||||||
}
|
}
|
||||||
#if ((DBUS_VERSION_MAJOR == 0) && ((DBUS_VERSION_MINOR == 30) || (DBUS_VERSION_MINOR == 31) || (DBUS_VERSION_MINOR == 32) || (DBUS_VERSION_MINOR == 33) || (DBUS_VERSION_MINOR == 34) || (DBUS_VERSION_MINOR == 35)))
|
|
||||||
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
|
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
|
||||||
{
|
{
|
||||||
/* New signal for dbus 0.23... */
|
/* New signal for dbus 0.23... */
|
||||||
@@ -226,10 +225,6 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
#error "Unrecognized version of DBUS."
|
|
||||||
#endif
|
|
||||||
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")
|
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")
|
||||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive")
|
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive")
|
||||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")
|
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")
|
||||||
|
@@ -204,7 +204,7 @@ void nm_ap_set_essid (NMAccessPoint *ap, const char * essid)
|
|||||||
* Get/set functions for encryption key
|
* Get/set functions for encryption key
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
char * nm_ap_get_enc_key_source (const NMAccessPoint *ap)
|
const char * nm_ap_get_enc_key_source (const NMAccessPoint *ap)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (ap != NULL, NULL);
|
g_return_val_if_fail (ap != NULL, NULL);
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ void nm_ap_set_enc_key_source (NMAccessPoint *ap, const char * key, NMEncKeyType
|
|||||||
char *nm_ap_get_enc_key_hashed (const NMAccessPoint *ap)
|
char *nm_ap_get_enc_key_hashed (const NMAccessPoint *ap)
|
||||||
{
|
{
|
||||||
char * hashed = NULL;
|
char * hashed = NULL;
|
||||||
char *source_key;
|
const char * source_key;
|
||||||
|
|
||||||
g_return_val_if_fail (ap != NULL, NULL);
|
g_return_val_if_fail (ap != NULL, NULL);
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ void nm_ap_set_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp);
|
|||||||
char * nm_ap_get_essid (const NMAccessPoint *ap);
|
char * nm_ap_get_essid (const NMAccessPoint *ap);
|
||||||
void nm_ap_set_essid (NMAccessPoint *ap, const char *essid);
|
void nm_ap_set_essid (NMAccessPoint *ap, const char *essid);
|
||||||
|
|
||||||
char * nm_ap_get_enc_key_source (const NMAccessPoint *ap);
|
const char * nm_ap_get_enc_key_source (const NMAccessPoint *ap);
|
||||||
char * nm_ap_get_enc_key_hashed (const NMAccessPoint *ap);
|
char * nm_ap_get_enc_key_hashed (const NMAccessPoint *ap);
|
||||||
void nm_ap_set_enc_key_source (NMAccessPoint *ap, const char *key, NMEncKeyType type);
|
void nm_ap_set_enc_key_source (NMAccessPoint *ap, const char *key, NMEncKeyType type);
|
||||||
NMEncKeyType nm_ap_get_enc_type (const NMAccessPoint *ap);
|
NMEncKeyType nm_ap_get_enc_type (const NMAccessPoint *ap);
|
||||||
|
@@ -626,35 +626,50 @@ void nm_dbus_update_wireless_scan_method (DBusConnection *connection, NMData *da
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_dbus_update_network_auth_method
|
* nm_dbus_update_network_info
|
||||||
*
|
*
|
||||||
* Tell NetworkManagerInfo the updated auth_method of the AP
|
* Tell NetworkManagerInfo the updated info of the AP
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
gboolean nm_dbus_update_network_auth_method (DBusConnection *connection, const char *network, const NMDeviceAuthMethod auth_method)
|
gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint *ap)
|
||||||
{
|
{
|
||||||
DBusMessage * message;
|
DBusMessage * message;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
dbus_int32_t auth_method_as_int32 = (dbus_int32_t) auth_method;
|
dbus_int32_t auth_method;
|
||||||
|
const char * essid;
|
||||||
|
const char * enc_key_source;
|
||||||
|
dbus_int32_t enc_key_type;
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, FALSE);
|
g_return_val_if_fail (connection != NULL, FALSE);
|
||||||
g_return_val_if_fail (network != NULL, FALSE);
|
g_return_val_if_fail (ap != NULL, FALSE);
|
||||||
g_return_val_if_fail (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN, FALSE);
|
|
||||||
|
|
||||||
if (!(message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "updateNetworkAuthMethod")))
|
auth_method = nm_ap_get_auth_method (ap);
|
||||||
|
if (auth_method == NM_DEVICE_AUTH_METHOD_UNKNOWN)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
essid = nm_ap_get_essid (ap);
|
||||||
|
if (!(enc_key_source = nm_ap_get_enc_key_source (ap)))
|
||||||
|
enc_key_source = "";
|
||||||
|
enc_key_type = nm_ap_get_enc_type (ap);
|
||||||
|
|
||||||
|
if (!(message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "updateNetworkInfo")))
|
||||||
{
|
{
|
||||||
nm_warning ("nm_dbus_update_network_auth_method (): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_update_network_info(): Couldn't allocate the dbus message");
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &network, DBUS_TYPE_INT32, &auth_method, DBUS_TYPE_INVALID);
|
dbus_message_append_args (message, DBUS_TYPE_STRING, &essid,
|
||||||
|
DBUS_TYPE_STRING, &enc_key_source,
|
||||||
|
DBUS_TYPE_INT32, &enc_key_type,
|
||||||
|
DBUS_TYPE_INT32, &auth_method,
|
||||||
|
DBUS_TYPE_INVALID);
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
nm_warning ("nm_dbus_update_network_auth_method (): failed to send dbus message.");
|
nm_warning ("nm_dbus_update_network_info(): failed to send dbus message.");
|
||||||
else
|
else
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
return (success);
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwo
|
|||||||
|
|
||||||
gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType type, const char *network, struct ether_addr *addr);
|
gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType type, const char *network, struct ether_addr *addr);
|
||||||
|
|
||||||
gboolean nm_dbus_update_network_auth_method (DBusConnection *connection, const char *network, const NMDeviceAuthMethod auth_method);
|
gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint *ap);
|
||||||
|
|
||||||
void nm_dbus_update_allowed_networks (DBusConnection *connection, NMAccessPointList *list, NMData *data);
|
void nm_dbus_update_allowed_networks (DBusConnection *connection, NMAccessPointList *list, NMData *data);
|
||||||
|
|
||||||
|
@@ -2968,8 +2968,10 @@ static gboolean nm_device_activate_stage5_ip_config_commit (NMActRequest *req)
|
|||||||
NMAccessPoint *ap = nm_act_request_get_ap (req);
|
NMAccessPoint *ap = nm_act_request_get_ap (req);
|
||||||
NMAccessPoint *tmp_ap;
|
NMAccessPoint *tmp_ap;
|
||||||
|
|
||||||
/* Cache the last known good auth method in both NetworkManagerInfo and our allowed AP list */
|
/* Cache details in the info-daemon since the connect was successful */
|
||||||
nm_dbus_update_network_auth_method (data->dbus_connection, nm_ap_get_essid (ap), nm_ap_get_auth_method (ap));
|
nm_dbus_update_network_info (data->dbus_connection, ap);
|
||||||
|
|
||||||
|
/* Cache the correct auth method in our AP list too */
|
||||||
if ((tmp_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
|
if ((tmp_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
|
||||||
nm_ap_set_auth_method (tmp_ap, nm_ap_get_auth_method (ap));
|
nm_ap_set_auth_method (tmp_ap, nm_ap_get_auth_method (ap));
|
||||||
}
|
}
|
||||||
@@ -3280,7 +3282,7 @@ void nm_device_set_user_key_for_network (NMActRequest *req, const char *key, con
|
|||||||
|
|
||||||
/* Be sure to update NMI with the new auth mode */
|
/* Be sure to update NMI with the new auth mode */
|
||||||
nm_ap_set_auth_method (allowed_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (allowed_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
||||||
nm_dbus_update_network_auth_method (data->dbus_connection, nm_ap_get_essid (allowed_ap), nm_ap_get_auth_method (allowed_ap));
|
nm_dbus_update_network_info (data->dbus_connection, allowed_ap);
|
||||||
|
|
||||||
nm_device_activate_schedule_stage1_device_prepare (req);
|
nm_device_activate_schedule_stage1_device_prepare (req);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user