mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-19 16:11:32 +00:00
libnm/tests: fix memleaks in tests for valgrind
This commit is contained in:
parent
0750d934bf
commit
ae73320b8c
|
@ -1054,8 +1054,8 @@ typedef enum {
|
|||
g_variant_builder_add (&__setting_builder, "{sv}", \
|
||||
__cur_property_name, \
|
||||
__property_val); \
|
||||
} else \
|
||||
g_variant_unref (__property_val); \
|
||||
} \
|
||||
g_variant_unref (__property_val); \
|
||||
} \
|
||||
\
|
||||
if (__cur_setting_name) \
|
||||
|
|
|
@ -98,7 +98,7 @@ out:
|
|||
static void
|
||||
test_cert (gconstpointer test_data)
|
||||
{
|
||||
char *path;
|
||||
gs_free char *path;
|
||||
GByteArray *array;
|
||||
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
||||
GError *error = NULL;
|
||||
|
@ -226,6 +226,7 @@ test_is_pkcs12 (const char *path, gboolean expect_fail)
|
|||
if (expect_fail) {
|
||||
g_assert_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_INVALID_DATA);
|
||||
g_assert (!is_pkcs12);
|
||||
g_clear_error (&error);
|
||||
} else {
|
||||
g_assert_no_error (error);
|
||||
g_assert (is_pkcs12);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <nm-utils.h>
|
||||
#include "gsystem-local-alloc.h"
|
||||
|
||||
#include "nm-setting-private.h"
|
||||
#include "nm-utils.h"
|
||||
|
@ -648,7 +649,7 @@ test_setting_ip4_config_address_data (void)
|
|||
static void
|
||||
test_setting_gsm_apn_spaces (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
const char *tmp;
|
||||
|
||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||
|
@ -676,7 +677,7 @@ test_setting_gsm_apn_spaces (void)
|
|||
static void
|
||||
test_setting_gsm_apn_bad_chars (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
|
||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||
ASSERT (s_gsm != NULL,
|
||||
|
@ -714,7 +715,7 @@ test_setting_gsm_apn_bad_chars (void)
|
|||
static void
|
||||
test_setting_gsm_apn_underscore (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
|
||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||
g_assert (s_gsm);
|
||||
|
@ -729,7 +730,7 @@ test_setting_gsm_apn_underscore (void)
|
|||
static void
|
||||
test_setting_gsm_without_number (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
|
||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||
g_assert (s_gsm);
|
||||
|
@ -1551,6 +1552,7 @@ test_connection_replace_settings_bad (void)
|
|||
connection = new_test_connection ();
|
||||
success = nm_connection_replace_settings (connection, new_settings, &error);
|
||||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING);
|
||||
g_clear_error (&error);
|
||||
g_assert (!success);
|
||||
|
||||
g_assert (nm_connection_verify (connection, NULL));
|
||||
|
@ -2388,7 +2390,7 @@ test_connection_bad_base_types (void)
|
|||
static void
|
||||
test_setting_compare_id (void)
|
||||
{
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
old = nm_setting_connection_new ();
|
||||
|
@ -2412,7 +2414,7 @@ test_setting_compare_id (void)
|
|||
static void
|
||||
test_setting_compare_timestamp (void)
|
||||
{
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
old = nm_setting_connection_new ();
|
||||
|
@ -2457,7 +2459,7 @@ static void
|
|||
test_setting_compare_secrets (gconstpointer test_data)
|
||||
{
|
||||
const TestDataCompareSecrets *data = test_data;
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
/* Make sure that a connection with transient/unsaved secrets compares
|
||||
|
@ -2488,7 +2490,7 @@ static void
|
|||
test_setting_compare_vpn_secrets (gconstpointer test_data)
|
||||
{
|
||||
const TestDataCompareSecrets *data = test_data;
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
/* Make sure that a connection with transient/unsaved secrets compares
|
||||
|
@ -2764,7 +2766,7 @@ test_setting_connection_changed_signal (void)
|
|||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingConnection *s_con;
|
||||
char *uuid;
|
||||
gs_free char *uuid;
|
||||
|
||||
connection = nm_simple_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
|
@ -3170,7 +3172,7 @@ test_setting_802_1x_changed_signal (void)
|
|||
static void
|
||||
test_setting_old_uuid (void)
|
||||
{
|
||||
NMSetting *setting;
|
||||
gs_unref_object NMSetting *setting;
|
||||
|
||||
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
||||
* like this one. Test that we maintain compatibility. */
|
||||
|
@ -3879,6 +3881,7 @@ test_setting_ip6_gateway (void)
|
|||
value = g_variant_lookup_value (ip6_dict, NM_SETTING_IP_CONFIG_GATEWAY, G_VARIANT_TYPE_STRING);
|
||||
g_assert (value != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (value, NULL), ==, "abcd::1");
|
||||
g_variant_unref (value);
|
||||
|
||||
value = g_variant_lookup_value (ip6_dict, NM_SETTING_IP_CONFIG_ADDRESSES, G_VARIANT_TYPE ("a(ayuay)"));
|
||||
g_assert (value != NULL);
|
||||
|
@ -3975,6 +3978,7 @@ test_hexstr2bin (void)
|
|||
g_assert (b);
|
||||
g_assert_cmpint (g_bytes_get_size (b), ==, items[i].expected_len);
|
||||
g_assert (memcmp (g_bytes_get_data (b, NULL), items[i].expected, g_bytes_get_size (b)) == 0);
|
||||
g_bytes_unref (b);
|
||||
} else
|
||||
g_assert (b == NULL);
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ test_need_tls_secrets_path (void)
|
|||
"need-tls-secrets-path-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -219,6 +220,7 @@ test_need_tls_secrets_blob (void)
|
|||
"need-tls-secrets-blob-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -345,6 +347,7 @@ test_need_tls_phase2_secrets_path (void)
|
|||
"need-tls-phase2-secrets-path-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -389,6 +392,7 @@ test_need_tls_phase2_secrets_blob (void)
|
|||
"need-tls-phase2-secrets-blob-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -559,8 +563,8 @@ test_update_secrets_wifi_bad_setting_name (void)
|
|||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_SETTING_NOT_FOUND);
|
||||
g_assert (success == FALSE);
|
||||
|
||||
g_clear_error (&error);
|
||||
g_variant_unref (secrets);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -668,6 +672,7 @@ test_update_secrets_whole_connection_bad_setting (void)
|
|||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_SETTING_NOT_FOUND);
|
||||
g_assert (success == FALSE);
|
||||
|
||||
g_clear_error (&error);
|
||||
g_variant_unref (copy);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
|
|
@ -186,6 +186,7 @@ test_phase2_private_key_import (const char *path,
|
|||
g_object_get (s_8021x, NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, &tmp_key, NULL);
|
||||
ASSERT (tmp_key != NULL, "phase2-private-key-import", "missing private key value");
|
||||
check_scheme_path (tmp_key, path);
|
||||
g_bytes_unref (tmp_key);
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
|
||||
|
@ -245,6 +246,7 @@ test_wrong_password_keeps_data (const char *path, const char *password)
|
|||
"wrong-password-keeps-data", "unexpected missing error");
|
||||
ASSERT (format == NM_SETTING_802_1X_CK_FORMAT_UNKNOWN,
|
||||
"wrong-password-keeps-data", "unexpected success reading private key format");
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Make sure the password hasn't changed */
|
||||
pw = nm_setting_802_1x_get_private_key_password (s_8021x);
|
||||
|
@ -342,6 +344,7 @@ test_wrong_phase2_password_keeps_data (const char *path, const char *password)
|
|||
"wrong-phase2-password-keeps-data", "unexpected missing error");
|
||||
ASSERT (format == NM_SETTING_802_1X_CK_FORMAT_UNKNOWN,
|
||||
"wrong-phase2-password-keeps-data", "unexpected success reading private key format");
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Make sure the password hasn't changed */
|
||||
pw = nm_setting_802_1x_get_phase2_private_key_password (s_8021x);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nm-setting-dcb.h"
|
||||
#include "nm-connection.h"
|
||||
#include "nm-errors.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
|
||||
#define DCB_FLAGS_ALL (NM_SETTING_DCB_FLAG_ENABLE | \
|
||||
NM_SETTING_DCB_FLAG_ADVERTISE | \
|
||||
|
@ -36,7 +37,7 @@
|
|||
static void
|
||||
test_dcb_flags_valid (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
guint i;
|
||||
|
@ -89,7 +90,7 @@ test_dcb_flags_valid (void)
|
|||
static void
|
||||
test_dcb_flags_invalid (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -148,7 +149,7 @@ test_dcb_flags_invalid (void)
|
|||
static void
|
||||
test_dcb_app_priorities (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -210,7 +211,7 @@ test_dcb_app_priorities (void)
|
|||
static void
|
||||
test_dcb_priorities_valid (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
guint i;
|
||||
|
@ -269,7 +270,7 @@ test_dcb_priorities_valid (void)
|
|||
static void
|
||||
test_dcb_bandwidth_sums (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ out:
|
|||
static void
|
||||
test_cert (gconstpointer test_data)
|
||||
{
|
||||
char *path;
|
||||
gs_free char *path;
|
||||
GByteArray *array;
|
||||
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
||||
GError *error = NULL;
|
||||
|
@ -153,6 +153,7 @@ test_load_private_key (const char *path,
|
|||
"unexpected failure determining private key file '%s' "
|
||||
"type with invalid password (expected %d, got %d)",
|
||||
path, NM_CRYPTO_KEY_TYPE_UNKNOWN, key_type);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,6 +184,7 @@ test_load_private_key (const char *path,
|
|||
g_byte_array_free (decrypted, TRUE);
|
||||
}
|
||||
|
||||
g_clear_error (&error);
|
||||
g_byte_array_free (array, TRUE);
|
||||
}
|
||||
|
||||
|
@ -207,6 +209,7 @@ test_load_pkcs12 (const char *path,
|
|||
"%d): %d %s",
|
||||
path, NM_CRYPTO_FILE_FORMAT_PKCS12, format, error->code, error->message);
|
||||
}
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <sys/resource.h>
|
||||
|
||||
#include <nm-utils.h>
|
||||
#include "gsystem-local-alloc.h"
|
||||
|
||||
#include "nm-setting-private.h"
|
||||
#include "nm-setting-connection.h"
|
||||
|
@ -310,6 +311,13 @@ test_setting_vpn_modify_during_foreach (void)
|
|||
g_object_unref (s_vpn);
|
||||
}
|
||||
|
||||
static void
|
||||
_g_value_array_free (void *ptr)
|
||||
{
|
||||
if (ptr)
|
||||
g_value_array_free ((GValueArray *) ptr);
|
||||
}
|
||||
|
||||
#define OLD_DBUS_TYPE_G_IP6_ADDRESS (dbus_g_type_get_struct ("GValueArray", DBUS_TYPE_G_UCHAR_ARRAY, G_TYPE_UINT, G_TYPE_INVALID))
|
||||
#define OLD_DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS (dbus_g_type_get_collection ("GPtrArray", OLD_DBUS_TYPE_G_IP6_ADDRESS))
|
||||
|
||||
|
@ -338,7 +346,7 @@ test_setting_ip6_config_old_address_array (void)
|
|||
|
||||
g_value_init (&written_value, OLD_DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS);
|
||||
|
||||
addresses = g_ptr_array_new ();
|
||||
addresses = g_ptr_array_new_full (0, _g_value_array_free);
|
||||
array = g_value_array_new (3);
|
||||
|
||||
/* IP address */
|
||||
|
@ -398,6 +406,7 @@ test_setting_ip6_config_old_address_array (void)
|
|||
ASSERT (memcmp (ba->data, &gw[0], sizeof (gw)) == 0,
|
||||
"ip6-old-addr", "unexpected failure comparing gateways");
|
||||
|
||||
g_ptr_array_unref (addresses);
|
||||
g_value_unset (&written_value);
|
||||
g_value_unset (&read_value);
|
||||
g_object_unref (s_ip6);
|
||||
|
@ -406,7 +415,7 @@ test_setting_ip6_config_old_address_array (void)
|
|||
static void
|
||||
test_setting_gsm_apn_spaces (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
const char *tmp;
|
||||
|
||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||
|
@ -434,7 +443,7 @@ test_setting_gsm_apn_spaces (void)
|
|||
static void
|
||||
test_setting_gsm_apn_bad_chars (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
|
||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||
ASSERT (s_gsm != NULL,
|
||||
|
@ -472,7 +481,7 @@ test_setting_gsm_apn_bad_chars (void)
|
|||
static void
|
||||
test_setting_gsm_apn_underscore (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -491,7 +500,7 @@ test_setting_gsm_apn_underscore (void)
|
|||
static void
|
||||
test_setting_gsm_without_number (void)
|
||||
{
|
||||
NMSettingGsm *s_gsm;
|
||||
gs_unref_object NMSettingGsm *s_gsm;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -1573,6 +1582,7 @@ test_connection_good_base_types (void)
|
|||
NM_SETTING_GSM_APN, "metered.billing.sucks",
|
||||
NULL);
|
||||
nm_connection_add_setting (connection, setting);
|
||||
g_clear_object (&connection);
|
||||
|
||||
/* CDMA connection */
|
||||
connection = nm_connection_new ();
|
||||
|
@ -1671,7 +1681,7 @@ test_connection_bad_base_types (void)
|
|||
static void
|
||||
test_setting_compare_id (void)
|
||||
{
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
old = nm_setting_connection_new ();
|
||||
|
@ -1697,7 +1707,7 @@ test_setting_compare_secrets (NMSettingSecretFlags secret_flags,
|
|||
NMSettingCompareFlags comp_flags,
|
||||
gboolean remove_secret)
|
||||
{
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
/* Make sure that a connection with transient/unsaved secrets compares
|
||||
|
@ -1729,7 +1739,7 @@ test_setting_compare_vpn_secrets (NMSettingSecretFlags secret_flags,
|
|||
NMSettingCompareFlags comp_flags,
|
||||
gboolean remove_secret)
|
||||
{
|
||||
NMSetting *old, *new;
|
||||
gs_unref_object NMSetting *old, *new;
|
||||
gboolean success;
|
||||
|
||||
/* Make sure that a connection with transient/unsaved secrets compares
|
||||
|
@ -1908,7 +1918,7 @@ test_setting_connection_changed_signal (void)
|
|||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingConnection *s_con;
|
||||
char *uuid;
|
||||
gs_free char *uuid;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
g_signal_connect (connection,
|
||||
|
@ -2318,7 +2328,7 @@ static void
|
|||
test_setting_old_uuid (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
NMSetting *setting;
|
||||
gs_unref_object NMSetting *setting;
|
||||
gboolean success;
|
||||
|
||||
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
||||
|
|
|
@ -176,6 +176,7 @@ test_need_tls_secrets_path (void)
|
|||
"need-tls-secrets-path-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -219,6 +220,7 @@ test_need_tls_secrets_blob (void)
|
|||
"need-tls-secrets-blob-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -345,6 +347,7 @@ test_need_tls_phase2_secrets_path (void)
|
|||
"need-tls-phase2-secrets-path-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -389,6 +392,7 @@ test_need_tls_phase2_secrets_blob (void)
|
|||
"need-tls-phase2-secrets-blob-key-password",
|
||||
"expected to require private key password, but it wasn't");
|
||||
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -507,6 +511,7 @@ test_update_secrets_wifi_single_setting (void)
|
|||
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0);
|
||||
g_assert_cmpstr (tmp, ==, wepkey);
|
||||
|
||||
g_hash_table_unref (secrets);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -547,6 +552,7 @@ test_update_secrets_wifi_full_hash (void)
|
|||
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0);
|
||||
g_assert_cmpstr (tmp, ==, wepkey);
|
||||
|
||||
g_hash_table_unref (all);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -577,6 +583,8 @@ test_update_secrets_wifi_bad_setting_name (void)
|
|||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_SETTING_NOT_FOUND);
|
||||
g_assert (success == FALSE);
|
||||
|
||||
g_clear_error (&error);
|
||||
g_hash_table_unref (secrets);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -600,7 +608,7 @@ test_update_secrets_whole_connection (void)
|
|||
secrets = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
|
||||
wsec_hash = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
|
||||
g_assert (wsec_hash);
|
||||
g_hash_table_insert (wsec_hash, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, string_to_gvalue (wepkey));
|
||||
g_hash_table_insert (wsec_hash, g_strdup (NM_SETTING_WIRELESS_SECURITY_WEP_KEY0), string_to_gvalue (wepkey));
|
||||
|
||||
success = nm_connection_update_secrets (connection, NULL, secrets, &error);
|
||||
g_assert_no_error (error);
|
||||
|
@ -610,6 +618,7 @@ test_update_secrets_whole_connection (void)
|
|||
g_assert (s_wsec);
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_wep_key (s_wsec, 0), ==, wepkey);
|
||||
|
||||
g_hash_table_unref (secrets);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
@ -629,6 +638,7 @@ test_update_secrets_whole_connection_empty_hash (void)
|
|||
g_assert_no_error (error);
|
||||
g_assert (success == TRUE);
|
||||
g_object_unref (connection);
|
||||
g_hash_table_unref (secrets);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -665,6 +675,7 @@ test_update_secrets_whole_connection_bad_setting (void)
|
|||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_SETTING_NOT_FOUND);
|
||||
g_assert (success == FALSE);
|
||||
|
||||
g_clear_error (&error);
|
||||
g_hash_table_destroy (secrets);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
@ -718,6 +729,7 @@ test_update_secrets_null_setting_name_with_setting_hash (void)
|
|||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_SETTING_NOT_FOUND);
|
||||
g_assert (!success);
|
||||
|
||||
g_clear_error (&error);
|
||||
g_hash_table_destroy (secrets);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
|
|
@ -188,6 +188,7 @@ test_phase2_private_key_import (const char *path,
|
|||
g_object_get (s_8021x, NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, &tmp_key, NULL);
|
||||
ASSERT (tmp_key != NULL, "phase2-private-key-import", "missing private key value");
|
||||
check_scheme_path (tmp_key, path);
|
||||
g_byte_array_free (tmp_key, TRUE);
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
|
||||
|
@ -249,6 +250,7 @@ test_wrong_password_keeps_data (const char *path, const char *password)
|
|||
"wrong-password-keeps-data", "unexpected missing error");
|
||||
ASSERT (format == NM_SETTING_802_1X_CK_FORMAT_UNKNOWN,
|
||||
"wrong-password-keeps-data", "unexpected success reading private key format");
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Make sure the password hasn't changed */
|
||||
pw = nm_setting_802_1x_get_private_key_password (s_8021x);
|
||||
|
@ -346,6 +348,7 @@ test_wrong_phase2_password_keeps_data (const char *path, const char *password)
|
|||
"wrong-phase2-password-keeps-data", "unexpected missing error");
|
||||
ASSERT (format == NM_SETTING_802_1X_CK_FORMAT_UNKNOWN,
|
||||
"wrong-phase2-password-keeps-data", "unexpected success reading private key format");
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Make sure the password hasn't changed */
|
||||
pw = nm_setting_802_1x_get_phase2_private_key_password (s_8021x);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <nm-utils.h>
|
||||
#include <nm-glib-compat.h>
|
||||
#include "nm-setting-dcb.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
|
||||
#define DCB_FLAGS_ALL (NM_SETTING_DCB_FLAG_ENABLE | \
|
||||
NM_SETTING_DCB_FLAG_ADVERTISE | \
|
||||
|
@ -34,7 +35,7 @@
|
|||
static void
|
||||
test_dcb_flags_valid (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
guint i;
|
||||
|
@ -87,7 +88,7 @@ test_dcb_flags_valid (void)
|
|||
static void
|
||||
test_dcb_flags_invalid (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -146,7 +147,7 @@ test_dcb_flags_invalid (void)
|
|||
static void
|
||||
test_dcb_app_priorities (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -208,7 +209,7 @@ test_dcb_app_priorities (void)
|
|||
static void
|
||||
test_dcb_priorities_valid (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
guint i;
|
||||
|
@ -267,7 +268,7 @@ test_dcb_priorities_valid (void)
|
|||
static void
|
||||
test_dcb_bandwidth_sums (void)
|
||||
{
|
||||
NMSettingDcb *s_dcb;
|
||||
gs_unref_object NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
|
Loading…
Reference in a new issue