mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 18:24:49 +00:00
libnm-util: implement connection changed signal
Emitted whenever settings are added or removed from the connection, and whenever any property of any setting in the connection is changed.
This commit is contained in:
parent
3bf4d84ca3
commit
f6064e7b74
|
@ -113,6 +113,7 @@ enum {
|
|||
enum {
|
||||
SECRETS_UPDATED,
|
||||
SECRETS_CLEARED,
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -172,6 +173,14 @@ nm_connection_create_setting (const char *name)
|
|||
return setting;
|
||||
}
|
||||
|
||||
static void
|
||||
setting_changed_cb (NMSetting *setting,
|
||||
GParamSpec *pspec,
|
||||
NMConnection *self)
|
||||
{
|
||||
g_signal_emit (self, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_add_setting:
|
||||
* @connection: a #NMConnection
|
||||
|
@ -191,6 +200,10 @@ nm_connection_add_setting (NMConnection *connection, NMSetting *setting)
|
|||
g_hash_table_insert (NM_CONNECTION_GET_PRIVATE (connection)->settings,
|
||||
(gpointer) G_OBJECT_TYPE_NAME (setting),
|
||||
setting);
|
||||
/* Listen for property changes so we can emit the 'changed' signal */
|
||||
g_signal_connect (setting, "notify", (GCallback) setting_changed_cb, connection);
|
||||
|
||||
g_signal_emit (connection, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,10 +217,21 @@ nm_connection_add_setting (NMConnection *connection, NMSetting *setting)
|
|||
void
|
||||
nm_connection_remove_setting (NMConnection *connection, GType setting_type)
|
||||
{
|
||||
NMConnectionPrivate *priv;
|
||||
NMSetting *setting;
|
||||
const char *setting_name;
|
||||
|
||||
g_return_if_fail (NM_IS_CONNECTION (connection));
|
||||
g_return_if_fail (g_type_is_a (setting_type, NM_TYPE_SETTING));
|
||||
|
||||
g_hash_table_remove (NM_CONNECTION_GET_PRIVATE (connection)->settings, g_type_name (setting_type));
|
||||
priv = NM_CONNECTION_GET_PRIVATE (connection);
|
||||
setting_name = g_type_name (setting_type);
|
||||
setting = g_hash_table_lookup (priv->settings, setting_name);
|
||||
if (setting) {
|
||||
g_signal_handlers_disconnect_by_func (setting, setting_changed_cb, connection);
|
||||
g_hash_table_remove (priv->settings, setting_name);
|
||||
g_signal_emit (connection, signals[CHANGED], 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,14 +363,18 @@ nm_connection_replace_settings (NMConnection *connection,
|
|||
GHashTable *new_settings,
|
||||
GError **error)
|
||||
{
|
||||
gboolean valid = FALSE;
|
||||
|
||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
||||
g_return_val_if_fail (new_settings != NULL, FALSE);
|
||||
if (error)
|
||||
g_return_val_if_fail (*error == NULL, FALSE);
|
||||
|
||||
if (!validate_permissions_type (new_settings, error))
|
||||
return FALSE;
|
||||
return hash_to_connection (connection, new_settings, error);
|
||||
if (validate_permissions_type (new_settings, error)) {
|
||||
valid = hash_to_connection (connection, new_settings, error);
|
||||
g_signal_emit (connection, signals[CHANGED], 0);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -728,8 +756,10 @@ nm_connection_update_secrets (NMConnection *connection,
|
|||
}
|
||||
}
|
||||
|
||||
if (updated)
|
||||
if (updated) {
|
||||
g_signal_emit (connection, signals[SECRETS_UPDATED], 0, setting_name);
|
||||
g_signal_emit (connection, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -815,6 +845,7 @@ nm_connection_clear_secrets (NMConnection *connection)
|
|||
nm_setting_clear_secrets (setting);
|
||||
|
||||
g_signal_emit (connection, signals[SECRETS_CLEARED], 0);
|
||||
g_signal_emit (connection, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,6 +872,7 @@ nm_connection_clear_secrets_with_flags (NMConnection *connection,
|
|||
nm_setting_clear_secrets_with_flags (setting, func, user_data);
|
||||
|
||||
g_signal_emit (connection, signals[SECRETS_CLEARED], 0);
|
||||
g_signal_emit (connection, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1536,6 +1568,23 @@ nm_connection_init (NMConnection *connection)
|
|||
priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMConnection *self = NM_CONNECTION (object);
|
||||
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (self);
|
||||
GHashTableIter iter;
|
||||
NMSetting *setting;
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->settings);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting)) {
|
||||
g_signal_handlers_disconnect_by_func (setting, setting_changed_cb, self);
|
||||
g_hash_table_iter_remove (&iter);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (nm_connection_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
|
@ -1543,10 +1592,7 @@ finalize (GObject *object)
|
|||
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection);
|
||||
|
||||
g_hash_table_destroy (priv->settings);
|
||||
priv->settings = NULL;
|
||||
|
||||
g_free (priv->path);
|
||||
priv->path = NULL;
|
||||
|
||||
G_OBJECT_CLASS (nm_connection_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -1593,6 +1639,7 @@ nm_connection_class_init (NMConnectionClass *klass)
|
|||
/* virtual methods */
|
||||
object_class->set_property = set_property;
|
||||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
/* Properties */
|
||||
|
@ -1623,7 +1670,7 @@ nm_connection_class_init (NMConnectionClass *klass)
|
|||
* have been changed.
|
||||
*/
|
||||
signals[SECRETS_UPDATED] =
|
||||
g_signal_new ("secrets-updated",
|
||||
g_signal_new (NM_CONNECTION_SECRETS_UPDATED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMConnectionClass, secrets_updated),
|
||||
|
@ -1640,7 +1687,25 @@ nm_connection_class_init (NMConnectionClass *klass)
|
|||
* are cleared.
|
||||
*/
|
||||
signals[SECRETS_CLEARED] =
|
||||
g_signal_new ("secrets-cleared",
|
||||
g_signal_new (NM_CONNECTION_SECRETS_CLEARED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* NMConnection::changed:
|
||||
* @connection: the object on which the signal is emitted
|
||||
*
|
||||
* The ::changed signal is emitted when any property of any property
|
||||
* (including secrets) of any setting of the connection is modified,
|
||||
* or when settings are added or removed.
|
||||
*
|
||||
* Since: 0.9.10
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
g_signal_new (NM_CONNECTION_CHANGED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL,
|
||||
|
|
|
@ -63,6 +63,13 @@ G_BEGIN_DECLS
|
|||
#define NM_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONNECTION))
|
||||
#define NM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
|
||||
|
||||
/* Signals */
|
||||
#define NM_CONNECTION_SECRETS_UPDATED "secrets-updated"
|
||||
#define NM_CONNECTION_SECRETS_CLEARED "secrets-cleared"
|
||||
#define NM_CONNECTION_CHANGED "changed"
|
||||
|
||||
/* Properties */
|
||||
#define NM_CONNECTION_PATH "path"
|
||||
|
||||
/**
|
||||
* NMConnectionError:
|
||||
|
@ -91,8 +98,6 @@ typedef enum
|
|||
#define NM_CONNECTION_ERROR nm_connection_error_quark ()
|
||||
GQuark nm_connection_error_quark (void);
|
||||
|
||||
#define NM_CONNECTION_PATH "path"
|
||||
|
||||
/**
|
||||
* NMConnection:
|
||||
*
|
||||
|
|
|
@ -248,6 +248,7 @@ nm_setting_802_1x_add_eap_method (NMSetting8021x *setting, const char *eap)
|
|||
}
|
||||
|
||||
priv->eap = g_slist_append (priv->eap, g_ascii_strdown (eap, -1));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -272,6 +273,7 @@ nm_setting_802_1x_remove_eap_method (NMSetting8021x *setting, guint32 i)
|
|||
|
||||
g_free (elt->data);
|
||||
priv->eap = g_slist_delete_link (priv->eap, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,6 +292,7 @@ nm_setting_802_1x_clear_eap_methods (NMSetting8021x *setting)
|
|||
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
|
||||
nm_utils_slist_free (priv->eap, g_free);
|
||||
priv->eap = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -534,8 +537,10 @@ nm_setting_802_1x_set_ca_cert (NMSetting8021x *self,
|
|||
priv->ca_cert = NULL;
|
||||
}
|
||||
|
||||
if (!cert_path)
|
||||
if (!cert_path) {
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CA_CERT);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data = crypto_load_and_verify_certificate (cert_path, &format, error);
|
||||
if (data) {
|
||||
|
@ -559,6 +564,7 @@ nm_setting_802_1x_set_ca_cert (NMSetting8021x *self,
|
|||
g_byte_array_unref (data);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CA_CERT);
|
||||
return priv->ca_cert != NULL;
|
||||
}
|
||||
|
||||
|
@ -647,6 +653,7 @@ nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting,
|
|||
}
|
||||
|
||||
priv->altsubject_matches = g_slist_append (priv->altsubject_matches, g_strdup (altsubject_match));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -671,6 +678,7 @@ nm_setting_802_1x_remove_altsubject_match (NMSetting8021x *setting, guint32 i)
|
|||
|
||||
g_free (elt->data);
|
||||
priv->altsubject_matches = g_slist_delete_link (priv->altsubject_matches, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -689,6 +697,7 @@ nm_setting_802_1x_clear_altsubject_matches (NMSetting8021x *setting)
|
|||
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
|
||||
nm_utils_slist_free (priv->altsubject_matches, g_free);
|
||||
priv->altsubject_matches = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -809,8 +818,10 @@ nm_setting_802_1x_set_client_cert (NMSetting8021x *self,
|
|||
priv->client_cert = NULL;
|
||||
}
|
||||
|
||||
if (!cert_path)
|
||||
if (!cert_path) {
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CLIENT_CERT);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data = crypto_load_and_verify_certificate (cert_path, &format, error);
|
||||
if (data) {
|
||||
|
@ -846,6 +857,7 @@ nm_setting_802_1x_set_client_cert (NMSetting8021x *self,
|
|||
g_byte_array_unref (data);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CLIENT_CERT);
|
||||
return priv->client_cert != NULL;
|
||||
}
|
||||
|
||||
|
@ -1070,8 +1082,10 @@ nm_setting_802_1x_set_phase2_ca_cert (NMSetting8021x *self,
|
|||
priv->phase2_ca_cert = NULL;
|
||||
}
|
||||
|
||||
if (!cert_path)
|
||||
if (!cert_path) {
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CA_CERT);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data = crypto_load_and_verify_certificate (cert_path, &format, error);
|
||||
if (data) {
|
||||
|
@ -1095,6 +1109,7 @@ nm_setting_802_1x_set_phase2_ca_cert (NMSetting8021x *self,
|
|||
g_byte_array_unref (data);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CA_CERT);
|
||||
return priv->phase2_ca_cert != NULL;
|
||||
}
|
||||
|
||||
|
@ -1185,6 +1200,7 @@ nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting,
|
|||
|
||||
priv->phase2_altsubject_matches = g_slist_append (priv->altsubject_matches,
|
||||
g_strdup (phase2_altsubject_match));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1209,6 +1225,7 @@ nm_setting_802_1x_remove_phase2_altsubject_match (NMSetting8021x *setting, guint
|
|||
|
||||
g_free (elt->data);
|
||||
priv->phase2_altsubject_matches = g_slist_delete_link (priv->phase2_altsubject_matches, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1227,6 +1244,7 @@ nm_setting_802_1x_clear_phase2_altsubject_matches (NMSetting8021x *setting)
|
|||
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
|
||||
nm_utils_slist_free (priv->phase2_altsubject_matches, g_free);
|
||||
priv->phase2_altsubject_matches = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1349,8 +1367,10 @@ nm_setting_802_1x_set_phase2_client_cert (NMSetting8021x *self,
|
|||
priv->phase2_client_cert = NULL;
|
||||
}
|
||||
|
||||
if (!cert_path)
|
||||
if (!cert_path) {
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CLIENT_CERT);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data = crypto_load_and_verify_certificate (cert_path, &format, error);
|
||||
if (data) {
|
||||
|
@ -1387,6 +1407,7 @@ nm_setting_802_1x_set_phase2_client_cert (NMSetting8021x *self,
|
|||
g_byte_array_unref (data);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CLIENT_CERT);
|
||||
return priv->phase2_client_cert != NULL;
|
||||
}
|
||||
|
||||
|
@ -1615,6 +1636,7 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *self,
|
|||
{
|
||||
NMSetting8021xPrivate *priv;
|
||||
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
||||
gboolean key_cleared = FALSE, password_cleared = FALSE;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_802_1X (self), FALSE);
|
||||
|
||||
|
@ -1650,13 +1672,22 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *self,
|
|||
memset (priv->private_key->data, 0, priv->private_key->len);
|
||||
g_byte_array_free (priv->private_key, TRUE);
|
||||
priv->private_key = NULL;
|
||||
key_cleared = TRUE;
|
||||
}
|
||||
|
||||
g_free (priv->private_key_password);
|
||||
priv->private_key_password = NULL;
|
||||
if (priv->private_key_password) {
|
||||
g_free (priv->private_key_password);
|
||||
priv->private_key_password = NULL;
|
||||
password_cleared = TRUE;
|
||||
}
|
||||
|
||||
if (key_path == NULL)
|
||||
if (key_path == NULL) {
|
||||
if (key_cleared)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY);
|
||||
if (password_cleared)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
priv->private_key_password = g_strdup (password);
|
||||
if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) {
|
||||
|
@ -1678,8 +1709,13 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *self,
|
|||
|
||||
priv->client_cert = g_byte_array_sized_new (priv->private_key->len);
|
||||
g_byte_array_append (priv->client_cert, priv->private_key->data, priv->private_key->len);
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CLIENT_CERT);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY);
|
||||
if (password_cleared || password)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
|
||||
|
||||
if (out_format)
|
||||
*out_format = format;
|
||||
return priv->private_key != NULL;
|
||||
|
@ -1908,6 +1944,7 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self,
|
|||
{
|
||||
NMSetting8021xPrivate *priv;
|
||||
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
||||
gboolean key_cleared = FALSE, password_cleared = FALSE;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_802_1X (self), FALSE);
|
||||
|
||||
|
@ -1943,13 +1980,22 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self,
|
|||
memset (priv->phase2_private_key->data, 0, priv->phase2_private_key->len);
|
||||
g_byte_array_free (priv->phase2_private_key, TRUE);
|
||||
priv->phase2_private_key = NULL;
|
||||
key_cleared = TRUE;
|
||||
}
|
||||
|
||||
g_free (priv->phase2_private_key_password);
|
||||
priv->phase2_private_key_password = NULL;
|
||||
if (priv->phase2_private_key_password) {
|
||||
g_free (priv->phase2_private_key_password);
|
||||
priv->phase2_private_key_password = NULL;
|
||||
password_cleared = TRUE;
|
||||
}
|
||||
|
||||
if (key_path == NULL)
|
||||
if (key_path == NULL) {
|
||||
if (key_cleared)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY);
|
||||
if (password_cleared)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
priv->phase2_private_key_password = g_strdup (password);
|
||||
if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) {
|
||||
|
@ -1971,8 +2017,13 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self,
|
|||
|
||||
priv->phase2_client_cert = g_byte_array_sized_new (priv->phase2_private_key->len);
|
||||
g_byte_array_append (priv->phase2_client_cert, priv->phase2_private_key->data, priv->phase2_private_key->len);
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CLIENT_CERT);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY);
|
||||
if (password_cleared || password)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD);
|
||||
|
||||
if (out_format)
|
||||
*out_format = format;
|
||||
return priv->phase2_private_key != NULL;
|
||||
|
|
|
@ -264,6 +264,8 @@ gboolean nm_setting_bond_add_option (NMSettingBond *setting,
|
|||
} else if (!strcmp (name, NM_SETTING_BOND_OPTION_ARP_INTERVAL))
|
||||
g_hash_table_remove (priv->options, NM_SETTING_BOND_OPTION_MIIMON);
|
||||
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_BOND_OPTIONS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -282,10 +284,15 @@ gboolean
|
|||
nm_setting_bond_remove_option (NMSettingBond *setting,
|
||||
const char *name)
|
||||
{
|
||||
gboolean found;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), FALSE);
|
||||
g_return_val_if_fail (validate_option (name), FALSE);
|
||||
|
||||
return g_hash_table_remove (NM_SETTING_BOND_GET_PRIVATE (setting)->options, name);
|
||||
found = g_hash_table_remove (NM_SETTING_BOND_GET_PRIVATE (setting)->options, name);
|
||||
if (found)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_BOND_OPTIONS);
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -413,6 +413,7 @@ nm_setting_connection_add_permission (NMSettingConnection *setting,
|
|||
p = permission_new (pitem);
|
||||
g_return_val_if_fail (p != NULL, FALSE);
|
||||
priv->permissions = g_slist_append (priv->permissions, p);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -439,6 +440,7 @@ nm_setting_connection_remove_permission (NMSettingConnection *setting,
|
|||
|
||||
permission_free ((Permission *) iter->data);
|
||||
priv->permissions = g_slist_delete_link (priv->permissions, iter);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -624,6 +626,7 @@ nm_setting_connection_add_secondary (NMSettingConnection *setting,
|
|||
}
|
||||
|
||||
priv->secondaries = g_slist_append (priv->secondaries, g_strdup (sec_uuid));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -650,6 +653,7 @@ nm_setting_connection_remove_secondary (NMSettingConnection *setting, guint32 id
|
|||
|
||||
g_free (elt->data);
|
||||
priv->secondaries = g_slist_delete_link (priv->secondaries, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
|
|
@ -193,6 +193,7 @@ nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, guint32 dns)
|
|||
}
|
||||
|
||||
g_array_append_val (priv->dns, dns);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -214,6 +215,7 @@ nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i)
|
|||
g_return_if_fail (i <= priv->dns->len);
|
||||
|
||||
g_array_remove_index (priv->dns, i);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,6 +233,7 @@ nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting)
|
|||
|
||||
priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
|
||||
g_array_remove_range (priv->dns, 0, priv->dns->len);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,6 +298,7 @@ nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting,
|
|||
}
|
||||
|
||||
priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -319,6 +323,7 @@ nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i)
|
|||
|
||||
g_free (elt->data);
|
||||
priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,6 +339,7 @@ nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting)
|
|||
|
||||
nm_utils_slist_free (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
|
||||
NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,6 +408,7 @@ nm_setting_ip4_config_add_address (NMSettingIP4Config *setting,
|
|||
g_return_val_if_fail (copy != NULL, FALSE);
|
||||
|
||||
priv->addresses = g_slist_append (priv->addresses, copy);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -426,6 +433,7 @@ nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i)
|
|||
|
||||
nm_ip4_address_unref ((NMIP4Address *) elt->data);
|
||||
priv->addresses = g_slist_delete_link (priv->addresses, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -443,6 +451,7 @@ nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting)
|
|||
|
||||
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
|
||||
priv->addresses = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,6 +519,7 @@ nm_setting_ip4_config_add_route (NMSettingIP4Config *setting,
|
|||
g_return_val_if_fail (copy != NULL, FALSE);
|
||||
|
||||
priv->routes = g_slist_append (priv->routes, copy);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -534,6 +544,7 @@ nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i)
|
|||
|
||||
nm_ip4_route_unref ((NMIP4Route *) elt->data);
|
||||
priv->routes = g_slist_delete_link (priv->routes, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -551,6 +562,7 @@ nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting)
|
|||
|
||||
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
|
||||
priv->routes = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -212,6 +212,7 @@ nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const struct in6_add
|
|||
copy = g_malloc0 (sizeof (struct in6_addr));
|
||||
memcpy (copy, addr, sizeof (struct in6_addr));
|
||||
priv->dns = g_slist_append (priv->dns, copy);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -237,6 +238,7 @@ nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i)
|
|||
|
||||
g_free (elt->data);
|
||||
priv->dns = g_slist_delete_link (priv->dns, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,6 +254,7 @@ nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting)
|
|||
|
||||
nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns, g_free);
|
||||
NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,6 +319,7 @@ nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting,
|
|||
}
|
||||
|
||||
priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -340,6 +344,7 @@ nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i)
|
|||
|
||||
g_free (elt->data);
|
||||
priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,6 +360,7 @@ nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting)
|
|||
|
||||
nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
|
||||
NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -423,6 +429,7 @@ nm_setting_ip6_config_add_address (NMSettingIP6Config *setting,
|
|||
g_return_val_if_fail (copy != NULL, FALSE);
|
||||
|
||||
priv->addresses = g_slist_append (priv->addresses, copy);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -447,6 +454,7 @@ nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i)
|
|||
|
||||
nm_ip6_address_unref ((NMIP6Address *) elt->data);
|
||||
priv->addresses = g_slist_delete_link (priv->addresses, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -464,6 +472,7 @@ nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting)
|
|||
|
||||
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
|
||||
priv->addresses = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -531,6 +540,7 @@ nm_setting_ip6_config_add_route (NMSettingIP6Config *setting,
|
|||
g_return_val_if_fail (copy != NULL, FALSE);
|
||||
|
||||
priv->routes = g_slist_append (priv->routes, copy);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -555,6 +565,7 @@ nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i)
|
|||
|
||||
nm_ip6_route_unref ((NMIP6Route *) elt->data);
|
||||
priv->routes = g_slist_delete_link (priv->routes, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,6 +583,7 @@ nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting)
|
|||
|
||||
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
|
||||
priv->routes = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -222,11 +222,13 @@ get_map (NMSettingVlan *self, NMVlanPriorityMap map)
|
|||
static void
|
||||
set_map (NMSettingVlan *self, NMVlanPriorityMap map, GSList *list)
|
||||
{
|
||||
if (map == NM_VLAN_INGRESS_MAP)
|
||||
if (map == NM_VLAN_INGRESS_MAP) {
|
||||
NM_SETTING_VLAN_GET_PRIVATE (self)->ingress_priority_map = list;
|
||||
else if (map == NM_VLAN_EGRESS_MAP)
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
|
||||
} else if (map == NM_VLAN_EGRESS_MAP) {
|
||||
NM_SETTING_VLAN_GET_PRIVATE (self)->egress_priority_map = list;
|
||||
else
|
||||
g_object_notify (G_OBJECT (self), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
@ -269,6 +271,10 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
|
|||
if (p->from == item->from) {
|
||||
p->to = item->to;
|
||||
g_free (item);
|
||||
if (map == NM_VLAN_INGRESS_MAP)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
|
||||
else
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -373,6 +379,10 @@ nm_setting_vlan_add_priority (NMSettingVlan *setting,
|
|||
item = iter->data;
|
||||
if (item->from == from) {
|
||||
item->to = to;
|
||||
if (map == NM_VLAN_INGRESS_MAP)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
|
||||
else
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,6 +196,7 @@ nm_setting_vpn_add_data_item (NMSettingVPN *setting,
|
|||
|
||||
g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->data,
|
||||
g_strdup (key), g_strdup (item));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,9 +231,14 @@ nm_setting_vpn_get_data_item (NMSettingVPN *setting, const char *key)
|
|||
gboolean
|
||||
nm_setting_vpn_remove_data_item (NMSettingVPN *setting, const char *key)
|
||||
{
|
||||
gboolean found;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_VPN (setting), FALSE);
|
||||
|
||||
return g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key);
|
||||
found = g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key);
|
||||
if (found)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_DATA);
|
||||
return found;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -323,6 +329,7 @@ nm_setting_vpn_add_secret (NMSettingVPN *setting,
|
|||
|
||||
g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets,
|
||||
g_strdup (key), g_strdup (secret));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_SECRETS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,9 +364,14 @@ nm_setting_vpn_get_secret (NMSettingVPN *setting, const char *key)
|
|||
gboolean
|
||||
nm_setting_vpn_remove_secret (NMSettingVPN *setting, const char *key)
|
||||
{
|
||||
gboolean found;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_VPN (setting), FALSE);
|
||||
|
||||
return g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key);
|
||||
found = g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key);
|
||||
if (found)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_SECRETS);
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -511,6 +523,9 @@ update_one_secret (NMSetting *setting, const char *key, GValue *value, GError **
|
|||
} else
|
||||
g_set_error_literal (error, NM_SETTING_ERROR, NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH, key);
|
||||
|
||||
if (success)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_SECRETS);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -562,6 +577,7 @@ set_secret_flags (NMSetting *setting,
|
|||
g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->data,
|
||||
g_strdup_printf ("%s-flags", secret_name),
|
||||
g_strdup_printf ("%u", flags));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_SECRETS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -643,6 +659,7 @@ clear_secrets_with_flags (NMSetting *setting,
|
|||
NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
|
||||
GHashTableIter iter;
|
||||
const char *secret;
|
||||
gboolean changed = TRUE;
|
||||
|
||||
if (priv->secrets == NULL)
|
||||
return;
|
||||
|
@ -653,9 +670,14 @@ clear_secrets_with_flags (NMSetting *setting,
|
|||
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
|
||||
|
||||
nm_setting_get_secret_flags (setting, secret, &flags, NULL);
|
||||
if (func (setting, pspec->name, flags, user_data) == TRUE)
|
||||
if (func (setting, pspec->name, flags, user_data) == TRUE) {
|
||||
g_hash_table_iter_remove (&iter);
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_SECRETS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -497,6 +497,7 @@ nm_setting_wired_add_s390_option (NMSettingWired *setting,
|
|||
g_hash_table_insert (NM_SETTING_WIRED_GET_PRIVATE (setting)->s390_options,
|
||||
g_strdup (key),
|
||||
g_strdup (value));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRED_S390_OPTIONS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -515,11 +516,16 @@ gboolean
|
|||
nm_setting_wired_remove_s390_option (NMSettingWired *setting,
|
||||
const char *key)
|
||||
{
|
||||
gboolean found;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), FALSE);
|
||||
g_return_val_if_fail (key != NULL, FALSE);
|
||||
g_return_val_if_fail (strlen (key), FALSE);
|
||||
|
||||
return g_hash_table_remove (NM_SETTING_WIRED_GET_PRIVATE (setting)->s390_options, key);
|
||||
found = g_hash_table_remove (NM_SETTING_WIRED_GET_PRIVATE (setting)->s390_options, key);
|
||||
if (found)
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRED_S390_OPTIONS);
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -228,6 +228,7 @@ nm_setting_wireless_security_add_proto (NMSettingWirelessSecurity *setting, cons
|
|||
}
|
||||
|
||||
priv->proto = g_slist_append (priv->proto, g_ascii_strdown (proto, -1));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PROTO);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -252,6 +253,7 @@ nm_setting_wireless_security_remove_proto (NMSettingWirelessSecurity *setting, g
|
|||
|
||||
g_free (elt->data);
|
||||
priv->proto = g_slist_delete_link (priv->proto, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PROTO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,6 +273,7 @@ nm_setting_wireless_security_clear_protos (NMSettingWirelessSecurity *setting)
|
|||
priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting);
|
||||
nm_utils_slist_free (priv->proto, g_free);
|
||||
priv->proto = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PROTO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,6 +342,7 @@ nm_setting_wireless_security_add_pairwise (NMSettingWirelessSecurity *setting, c
|
|||
}
|
||||
|
||||
priv->pairwise = g_slist_append (priv->pairwise, g_ascii_strdown (pairwise, -1));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -364,6 +368,7 @@ nm_setting_wireless_security_remove_pairwise (NMSettingWirelessSecurity *setting
|
|||
|
||||
g_free (elt->data);
|
||||
priv->pairwise = g_slist_delete_link (priv->pairwise, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,6 +388,7 @@ nm_setting_wireless_security_clear_pairwise (NMSettingWirelessSecurity *setting)
|
|||
priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting);
|
||||
nm_utils_slist_free (priv->pairwise, g_free);
|
||||
priv->pairwise = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -452,6 +458,7 @@ nm_setting_wireless_security_add_group (NMSettingWirelessSecurity *setting, cons
|
|||
}
|
||||
|
||||
priv->group = g_slist_append (priv->group, g_ascii_strdown (group, -1));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_GROUP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -477,6 +484,7 @@ nm_setting_wireless_security_remove_group (NMSettingWirelessSecurity *setting, g
|
|||
|
||||
g_free (elt->data);
|
||||
priv->group = g_slist_delete_link (priv->group, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_GROUP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -496,6 +504,7 @@ nm_setting_wireless_security_clear_groups (NMSettingWirelessSecurity *setting)
|
|||
priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting);
|
||||
nm_utils_slist_free (priv->group, g_free);
|
||||
priv->group = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_GROUP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -622,18 +631,22 @@ nm_setting_wireless_security_set_wep_key (NMSettingWirelessSecurity *setting, gu
|
|||
case 0:
|
||||
g_free (priv->wep_key0);
|
||||
priv->wep_key0 = g_strdup (key);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
|
||||
break;
|
||||
case 1:
|
||||
g_free (priv->wep_key1);
|
||||
priv->wep_key1 = g_strdup (key);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_WEP_KEY1);
|
||||
break;
|
||||
case 2:
|
||||
g_free (priv->wep_key2);
|
||||
priv->wep_key2 = g_strdup (key);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_WEP_KEY2);
|
||||
break;
|
||||
case 3:
|
||||
g_free (priv->wep_key3);
|
||||
priv->wep_key3 = g_strdup (key);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_WEP_KEY3);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
@ -1118,16 +1131,20 @@ set_property (GObject *object, guint prop_id,
|
|||
priv->leap_username = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_WEP_KEY0:
|
||||
nm_setting_wireless_security_set_wep_key (setting, 0, g_value_get_string (value));
|
||||
g_free (priv->wep_key0);
|
||||
priv->wep_key0 = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_WEP_KEY1:
|
||||
nm_setting_wireless_security_set_wep_key (setting, 1, g_value_get_string (value));
|
||||
g_free (priv->wep_key1);
|
||||
priv->wep_key1 = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_WEP_KEY2:
|
||||
nm_setting_wireless_security_set_wep_key (setting, 2, g_value_get_string (value));
|
||||
g_free (priv->wep_key2);
|
||||
priv->wep_key2 = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_WEP_KEY3:
|
||||
nm_setting_wireless_security_set_wep_key (setting, 3, g_value_get_string (value));
|
||||
g_free (priv->wep_key3);
|
||||
priv->wep_key3 = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_WEP_KEY_FLAGS:
|
||||
priv->wep_key_flags = g_value_get_uint (value);
|
||||
|
|
|
@ -648,9 +648,10 @@ nm_setting_wireless_add_seen_bssid (NMSettingWireless *setting,
|
|||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!found) {
|
||||
priv->seen_bssids = g_slist_prepend (priv->seen_bssids, lower_bssid);
|
||||
else
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SEEN_BSSIDS);
|
||||
} else
|
||||
g_free (lower_bssid);
|
||||
|
||||
return !found;
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
#include "nm-setting-ip4-config.h"
|
||||
#include "nm-setting-pppoe.h"
|
||||
#include "nm-setting-serial.h"
|
||||
#include "nm-setting-vlan.h"
|
||||
#include "nm-setting-bond.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-glib-compat.h"
|
||||
|
||||
|
@ -1661,6 +1664,416 @@ test_hwaddr_aton_malformed (void)
|
|||
g_assert (nm_utils_hwaddr_aton ("0:1a:2B:3:a@%%", ARPHRD_ETHER, buf) == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_connection_changed_cb (NMConnection *connection, gboolean *data)
|
||||
{
|
||||
*data = TRUE;
|
||||
}
|
||||
|
||||
#define ASSERT_CHANGED(statement) \
|
||||
{ \
|
||||
changed = FALSE; \
|
||||
statement; \
|
||||
g_assert (changed); \
|
||||
}
|
||||
|
||||
#define ASSERT_UNCHANGED(statement) \
|
||||
{ \
|
||||
changed = FALSE; \
|
||||
statement; \
|
||||
g_assert (!changed); \
|
||||
}
|
||||
|
||||
static void
|
||||
test_connection_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
connection = new_test_connection ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
/* Add new setting */
|
||||
ASSERT_CHANGED (nm_connection_add_setting (connection, nm_setting_vlan_new ()));
|
||||
|
||||
/* Remove existing setting */
|
||||
ASSERT_CHANGED (nm_connection_remove_setting (connection, NM_TYPE_SETTING_VLAN));
|
||||
|
||||
/* Remove non-existing setting */
|
||||
ASSERT_UNCHANGED (nm_connection_remove_setting (connection, NM_TYPE_SETTING_VLAN));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_connection_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingConnection *s_con;
|
||||
char *uuid;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_con = (NMSettingConnection *) nm_setting_connection_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_con));
|
||||
|
||||
ASSERT_CHANGED (g_object_set (s_con, NM_SETTING_CONNECTION_ID, "adfadfasdfaf", NULL));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_connection_add_permission (s_con, "user", "billsmith", NULL));
|
||||
ASSERT_CHANGED (nm_setting_connection_remove_permission (s_con, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_connection_remove_permission (s_con, 1));
|
||||
|
||||
uuid = nm_utils_uuid_generate ();
|
||||
ASSERT_CHANGED (nm_setting_connection_add_secondary (s_con, uuid));
|
||||
ASSERT_CHANGED (nm_setting_connection_remove_secondary (s_con, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_connection_remove_secondary (s_con, 1));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_bond_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingBond *s_bond;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_bond = (NMSettingBond *) nm_setting_bond_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_bond));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_bond_add_option (s_bond, NM_SETTING_BOND_OPTION_DOWNDELAY, "10"));
|
||||
ASSERT_CHANGED (nm_setting_bond_remove_option (s_bond, NM_SETTING_BOND_OPTION_DOWNDELAY));
|
||||
ASSERT_UNCHANGED (nm_setting_bond_remove_option (s_bond, NM_SETTING_BOND_OPTION_UPDELAY));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_ip4_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMIP4Address *addr;
|
||||
NMIP4Route *route;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_dns (s_ip4, 0x1122));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 1));
|
||||
|
||||
nm_setting_ip4_config_add_dns (s_ip4, 0x3344);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_dns (s_ip4));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 1));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_dns_searches (s_ip4));
|
||||
|
||||
addr = nm_ip4_address_new ();
|
||||
nm_ip4_address_set_address (addr, 0x2233);
|
||||
nm_ip4_address_set_prefix (addr, 24);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1));
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, addr);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_addresses (s_ip4));
|
||||
|
||||
route = nm_ip4_route_new ();
|
||||
nm_ip4_route_set_dest (route, 0x2233);
|
||||
nm_ip4_route_set_prefix (route, 24);
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_route (s_ip4, route));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_route (s_ip4, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_route (s_ip4, 1));
|
||||
|
||||
nm_setting_ip4_config_add_route (s_ip4, route);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_routes (s_ip4));
|
||||
|
||||
nm_ip4_address_unref (addr);
|
||||
nm_ip4_route_unref (route);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_ip6_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMIP6Address *addr;
|
||||
NMIP6Route *route;
|
||||
const struct in6_addr t = { { { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 } } };
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_dns (s_ip6, &t));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 1));
|
||||
|
||||
nm_setting_ip6_config_add_dns (s_ip6, &t);
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_dns (s_ip6));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 1));
|
||||
|
||||
nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com");
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_dns_searches (s_ip6));
|
||||
|
||||
addr = nm_ip6_address_new ();
|
||||
nm_ip6_address_set_address (addr, &t);
|
||||
nm_ip6_address_set_prefix (addr, 64);
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_address (s_ip6, addr));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_address (s_ip6, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_address (s_ip6, 1));
|
||||
|
||||
nm_setting_ip6_config_add_address (s_ip6, addr);
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_addresses (s_ip6));
|
||||
|
||||
route = nm_ip6_route_new ();
|
||||
nm_ip6_route_set_dest (route, &t);
|
||||
nm_ip6_route_set_prefix (route, 128);
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_route (s_ip6, route));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_route (s_ip6, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_route (s_ip6, 1));
|
||||
|
||||
nm_setting_ip6_config_add_route (s_ip6, route);
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_routes (s_ip6));
|
||||
|
||||
nm_ip6_address_unref (addr);
|
||||
nm_ip6_route_unref (route);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_vlan_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingVlan *s_vlan;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_vlan = (NMSettingVlan *) nm_setting_vlan_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_vlan));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_vlan_add_priority (s_vlan, NM_VLAN_INGRESS_MAP, 1, 3));
|
||||
ASSERT_CHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_INGRESS_MAP, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_INGRESS_MAP, 1));
|
||||
ASSERT_CHANGED (nm_setting_vlan_add_priority_str (s_vlan, NM_VLAN_INGRESS_MAP, "1:3"));
|
||||
ASSERT_CHANGED (nm_setting_vlan_clear_priorities (s_vlan, NM_VLAN_INGRESS_MAP));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_vlan_add_priority (s_vlan, NM_VLAN_EGRESS_MAP, 1, 3));
|
||||
ASSERT_CHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_EGRESS_MAP, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_vlan_remove_priority (s_vlan, NM_VLAN_EGRESS_MAP, 1));
|
||||
ASSERT_CHANGED (nm_setting_vlan_add_priority_str (s_vlan, NM_VLAN_EGRESS_MAP, "1:3"));
|
||||
ASSERT_CHANGED (nm_setting_vlan_clear_priorities (s_vlan, NM_VLAN_EGRESS_MAP));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_vpn_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingVPN *s_vpn;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_vpn = (NMSettingVPN *) nm_setting_vpn_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_vpn));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_vpn_add_data_item (s_vpn, "foobar", "baz"));
|
||||
ASSERT_CHANGED (nm_setting_vpn_remove_data_item (s_vpn, "foobar"));
|
||||
ASSERT_UNCHANGED (nm_setting_vpn_remove_data_item (s_vpn, "not added"));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_vpn_add_secret (s_vpn, "foobar", "baz"));
|
||||
ASSERT_CHANGED (nm_setting_vpn_remove_secret (s_vpn, "foobar"));
|
||||
ASSERT_UNCHANGED (nm_setting_vpn_remove_secret (s_vpn, "not added"));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_wired_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingWired *s_wired;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_wired = (NMSettingWired *) nm_setting_wired_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_wired));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_wired_add_s390_option (s_wired, "portno", "1"));
|
||||
ASSERT_CHANGED (nm_setting_wired_remove_s390_option (s_wired, "portno"));
|
||||
ASSERT_UNCHANGED (nm_setting_wired_remove_s390_option (s_wired, "layer2"));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_wireless_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingWireless *s_wifi;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_wifi));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_wireless_add_seen_bssid (s_wifi, "00:11:22:33:44:55"));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_wireless_security_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_wsec));
|
||||
|
||||
/* Protos */
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_add_proto (s_wsec, "wpa"));
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_remove_proto (s_wsec, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_wireless_security_remove_proto (s_wsec, 1));
|
||||
|
||||
nm_setting_wireless_security_add_proto (s_wsec, "wep");
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_clear_protos (s_wsec));
|
||||
|
||||
/* Pairwise ciphers */
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_add_pairwise (s_wsec, "wep40"));
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_remove_pairwise (s_wsec, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_wireless_security_remove_pairwise (s_wsec, 1));
|
||||
|
||||
nm_setting_wireless_security_add_pairwise (s_wsec, "tkip");
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_clear_pairwise (s_wsec));
|
||||
|
||||
/* Group ciphers */
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_add_group (s_wsec, "ccmp"));
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_remove_group (s_wsec, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_wireless_security_remove_group (s_wsec, 1));
|
||||
|
||||
nm_setting_wireless_security_add_group (s_wsec, "tkip");
|
||||
ASSERT_CHANGED (nm_setting_wireless_security_clear_groups (s_wsec));
|
||||
|
||||
/* WEP key secret flags */
|
||||
ASSERT_CHANGED (g_assert (nm_setting_set_secret_flags (NM_SETTING (s_wsec), "wep-key0", NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL)));
|
||||
ASSERT_CHANGED (g_assert (nm_setting_set_secret_flags (NM_SETTING (s_wsec), "wep-key1", NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL)));
|
||||
ASSERT_CHANGED (g_assert (nm_setting_set_secret_flags (NM_SETTING (s_wsec), "wep-key2", NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL)));
|
||||
ASSERT_CHANGED (g_assert (nm_setting_set_secret_flags (NM_SETTING (s_wsec), "wep-key3", NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL)));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_802_1x_changed_signal (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSetting8021x *s_8021x;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_8021x));
|
||||
|
||||
/* EAP methods */
|
||||
ASSERT_CHANGED (nm_setting_802_1x_add_eap_method (s_8021x, "tls"));
|
||||
ASSERT_CHANGED (nm_setting_802_1x_remove_eap_method (s_8021x, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_802_1x_remove_eap_method (s_8021x, 1));
|
||||
|
||||
nm_setting_802_1x_add_eap_method (s_8021x, "ttls");
|
||||
ASSERT_CHANGED (nm_setting_802_1x_clear_eap_methods (s_8021x));
|
||||
|
||||
/* alternate subject matches */
|
||||
ASSERT_CHANGED (nm_setting_802_1x_add_altsubject_match (s_8021x, "EMAIL:server@example.com"));
|
||||
ASSERT_CHANGED (nm_setting_802_1x_remove_altsubject_match (s_8021x, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_802_1x_remove_altsubject_match (s_8021x, 1));
|
||||
|
||||
nm_setting_802_1x_add_altsubject_match (s_8021x, "EMAIL:server@example.com");
|
||||
ASSERT_CHANGED (nm_setting_802_1x_clear_altsubject_matches (s_8021x));
|
||||
|
||||
/* phase2 alternate subject matches */
|
||||
ASSERT_CHANGED (nm_setting_802_1x_add_phase2_altsubject_match (s_8021x, "EMAIL:server@example.com"));
|
||||
ASSERT_CHANGED (nm_setting_802_1x_remove_phase2_altsubject_match (s_8021x, 0));
|
||||
ASSERT_UNCHANGED (nm_setting_802_1x_remove_phase2_altsubject_match (s_8021x, 1));
|
||||
|
||||
nm_setting_802_1x_add_phase2_altsubject_match (s_8021x, "EMAIL:server@example.com");
|
||||
ASSERT_CHANGED (nm_setting_802_1x_clear_phase2_altsubject_matches (s_8021x));
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
@ -1720,6 +2133,18 @@ int main (int argc, char **argv)
|
|||
test_hwaddr_aton_no_leading_zeros ();
|
||||
test_hwaddr_aton_malformed ();
|
||||
|
||||
test_connection_changed_signal ();
|
||||
test_setting_connection_changed_signal ();
|
||||
test_setting_bond_changed_signal ();
|
||||
test_setting_ip4_changed_signal ();
|
||||
test_setting_ip6_changed_signal ();
|
||||
test_setting_vlan_changed_signal ();
|
||||
test_setting_vpn_changed_signal ();
|
||||
test_setting_wired_changed_signal ();
|
||||
test_setting_wireless_changed_signal ();
|
||||
test_setting_wireless_security_changed_signal ();
|
||||
test_setting_802_1x_changed_signal ();
|
||||
|
||||
base = g_path_get_basename (argv[0]);
|
||||
fprintf (stdout, "%s: SUCCESS\n", base);
|
||||
g_free (base);
|
||||
|
|
Loading…
Reference in a new issue