diff options
Diffstat (limited to 'src/supplicant')
| -rw-r--r-- | src/supplicant/nm-supplicant-config.c | 11 | ||||
| -rw-r--r-- | src/supplicant/nm-supplicant-settings-verify.c | 7 | ||||
| -rw-r--r-- | src/supplicant/nm-supplicant-settings-verify.h | 1 | ||||
| -rw-r--r-- | src/supplicant/tests/meson.build | 2 | ||||
| -rw-r--r-- | src/supplicant/tests/test-supplicant-config.c | 6 |
5 files changed, 12 insertions, 15 deletions
diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c index 14f5cac8..80db5baa 100644 --- a/src/supplicant/nm-supplicant-config.c +++ b/src/supplicant/nm-supplicant-config.c @@ -144,7 +144,7 @@ nm_supplicant_config_add_option_with_type (NMSupplicantConfig *self, memset (&buf[0], 0, sizeof (buf)); memcpy (&buf[0], value, len > 254 ? 254 : len); g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "key '%s' and/or value '%s' invalid", key, hidden ? hidden : buf); + "key '%s' and/or value '%s' invalid", key, hidden ?: buf); return FALSE; } } @@ -168,7 +168,7 @@ nm_supplicant_config_add_option_with_type (NMSupplicantConfig *self, char buf[255]; memset (&buf[0], 0, sizeof (buf)); memcpy (&buf[0], opt->value, opt->len > 254 ? 254 : opt->len); - nm_log_info (LOGD_SUPPLICANT, "Config: added '%s' value '%s'", key, hidden ? hidden : &buf[0]); + nm_log_info (LOGD_SUPPLICANT, "Config: added '%s' value '%s'", key, hidden ?: &buf[0]); } g_hash_table_insert (priv->config, g_strdup (key), opt); @@ -275,7 +275,6 @@ nm_supplicant_config_finalize (GObject *object) G_OBJECT_CLASS (nm_supplicant_config_parent_class)->finalize (object); } - static void nm_supplicant_config_class_init (NMSupplicantConfigClass *klass) { @@ -980,7 +979,7 @@ add_pkcs11_uri_with_pin (NMSupplicantConfig *self, tmp = g_strdup_printf ("%s%s%s", split[0], (pin_qattr ? "?" : ""), - (pin_qattr ? pin_qattr : "")); + (pin_qattr ?: "")); tmp_log = g_strdup_printf ("%s%s%s", split[0], (pin_qattr ? "?" : ""), @@ -1172,7 +1171,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, /* CA path */ path = nm_setting_802_1x_get_ca_path (setting); - path = ca_path_override ? ca_path_override : path; + path = ca_path_override ?: path; if (path) { if (!add_string_val (self, path, "ca_path", FALSE, NULL, error)) return FALSE; @@ -1180,7 +1179,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, /* Phase2 CA path */ path = nm_setting_802_1x_get_phase2_ca_path (setting); - path = ca_path_override ? ca_path_override : path; + path = ca_path_override ?: path; if (path) { if (!add_string_val (self, path, "ca_path2", FALSE, NULL, error)) return FALSE; diff --git a/src/supplicant/nm-supplicant-settings-verify.c b/src/supplicant/nm-supplicant-settings-verify.c index 5198d75f..317afff9 100644 --- a/src/supplicant/nm-supplicant-settings-verify.c +++ b/src/supplicant/nm-supplicant-settings-verify.c @@ -36,7 +36,6 @@ struct Opt { const char ** str_allowed; }; - static gboolean validate_type_int (const struct Opt * opt, const char * value, const guint32 len); @@ -67,7 +66,6 @@ static const struct validate_entry validate_table[] = { { TYPE_KEYWORD, validate_type_keyword }, }; - const char * pairwise_allowed[] = { "CCMP", "TKIP", "NONE", NULL }; const char * group_allowed[] = { "CCMP", "TKIP", "WEP104", "WEP40", NULL }; const char * proto_allowed[] = { "WPA", "RSN", NULL }; @@ -155,7 +153,6 @@ static const struct Opt opt_table[] = { { "ieee80211w", TYPE_INT, 0, 2, FALSE, NULL }, }; - static gboolean validate_type_int (const struct Opt * opt, const char * value, @@ -190,7 +187,7 @@ validate_type_bytes (const struct Opt * opt, g_return_val_if_fail (opt != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); - check_len = opt->int_high ? opt->int_high : 255; + check_len = opt->int_high ?: 255; if (len > check_len) return FALSE; @@ -207,7 +204,7 @@ validate_type_utf8 (const struct Opt *opt, g_return_val_if_fail (opt != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); - check_len = opt->int_high ? opt->int_high : 255; + check_len = opt->int_high ?: 255; /* Note that we deliberately don't validate the UTF-8, because some "UTF-8" fields, such as 8021x.password, do not actually have to be valid UTF-8 */ diff --git a/src/supplicant/nm-supplicant-settings-verify.h b/src/supplicant/nm-supplicant-settings-verify.h index 920343ba..1eec136d 100644 --- a/src/supplicant/nm-supplicant-settings-verify.h +++ b/src/supplicant/nm-supplicant-settings-verify.h @@ -34,5 +34,4 @@ OptType nm_supplicant_settings_verify_setting (const char * key, const char * value, const guint32 len); - #endif /* __NETWORKMANAGER_SUPPLICANT_SETTINGS_VERIFY_H__ */ diff --git a/src/supplicant/tests/meson.build b/src/supplicant/tests/meson.build index e6a86b20..b8bad7f3 100644 --- a/src/supplicant/tests/meson.build +++ b/src/supplicant/tests/meson.build @@ -4,7 +4,7 @@ exe = executable( test_unit, test_unit + '.c', dependencies: test_nm_dep, - c_args: '-DTEST_CERT_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'certs')) + c_args: nm_build_cflags, ) test( diff --git a/src/supplicant/tests/test-supplicant-config.c b/src/supplicant/tests/test-supplicant-config.c index 60ca5258..36831e67 100644 --- a/src/supplicant/tests/test-supplicant-config.c +++ b/src/supplicant/tests/test-supplicant-config.c @@ -37,6 +37,10 @@ #include "nm-test-utils-core.h" +#define TEST_CERT_DIR NM_BUILD_SRCDIR"/src/supplicant/tests/certs" + +/*****************************************************************************/ + static gboolean validate_opt (const char *detail, GVariant *config, @@ -138,7 +142,6 @@ build_supplicant_config (NMConnection *connection, g_assert_no_error (error); g_assert (success); - success = nm_supplicant_config_add_bgscan (config, connection, &error); g_assert_no_error (error); g_assert (success); @@ -146,7 +149,6 @@ build_supplicant_config (NMConnection *connection, return nm_supplicant_config_to_variant (config); } - static NMConnection * new_basic_connection (const char *id, GBytes *ssid, |