diff options
Diffstat (limited to 'src/supplicant-manager')
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-config.c | 1128 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-config.h | 83 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-interface.c | 1663 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-interface.h | 167 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-manager.c | 410 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-manager.h | 53 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-settings-verify.c | 276 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-settings-verify.h | 38 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-types.h | 52 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/Makefile.am | 24 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/Makefile.in | 1256 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/certs/Makefile.am | 6 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/certs/Makefile.in | 605 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/certs/test-ca-cert.pem | 27 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/certs/test-cert.p12 | bin | 4092 -> 0 bytes | |||
| -rw-r--r-- | src/supplicant-manager/tests/test-supplicant-config.c | 614 |
16 files changed, 0 insertions, 6402 deletions
diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c deleted file mode 100644 index 6283edd6..00000000 --- a/src/supplicant-manager/nm-supplicant-config.c +++ /dev/null @@ -1,1128 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2012 Red Hat, Inc. - * Copyright (C) 2007 - 2008 Novell, Inc. - */ - -#include "nm-default.h" - -#include <string.h> -#include <stdlib.h> - -#include "nm-supplicant-config.h" -#include "nm-supplicant-settings-verify.h" -#include "nm-setting.h" -#include "NetworkManagerUtils.h" -#include "nm-utils.h" - -#define NM_SUPPLICANT_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - NM_TYPE_SUPPLICANT_CONFIG, \ - NMSupplicantConfigPrivate)) - -G_DEFINE_TYPE (NMSupplicantConfig, nm_supplicant_config, G_TYPE_OBJECT) - -typedef struct { - char *value; - guint32 len; - OptType type; -} ConfigOption; - -typedef struct -{ - GHashTable *config; - GHashTable *blobs; - guint32 ap_scan; - gboolean fast_required; - gboolean dispose_has_run; -} NMSupplicantConfigPrivate; - -NMSupplicantConfig * -nm_supplicant_config_new (void) -{ - return g_object_new (NM_TYPE_SUPPLICANT_CONFIG, NULL); -} - -static void -config_option_free (ConfigOption *opt) -{ - g_free (opt->value); - g_slice_free (ConfigOption, opt); -} - -static void -blob_free (GByteArray *array) -{ - g_byte_array_free (array, TRUE); -} - -static void -nm_supplicant_config_init (NMSupplicantConfig * self) -{ - NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - - priv->config = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) config_option_free); - - priv->blobs = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) blob_free); - - priv->ap_scan = 1; - priv->dispose_has_run = FALSE; -} - -static gboolean -nm_supplicant_config_add_option_with_type (NMSupplicantConfig *self, - const char *key, - const char *value, - gint32 len, - OptType opt_type, - gboolean secret, - GError **error) -{ - NMSupplicantConfigPrivate *priv; - ConfigOption *old_opt; - ConfigOption *opt; - OptType type; - - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); - g_return_val_if_fail (key != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - nm_assert (!error || !*error); - - priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - - if (len < 0) - len = strlen (value); - - if (opt_type != TYPE_INVALID) - type = opt_type; - else { - type = nm_supplicant_settings_verify_setting (key, value, len); - if (type == TYPE_INVALID) { - char buf[255]; - 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, secret ? "<omitted>" : buf); - return FALSE; - } - } - - old_opt = (ConfigOption *) g_hash_table_lookup (priv->config, key); - if (old_opt) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "key '%s' already configured", key); - return FALSE; - } - - opt = g_slice_new0 (ConfigOption); - opt->value = g_malloc (len + 1); - memcpy (opt->value, value, len); - opt->value[len] = '\0'; - - opt->len = len; - opt->type = type; - - { - 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, secret ? "<omitted>" : &buf[0]); - } - - g_hash_table_insert (priv->config, g_strdup (key), opt); - - return TRUE; -} - -static gboolean -nm_supplicant_config_add_option (NMSupplicantConfig *self, - const char *key, - const char *value, - gint32 len, - gboolean secret, - GError **error) -{ - return nm_supplicant_config_add_option_with_type (self, key, value, len, TYPE_INVALID, secret, error); -} - -static gboolean -nm_supplicant_config_add_blob (NMSupplicantConfig *self, - const char *key, - GBytes *value, - const char *blobid, - GError **error) -{ - NMSupplicantConfigPrivate *priv; - ConfigOption *old_opt; - ConfigOption *opt; - OptType type; - GByteArray *blob; - const guint8 *data; - gsize data_len; - - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); - g_return_val_if_fail (key != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - g_return_val_if_fail (blobid != NULL, FALSE); - - data = g_bytes_get_data (value, &data_len); - g_return_val_if_fail (data_len > 0, FALSE); - - priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - - type = nm_supplicant_settings_verify_setting (key, (const char *) data, data_len); - if (type == TYPE_INVALID) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "key '%s' and/or its contained value is invalid", key); - return FALSE; - } - - old_opt = (ConfigOption *) g_hash_table_lookup (priv->config, key); - if (old_opt) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "key '%s' already configured", key); - return FALSE; - } - - blob = g_byte_array_sized_new (data_len); - g_byte_array_append (blob, data, data_len); - - opt = g_slice_new0 (ConfigOption); - opt->value = g_strdup_printf ("blob://%s", blobid); - opt->len = strlen (opt->value); - opt->type = type; - - nm_log_info (LOGD_SUPPLICANT, "Config: added '%s' value '%s'", key, opt->value); - - g_hash_table_insert (priv->config, g_strdup (key), opt); - g_hash_table_insert (priv->blobs, g_strdup (blobid), blob); - - return TRUE; -} - -static gboolean -nm_supplicant_config_add_blob_for_connection (NMSupplicantConfig *self, - GBytes *field, - const char *name, - const char *con_uid, - GError **error) -{ - if (field && g_bytes_get_size (field)) { - gs_free char *uid = NULL; - char *p; - - uid = g_strdup_printf ("%s-%s", con_uid, name); - for (p = uid; *p; p++) { - if (*p == '/') - *p = '-'; - } - if (!nm_supplicant_config_add_blob (self, name, field, uid, error)) - return FALSE; - } - return TRUE; -} - -static void -nm_supplicant_config_finalize (GObject *object) -{ - /* Complete object destruction */ - g_hash_table_destroy (NM_SUPPLICANT_CONFIG_GET_PRIVATE (object)->config); - g_hash_table_destroy (NM_SUPPLICANT_CONFIG_GET_PRIVATE (object)->blobs); - - /* Chain up to the parent class */ - G_OBJECT_CLASS (nm_supplicant_config_parent_class)->finalize (object); -} - - -static void -nm_supplicant_config_class_init (NMSupplicantConfigClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = nm_supplicant_config_finalize; - - g_type_class_add_private (object_class, sizeof (NMSupplicantConfigPrivate)); -} - -guint32 -nm_supplicant_config_get_ap_scan (NMSupplicantConfig * self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), 1); - - return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->ap_scan; -} - -gboolean -nm_supplicant_config_fast_required (NMSupplicantConfig *self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); - - return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->fast_required; -} - -GVariant * -nm_supplicant_config_to_variant (NMSupplicantConfig *self) -{ - NMSupplicantConfigPrivate *priv; - GVariantBuilder builder; - GHashTableIter iter; - ConfigOption *option; - const char *key; - - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), NULL); - - priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - - g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); - - g_hash_table_iter_init (&iter, priv->config); - while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &option)) { - switch (option->type) { - case TYPE_INT: - g_variant_builder_add (&builder, "{sv}", key, g_variant_new_int32 (atoi (option->value))); - break; - case TYPE_BYTES: - case TYPE_UTF8: - g_variant_builder_add (&builder, "{sv}", - key, - g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, - option->value, option->len, 1)); - break; - case TYPE_KEYWORD: - case TYPE_STRING: - g_variant_builder_add (&builder, "{sv}", key, g_variant_new_string (option->value)); - break; - default: - break; - } - } - - return g_variant_builder_end (&builder); -} - -GHashTable * -nm_supplicant_config_get_blobs (NMSupplicantConfig * self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), NULL); - - return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->blobs; -} - -static const char * -wifi_freqs_to_string (gboolean bg_band) -{ - static const char *str_2ghz = NULL; - static const char *str_5ghz = NULL; - const char *str; - - str = bg_band ? str_2ghz : str_5ghz; - - if (G_UNLIKELY (str == NULL)) { - GString *tmp; - const guint *freqs; - int i; - - freqs = bg_band ? nm_utils_wifi_2ghz_freqs () : nm_utils_wifi_5ghz_freqs (); - tmp = g_string_sized_new (bg_band ? 70 : 225); - for (i = 0; freqs[i]; i++) - g_string_append_printf (tmp, i == 0 ? "%d" : " %d", freqs[i]); - str = g_string_free (tmp, FALSE); - if (bg_band) - str_2ghz = str; - else - str_5ghz = str; - } - return str; -} - -gboolean -nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, - NMSettingWireless * setting, - guint32 fixed_freq, - GError **error) -{ - NMSupplicantConfigPrivate *priv; - gboolean is_adhoc, is_ap; - const char *mode, *band; - guint32 channel; - GBytes *ssid; - const char *bssid; - - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); - g_return_val_if_fail (setting != NULL, FALSE); - g_return_val_if_fail (!error || !*error, FALSE); - - priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - - mode = nm_setting_wireless_get_mode (setting); - is_adhoc = (mode && !strcmp (mode, "adhoc")) ? TRUE : FALSE; - is_ap = (mode && !strcmp (mode, "ap")) ? TRUE : FALSE; - if (is_adhoc || is_ap) - priv->ap_scan = 2; - else - priv->ap_scan = 1; - - ssid = nm_setting_wireless_get_ssid (setting); - if (!nm_supplicant_config_add_option (self, "ssid", - (char *) g_bytes_get_data (ssid, NULL), - g_bytes_get_size (ssid), - FALSE, - error)) - return FALSE; - - if (is_adhoc) { - if (!nm_supplicant_config_add_option (self, "mode", "1", -1, FALSE, error)) - return FALSE; - } - - if (is_ap) { - if (!nm_supplicant_config_add_option (self, "mode", "2", -1, FALSE, error)) - return FALSE; - } - - if ((is_adhoc || is_ap) && fixed_freq) { - gs_free char *str_freq = NULL; - - str_freq = g_strdup_printf ("%u", fixed_freq); - if (!nm_supplicant_config_add_option (self, "frequency", str_freq, -1, FALSE, error)) - return FALSE; - } - - /* Except for Ad-Hoc and Hotspot, request that the driver probe for the - * specific SSID we want to associate with. - */ - if (!(is_adhoc || is_ap)) { - if (!nm_supplicant_config_add_option (self, "scan_ssid", "1", -1, FALSE, error)) - return FALSE; - } - - bssid = nm_setting_wireless_get_bssid (setting); - if (bssid) { - if (!nm_supplicant_config_add_option (self, "bssid", - bssid, strlen (bssid), - FALSE, - error)) - return FALSE; - } - - band = nm_setting_wireless_get_band (setting); - channel = nm_setting_wireless_get_channel (setting); - if (band) { - if (channel) { - guint32 freq; - gs_free char *str_freq = NULL; - - freq = nm_utils_wifi_channel_to_freq (channel, band); - str_freq = g_strdup_printf ("%u", freq); - if (!nm_supplicant_config_add_option (self, "freq_list", str_freq, -1, FALSE, error)) - return FALSE; - } else { - const char *freqs = NULL; - - if (!strcmp (band, "a")) - freqs = wifi_freqs_to_string (FALSE); - else if (!strcmp (band, "bg")) - freqs = wifi_freqs_to_string (TRUE); - - if (freqs && !nm_supplicant_config_add_option (self, "freq_list", freqs, strlen (freqs), FALSE, error)) - return FALSE; - } - } - - return TRUE; -} - -static gboolean -add_string_val (NMSupplicantConfig *self, - const char *field, - const char *name, - gboolean ucase, - gboolean secret, - GError **error) -{ - - if (field) { - gs_free char *value = NULL; - - if (ucase) { - value = g_ascii_strup (field, -1); - field = value; - } - return nm_supplicant_config_add_option (self, name, field, strlen (field), secret, error); - } - return TRUE; -} - -#define ADD_STRING_LIST_VAL(self, setting, setting_name, field, field_plural, name, separator, ucase, secret, error) \ - ({ \ - typeof (*(setting)) *_setting = (setting); \ - gboolean _success = TRUE; \ - \ - if (nm_setting_##setting_name##_get_num_##field_plural (_setting)) { \ - const char _separator = (separator); \ - GString *_str = g_string_new (NULL); \ - guint _k, _n; \ - \ - _n = nm_setting_##setting_name##_get_num_##field_plural (_setting); \ - for (_k = 0; _k < _n; _k++) { \ - const char *item = nm_setting_##setting_name##_get_##field (_setting, _k); \ - \ - if (!_str->len) { \ - g_string_append (_str, item); \ - } else { \ - g_string_append_c (_str, _separator); \ - g_string_append (_str, item); \ - } \ - } \ - if ((ucase)) \ - g_string_ascii_up (_str); \ - if (_str->len) { \ - if (!nm_supplicant_config_add_option ((self), (name), _str->str, -1, (secret), (error))) \ - _success = FALSE; \ - } \ - g_string_free (_str, TRUE); \ - } \ - _success; \ - }) - -static void -wep128_passphrase_hash (const char *input, - size_t input_len, - guint8 *out_digest, - size_t *out_digest_len) -{ - GChecksum *sum; - guint8 data[64]; - int i; - - g_return_if_fail (out_digest != NULL); - g_return_if_fail (out_digest_len != NULL); - g_return_if_fail (*out_digest_len >= 16); - - /* Get at least 64 bytes by repeating the passphrase into the buffer */ - for (i = 0; i < sizeof (data); i++) - data[i] = input[i % input_len]; - - sum = g_checksum_new (G_CHECKSUM_MD5); - g_assert (sum); - g_checksum_update (sum, data, sizeof (data)); - g_checksum_get_digest (sum, out_digest, out_digest_len); - g_checksum_free (sum); - - g_assert (*out_digest_len == 16); - /* WEP104 keys are 13 bytes in length (26 hex characters) */ - *out_digest_len = 13; -} - -static gboolean -add_wep_key (NMSupplicantConfig *self, - const char *key, - const char *name, - NMWepKeyType wep_type, - GError **error) -{ - size_t key_len = key ? strlen (key) : 0; - - if (!key || !key_len) - return TRUE; - - if (wep_type == NM_WEP_KEY_TYPE_UNKNOWN) { - if (nm_utils_wep_key_valid (key, NM_WEP_KEY_TYPE_KEY)) - wep_type = NM_WEP_KEY_TYPE_KEY; - else if (nm_utils_wep_key_valid (key, NM_WEP_KEY_TYPE_PASSPHRASE)) - wep_type = NM_WEP_KEY_TYPE_PASSPHRASE; - } - - if ( (wep_type == NM_WEP_KEY_TYPE_UNKNOWN) - || (wep_type == NM_WEP_KEY_TYPE_KEY)) { - if ((key_len == 10) || (key_len == 26)) { - gs_unref_bytes GBytes *bytes = NULL; - - bytes = nm_utils_hexstr2bin (key); - if (!bytes) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "cannot add wep-key %s to suplicant config because key is not hex", - name); - return FALSE; - } - if (!nm_supplicant_config_add_option (self, - name, - g_bytes_get_data (bytes, NULL), - g_bytes_get_size (bytes), - TRUE, - error)) - return FALSE; - } else if ((key_len == 5) || (key_len == 13)) { - if (!nm_supplicant_config_add_option (self, name, key, key_len, TRUE, error)) - return FALSE; - } else { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "Cannot add wep-key %s to suplicant config because key-length %u is invalid", - name, (guint) key_len); - return FALSE; - } - } else if (wep_type == NM_WEP_KEY_TYPE_PASSPHRASE) { - guint8 digest[16]; - size_t digest_len = sizeof (digest); - - wep128_passphrase_hash (key, key_len, digest, &digest_len); - if (!nm_supplicant_config_add_option (self, name, (const char *) digest, digest_len, TRUE, error)) - return FALSE; - } - - return TRUE; -} - -gboolean -nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self, - NMSettingWirelessSecurity *setting, - NMSetting8021x *setting_8021x, - const char *con_uuid, - guint32 mtu, - GError **error) -{ - const char *key_mgmt, *auth_alg; - const char *psk; - - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); - g_return_val_if_fail (setting != NULL, FALSE); - g_return_val_if_fail (con_uuid != NULL, FALSE); - g_return_val_if_fail (!error || !*error, FALSE); - - key_mgmt = nm_setting_wireless_security_get_key_mgmt (setting); - if (!add_string_val (self, key_mgmt, "key_mgmt", TRUE, FALSE, error)) - return FALSE; - - auth_alg = nm_setting_wireless_security_get_auth_alg (setting); - if (!add_string_val (self, auth_alg, "auth_alg", TRUE, FALSE, error)) - return FALSE; - - psk = nm_setting_wireless_security_get_psk (setting); - if (psk) { - size_t psk_len = strlen (psk); - - if (psk_len == 64) { - gs_unref_bytes GBytes *bytes = NULL; - - /* Hex PSK */ - bytes = nm_utils_hexstr2bin (psk); - if (!bytes) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "Cannot add psk to supplicant config due to invalid hex"); - return FALSE; - } - - if (!nm_supplicant_config_add_option (self, - "psk", - g_bytes_get_data (bytes, NULL), - g_bytes_get_size (bytes), - TRUE, - error)) - return FALSE; - } else if (psk_len >= 8 && psk_len <= 63) { - /* Use TYPE_STRING here so that it gets pushed to the - * supplicant as a string, and therefore gets quoted, - * and therefore the supplicant will interpret it as a - * passphrase and not a hex key. - */ - if (!nm_supplicant_config_add_option_with_type (self, "psk", psk, -1, TYPE_STRING, TRUE, error)) - return FALSE; - } else { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "Cannot add psk to supplicant config due to invalid PSK length %u (not between 8 and 63 characters)", - (guint) psk_len); - return FALSE; - } - } - - /* Only WPA-specific things when using WPA */ - if ( !strcmp (key_mgmt, "wpa-none") - || !strcmp (key_mgmt, "wpa-psk") - || !strcmp (key_mgmt, "wpa-eap")) { - if (!ADD_STRING_LIST_VAL (self, setting, wireless_security, proto, protos, "proto", ' ', TRUE, FALSE, error)) - return FALSE; - if (!ADD_STRING_LIST_VAL (self, setting, wireless_security, pairwise, pairwise, "pairwise", ' ', TRUE, FALSE, error)) - return FALSE; - if (!ADD_STRING_LIST_VAL (self, setting, wireless_security, group, groups, "group", ' ', TRUE, FALSE, error)) - return FALSE; - } - - /* WEP keys if required */ - if (!strcmp (key_mgmt, "none")) { - NMWepKeyType wep_type = nm_setting_wireless_security_get_wep_key_type (setting); - const char *wep0 = nm_setting_wireless_security_get_wep_key (setting, 0); - const char *wep1 = nm_setting_wireless_security_get_wep_key (setting, 1); - const char *wep2 = nm_setting_wireless_security_get_wep_key (setting, 2); - const char *wep3 = nm_setting_wireless_security_get_wep_key (setting, 3); - - if (!add_wep_key (self, wep0, "wep_key0", wep_type, error)) - return FALSE; - if (!add_wep_key (self, wep1, "wep_key1", wep_type, error)) - return FALSE; - if (!add_wep_key (self, wep2, "wep_key2", wep_type, error)) - return FALSE; - if (!add_wep_key (self, wep3, "wep_key3", wep_type, error)) - return FALSE; - - if (wep0 || wep1 || wep2 || wep3) { - gs_free char *value = NULL; - - value = g_strdup_printf ("%d", nm_setting_wireless_security_get_wep_tx_keyidx (setting)); - if (!nm_supplicant_config_add_option (self, "wep_tx_keyidx", value, -1, FALSE, error)) - return FALSE; - } - } - - if (auth_alg && !strcmp (auth_alg, "leap")) { - /* LEAP */ - if (!strcmp (key_mgmt, "ieee8021x")) { - const char *tmp; - - tmp = nm_setting_wireless_security_get_leap_username (setting); - if (!add_string_val (self, tmp, "identity", FALSE, FALSE, error)) - return FALSE; - - tmp = nm_setting_wireless_security_get_leap_password (setting); - if (!add_string_val (self, tmp, "password", FALSE, TRUE, error)) - return FALSE; - - if (!add_string_val (self, "leap", "eap", TRUE, FALSE, error)) - return FALSE; - } else { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "Invalid key-mgmt \"%s\" for leap", key_mgmt); - return FALSE; - } - } else { - /* 802.1x for Dynamic WEP and WPA-Enterprise */ - if (!strcmp (key_mgmt, "ieee8021x") || !strcmp (key_mgmt, "wpa-eap")) { - if (!setting_8021x) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "Cannot set key-mgmt %s with missing 8021x setting", key_mgmt); - return FALSE; - } - if (!nm_supplicant_config_add_setting_8021x (self, setting_8021x, con_uuid, mtu, FALSE, error)) - return FALSE; - } - - if (!strcmp (key_mgmt, "wpa-eap")) { - /* If using WPA Enterprise, enable optimized background scanning - * to ensure roaming within an ESS works well. - */ - if (!nm_supplicant_config_add_option (self, "bgscan", "simple:30:-65:300", -1, FALSE, error)) - return FALSE; - - /* When using WPA-Enterprise, we want to use Proactive Key Caching (also - * called Opportunistic Key Caching) to avoid full EAP exchanges when - * roaming between access points in the same mobility group. - */ - if (!nm_supplicant_config_add_option (self, "proactive_key_caching", "1", -1, FALSE, error)) - return FALSE; - } - } - - return TRUE; -} - -gboolean -nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, - NMSetting8021x *setting, - const char *con_uuid, - guint32 mtu, - gboolean wired, - GError **error) -{ - NMSupplicantConfigPrivate *priv; - char *tmp; - const char *peapver, *value, *path; - gboolean added; - GString *phase1, *phase2; - GBytes *bytes; - gboolean fast = FALSE; - guint32 i, num_eap; - gboolean fast_provisoning_allowed = FALSE; - const char *ca_path_override = NULL, *ca_cert_override = NULL; - guint32 frag, hdrs; - gs_free char *frag_str = NULL; - - g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); - g_return_val_if_fail (setting != NULL, FALSE); - g_return_val_if_fail (con_uuid != NULL, FALSE); - - priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - - value = nm_setting_802_1x_get_password (setting); - if (value) { - if (!add_string_val (self, value, "password", FALSE, TRUE, error)) - return FALSE; - } else { - bytes = nm_setting_802_1x_get_password_raw (setting); - if (bytes) { - if (!nm_supplicant_config_add_option (self, - "password", - (const char *) g_bytes_get_data (bytes, NULL), - g_bytes_get_size (bytes), - TRUE, - error)) - return FALSE; - } - } - value = nm_setting_802_1x_get_pin (setting); - if (!add_string_val (self, value, "pin", FALSE, TRUE, error)) - return FALSE; - - if (wired) { - if (!add_string_val (self, "IEEE8021X", "key_mgmt", FALSE, FALSE, error)) - return FALSE; - /* Wired 802.1x must always use eapol_flags=0 */ - if (!add_string_val (self, "0", "eapol_flags", FALSE, FALSE, error)) - return FALSE; - priv->ap_scan = 0; - } - - if (!ADD_STRING_LIST_VAL (self, setting, 802_1x, eap_method, eap_methods, "eap", ' ', TRUE, FALSE, error)) - return FALSE; - - /* Check EAP method for special handling: PEAP + GTC, FAST */ - num_eap = nm_setting_802_1x_get_num_eap_methods (setting); - for (i = 0; i < num_eap; i++) { - const char *method = nm_setting_802_1x_get_eap_method (setting, i); - - if (method && (strcasecmp (method, "fast") == 0)) { - fast = TRUE; - priv->fast_required = TRUE; - } - } - - /* Adjust the fragment size according to MTU, but do not set it higher than 1280-14 - * for better compatibility */ - hdrs = 14; /* EAPOL + EAP-TLS */ - frag = 1280 - hdrs; - if (mtu > hdrs) - frag = CLAMP (mtu - hdrs, 100, frag); - frag_str = g_strdup_printf ("%u", frag); - - if (!nm_supplicant_config_add_option (self, "fragment_size", frag_str, -1, FALSE, error)) - return FALSE; - - phase1 = g_string_new (NULL); - peapver = nm_setting_802_1x_get_phase1_peapver (setting); - if (peapver) { - if (!strcmp (peapver, "0")) - g_string_append (phase1, "peapver=0"); - else if (!strcmp (peapver, "1")) - g_string_append (phase1, "peapver=1"); - } - - if (nm_setting_802_1x_get_phase1_peaplabel (setting)) { - if (phase1->len) - g_string_append_c (phase1, ' '); - g_string_append_printf (phase1, "peaplabel=%s", nm_setting_802_1x_get_phase1_peaplabel (setting)); - } - - value = nm_setting_802_1x_get_phase1_fast_provisioning (setting); - if (value) { - if (phase1->len) - g_string_append_c (phase1, ' '); - g_string_append_printf (phase1, "fast_provisioning=%s", value); - - if (strcmp (value, "0") != 0) - fast_provisoning_allowed = TRUE; - } - - if (phase1->len) { - if (!add_string_val (self, phase1->str, "phase1", FALSE, FALSE, error)) { - g_string_free (phase1, TRUE); - return FALSE; - } - } - g_string_free (phase1, TRUE); - - phase2 = g_string_new (NULL); - if (nm_setting_802_1x_get_phase2_auth (setting) && !fast_provisoning_allowed) { - tmp = g_ascii_strup (nm_setting_802_1x_get_phase2_auth (setting), -1); - g_string_append_printf (phase2, "auth=%s", tmp); - g_free (tmp); - } - - if (nm_setting_802_1x_get_phase2_autheap (setting)) { - if (phase2->len) - g_string_append_c (phase2, ' '); - tmp = g_ascii_strup (nm_setting_802_1x_get_phase2_autheap (setting), -1); - g_string_append_printf (phase2, "autheap=%s", tmp); - g_free (tmp); - } - - if (phase2->len) { - if (!add_string_val (self, phase2->str, "phase2", FALSE, FALSE, error)) { - g_string_free (phase2, TRUE); - return FALSE; - } - } - g_string_free (phase2, TRUE); - - /* PAC file */ - path = nm_setting_802_1x_get_pac_file (setting); - if (path) { - if (!add_string_val (self, path, "pac_file", FALSE, FALSE, error)) - return FALSE; - } else { - /* PAC file is not specified. - * If provisioning is allowed, use an blob format. - */ - if (fast_provisoning_allowed) { - gs_free char *blob_name = NULL; - - blob_name = g_strdup_printf ("blob://pac-blob-%s", con_uuid); - if (!add_string_val (self, blob_name, "pac_file", FALSE, FALSE, error)) - return FALSE; - } else { - /* This is only error for EAP-FAST; don't disturb other methods. */ - if (fast) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "EAP-FAST error: no PAC file provided and " - "automatic PAC provisioning is disabled"); - return FALSE; - } - } - } - - /* If user wants to use system CA certs, either populate ca_path (if the path - * is a directory) or ca_cert (the path is a file name) */ - if (nm_setting_802_1x_get_system_ca_certs (setting)) { - if (g_file_test (SYSTEM_CA_PATH, G_FILE_TEST_IS_DIR)) - ca_path_override = SYSTEM_CA_PATH; - else - ca_cert_override = SYSTEM_CA_PATH; - } - - /* CA path */ - path = nm_setting_802_1x_get_ca_path (setting); - path = ca_path_override ? ca_path_override : path; - if (path) { - if (!add_string_val (self, path, "ca_path", FALSE, FALSE, error)) - return FALSE; - } - - /* Phase2 CA path */ - path = nm_setting_802_1x_get_phase2_ca_path (setting); - path = ca_path_override ? ca_path_override : path; - if (path) { - if (!add_string_val (self, path, "ca_path2", FALSE, FALSE, error)) - return FALSE; - } - - /* CA certificate */ - if (ca_cert_override) { - if (!add_string_val (self, ca_cert_override, "ca_cert", FALSE, FALSE, error)) - return FALSE; - } else { - switch (nm_setting_802_1x_get_ca_cert_scheme (setting)) { - case NM_SETTING_802_1X_CK_SCHEME_BLOB: - bytes = nm_setting_802_1x_get_ca_cert_blob (setting); - if (!nm_supplicant_config_add_blob_for_connection (self, bytes, "ca_cert", con_uuid, error)) - return FALSE; - break; - case NM_SETTING_802_1X_CK_SCHEME_PATH: - path = nm_setting_802_1x_get_ca_cert_path (setting); - if (!add_string_val (self, path, "ca_cert", FALSE, FALSE, error)) - return FALSE; - break; - default: - break; - } - } - - /* Phase 2 CA certificate */ - if (ca_cert_override) { - if (!add_string_val (self, ca_cert_override, "ca_cert2", FALSE, FALSE, error)) - return FALSE; - } else { - switch (nm_setting_802_1x_get_phase2_ca_cert_scheme (setting)) { - case NM_SETTING_802_1X_CK_SCHEME_BLOB: - bytes = nm_setting_802_1x_get_phase2_ca_cert_blob (setting); - if (!nm_supplicant_config_add_blob_for_connection (self, bytes, "ca_cert2", con_uuid, error)) - return FALSE; - break; - case NM_SETTING_802_1X_CK_SCHEME_PATH: - path = nm_setting_802_1x_get_phase2_ca_cert_path (setting); - if (!add_string_val (self, path, "ca_cert2", FALSE, FALSE, error)) - return FALSE; - break; - default: - break; - } - } - - /* Subject match */ - value = nm_setting_802_1x_get_subject_match (setting); - if (!add_string_val (self, value, "subject_match", FALSE, FALSE, error)) - return FALSE; - value = nm_setting_802_1x_get_phase2_subject_match (setting); - if (!add_string_val (self, value, "subject_match2", FALSE, FALSE, error)) - return FALSE; - - /* altSubjectName match */ - if (!ADD_STRING_LIST_VAL (self, setting, 802_1x, altsubject_match, altsubject_matches, "altsubject_match", ';', FALSE, FALSE, error)) - return FALSE; - if (!ADD_STRING_LIST_VAL (self, setting, 802_1x, phase2_altsubject_match, phase2_altsubject_matches, "altsubject_match2", ';', FALSE, FALSE, error)) - return FALSE; - - /* Domain suffix match */ - value = nm_setting_802_1x_get_domain_suffix_match (setting); - if (!add_string_val (self, value, "domain_suffix_match", FALSE, FALSE, error)) - return FALSE; - value = nm_setting_802_1x_get_phase2_domain_suffix_match (setting); - if (!add_string_val (self, value, "domain_suffix_match2", FALSE, FALSE, error)) - return FALSE; - - /* Private key */ - added = FALSE; - switch (nm_setting_802_1x_get_private_key_scheme (setting)) { - case NM_SETTING_802_1X_CK_SCHEME_BLOB: - bytes = nm_setting_802_1x_get_private_key_blob (setting); - if (!nm_supplicant_config_add_blob_for_connection (self, bytes, "private_key", con_uuid, error)) - return FALSE; - added = TRUE; - break; - case NM_SETTING_802_1X_CK_SCHEME_PATH: - path = nm_setting_802_1x_get_private_key_path (setting); - if (!add_string_val (self, path, "private_key", FALSE, FALSE, error)) - return FALSE; - added = TRUE; - break; - default: - break; - } - - if (added) { - NMSetting8021xCKFormat format; - NMSetting8021xCKScheme scheme; - - format = nm_setting_802_1x_get_private_key_format (setting); - scheme = nm_setting_802_1x_get_private_key_scheme (setting); - - if ( scheme == NM_SETTING_802_1X_CK_SCHEME_PATH - || format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) { - /* Only add the private key password for PKCS#12 blobs and - * all path schemes, since in both of these cases the private key - * isn't decrypted at all. - */ - value = nm_setting_802_1x_get_private_key_password (setting); - if (!add_string_val (self, value, "private_key_passwd", FALSE, TRUE, error)) - return FALSE; - } - - if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) { - /* Only add the client cert if the private key is not PKCS#12, as - * wpa_supplicant configuration directs us to do. - */ - switch (nm_setting_802_1x_get_client_cert_scheme (setting)) { - case NM_SETTING_802_1X_CK_SCHEME_BLOB: - bytes = nm_setting_802_1x_get_client_cert_blob (setting); - if (!nm_supplicant_config_add_blob_for_connection (self, bytes, "client_cert", con_uuid, error)) - return FALSE; - break; - case NM_SETTING_802_1X_CK_SCHEME_PATH: - path = nm_setting_802_1x_get_client_cert_path (setting); - if (!add_string_val (self, path, "client_cert", FALSE, FALSE, error)) - return FALSE; - break; - default: - break; - } - } - } - - /* Phase 2 private key */ - added = FALSE; - switch (nm_setting_802_1x_get_phase2_private_key_scheme (setting)) { - case NM_SETTING_802_1X_CK_SCHEME_BLOB: - bytes = nm_setting_802_1x_get_phase2_private_key_blob (setting); - if (!nm_supplicant_config_add_blob_for_connection (self, bytes, "private_key2", con_uuid, error)) - return FALSE; - added = TRUE; - break; - case NM_SETTING_802_1X_CK_SCHEME_PATH: - path = nm_setting_802_1x_get_phase2_private_key_path (setting); - if (!add_string_val (self, path, "private_key2", FALSE, FALSE, error)) - return FALSE; - added = TRUE; - break; - default: - break; - } - - if (added) { - NMSetting8021xCKFormat format; - NMSetting8021xCKScheme scheme; - - format = nm_setting_802_1x_get_phase2_private_key_format (setting); - scheme = nm_setting_802_1x_get_phase2_private_key_scheme (setting); - - if ( scheme == NM_SETTING_802_1X_CK_SCHEME_PATH - || format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) { - /* Only add the private key password for PKCS#12 blobs and - * all path schemes, since in both of these cases the private key - * isn't decrypted at all. - */ - value = nm_setting_802_1x_get_phase2_private_key_password (setting); - if (!add_string_val (self, value, "private_key2_passwd", FALSE, TRUE, error)) - return FALSE; - } - - if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) { - /* Only add the client cert if the private key is not PKCS#12, as - * wpa_supplicant configuration directs us to do. - */ - switch (nm_setting_802_1x_get_phase2_client_cert_scheme (setting)) { - case NM_SETTING_802_1X_CK_SCHEME_BLOB: - bytes = nm_setting_802_1x_get_phase2_client_cert_blob (setting); - if (!nm_supplicant_config_add_blob_for_connection (self, bytes, "client_cert2", con_uuid, error)) - return FALSE; - break; - case NM_SETTING_802_1X_CK_SCHEME_PATH: - path = nm_setting_802_1x_get_phase2_client_cert_path (setting); - if (!add_string_val (self, path, "client_cert2", FALSE, FALSE, error)) - return FALSE; - break; - default: - break; - } - } - } - - value = nm_setting_802_1x_get_identity (setting); - if (!add_string_val (self, value, "identity", FALSE, FALSE, error)) - return FALSE; - value = nm_setting_802_1x_get_anonymous_identity (setting); - if (!add_string_val (self, value, "anonymous_identity", FALSE, FALSE, error)) - return FALSE; - - return TRUE; -} - -gboolean -nm_supplicant_config_add_no_security (NMSupplicantConfig *self, GError **error) -{ - return nm_supplicant_config_add_option (self, "key_mgmt", "NONE", -1, FALSE, error); -} - diff --git a/src/supplicant-manager/nm-supplicant-config.h b/src/supplicant-manager/nm-supplicant-config.h deleted file mode 100644 index bf3e64c5..00000000 --- a/src/supplicant-manager/nm-supplicant-config.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2012 Red Hat, Inc. - * Copyright (C) 2007 - 2008 Novell, Inc. - */ - -#ifndef __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ -#define __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ - -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-8021x.h> - -#include "nm-supplicant-types.h" - -#define NM_TYPE_SUPPLICANT_CONFIG (nm_supplicant_config_get_type ()) -#define NM_SUPPLICANT_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SUPPLICANT_CONFIG, NMSupplicantConfig)) -#define NM_SUPPLICANT_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SUPPLICANT_CONFIG, NMSupplicantConfigClass)) -#define NM_IS_SUPPLICANT_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SUPPLICANT_CONFIG)) -#define NM_IS_SUPPLICANT_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_CONFIG)) -#define NM_SUPPLICANT_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_CONFIG, NMSupplicantConfigClass)) - -struct _NMSupplicantConfig -{ - GObject parent; -}; - -typedef struct -{ - GObjectClass parent; -} NMSupplicantConfigClass; - - -GType nm_supplicant_config_get_type (void); - -NMSupplicantConfig *nm_supplicant_config_new (void); - -guint32 nm_supplicant_config_get_ap_scan (NMSupplicantConfig *self); - -gboolean nm_supplicant_config_fast_required (NMSupplicantConfig *self); - -GVariant *nm_supplicant_config_to_variant (NMSupplicantConfig *self); - -GHashTable *nm_supplicant_config_get_blobs (NMSupplicantConfig *self); - -gboolean nm_supplicant_config_add_setting_wireless (NMSupplicantConfig *self, - NMSettingWireless *setting, - guint32 fixed_freq, - GError **error); - -gboolean nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self, - NMSettingWirelessSecurity *setting, - NMSetting8021x *setting_8021x, - const char *con_uuid, - guint32 mtu, - GError **error); - -gboolean nm_supplicant_config_add_no_security (NMSupplicantConfig *self, - GError **error); - -gboolean nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, - NMSetting8021x *setting, - const char *con_uuid, - guint32 mtu, - gboolean wired, - GError **error); - -#endif /* __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ */ diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c deleted file mode 100644 index 05d9aa67..00000000 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ /dev/null @@ -1,1663 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2012 Red Hat, Inc. - * Copyright (C) 2006 - 2008 Novell, Inc. - */ - -#include "nm-default.h" - -#include <stdio.h> -#include <string.h> - -#include "NetworkManagerUtils.h" -#include "nm-supplicant-interface.h" -#include "nm-supplicant-config.h" -#include "nm-core-internal.h" -#include "nm-dbus-compat.h" - -#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface" -#define WPAS_DBUS_IFACE_BSS WPAS_DBUS_INTERFACE ".BSS" -#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network" -#define WPAS_ERROR_INVALID_IFACE WPAS_DBUS_INTERFACE ".InvalidInterface" -#define WPAS_ERROR_EXISTS_ERROR WPAS_DBUS_INTERFACE ".InterfaceExists" - -G_DEFINE_TYPE (NMSupplicantInterface, nm_supplicant_interface, G_TYPE_OBJECT) - -#define NM_SUPPLICANT_INTERFACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - NM_TYPE_SUPPLICANT_INTERFACE, \ - NMSupplicantInterfacePrivate)) - -/* Signals */ -enum { - STATE, /* change in the interface's state */ - REMOVED, /* interface was removed by the supplicant */ - NEW_BSS, /* interface saw a new access point from a scan */ - BSS_UPDATED, /* a BSS property changed */ - BSS_REMOVED, /* supplicant removed BSS from its scan list */ - SCAN_DONE, /* wifi scan is complete */ - CONNECTION_ERROR, /* an error occurred during a connection request */ - CREDENTIALS_REQUEST, /* 802.1x identity or password requested */ - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* Properties */ -NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface, - PROP_IFACE, - PROP_SCANNING, - PROP_CURRENT_BSS, - PROP_IS_WIRELESS, - PROP_FAST_SUPPORTED, - PROP_AP_SUPPORT, -); - -typedef struct { - char * dev; - bool is_wireless; - bool fast_supported; - gboolean has_credreq; /* Whether querying 802.1x credentials is supported */ - NMSupplicantFeature ap_support; /* Lightweight AP mode support */ - NMSupplicantFeature mac_randomization_support; - guint32 max_scan_ssids; - guint32 ready_count; - - char * object_path; - guint32 state; - int disconnect_reason; - - gboolean scanning; - - GDBusProxy * wpas_proxy; - GCancellable * init_cancellable; - GDBusProxy * iface_proxy; - GCancellable * other_cancellable; - GCancellable * assoc_cancellable; - char * net_path; - guint32 blobs_left; - GHashTable * bss_proxies; - char * current_bss; - - gint32 last_scan; /* timestamp as returned by nm_utils_get_monotonic_timestamp_s() */ - - NMSupplicantConfig *cfg; -} NMSupplicantInterfacePrivate; - -/*********************************************************************************************/ - -#define _NMLOG_DOMAIN LOGD_SUPPLICANT -#define _NMLOG_PREFIX_NAME "sup-iface" -#define _NMLOG(level, ...) \ - G_STMT_START { \ - char _sbuf[64]; \ - \ - nm_log ((level), _NMLOG_DOMAIN, \ - "%s%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \ - _NMLOG_PREFIX_NAME, \ - ((self) \ - ? nm_sprintf_buf (_sbuf, \ - "[%p,%s]", \ - (self), \ - NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->dev) \ - : "") \ - _NM_UTILS_MACRO_REST(__VA_ARGS__)); \ - } G_STMT_END - -/*********************************************************************************************/ - -static void -emit_error_helper (NMSupplicantInterface *self, GError *error) -{ - char *name = NULL; - - if (g_dbus_error_is_remote_error (error)) - name = g_dbus_error_get_remote_error (error); - - g_signal_emit (self, signals[CONNECTION_ERROR], 0, name, error->message); - g_free (name); -} - -static void -bss_props_changed_cb (GDBusProxy *proxy, - GVariant *changed_properties, - char **invalidated_properties, - gpointer user_data) -{ - NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (priv->scanning) - priv->last_scan = nm_utils_get_monotonic_timestamp_s (); - - g_signal_emit (self, signals[BSS_UPDATED], 0, - g_dbus_proxy_get_object_path (proxy), - changed_properties); -} - -static GVariant * -_get_bss_proxy_properties (NMSupplicantInterface *self, GDBusProxy *proxy) -{ - gs_strfreev char **properties = NULL; - GVariantBuilder builder; - char **iter; - - iter = properties = g_dbus_proxy_get_cached_property_names (proxy); - if (!iter) - return NULL; - - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - while (*iter) { - GVariant *copy = g_dbus_proxy_get_cached_property (proxy, *iter); - - g_variant_builder_add (&builder, "{sv}", *iter++, copy); - g_variant_unref (copy); - } - - return g_variant_builder_end (&builder); -} - -#define BSS_PROXY_INITED "bss-proxy-inited" - -static void -on_bss_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - gs_free_error GError *error = NULL; - gs_unref_variant GVariant *props = NULL; - - if (!g_async_initable_init_finish (G_ASYNC_INITABLE (proxy), result, &error)) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - self = NM_SUPPLICANT_INTERFACE (user_data); - _LOGD ("failed to acquire BSS proxy: (%s)", error->message); - g_hash_table_remove (NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->bss_proxies, - g_dbus_proxy_get_object_path (proxy)); - } - return; - } - - self = NM_SUPPLICANT_INTERFACE (user_data); - props = _get_bss_proxy_properties (self, proxy); - if (!props) - return; - - g_object_set_data (G_OBJECT (proxy), BSS_PROXY_INITED, GUINT_TO_POINTER (TRUE)); - - g_signal_emit (self, signals[NEW_BSS], 0, - g_dbus_proxy_get_object_path (proxy), - g_variant_ref_sink (props)); -} - -static void -handle_new_bss (NMSupplicantInterface *self, const char *object_path) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - GDBusProxy *bss_proxy; - - g_return_if_fail (object_path != NULL); - - if (g_hash_table_lookup (priv->bss_proxies, object_path)) - return; - - bss_proxy = g_object_new (G_TYPE_DBUS_PROXY, - "g-bus-type", G_BUS_TYPE_SYSTEM, - "g-flags", G_DBUS_PROXY_FLAGS_NONE, - "g-name", WPAS_DBUS_SERVICE, - "g-object-path", object_path, - "g-interface-name", WPAS_DBUS_IFACE_BSS, - NULL); - g_hash_table_insert (priv->bss_proxies, - (char *) g_dbus_proxy_get_object_path (bss_proxy), - bss_proxy); - g_signal_connect (bss_proxy, "g-properties-changed", G_CALLBACK (bss_props_changed_cb), self); - g_async_initable_init_async (G_ASYNC_INITABLE (bss_proxy), - G_PRIORITY_DEFAULT, - priv->other_cancellable, - (GAsyncReadyCallback) on_bss_proxy_acquired, - self); -} - -static void -set_state (NMSupplicantInterface *self, guint32 new_state) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - guint32 old_state = priv->state; - - g_return_if_fail (new_state < NM_SUPPLICANT_INTERFACE_STATE_LAST); - - if (new_state == priv->state) - return; - - /* DOWN is a terminal state */ - g_return_if_fail (priv->state != NM_SUPPLICANT_INTERFACE_STATE_DOWN); - - /* Cannot regress to READY, STARTING, or INIT from higher states */ - if (priv->state >= NM_SUPPLICANT_INTERFACE_STATE_READY) - g_return_if_fail (new_state > NM_SUPPLICANT_INTERFACE_STATE_READY); - - if (new_state == NM_SUPPLICANT_INTERFACE_STATE_READY) { - if (priv->other_cancellable) { - g_warn_if_fail (priv->other_cancellable == NULL); - g_cancellable_cancel (priv->other_cancellable); - g_clear_object (&priv->other_cancellable); - } - priv->other_cancellable = g_cancellable_new (); - } else if (new_state == NM_SUPPLICANT_INTERFACE_STATE_DOWN) { - if (priv->init_cancellable) - g_cancellable_cancel (priv->init_cancellable); - g_clear_object (&priv->init_cancellable); - - if (priv->other_cancellable) - g_cancellable_cancel (priv->other_cancellable); - g_clear_object (&priv->other_cancellable); - - if (priv->iface_proxy) - g_signal_handlers_disconnect_by_data (priv->iface_proxy, self); - } - - priv->state = new_state; - - if ( priv->state == NM_SUPPLICANT_INTERFACE_STATE_SCANNING - || old_state == NM_SUPPLICANT_INTERFACE_STATE_SCANNING) - priv->last_scan = nm_utils_get_monotonic_timestamp_s (); - - /* Disconnect reason is no longer relevant when not in the DISCONNECTED state */ - if (priv->state != NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED) - priv->disconnect_reason = 0; - - g_signal_emit (self, signals[STATE], 0, - priv->state, - old_state, - priv->disconnect_reason); -} - -static int -wpas_state_string_to_enum (const char *str_state) -{ - if (!strcmp (str_state, "interface_disabled")) - return NM_SUPPLICANT_INTERFACE_STATE_DISABLED; - else if (!strcmp (str_state, "disconnected")) - return NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED; - else if (!strcmp (str_state, "inactive")) - return NM_SUPPLICANT_INTERFACE_STATE_INACTIVE; - else if (!strcmp (str_state, "scanning")) - return NM_SUPPLICANT_INTERFACE_STATE_SCANNING; - else if (!strcmp (str_state, "authenticating")) - return NM_SUPPLICANT_INTERFACE_STATE_AUTHENTICATING; - else if (!strcmp (str_state, "associating")) - return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING; - else if (!strcmp (str_state, "associated")) - return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED; - else if (!strcmp (str_state, "4way_handshake")) - return NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE; - else if (!strcmp (str_state, "group_handshake")) - return NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE; - else if (!strcmp (str_state, "completed")) - return NM_SUPPLICANT_INTERFACE_STATE_COMPLETED; - - return -1; -} - -static void -set_state_from_string (NMSupplicantInterface *self, const char *new_state) -{ - int state; - - state = wpas_state_string_to_enum (new_state); - if (state == -1) { - _LOGW ("unknown supplicant state '%s'", new_state); - return; - } - set_state (self, (guint32) state); -} - -static void -set_scanning (NMSupplicantInterface *self, gboolean new_scanning) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (priv->scanning != new_scanning) { - priv->scanning = new_scanning; - - /* Cache time of last scan completion */ - if (priv->scanning == FALSE) - priv->last_scan = nm_utils_get_monotonic_timestamp_s (); - - _notify (self, PROP_SCANNING); - } -} - -gboolean -nm_supplicant_interface_get_scanning (NMSupplicantInterface *self) -{ - NMSupplicantInterfacePrivate *priv; - - g_return_val_if_fail (self != NULL, FALSE); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - if (priv->scanning) - return TRUE; - if (priv->state == NM_SUPPLICANT_INTERFACE_STATE_SCANNING) - return TRUE; - return FALSE; -} - -const char * -nm_supplicant_interface_get_current_bss (NMSupplicantInterface *self) -{ - NMSupplicantInterfacePrivate *priv; - - g_return_val_if_fail (self != NULL, FALSE); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - return priv->state >= NM_SUPPLICANT_INTERFACE_STATE_READY ? priv->current_bss : NULL; -} - -gint32 -nm_supplicant_interface_get_last_scan_time (NMSupplicantInterface *self) -{ - return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->last_scan; -} - -#define MATCH_PROPERTY(p, n, v, t) (!strcmp (p, n) && g_variant_is_of_type (v, t)) - -static void -parse_capabilities (NMSupplicantInterface *self, GVariant *capabilities) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - gboolean have_active = FALSE, have_ssid = FALSE; - gint32 max_scan_ssids = -1; - const char **array; - - g_return_if_fail (capabilities && g_variant_is_of_type (capabilities, G_VARIANT_TYPE_VARDICT)); - - if ( g_variant_lookup (capabilities, "Scan", "^a&s", &array) - && array) { - if (g_strv_contains (array, "active")) - have_active = TRUE; - if (g_strv_contains (array, "ssid")) - have_ssid = TRUE; - g_free (array); - } - - if (g_variant_lookup (capabilities, "MaxScanSSID", "i", &max_scan_ssids)) { - /* We need active scan and SSID probe capabilities to care about MaxScanSSIDs */ - if (max_scan_ssids > 0 && have_active && have_ssid) { - /* wpa_supplicant's WPAS_MAX_SCAN_SSIDS value is 16, but for speed - * and to ensure we don't disclose too many SSIDs from the hidden - * list, we'll limit to 5. - */ - priv->max_scan_ssids = CLAMP (max_scan_ssids, 0, 5); - _LOGI ("supports %d scan SSIDs", priv->max_scan_ssids); - } - } -} - -static void -iface_check_ready (NMSupplicantInterface *self) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (priv->ready_count && priv->state < NM_SUPPLICANT_INTERFACE_STATE_READY) { - priv->ready_count--; - if (priv->ready_count == 0) - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_READY); - } -} - -gboolean -nm_supplicant_interface_credentials_reply (NMSupplicantInterface *self, - const char *field, - const char *value, - GError **error) -{ - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *reply = NULL; - - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE); - g_return_val_if_fail (field != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - g_return_val_if_fail (priv->has_credreq == TRUE, FALSE); - - /* Need a network block object path */ - g_return_val_if_fail (priv->net_path, FALSE); - reply = g_dbus_proxy_call_sync (priv->iface_proxy, - "NetworkReply", - g_variant_new ("(oss)", - priv->net_path, - field, - value), - G_DBUS_CALL_FLAGS_NONE, - 5000, - NULL, - error); - if (error && *error) - g_dbus_error_strip_remote_error (*error); - - return !!reply; -} - -static void -iface_check_netreply_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *variant = NULL; - gs_free_error GError *error = NULL; - - /* We know NetworkReply is supported if the NetworkReply method returned - * successfully (which is unexpected since we sent a bogus network - * object path) or if we got an "InvalidArgs" (which indicates NetworkReply - * is supported). We know it's not supported if we get an - * "UnknownMethod" error. - */ - - variant = g_dbus_proxy_call_finish (proxy, result, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (variant || _nm_dbus_error_has_name (error, "fi.w1.wpa_supplicant1.InvalidArgs")) - priv->has_credreq = TRUE; - - _LOGD ("supplicant %s network credentials requests", - priv->has_credreq ? "supports" : "does not support"); - - iface_check_ready (self); -} - -NMSupplicantFeature -nm_supplicant_interface_get_ap_support (NMSupplicantInterface *self) -{ - return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->ap_support; -} - -void -nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self, - NMSupplicantFeature ap_support) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - /* Use the best indicator of support between the supplicant global - * Capabilities property and the interface's introspection data. - */ - if (ap_support > priv->ap_support) - priv->ap_support = ap_support; -} - -static void -set_preassoc_scan_mac_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - gs_unref_variant GVariant *variant = NULL; - gs_free_error GError *error = NULL; - - variant = _nm_dbus_proxy_call_finish (proxy, result, - G_VARIANT_TYPE ("()"), - &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - if (error) - _LOGW ("failed to enable scan MAC address randomization (%s)", error->message); - iface_check_ready (self); -} - -static void -iface_introspect_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *variant = NULL; - gs_free_error GError *error = NULL; - const char *data; - - variant = _nm_dbus_proxy_call_finish (proxy, result, - G_VARIANT_TYPE ("(s)"), - &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (variant) { - g_variant_get (variant, "(&s)", &data); - - /* The ProbeRequest method only exists if AP mode has been enabled */ - if (strstr (data, "ProbeRequest")) - priv->ap_support = NM_SUPPLICANT_FEATURE_YES; - - if (strstr (data, "PreassocMacAddr")) { - priv->mac_randomization_support = NM_SUPPLICANT_FEATURE_YES; - - /* Turn on MAC randomization during scans by default */ - priv->ready_count++; - g_dbus_proxy_call (priv->iface_proxy, - DBUS_INTERFACE_PROPERTIES ".Set", - g_variant_new ("(ssv)", - WPAS_DBUS_IFACE_INTERFACE, - "PreassocMacAddr", - g_variant_new_string ("0")), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - (GAsyncReadyCallback) set_preassoc_scan_mac_cb, - self); - } - } - - iface_check_ready (self); -} - -static void -wpas_iface_scan_done (GDBusProxy *proxy, - gboolean success, - gpointer user_data) -{ - NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - GVariant *props; - GHashTableIter iter; - char *bss_path; - GDBusProxy *bss_proxy; - - /* Cache last scan completed time */ - priv->last_scan = nm_utils_get_monotonic_timestamp_s (); - - g_signal_emit (self, signals[SCAN_DONE], 0, success); - - /* Emit NEW_BSS so that wifi device has the APs (in case it removed them) */ - g_hash_table_iter_init (&iter, priv->bss_proxies); - while (g_hash_table_iter_next (&iter, (gpointer) &bss_path, (gpointer) &bss_proxy)) { - if (g_object_get_data (G_OBJECT (bss_proxy), BSS_PROXY_INITED)) { - props = _get_bss_proxy_properties (self, bss_proxy); - if (props) { - g_signal_emit (self, signals[NEW_BSS], 0, - bss_path, - g_variant_ref_sink (props)); - g_variant_unref (props); - } - } - } -} - -static void -wpas_iface_bss_added (GDBusProxy *proxy, - const char *path, - GVariant *props, - gpointer user_data) -{ - NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (priv->scanning) - priv->last_scan = nm_utils_get_monotonic_timestamp_s (); - - handle_new_bss (self, path); -} - -static void -wpas_iface_bss_removed (GDBusProxy *proxy, - const char *path, - gpointer user_data) -{ - NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - g_signal_emit (self, signals[BSS_REMOVED], 0, path); - g_hash_table_remove (priv->bss_proxies, path); -} - -static void -wpas_iface_network_request (GDBusProxy *proxy, - const char *path, - const char *field, - const char *message, - gpointer user_data) -{ - NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (priv->has_credreq && priv->net_path && !g_strcmp0 (path, priv->net_path)) - g_signal_emit (self, signals[CREDENTIALS_REQUEST], 0, field, message); -} - -static void -props_changed_cb (GDBusProxy *proxy, - GVariant *changed_properties, - GStrv invalidated_properties, - gpointer user_data) -{ - NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - const char *s, **array, **iter; - gboolean b = FALSE; - gint32 i32; - GVariant *v; - - g_object_freeze_notify (G_OBJECT (self)); - - if (g_variant_lookup (changed_properties, "Scanning", "b", &b)) - set_scanning (self, b); - - if ( g_variant_lookup (changed_properties, "State", "&s", &s) - && priv->state >= NM_SUPPLICANT_INTERFACE_STATE_READY) { - /* Only transition to actual wpa_supplicant interface states (ie, - * anything > READY) after the NMSupplicantInterface has had a - * chance to initialize, which is signalled by entering the READY - * state. - */ - set_state_from_string (self, s); - } - - if (g_variant_lookup (changed_properties, "BSSs", "^a&o", &array)) { - iter = array; - while (*iter) - handle_new_bss (self, *iter++); - g_free (array); - } - - if (g_variant_lookup (changed_properties, "CurrentBSS", "&o", &s)) { - if (strcmp (s, "/") == 0) - s = NULL; - if (g_strcmp0 (s, priv->current_bss) != 0) { - g_free (priv->current_bss); - priv->current_bss = g_strdup (s); - _notify (self, PROP_CURRENT_BSS); - } - } - - v = g_variant_lookup_value (changed_properties, "Capabilities", G_VARIANT_TYPE_VARDICT); - if (v) { - parse_capabilities (self, v); - g_variant_unref (v); - } - - if (g_variant_lookup (changed_properties, "DisconnectReason", "i", &i32)) { - /* Disconnect reason is currently only given for deauthentication events, - * not disassociation; currently they are IEEE 802.11 "reason codes", - * defined by (IEEE 802.11-2007, 7.3.1.7, Table 7-22). Any locally caused - * deauthentication will be negative, while authentications caused by the - * AP will be positive. - */ - priv->disconnect_reason = i32; - if (priv->disconnect_reason != 0) - _LOGW ("connection disconnected (reason %d)", priv->disconnect_reason); - } - - g_object_thaw_notify (G_OBJECT (self)); -} - -static void -on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_free_error GError *error = NULL; - - if (!g_async_initable_init_finish (G_ASYNC_INITABLE (proxy), result, &error)) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - self = NM_SUPPLICANT_INTERFACE (user_data); - _LOGW ("failed to acquire wpa_supplicant interface proxy: (%s)", error->message); - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); - } - return; - } - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - _nm_dbus_signal_connect (priv->iface_proxy, "ScanDone", G_VARIANT_TYPE ("(b)"), - G_CALLBACK (wpas_iface_scan_done), self); - _nm_dbus_signal_connect (priv->iface_proxy, "BSSAdded", G_VARIANT_TYPE ("(oa{sv})"), - G_CALLBACK (wpas_iface_bss_added), self); - _nm_dbus_signal_connect (priv->iface_proxy, "BSSRemoved", G_VARIANT_TYPE ("(o)"), - G_CALLBACK (wpas_iface_bss_removed), self); - _nm_dbus_signal_connect (priv->iface_proxy, "NetworkRequest", G_VARIANT_TYPE ("(oss)"), - G_CALLBACK (wpas_iface_network_request), self); - - /* Scan result aging parameters */ - g_dbus_proxy_call (priv->iface_proxy, - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", - WPAS_DBUS_IFACE_INTERFACE, - "BSSExpireAge", - g_variant_new_uint32 (250)), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - NULL, - NULL); - g_dbus_proxy_call (priv->iface_proxy, - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", - WPAS_DBUS_IFACE_INTERFACE, - "BSSExpireCount", - g_variant_new_uint32 (2)), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - NULL, - NULL); - - /* Check whether NetworkReply and AP mode are supported */ - priv->ready_count = 1; - g_dbus_proxy_call (priv->iface_proxy, - "NetworkReply", - g_variant_new ("(oss)", - "/fff", - "foobar", - "foobar"), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - (GAsyncReadyCallback) iface_check_netreply_cb, - self); - - if (priv->ap_support == NM_SUPPLICANT_FEATURE_UNKNOWN || - priv->mac_randomization_support == NM_SUPPLICANT_FEATURE_UNKNOWN) { - /* If the global supplicant capabilities property is not present, we can - * fall back to checking whether the ProbeRequest method is supported. If - * neither of these works we have no way of determining if AP mode is - * supported or not. hostap 1.0 and earlier don't support either of these. - */ - priv->ready_count++; - g_dbus_proxy_call (priv->iface_proxy, - DBUS_INTERFACE_INTROSPECTABLE ".Introspect", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - (GAsyncReadyCallback) iface_introspect_cb, - self); - } -} - -static void -interface_add_done (NMSupplicantInterface *self, const char *path) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - _LOGD ("interface added to supplicant"); - - priv->object_path = g_strdup (path); - priv->iface_proxy = g_object_new (G_TYPE_DBUS_PROXY, - "g-bus-type", G_BUS_TYPE_SYSTEM, - "g-flags", G_DBUS_PROXY_FLAGS_NONE, - "g-name", WPAS_DBUS_SERVICE, - "g-object-path", priv->object_path, - "g-interface-name", WPAS_DBUS_IFACE_INTERFACE, - NULL); - g_signal_connect (priv->iface_proxy, "g-properties-changed", G_CALLBACK (props_changed_cb), self); - g_async_initable_init_async (G_ASYNC_INITABLE (priv->iface_proxy), - G_PRIORITY_DEFAULT, - priv->init_cancellable, - (GAsyncReadyCallback) on_iface_proxy_acquired, - self); -} - -static void -interface_get_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *variant = NULL; - gs_free_error GError *error = NULL; - const char *path; - - variant = _nm_dbus_proxy_call_finish (proxy, result, - G_VARIANT_TYPE ("(o)"), - &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (variant) { - g_variant_get (variant, "(&o)", &path); - interface_add_done (self, path); - } else { - g_dbus_error_strip_remote_error (error); - _LOGE ("error getting interface: %s", error->message); - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); - } -} - -static void -interface_add_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_free_error GError *error = NULL; - gs_unref_variant GVariant *variant = NULL; - const char *path; - - variant = _nm_dbus_proxy_call_finish (proxy, result, - G_VARIANT_TYPE ("(o)"), - &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (variant) { - g_variant_get (variant, "(&o)", &path); - interface_add_done (self, path); - } else if (_nm_dbus_error_has_name (error, WPAS_ERROR_EXISTS_ERROR)) { - /* Interface already added, just get its object path */ - g_dbus_proxy_call (priv->wpas_proxy, - "GetInterface", - g_variant_new ("(s)", priv->dev), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - (GAsyncReadyCallback) interface_get_cb, - self); - } else if ( g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_EXEC_FAILED) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FORK_FAILED) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FAILED) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_TIMEOUT) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_NO_REPLY) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_TIMED_OUT) - || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND)) { - /* Supplicant wasn't running and could not be launched via service - * activation. Wait for it to start by moving back to the INIT - * state. - */ - g_dbus_error_strip_remote_error (error); - _LOGD ("failed to activate supplicant: %s", error->message); - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_INIT); - } else { - g_dbus_error_strip_remote_error (error); - _LOGE ("error adding interface: %s", error->message); - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); - } -} - -#if HAVE_WEXT -#define DEFAULT_WIFI_DRIVER "nl80211,wext" -#else -#define DEFAULT_WIFI_DRIVER "nl80211" -#endif - -static void -on_wpas_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_free_error GError *error = NULL; - GDBusProxy *wpas_proxy; - GVariantBuilder props; - - wpas_proxy = g_dbus_proxy_new_for_bus_finish (result, &error); - if (!wpas_proxy) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - self = NM_SUPPLICANT_INTERFACE (user_data); - _LOGW ("failed to acquire wpa_supplicant proxy: (%s)", error->message); - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); - } - return; - } - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - priv->wpas_proxy = wpas_proxy; - - /* Try to add the interface to the supplicant. If the supplicant isn't - * running, this will start it via D-Bus activation and return the response - * when the supplicant has started. - */ - - g_variant_builder_init (&props, G_VARIANT_TYPE_VARDICT); - g_variant_builder_add (&props, "{sv}", - "Driver", - g_variant_new_string (priv->is_wireless ? DEFAULT_WIFI_DRIVER : "wired")); - g_variant_builder_add (&props, "{sv}", - "Ifname", - g_variant_new_string (priv->dev)); - - g_dbus_proxy_call (priv->wpas_proxy, - "CreateInterface", - g_variant_new ("(a{sv})", &props), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->init_cancellable, - (GAsyncReadyCallback) interface_add_cb, - self); -} - -static void -interface_add (NMSupplicantInterface *self) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - /* Can only start the interface from INIT state */ - g_return_if_fail (priv->state == NM_SUPPLICANT_INTERFACE_STATE_INIT); - - _LOGD ("adding interface to supplicant"); - - /* Move to starting to prevent double-calls of interface_add() */ - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_STARTING); - - g_warn_if_fail (priv->init_cancellable == NULL); - g_clear_object (&priv->init_cancellable); - priv->init_cancellable = g_cancellable_new (); - - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | - G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, - NULL, - WPAS_DBUS_SERVICE, - WPAS_DBUS_PATH, - WPAS_DBUS_INTERFACE, - priv->init_cancellable, - (GAsyncReadyCallback) on_wpas_proxy_acquired, - self); -} - -void -nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self, - gboolean available) -{ - NMSupplicantInterfacePrivate *priv; - - g_return_if_fail (NM_IS_SUPPLICANT_INTERFACE (self)); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (available) { - /* This can happen if the supplicant couldn't be activated but - * for some reason was started after the activation failure. - */ - if (priv->state == NM_SUPPLICANT_INTERFACE_STATE_INIT) - interface_add (self); - } else { - /* The supplicant stopped; so we must tear down the interface */ - set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); - } -} - -static void -log_result_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - - reply = g_dbus_proxy_call_finish (proxy, result, &error); - if ( !reply - && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) - && !strstr (error->message, "fi.w1.wpa_supplicant1.NotConnected")) { - g_dbus_error_strip_remote_error (error); - nm_log_warn (_NMLOG_DOMAIN, "%s: failed to %s: %s", - _NMLOG_PREFIX_NAME, (const char *) user_data, error->message); - } -} - -void -nm_supplicant_interface_disconnect (NMSupplicantInterface * self) -{ - NMSupplicantInterfacePrivate *priv; - - g_return_if_fail (NM_IS_SUPPLICANT_INTERFACE (self)); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - /* Cancel all pending calls related to a prior connection attempt */ - if (priv->assoc_cancellable) { - g_cancellable_cancel (priv->assoc_cancellable); - g_clear_object (&priv->assoc_cancellable); - } - - /* Don't do anything if there is no connection to the supplicant yet. */ - if (!priv->iface_proxy) - return; - - /* Disconnect from the current AP */ - if ( (priv->state >= NM_SUPPLICANT_INTERFACE_STATE_SCANNING) - && (priv->state <= NM_SUPPLICANT_INTERFACE_STATE_COMPLETED)) { - g_dbus_proxy_call (priv->iface_proxy, - "Disconnect", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) log_result_cb, - "disconnect"); - } - - /* Remove any network that was added by NetworkManager */ - if (priv->net_path) { - g_dbus_proxy_call (priv->iface_proxy, - "RemoveNetwork", - g_variant_new ("(o)", priv->net_path), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->other_cancellable, - (GAsyncReadyCallback) log_result_cb, - "remove network"); - g_free (priv->net_path); - priv->net_path = NULL; - } -} - -static void -select_network_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - - reply = g_dbus_proxy_call_finish (proxy, result, &error); - if ( !reply - && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - self = NM_SUPPLICANT_INTERFACE (user_data); - g_dbus_error_strip_remote_error (error); - _LOGW ("couldn't select network config: %s", error->message); - emit_error_helper (self, error); - } -} - -static void -call_select_network (NMSupplicantInterface *self) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - /* We only select the network after all blobs (if any) have been set */ - if (priv->blobs_left == 0) { - g_dbus_proxy_call (priv->iface_proxy, - "SelectNetwork", - g_variant_new ("(o)", priv->net_path), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->assoc_cancellable, - (GAsyncReadyCallback) select_network_cb, - self); - } -} - -static void -add_blob_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - - reply = g_dbus_proxy_call_finish (proxy, result, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - priv->blobs_left--; - if (reply) - call_select_network (self); - else { - g_dbus_error_strip_remote_error (error); - _LOGW ("couldn't set network certificates: %s", error->message); - emit_error_helper (self, error); - } -} - -static void -add_network_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - GHashTable *blobs; - GHashTableIter iter; - const char *blob_name; - GByteArray *blob_data; - - reply = _nm_dbus_proxy_call_finish (proxy, result, - G_VARIANT_TYPE ("(o)"), - &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - g_free (priv->net_path); - priv->net_path = NULL; - - if (error) { - g_dbus_error_strip_remote_error (error); - _LOGW ("adding network to supplicant failed: %s", error->message); - emit_error_helper (self, error); - return; - } - - g_variant_get (reply, "(o)", &priv->net_path); - - /* Send blobs first; otherwise jump to selecting the network */ - blobs = nm_supplicant_config_get_blobs (priv->cfg); - priv->blobs_left = g_hash_table_size (blobs); - - g_hash_table_iter_init (&iter, blobs); - while (g_hash_table_iter_next (&iter, (gpointer) &blob_name, (gpointer) &blob_data)) { - g_dbus_proxy_call (priv->iface_proxy, - "AddBlob", - g_variant_new ("(s@ay)", - blob_name, - g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, - blob_data->data, blob_data->len, 1)), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->assoc_cancellable, - (GAsyncReadyCallback) add_blob_cb, - self); - } - - call_select_network (self); -} - -static void -add_network (NMSupplicantInterface *self) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - g_dbus_proxy_call (priv->iface_proxy, - "AddNetwork", - g_variant_new ("(@a{sv})", nm_supplicant_config_to_variant (priv->cfg)), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->assoc_cancellable, - (GAsyncReadyCallback) add_network_cb, - self); -} - -static void -set_mac_randomization_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - - reply = g_dbus_proxy_call_finish (proxy, result, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (!reply) { - g_dbus_error_strip_remote_error (error); - _LOGW ("couldn't send MAC randomization mode to the supplicant interface: %s", - error->message); - emit_error_helper (self, error); - return; - } - - _LOGT ("config: set MAC randomization to 0"); - add_network (self); -} - -static void -set_ap_scan_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - NMSupplicantInterfacePrivate *priv; - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - - reply = g_dbus_proxy_call_finish (proxy, result, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - if (!reply) { - g_dbus_error_strip_remote_error (error); - _LOGW ("couldn't send AP scan mode to the supplicant interface: %s", - error->message); - emit_error_helper (self, error); - return; - } - - _LOGI ("config: set interface ap_scan to %d", - nm_supplicant_config_get_ap_scan (priv->cfg)); - - if (priv->mac_randomization_support == NM_SUPPLICANT_FEATURE_YES) { - /* Enable/disable association MAC address randomization */ - g_dbus_proxy_call (priv->iface_proxy, - DBUS_INTERFACE_PROPERTIES ".Set", - g_variant_new ("(ssv)", - WPAS_DBUS_IFACE_INTERFACE, - "MacAddr", - g_variant_new_string ("0")), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->assoc_cancellable, - (GAsyncReadyCallback) set_mac_randomization_cb, - self); - } else - add_network (self); -} - -gboolean -nm_supplicant_interface_set_config (NMSupplicantInterface *self, - NMSupplicantConfig *cfg, - GError **error) -{ - NMSupplicantInterfacePrivate *priv; - - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - nm_supplicant_interface_disconnect (self); - - /* Make sure the supplicant supports EAP-FAST before trying to send - * it an EAP-FAST configuration. - */ - if (nm_supplicant_config_fast_required (cfg) && !priv->fast_supported) { - g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, - "EAP-FAST is not supported by the supplicant"); - return FALSE; - } - - g_clear_object (&priv->cfg); - if (cfg) { - priv->assoc_cancellable = g_cancellable_new (); - priv->cfg = g_object_ref (cfg); - g_dbus_proxy_call (priv->iface_proxy, - DBUS_INTERFACE_PROPERTIES ".Set", - g_variant_new ("(ssv)", - WPAS_DBUS_IFACE_INTERFACE, - "ApScan", - g_variant_new_uint32 (nm_supplicant_config_get_ap_scan (priv->cfg))), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->assoc_cancellable, - (GAsyncReadyCallback) set_ap_scan_cb, - self); - } - return TRUE; -} - -static void -scan_request_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantInterface *self; - gs_unref_variant GVariant *reply = NULL; - gs_free_error GError *error = NULL; - - reply = g_dbus_proxy_call_finish (proxy, result, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_SUPPLICANT_INTERFACE (user_data); - - if (error) { - if (_nm_dbus_error_has_name (error, "fi.w1.wpa_supplicant1.Interface.ScanError")) - _LOGD ("could not get scan request result: %s", error->message); - else { - g_dbus_error_strip_remote_error (error); - _LOGW ("could not get scan request result: %s", error->message); - } - } - g_signal_emit (self, signals[SCAN_DONE], 0, error ? FALSE : TRUE); -} - -gboolean -nm_supplicant_interface_request_scan (NMSupplicantInterface *self, const GPtrArray *ssids) -{ - NMSupplicantInterfacePrivate *priv; - GVariantBuilder builder; - guint i; - - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE); - - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - /* Scan parameters */ - g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); - g_variant_builder_add (&builder, "{sv}", "Type", g_variant_new_string ("active")); - if (ssids) { - GVariantBuilder ssids_builder; - - g_variant_builder_init (&ssids_builder, G_VARIANT_TYPE_BYTESTRING_ARRAY); - for (i = 0; i < ssids->len; i++) { - GByteArray *ssid = g_ptr_array_index (ssids, i); - g_variant_builder_add (&ssids_builder, "@ay", - g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, - ssid->data, ssid->len, 1)); - } - g_variant_builder_add (&builder, "{sv}", "SSIDs", g_variant_builder_end (&ssids_builder)); - } - - g_dbus_proxy_call (priv->iface_proxy, - "Scan", - g_variant_new ("(a{sv})", &builder), - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->other_cancellable, - (GAsyncReadyCallback) scan_request_cb, - self); - return TRUE; -} - -guint32 -nm_supplicant_interface_get_state (NMSupplicantInterface * self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), NM_SUPPLICANT_INTERFACE_STATE_DOWN); - - return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->state; -} - -const char * -nm_supplicant_interface_state_to_string (guint32 state) -{ - switch (state) { - case NM_SUPPLICANT_INTERFACE_STATE_INIT: - return "init"; - case NM_SUPPLICANT_INTERFACE_STATE_STARTING: - return "starting"; - case NM_SUPPLICANT_INTERFACE_STATE_READY: - return "ready"; - case NM_SUPPLICANT_INTERFACE_STATE_DISABLED: - return "disabled"; - case NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED: - return "disconnected"; - case NM_SUPPLICANT_INTERFACE_STATE_INACTIVE: - return "inactive"; - case NM_SUPPLICANT_INTERFACE_STATE_SCANNING: - return "scanning"; - case NM_SUPPLICANT_INTERFACE_STATE_AUTHENTICATING: - return "authenticating"; - case NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING: - return "associating"; - case NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED: - return "associated"; - case NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE: - return "4-way handshake"; - case NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE: - return "group handshake"; - case NM_SUPPLICANT_INTERFACE_STATE_COMPLETED: - return "completed"; - case NM_SUPPLICANT_INTERFACE_STATE_DOWN: - return "down"; - default: - break; - } - return "unknown"; -} - -const char * -nm_supplicant_interface_get_object_path (NMSupplicantInterface *self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), NULL); - - return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->object_path; -} - -const char * -nm_supplicant_interface_get_ifname (NMSupplicantInterface *self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), NULL); - - return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->dev; -} - -guint -nm_supplicant_interface_get_max_scan_ssids (NMSupplicantInterface *self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), 0); - - return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->max_scan_ssids; -} - -/*******************************************************************/ - -NMSupplicantInterface * -nm_supplicant_interface_new (const char *ifname, - gboolean is_wireless, - gboolean fast_supported, - NMSupplicantFeature ap_support) -{ - g_return_val_if_fail (ifname != NULL, NULL); - - return g_object_new (NM_TYPE_SUPPLICANT_INTERFACE, - NM_SUPPLICANT_INTERFACE_IFACE, ifname, - NM_SUPPLICANT_INTERFACE_IS_WIRELESS, is_wireless, - NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, fast_supported, - NM_SUPPLICANT_INTERFACE_AP_SUPPORT, (int) ap_support, - NULL); -} - -static void -nm_supplicant_interface_init (NMSupplicantInterface * self) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - - priv->state = NM_SUPPLICANT_INTERFACE_STATE_INIT; - priv->bss_proxies = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); -} - -static void -set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object); - - switch (prop_id) { - case PROP_IFACE: - /* construct-only */ - priv->dev = g_value_dup_string (value); - g_return_if_fail (priv->dev); - break; - case PROP_IS_WIRELESS: - /* construct-only */ - priv->is_wireless = g_value_get_boolean (value); - break; - case PROP_FAST_SUPPORTED: - /* construct-only */ - priv->fast_supported = g_value_get_boolean (value); - break; - case PROP_AP_SUPPORT: - /* construct-only */ - priv->ap_support = g_value_get_int (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object); - - switch (prop_id) { - case PROP_SCANNING: - g_value_set_boolean (value, priv->scanning); - break; - case PROP_CURRENT_BSS: - g_value_set_string (value, priv->current_bss); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -dispose (GObject *object) -{ - NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object); - - if (priv->iface_proxy) - g_signal_handlers_disconnect_by_data (priv->iface_proxy, NM_SUPPLICANT_INTERFACE (object)); - g_clear_object (&priv->iface_proxy); - - nm_clear_g_cancellable (&priv->init_cancellable); - nm_clear_g_cancellable (&priv->other_cancellable); - nm_clear_g_cancellable (&priv->assoc_cancellable); - - g_clear_object (&priv->wpas_proxy); - g_clear_pointer (&priv->bss_proxies, (GDestroyNotify) g_hash_table_destroy); - - g_clear_pointer (&priv->net_path, g_free); - g_clear_pointer (&priv->dev, g_free); - g_clear_pointer (&priv->object_path, g_free); - g_clear_pointer (&priv->current_bss, g_free); - - g_clear_object (&priv->cfg); - - /* Chain up to the parent class */ - G_OBJECT_CLASS (nm_supplicant_interface_parent_class)->dispose (object); -} - -static void -nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (object_class, sizeof (NMSupplicantInterfacePrivate)); - - object_class->dispose = dispose; - object_class->set_property = set_property; - object_class->get_property = get_property; - - /* Properties */ - obj_properties[PROP_SCANNING] = - g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_SCANNING, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); - obj_properties[PROP_CURRENT_BSS] = - g_param_spec_string (NM_SUPPLICANT_INTERFACE_CURRENT_BSS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); - obj_properties[PROP_IFACE] = - g_param_spec_string (NM_SUPPLICANT_INTERFACE_IFACE, "", "", - NULL, - G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS); - obj_properties[PROP_IS_WIRELESS] = - g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_IS_WIRELESS, "", "", - TRUE, - G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS); - obj_properties[PROP_FAST_SUPPORTED] = - g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, "", "", - TRUE, - G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS); - obj_properties[PROP_AP_SUPPORT] = - g_param_spec_int (NM_SUPPLICANT_INTERFACE_AP_SUPPORT, "", "", - NM_SUPPLICANT_FEATURE_UNKNOWN, - NM_SUPPLICANT_FEATURE_YES, - NM_SUPPLICANT_FEATURE_UNKNOWN, - G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS); - - g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); - - /* Signals */ - signals[STATE] = - g_signal_new (NM_SUPPLICANT_INTERFACE_STATE, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, state), - NULL, NULL, NULL, - G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INT); - - signals[REMOVED] = - g_signal_new (NM_SUPPLICANT_INTERFACE_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, removed), - NULL, NULL, NULL, - G_TYPE_NONE, 0); - - signals[NEW_BSS] = - g_signal_new (NM_SUPPLICANT_INTERFACE_NEW_BSS, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, new_bss), - NULL, NULL, NULL, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); - - signals[BSS_UPDATED] = - g_signal_new (NM_SUPPLICANT_INTERFACE_BSS_UPDATED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, bss_updated), - NULL, NULL, NULL, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); - - signals[BSS_REMOVED] = - g_signal_new (NM_SUPPLICANT_INTERFACE_BSS_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, bss_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, G_TYPE_STRING); - - signals[SCAN_DONE] = - g_signal_new (NM_SUPPLICANT_INTERFACE_SCAN_DONE, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, scan_done), - NULL, NULL, NULL, - G_TYPE_NONE, 1, G_TYPE_BOOLEAN); - - signals[CONNECTION_ERROR] = - g_signal_new (NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, connection_error), - NULL, NULL, NULL, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - - signals[CREDENTIALS_REQUEST] = - g_signal_new (NM_SUPPLICANT_INTERFACE_CREDENTIALS_REQUEST, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSupplicantInterfaceClass, credentials_request), - NULL, NULL, NULL, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); -} - diff --git a/src/supplicant-manager/nm-supplicant-interface.h b/src/supplicant-manager/nm-supplicant-interface.h deleted file mode 100644 index a586e7ea..00000000 --- a/src/supplicant-manager/nm-supplicant-interface.h +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2010 Red Hat, Inc. - * Copyright (C) 2007 - 2008 Novell, Inc. - */ - -#ifndef __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ -#define __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ - -#include "nm-supplicant-types.h" - -/* - * Supplicant interface states - * A mix of wpa_supplicant interface states and internal states. - */ -enum { - NM_SUPPLICANT_INTERFACE_STATE_INIT = 0, - NM_SUPPLICANT_INTERFACE_STATE_STARTING, - NM_SUPPLICANT_INTERFACE_STATE_READY, - NM_SUPPLICANT_INTERFACE_STATE_DISABLED, - NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED, - NM_SUPPLICANT_INTERFACE_STATE_INACTIVE, - NM_SUPPLICANT_INTERFACE_STATE_SCANNING, - NM_SUPPLICANT_INTERFACE_STATE_AUTHENTICATING, - NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING, - NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED, - NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE, - NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE, - NM_SUPPLICANT_INTERFACE_STATE_COMPLETED, - NM_SUPPLICANT_INTERFACE_STATE_DOWN, - NM_SUPPLICANT_INTERFACE_STATE_LAST -}; - -#define NM_TYPE_SUPPLICANT_INTERFACE (nm_supplicant_interface_get_type ()) -#define NM_SUPPLICANT_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SUPPLICANT_INTERFACE, NMSupplicantInterface)) -#define NM_SUPPLICANT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SUPPLICANT_INTERFACE, NMSupplicantInterfaceClass)) -#define NM_IS_SUPPLICANT_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SUPPLICANT_INTERFACE)) -#define NM_IS_SUPPLICANT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_INTERFACE)) -#define NM_SUPPLICANT_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_INTERFACE, NMSupplicantInterfaceClass)) - -/* Properties */ -#define NM_SUPPLICANT_INTERFACE_IFACE "iface" -#define NM_SUPPLICANT_INTERFACE_SCANNING "scanning" -#define NM_SUPPLICANT_INTERFACE_CURRENT_BSS "current-bss" -#define NM_SUPPLICANT_INTERFACE_IS_WIRELESS "is-wireless" -#define NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED "fast-supported" -#define NM_SUPPLICANT_INTERFACE_AP_SUPPORT "ap-support" - -/* Signals */ -#define NM_SUPPLICANT_INTERFACE_STATE "state" -#define NM_SUPPLICANT_INTERFACE_REMOVED "removed" -#define NM_SUPPLICANT_INTERFACE_NEW_BSS "new-bss" -#define NM_SUPPLICANT_INTERFACE_BSS_UPDATED "bss-updated" -#define NM_SUPPLICANT_INTERFACE_BSS_REMOVED "bss-removed" -#define NM_SUPPLICANT_INTERFACE_SCAN_DONE "scan-done" -#define NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR "connection-error" -#define NM_SUPPLICANT_INTERFACE_CREDENTIALS_REQUEST "credentials-request" - -struct _NMSupplicantInterface { - GObject parent; -}; - -typedef struct { - GObjectClass parent; - - /* Signals */ - - /* change in the interface's state */ - void (*state) (NMSupplicantInterface * iface, - guint32 new_state, - guint32 old_state, - int disconnect_reason); - - /* interface was removed by the supplicant */ - void (*removed) (NMSupplicantInterface * iface); - - /* interface saw a new BSS */ - void (*new_bss) (NMSupplicantInterface *iface, - const char *object_path, - GVariant *props); - - /* a BSS property changed */ - void (*bss_updated) (NMSupplicantInterface *iface, - const char *object_path, - GVariant *props); - - /* supplicant removed a BSS from its scan list */ - void (*bss_removed) (NMSupplicantInterface *iface, - const char *object_path); - - /* wireless scan is done */ - void (*scan_done) (NMSupplicantInterface *iface, - gboolean success); - - /* an error occurred during a connection request */ - void (*connection_error) (NMSupplicantInterface * iface, - const char * name, - const char * message); - - /* 802.1x credentials requested */ - void (*credentials_request) (NMSupplicantInterface *iface, - const char *field, - const char *message); -} NMSupplicantInterfaceClass; - -GType nm_supplicant_interface_get_type (void); - -NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname, - gboolean is_wireless, - gboolean fast_supported, - NMSupplicantFeature ap_support); - -void nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self, - gboolean available); - -gboolean nm_supplicant_interface_set_config (NMSupplicantInterface * iface, - NMSupplicantConfig * cfg, - GError **error); - -void nm_supplicant_interface_disconnect (NMSupplicantInterface * iface); - -const char *nm_supplicant_interface_get_object_path (NMSupplicantInterface * iface); - -gboolean nm_supplicant_interface_request_scan (NMSupplicantInterface * self, const GPtrArray *ssids); - -guint32 nm_supplicant_interface_get_state (NMSupplicantInterface * self); - -const char *nm_supplicant_interface_state_to_string (guint32 state); - -gboolean nm_supplicant_interface_get_scanning (NMSupplicantInterface *self); - -const char *nm_supplicant_interface_get_current_bss (NMSupplicantInterface *self); - -gint32 nm_supplicant_interface_get_last_scan_time (NMSupplicantInterface *self); - -const char *nm_supplicant_interface_get_ifname (NMSupplicantInterface *self); - -guint nm_supplicant_interface_get_max_scan_ssids (NMSupplicantInterface *self); - -gboolean nm_supplicant_interface_get_has_credentials_request (NMSupplicantInterface *self); - -gboolean nm_supplicant_interface_credentials_reply (NMSupplicantInterface *self, - const char *field, - const char *value, - GError **error); - -NMSupplicantFeature nm_supplicant_interface_get_ap_support (NMSupplicantInterface *self); - -void nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self, - NMSupplicantFeature apmode); - -#endif /* NM_SUPPLICANT_INTERFACE_H */ diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c deleted file mode 100644 index 57cd5713..00000000 --- a/src/supplicant-manager/nm-supplicant-manager.c +++ /dev/null @@ -1,410 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2010 Red Hat, Inc. - * Copyright (C) 2007 - 2008 Novell, Inc. - */ - -#include "nm-default.h" - -#include <string.h> - -#include "nm-supplicant-manager.h" -#include "nm-supplicant-interface.h" -#include "nm-supplicant-types.h" -#include "nm-core-internal.h" - -#define NM_SUPPLICANT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - NM_TYPE_SUPPLICANT_MANAGER, \ - NMSupplicantManagerPrivate)) - -G_DEFINE_TYPE (NMSupplicantManager, nm_supplicant_manager, G_TYPE_OBJECT) - -#define _NMLOG_DOMAIN LOGD_SUPPLICANT -#define _NMLOG_PREFIX_NAME "supplicant" -#define _NMLOG(level, ...) \ - G_STMT_START { \ - nm_log ((level), _NMLOG_DOMAIN, \ - "%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \ - _NMLOG_PREFIX_NAME": " \ - _NM_UTILS_MACRO_REST(__VA_ARGS__)); \ - } G_STMT_END - -typedef struct { - GDBusProxy * proxy; - GCancellable * cancellable; - gboolean running; - - GSList *ifaces; - gboolean fast_supported; - NMSupplicantFeature ap_support; - guint die_count_reset_id; - guint die_count; -} NMSupplicantManagerPrivate; - -/********************************************************************/ - -G_DEFINE_QUARK (nm-supplicant-error-quark, nm_supplicant_error); - -/********************************************************************/ - -static inline gboolean -die_count_exceeded (guint32 count) -{ - return count > 2; -} - -static gboolean -is_available (NMSupplicantManager *self) -{ - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - - return priv->running - && !die_count_exceeded (priv->die_count); -} - -/********************************************************************/ - -static void -_sup_iface_last_ref (gpointer data, - GObject *object, - gboolean is_last_ref) -{ - NMSupplicantManager *self = data; - NMSupplicantManagerPrivate *priv; - NMSupplicantInterface *sup_iface = (NMSupplicantInterface *) object; - const char *op; - - g_return_if_fail (NM_IS_SUPPLICANT_MANAGER (self)); - g_return_if_fail (NM_IS_SUPPLICANT_INTERFACE (sup_iface)); - g_return_if_fail (is_last_ref); - - priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - - if (!g_slist_find (priv->ifaces, sup_iface)) - g_return_if_reached (); - - /* Ask wpa_supplicant to remove this interface */ - if ( priv->running - && priv->proxy - && (op = nm_supplicant_interface_get_object_path (sup_iface))) { - g_dbus_proxy_call (priv->proxy, - "RemoveInterface", - g_variant_new ("(o)", op), - G_DBUS_CALL_FLAGS_NONE, - 3000, - NULL, - NULL, - NULL); - } - - priv->ifaces = g_slist_remove (priv->ifaces, sup_iface); - g_object_remove_toggle_ref ((GObject *) sup_iface, _sup_iface_last_ref, self); -} - -/** - * nm_supplicant_manager_create_interface: - * @self: the #NMSupplicantManager - * @ifname: the interface for which to obtain the supplicant interface - * @is_wireless: whether the interface is supposed to be wireless. - * - * Note: the manager owns a reference to the instance and the only way to - * get the manager to release it, is by dropping all other references - * to the supplicant-interface (or destroying the manager). - * - * Returns: (transfer full): returns a #NMSupplicantInterface or %NULL. - * Must be unrefed at the end. - * */ -NMSupplicantInterface * -nm_supplicant_manager_create_interface (NMSupplicantManager *self, - const char *ifname, - gboolean is_wireless) -{ - NMSupplicantManagerPrivate *priv; - NMSupplicantInterface *iface; - GSList *ifaces; - - g_return_val_if_fail (NM_IS_SUPPLICANT_MANAGER (self), NULL); - g_return_val_if_fail (ifname != NULL, NULL); - - priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - - _LOGD ("(%s): creating new supplicant interface", ifname); - - /* assert against not requesting duplicate interfaces. */ - for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next) { - if (g_strcmp0 (nm_supplicant_interface_get_ifname (ifaces->data), ifname) == 0) - g_return_val_if_reached (NULL); - } - - iface = nm_supplicant_interface_new (ifname, - is_wireless, - priv->fast_supported, - priv->ap_support); - - priv->ifaces = g_slist_prepend (priv->ifaces, iface); - g_object_add_toggle_ref ((GObject *) iface, _sup_iface_last_ref, self); - - /* If we're making the supplicant take a time out for a bit, don't - * let the supplicant interface start immediately, just let it hang - * around in INIT state until we're ready to talk to the supplicant - * again. - */ - if (is_available (self)) - nm_supplicant_interface_set_supplicant_available (iface, TRUE); - - return iface; -} - -static void -update_capabilities (NMSupplicantManager *self) -{ - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - GSList *ifaces; - const char **array; - GVariant *value; - - /* The supplicant only advertises global capabilities if the following - * commit has been applied: - * - * commit 1634ac0654eba8d458640a115efc0a6cde3bac4d - * Author: Dan Williams <dcbw@redhat.com> - * Date: Sat Sep 29 19:06:30 2012 +0300 - * - * dbus: Add global capabilities property - */ - priv->ap_support = NM_SUPPLICANT_FEATURE_UNKNOWN; - - value = g_dbus_proxy_get_cached_property (priv->proxy, "Capabilities"); - if (value) { - if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY)) { - array = g_variant_get_strv (value, NULL); - priv->ap_support = NM_SUPPLICANT_FEATURE_NO; - if (array) { - if (g_strv_contains (array, "ap")) - priv->ap_support = NM_SUPPLICANT_FEATURE_YES; - g_free (array); - } - } - g_variant_unref (value); - } - - /* Tell all interfaces about results of the AP check */ - for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next) - nm_supplicant_interface_set_ap_support (ifaces->data, priv->ap_support); - - _LOGD ("AP mode is %ssupported", - (priv->ap_support == NM_SUPPLICANT_FEATURE_YES) ? "" : - (priv->ap_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly "); - - /* EAP-FAST */ - priv->fast_supported = FALSE; - value = g_dbus_proxy_get_cached_property (priv->proxy, "EapMethods"); - if (value) { - if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY)) { - array = g_variant_get_strv (value, NULL); - if (array) { - if (g_strv_contains (array, "fast")) - priv->fast_supported = TRUE; - g_free (array); - } - } - g_variant_unref (value); - } - - _LOGD ("EAP-FAST is %ssupported", priv->fast_supported ? "" : "not "); -} - -static void -availability_changed (NMSupplicantManager *self, gboolean available) -{ - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - GSList *ifaces, *iter; - - if (!priv->ifaces) - return; - - /* setting the supplicant as unavailable might cause the caller to unref - * the supplicant (and thus remove the instance from the list of interfaces. - * Delay that by taking an additional reference first. */ - ifaces = g_slist_copy (priv->ifaces); - for (iter = ifaces; iter; iter = iter->next) - g_object_ref (iter->data); - for (iter = ifaces; iter; iter = iter->next) - nm_supplicant_interface_set_supplicant_available (iter->data, available); - g_slist_free_full (ifaces, g_object_unref); -} - -static void -set_running (NMSupplicantManager *self, gboolean now_running) -{ - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - gboolean old_available = is_available (self); - gboolean new_available; - - priv->running = now_running; - new_available = is_available (self); - if (old_available != new_available) - availability_changed (self, new_available); -} - -static void -set_die_count (NMSupplicantManager *self, guint new_die_count) -{ - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - gboolean old_available = is_available (self); - gboolean new_available; - - priv->die_count = new_die_count; - new_available = is_available (self); - if (old_available != new_available) - availability_changed (self, new_available); -} - -static gboolean -wpas_die_count_reset_cb (gpointer user_data) -{ - NMSupplicantManager *self = NM_SUPPLICANT_MANAGER (user_data); - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - - /* Reset the die count back to zero, which allows use of the supplicant again */ - priv->die_count_reset_id = 0; - set_die_count (self, 0); - _LOGI ("wpa_supplicant die count reset"); - return FALSE; -} - -static void -name_owner_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data) -{ - NMSupplicantManager *self = NM_SUPPLICANT_MANAGER (user_data); - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - char *owner; - - g_return_if_fail (proxy == priv->proxy); - - owner = g_dbus_proxy_get_name_owner (proxy); - _LOGI ("wpa_supplicant %s", owner ? "running" : "stopped"); - - if (owner) { - set_running (self, TRUE); - update_capabilities (self); - } else if (priv->running) { - /* Reschedule the die count reset timeout. Every time the supplicant - * dies we wait 10 seconds before resetting the counter. If the - * supplicant died more than twice before the timer is reset, then - * we don't try to talk to the supplicant for a while. - */ - if (priv->die_count_reset_id) - g_source_remove (priv->die_count_reset_id); - priv->die_count_reset_id = g_timeout_add_seconds (10, wpas_die_count_reset_cb, self); - set_die_count (self, priv->die_count + 1); - - if (die_count_exceeded (priv->die_count)) { - _LOGI ("wpa_supplicant die count %d; ignoring for 10 seconds", - priv->die_count); - } - - set_running (self, FALSE); - - priv->fast_supported = FALSE; - } - - g_free (owner); -} - -static void -on_proxy_acquired (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMSupplicantManager *self; - NMSupplicantManagerPrivate *priv; - GError *error = NULL; - GDBusProxy *proxy; - - proxy = g_dbus_proxy_new_for_bus_finish (result, &error); - if (!proxy) { - _LOGW ("failed to acquire wpa_supplicant proxy: Wi-Fi and 802.1x will not be available (%s)", - error->message); - g_clear_error (&error); - return; - } - - self = NM_SUPPLICANT_MANAGER (user_data); - priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - - priv->proxy = proxy; - g_signal_connect (priv->proxy, "notify::g-name-owner", G_CALLBACK (name_owner_cb), self); - name_owner_cb (priv->proxy, NULL, self); -} - -/*******************************************************************/ - -NM_DEFINE_SINGLETON_GETTER (NMSupplicantManager, nm_supplicant_manager_get, NM_TYPE_SUPPLICANT_MANAGER); - -static void -nm_supplicant_manager_init (NMSupplicantManager *self) -{ - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - - priv->cancellable = g_cancellable_new (); - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_NONE, - NULL, - WPAS_DBUS_SERVICE, - WPAS_DBUS_PATH, - WPAS_DBUS_INTERFACE, - priv->cancellable, - (GAsyncReadyCallback) on_proxy_acquired, - self); -} - -static void -dispose (GObject *object) -{ - NMSupplicantManager *self = (NMSupplicantManager *) object; - NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - GSList *ifaces; - - nm_clear_g_source (&priv->die_count_reset_id); - - if (priv->cancellable) { - g_cancellable_cancel (priv->cancellable); - g_clear_object (&priv->cancellable); - } - - if (priv->ifaces) { - for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next) - g_object_remove_toggle_ref (ifaces->data, _sup_iface_last_ref, self); - g_slist_free (priv->ifaces); - priv->ifaces = NULL; - } - - g_clear_object (&priv->proxy); - - G_OBJECT_CLASS (nm_supplicant_manager_parent_class)->dispose (object); -} - -static void -nm_supplicant_manager_class_init (NMSupplicantManagerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (object_class, sizeof (NMSupplicantManagerPrivate)); - - object_class->dispose = dispose; -} - diff --git a/src/supplicant-manager/nm-supplicant-manager.h b/src/supplicant-manager/nm-supplicant-manager.h deleted file mode 100644 index 4cd7a0bd..00000000 --- a/src/supplicant-manager/nm-supplicant-manager.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2008 Red Hat, Inc. - * Copyright (C) 2007 - 2008 Novell, Inc. - */ - -#ifndef __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ -#define __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ - -#include "nm-supplicant-types.h" -#include "nm-device.h" - -#define NM_TYPE_SUPPLICANT_MANAGER (nm_supplicant_manager_get_type ()) -#define NM_SUPPLICANT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SUPPLICANT_MANAGER, NMSupplicantManager)) -#define NM_SUPPLICANT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SUPPLICANT_MANAGER, NMSupplicantManagerClass)) -#define NM_IS_SUPPLICANT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SUPPLICANT_MANAGER)) -#define NM_IS_SUPPLICANT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_MANAGER)) -#define NM_SUPPLICANT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_MANAGER, NMSupplicantManagerClass)) - -struct _NMSupplicantManager -{ - GObject parent; -}; - -typedef struct -{ - GObjectClass parent; -} NMSupplicantManagerClass; - -GType nm_supplicant_manager_get_type (void); - -NMSupplicantManager *nm_supplicant_manager_get (void); - -NMSupplicantInterface *nm_supplicant_manager_create_interface (NMSupplicantManager *mgr, - const char *ifname, - gboolean is_wireless); - -#endif /* __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ */ diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.c b/src/supplicant-manager/nm-supplicant-settings-verify.c deleted file mode 100644 index bb046f93..00000000 --- a/src/supplicant-manager/nm-supplicant-settings-verify.c +++ /dev/null @@ -1,276 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2012 Red Hat, Inc. - */ - -#include "nm-default.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#include "nm-supplicant-settings-verify.h" - -struct Opt { - const char * key; - const OptType type; - const gint32 int_low; /* Inclusive */ - const gint32 int_high; /* Inclusive; max length for strings */ - const gboolean str_allowed_multiple; - const char ** str_allowed; -}; - - -static gboolean validate_type_int (const struct Opt * opt, - const char * value, - const guint32 len); - -static gboolean validate_type_bytes (const struct Opt * opt, - const char * value, - const guint32 len); - -static gboolean validate_type_utf8 (const struct Opt *opt, - const char * value, - const guint32 len); - -static gboolean validate_type_keyword (const struct Opt * opt, - const char * value, - const guint32 len); - -typedef gboolean (*validate_func)(const struct Opt *, const char *, const guint32); - -struct validate_entry { - const OptType type; - const validate_func func; -}; - -static const struct validate_entry validate_table[] = { - { TYPE_INT, validate_type_int }, - { TYPE_BYTES, validate_type_bytes }, - { TYPE_UTF8, validate_type_utf8 }, - { 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 }; -const char * key_mgmt_allowed[] = { "WPA-PSK", "WPA-EAP", "IEEE8021X", "WPA-NONE", - "NONE", NULL }; -const char * auth_alg_allowed[] = { "OPEN", "SHARED", "LEAP", NULL }; -const char * eap_allowed[] = { "LEAP", "MD5", "TLS", "PEAP", "TTLS", "SIM", - "PSK", "FAST", "PWD", NULL }; - -const char * phase1_allowed[] = {"peapver=0", "peapver=1", "peaplabel=1", - "peap_outer_success=0", "include_tls_length=1", - "sim_min_num_chal=3", "fast_provisioning=0", - "fast_provisioning=1", "fast_provisioning=2", - "fast_provisioning=3", NULL }; -const char * phase2_allowed[] = {"auth=PAP", "auth=CHAP", "auth=MSCHAP", - "auth=MSCHAPV2", "auth=GTC", "auth=OTP", - "auth=MD5", "auth=TLS", "autheap=MD5", - "autheap=MSCHAPV2", "autheap=OTP", - "autheap=GTC", "autheap=TLS", NULL }; - -static const struct Opt opt_table[] = { - { "ssid", TYPE_BYTES, 0, 32,FALSE, NULL }, - { "bssid", TYPE_KEYWORD, 0, 0, FALSE, NULL }, - { "scan_ssid", TYPE_INT, 0, 1, FALSE, NULL }, - { "mode", TYPE_INT, 0, 2, FALSE, NULL }, - { "frequency", TYPE_INT, 2412, 5825, FALSE, NULL }, - { "auth_alg", TYPE_KEYWORD, 0, 0, FALSE, auth_alg_allowed }, - { "psk", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "pairwise", TYPE_KEYWORD, 0, 0, FALSE, pairwise_allowed }, - { "group", TYPE_KEYWORD, 0, 0, FALSE, group_allowed }, - { "proto", TYPE_KEYWORD, 0, 0, FALSE, proto_allowed }, - { "key_mgmt", TYPE_KEYWORD, 0, 0, FALSE, key_mgmt_allowed }, - { "wep_key0", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "wep_key1", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "wep_key2", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "wep_key3", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "wep_tx_keyidx", TYPE_INT, 0, 3, FALSE, NULL }, - { "eapol_flags", TYPE_INT, 0, 3, FALSE, NULL }, - { "eap", TYPE_KEYWORD, 0, 0, FALSE, eap_allowed }, - { "identity", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "password", TYPE_UTF8, 0, 0, FALSE, NULL }, - { "ca_path", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "subject_match", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "altsubject_match", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "domain_suffix_match",TYPE_BYTES, 0, 0, FALSE, NULL }, - { "ca_cert", TYPE_BYTES, 0, 65536, FALSE, NULL }, - { "client_cert", TYPE_BYTES, 0, 65536, FALSE, NULL }, - { "private_key", TYPE_BYTES, 0, 65536, FALSE, NULL }, - { "private_key_passwd", TYPE_BYTES, 0, 1024, FALSE, NULL }, - { "phase1", TYPE_KEYWORD, 0, 0, TRUE, phase1_allowed }, - { "phase2", TYPE_KEYWORD, 0, 0, TRUE, phase2_allowed }, - { "anonymous_identity", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "ca_path2", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "subject_match2", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "altsubject_match2", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "domain_suffix_match2", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "ca_cert2", TYPE_BYTES, 0, 65536, FALSE, NULL }, - { "client_cert2", TYPE_BYTES, 0, 65536, FALSE, NULL }, - { "private_key2", TYPE_BYTES, 0, 65536, FALSE, NULL }, - { "private_key2_passwd",TYPE_BYTES, 0, 1024, FALSE, NULL }, - { "pin", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "pcsc", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "nai", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "eappsk", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "pac_file", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "engine", TYPE_INT, 0, 1, FALSE, NULL }, - { "engine_id", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "key_id", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "fragment_size", TYPE_INT, 1, 2000, FALSE, NULL }, - { "proactive_key_caching", TYPE_INT, 0, 1, FALSE, NULL }, - { "bgscan", TYPE_BYTES, 0, 0, FALSE, NULL }, - { "pac_file", TYPE_BYTES, 0, 1024, FALSE, NULL }, - { "freq_list", TYPE_KEYWORD, 0, 0, FALSE, NULL }, -}; - - -static gboolean -validate_type_int (const struct Opt * opt, - const char * value, - const guint32 len) -{ - long int intval; - - g_return_val_if_fail (opt != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - - errno = 0; - intval = strtol (value, NULL, 10); - if (errno != 0) - return FALSE; - - /* strtol returns a long, but we are dealing with ints */ - if (intval > INT_MAX || intval < INT_MIN) - return FALSE; - if (intval > opt->int_high || intval < opt->int_low) - return FALSE; - - return TRUE; -} - -static gboolean -validate_type_bytes (const struct Opt * opt, - const char * value, - const guint32 len) -{ - guint32 check_len; - - 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; - if (len > check_len) - return FALSE; - - return TRUE; -} - -static gboolean -validate_type_utf8 (const struct Opt *opt, - const char * value, - const guint32 len) -{ - guint32 check_len; - - 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; - /* 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 */ - if (g_utf8_strlen (value, len) > check_len) - return FALSE; - - return TRUE; -} - -static gboolean -validate_type_keyword (const struct Opt * opt, - const char * value, - const guint32 len) -{ - char ** allowed; - gchar ** candidates = NULL; - char ** candidate; - gboolean found = FALSE; - - g_return_val_if_fail (opt != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - - /* Allow everything */ - if (!opt->str_allowed) - return TRUE; - - candidates = g_strsplit (value, " ", 0); - if (!candidates) - goto out; - - /* validate each space-separated word in 'value' */ - for (candidate = candidates; *candidate; candidate++) { - found = FALSE; - for (allowed = (char **) opt->str_allowed; *allowed; allowed++) { - if (strcmp (*candidate, *allowed) == 0) { - found = TRUE; - break; - } - } - if (!found) - break; - } - -out: - g_strfreev (candidates); - return found; -} - -OptType -nm_supplicant_settings_verify_setting (const char * key, - const char * value, - const guint32 len) -{ - OptType type = TYPE_INVALID; - int opt_count = sizeof (opt_table) / sizeof (opt_table[0]); - int val_count = sizeof (validate_table) / sizeof (validate_table[0]); - int i, j; - - g_return_val_if_fail (key != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - - for (i = 0; i < opt_count; i++) { - if (strcmp (opt_table[i].key, key) != 0) - continue; - - for (j = 0; j < val_count; j++) { - if (validate_table[j].type == opt_table[i].type) { - if ((*(validate_table[j].func))(&opt_table[i], value, len)) { - type = opt_table[i].type; - break; - } - } - } - } - - return type; -} - diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.h b/src/supplicant-manager/nm-supplicant-settings-verify.h deleted file mode 100644 index 920343ba..00000000 --- a/src/supplicant-manager/nm-supplicant-settings-verify.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2008 Red Hat, Inc. - */ - -#ifndef __NETWORKMANAGER_SUPPLICANT_SETTINGS_VERIFY_H__ -#define __NETWORKMANAGER_SUPPLICANT_SETTINGS_VERIFY_H__ - -typedef enum { - TYPE_INVALID = 0, - TYPE_INT, - TYPE_BYTES, - TYPE_UTF8, - TYPE_KEYWORD, - TYPE_STRING -} OptType; - -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-manager/nm-supplicant-types.h b/src/supplicant-manager/nm-supplicant-types.h deleted file mode 100644 index e9be5be4..00000000 --- a/src/supplicant-manager/nm-supplicant-types.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2006 - 2008 Red Hat, Inc. - */ - -#ifndef __NETWORKMANAGER_SUPPLICANT_TYPES_H__ -#define __NETWORKMANAGER_SUPPLICANT_TYPES_H__ - -#define WPAS_DBUS_SERVICE "fi.w1.wpa_supplicant1" -#define WPAS_DBUS_PATH "/fi/w1/wpa_supplicant1" -#define WPAS_DBUS_INTERFACE "fi.w1.wpa_supplicant1" - -typedef struct _NMSupplicantManager NMSupplicantManager; -typedef struct _NMSupplicantInterface NMSupplicantInterface; -typedef struct _NMSupplicantConfig NMSupplicantConfig; - -typedef enum { - NM_SUPPLICANT_FEATURE_UNKNOWN = 0, /* Can't detect whether supported or not */ - NM_SUPPLICANT_FEATURE_NO = 1, /* Feature definitely not supported */ - NM_SUPPLICANT_FEATURE_YES = 2, /* Feature definitely supported */ -} NMSupplicantFeature; - -/** - * NMSupplicantError: - * @NM_SUPPLICANT_ERROR_UNKNOWN: unknown or unclassified error - * @NM_SUPPLICANT_ERROR_CONFIG: a failure constructing the - * wpa-supplicant configuration. - */ -typedef enum { - NM_SUPPLICANT_ERROR_UNKNOWN = 0, /*< nick=Unknown >*/ - NM_SUPPLICANT_ERROR_CONFIG = 1, /*< nick=Config >*/ -} NMSupplicantError; - -#define NM_SUPPLICANT_ERROR (nm_supplicant_error_quark ()) -GQuark nm_supplicant_error_quark (void); - -#endif /* NM_SUPPLICANT_TYPES_H */ diff --git a/src/supplicant-manager/tests/Makefile.am b/src/supplicant-manager/tests/Makefile.am deleted file mode 100644 index 3ab9122e..00000000 --- a/src/supplicant-manager/tests/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -SUBDIRS=certs - -AM_CPPFLAGS = \ - -I$(top_srcdir)/shared \ - -I$(top_builddir)/shared \ - -I$(top_srcdir)/libnm-core \ - -I$(top_builddir)/libnm-core \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/supplicant-manager \ - -DG_LOG_DOMAIN=\""NetworkManager"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \ - -DTEST_CERT_DIR=\"$(abs_srcdir)/certs\" \ - $(GLIB_CFLAGS) - -noinst_PROGRAMS = test-supplicant-config - -test_supplicant_config_SOURCES = \ - test-supplicant-config.c - -test_supplicant_config_LDADD = \ - $(top_builddir)/src/libNetworkManager.la - -@VALGRIND_RULES@ -TESTS = test-supplicant-config diff --git a/src/supplicant-manager/tests/Makefile.in b/src/supplicant-manager/tests/Makefile.in deleted file mode 100644 index eb6b03ea..00000000 --- a/src/supplicant-manager/tests/Makefile.in +++ /dev/null @@ -1,1256 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = test-supplicant-config$(EXEEXT) -TESTS = test-supplicant-config$(EXEEXT) -subdir = src/supplicant-manager/tests -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/ax_lib_readline.m4 \ - $(top_srcdir)/m4/compiler_options.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/git-sha-record.m4 \ - $(top_srcdir)/m4/gnome-code-coverage.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_test_supplicant_config_OBJECTS = test-supplicant-config.$(OBJEXT) -test_supplicant_config_OBJECTS = $(am_test_supplicant_config_OBJECTS) -test_supplicant_config_DEPENDENCIES = \ - $(top_builddir)/src/libNetworkManager.la -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(test_supplicant_config_SOURCES) -DIST_SOURCES = $(test_supplicant_config_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - check recheck distdir -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red='[0;31m'; \ - grn='[0;32m'; \ - lgn='[1;32m'; \ - blu='[1;34m'; \ - mgn='[0;35m'; \ - brg='[1m'; \ - std='[m'; \ - fi; \ -} -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp \ - $(top_srcdir)/build-aux/test-driver -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ -BLUEZ5_LIBS = @BLUEZ5_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ -DLLTOOL = @DLLTOOL@ -DL_LIBS = @DL_LIBS@ -DNSMASQ_PATH = @DNSMASQ_PATH@ -DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -IPTABLES_PATH = @IPTABLES_PATH@ -JANSSON_CFLAGS = @JANSSON_CFLAGS@ -JANSSON_LIBS = @JANSSON_LIBS@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@ -LIBAUDIT_LIBS = @LIBAUDIT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ -LIBNDP_LIBS = @LIBNDP_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ -LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ -LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ -LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LOG_DRIVER = @LOG_DRIVER@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ -MM_GLIB_LIBS = @MM_GLIB_LIBS@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NEWT_CFLAGS = @NEWT_CFLAGS@ -NEWT_LIBS = @NEWT_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ -NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ -NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ -NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PPPD_PATH = @PPPD_PATH@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -SANITIZERS = @SANITIZERS@ -SANITIZER_ENV = @SANITIZER_ENV@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ -SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@ -SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ -SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ -SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@ -SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@ -SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ -SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_DIR = @UDEV_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VALGRIND_RULES = @VALGRIND_RULES@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -nmbinary = @nmbinary@ -nmconfdir = @nmconfdir@ -nmdatadir = @nmdatadir@ -nmlibdir = @nmlibdir@ -nmrundir = @nmrundir@ -nmstatedir = @nmstatedir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_dhclient = @with_dhclient@ -with_dhcpcd = @with_dhcpcd@ -with_netconfig = @with_netconfig@ -with_resolvconf = @with_resolvconf@ -with_valgrind = @with_valgrind@ -SUBDIRS = certs -AM_CPPFLAGS = \ - -I$(top_srcdir)/shared \ - -I$(top_builddir)/shared \ - -I$(top_srcdir)/libnm-core \ - -I$(top_builddir)/libnm-core \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/supplicant-manager \ - -DG_LOG_DOMAIN=\""NetworkManager"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \ - -DTEST_CERT_DIR=\"$(abs_srcdir)/certs\" \ - $(GLIB_CFLAGS) - -test_supplicant_config_SOURCES = \ - test-supplicant-config.c - -test_supplicant_config_LDADD = \ - $(top_builddir)/src/libNetworkManager.la - -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/supplicant-manager/tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/supplicant-manager/tests/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -test-supplicant-config$(EXEEXT): $(test_supplicant_config_OBJECTS) $(test_supplicant_config_DEPENDENCIES) $(EXTRA_test_supplicant_config_DEPENDENCIES) - @rm -f test-supplicant-config$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_supplicant_config_OBJECTS) $(test_supplicant_config_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-supplicant-config.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test-supplicant-config.log: test-supplicant-config$(EXEEXT) - @p='test-supplicant-config$(EXEEXT)'; \ - b='test-supplicant-config'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-recursive -all-am: Makefile $(PROGRAMS) -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(am__recursive_targets) check-am install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-TESTS check-am clean clean-generic clean-libtool \ - clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ - uninstall uninstall-am - -.PRECIOUS: Makefile - - -@VALGRIND_RULES@ - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/supplicant-manager/tests/certs/Makefile.am b/src/supplicant-manager/tests/certs/Makefile.am deleted file mode 100644 index f2e889f7..00000000 --- a/src/supplicant-manager/tests/certs/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -CERTS = \ - test-ca-cert.pem \ - test-cert.p12 - -EXTRA_DIST = $(CERTS) - diff --git a/src/supplicant-manager/tests/certs/Makefile.in b/src/supplicant-manager/tests/certs/Makefile.in deleted file mode 100644 index 3d348a38..00000000 --- a/src/supplicant-manager/tests/certs/Makefile.in +++ /dev/null @@ -1,605 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/supplicant-manager/tests/certs -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/ax_lib_readline.m4 \ - $(top_srcdir)/m4/compiler_options.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/git-sha-record.m4 \ - $(top_srcdir)/m4/gnome-code-coverage.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ -BLUEZ5_LIBS = @BLUEZ5_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ -DLLTOOL = @DLLTOOL@ -DL_LIBS = @DL_LIBS@ -DNSMASQ_PATH = @DNSMASQ_PATH@ -DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -IPTABLES_PATH = @IPTABLES_PATH@ -JANSSON_CFLAGS = @JANSSON_CFLAGS@ -JANSSON_LIBS = @JANSSON_LIBS@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@ -LIBAUDIT_LIBS = @LIBAUDIT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ -LIBNDP_LIBS = @LIBNDP_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ -LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ -LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ -LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LOG_DRIVER = @LOG_DRIVER@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ -MM_GLIB_LIBS = @MM_GLIB_LIBS@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NEWT_CFLAGS = @NEWT_CFLAGS@ -NEWT_LIBS = @NEWT_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ -NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ -NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ -NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PPPD_PATH = @PPPD_PATH@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -SANITIZERS = @SANITIZERS@ -SANITIZER_ENV = @SANITIZER_ENV@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ -SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@ -SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ -SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ -SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@ -SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@ -SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ -SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_DIR = @UDEV_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VALGRIND_RULES = @VALGRIND_RULES@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -nmbinary = @nmbinary@ -nmconfdir = @nmconfdir@ -nmdatadir = @nmdatadir@ -nmlibdir = @nmlibdir@ -nmrundir = @nmrundir@ -nmstatedir = @nmstatedir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_dhclient = @with_dhclient@ -with_dhcpcd = @with_dhcpcd@ -with_netconfig = @with_netconfig@ -with_resolvconf = @with_resolvconf@ -with_valgrind = @with_valgrind@ -CERTS = \ - test-ca-cert.pem \ - test-cert.p12 - -EXTRA_DIST = $(CERTS) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/supplicant-manager/tests/certs/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/supplicant-manager/tests/certs/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/supplicant-manager/tests/certs/test-ca-cert.pem b/src/supplicant-manager/tests/certs/test-ca-cert.pem deleted file mode 100644 index ef1be20d..00000000 --- a/src/supplicant-manager/tests/certs/test-ca-cert.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEjzCCA3egAwIBAgIJAOvnZPt59yIZMA0GCSqGSIb3DQEBBQUAMIGLMQswCQYD -VQQGEwJVUzESMBAGA1UECBMJQmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcw -FQYDVQQKEw5NeSBDb21wYW55IEx0ZDEQMA4GA1UECxMHVGVzdGluZzENMAsGA1UE -AxMEdGVzdDEcMBoGCSqGSIb3DQEJARYNdGVzdEB0ZXN0LmNvbTAeFw0wOTAzMTAx -NTEyMTRaFw0xOTAzMDgxNTEyMTRaMIGLMQswCQYDVQQGEwJVUzESMBAGA1UECBMJ -QmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcwFQYDVQQKEw5NeSBDb21wYW55 -IEx0ZDEQMA4GA1UECxMHVGVzdGluZzENMAsGA1UEAxMEdGVzdDEcMBoGCSqGSIb3 -DQEJARYNdGVzdEB0ZXN0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAKot9j+/+CX1/gZLgJHIXCRgCItKLGnf7qGbgqB9T2ACBqR0jllKWwDKrcWU -xjXNIc+GF9Wnv+lX6G0Okn4Zt3/uRNobL+2b/yOF7M3Td3/9W873zdkQQX930YZc -Rr8uxdRPP5bxiCgtcw632y21sSEbG9mjccAUnV/0jdvfmMNj0i8gN6E0fMBiJ9S3 -FkxX/KFvt9JWE9CtoyL7ki7UIDq+6vj7Gd5N0B3dOa1y+rRHZzKlJPcSXQSEYUS4 -HmKDwiKSVahft8c4tDn7KPi0vex91hlgZVd3usL2E/Vq7o5D9FAZ5kZY0AdFXwdm -J4lO4Mj7ac7GE4vNERNcXVIX59sCAwEAAaOB8zCB8DAdBgNVHQ4EFgQUuDU3Mr7P -T3n1e3Sy8hBauoDFahAwgcAGA1UdIwSBuDCBtYAUuDU3Mr7PT3n1e3Sy8hBauoDF -ahChgZGkgY4wgYsxCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAO -BgNVBAcTB05ld2J1cnkxFzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMRAwDgYDVQQL -EwdUZXN0aW5nMQ0wCwYDVQQDEwR0ZXN0MRwwGgYJKoZIhvcNAQkBFg10ZXN0QHRl -c3QuY29tggkA6+dk+3n3IhkwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC -AQEAVRG4aALIvCXCiKfe7K+iJxjBVRDFPEf7JWA9LGgbFOn6pNvbxonrR+0BETdc -JV1ET4ct2xsE7QNFIkp9GKRC+6J32zCo8qtLCD5+v436r8TUG2/t2JRMkb9I2XVT -p7RJoot6M0Ltf8KNQUPYh756xmKZ4USfQUwc58MOSDGY8VWEXJOYij9Pf0e0c52t -qiCEjXH7uXiS8Pgq9TYm7AkWSOrglYhSa83x0f8mtT8Q15nBESIHZ6o8FAS2bBgn -B0BkrKRjtBUkuJG3vTox+bYINh2Gxi1JZHWSV1tN5z3hd4VFcKqanW5OgQwToBqp -3nniskIjbH0xjgZf/nVMyLnjxg== ------END CERTIFICATE----- diff --git a/src/supplicant-manager/tests/certs/test-cert.p12 b/src/supplicant-manager/tests/certs/test-cert.p12 deleted file mode 100644 index ae4a6830..00000000 --- a/src/supplicant-manager/tests/certs/test-cert.p12 +++ /dev/null Binary files differdiff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c deleted file mode 100644 index e8f84448..00000000 --- a/src/supplicant-manager/tests/test-supplicant-config.c +++ /dev/null @@ -1,614 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 - 2011 Red Hat, Inc. - */ - -#include "nm-default.h" - -#include <stdio.h> -#include <stdarg.h> -#include <unistd.h> -#include <string.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include "nm-core-internal.h" - -#include "nm-supplicant-config.h" -#include "nm-supplicant-settings-verify.h" - -#include "nm-test-utils-core.h" - -static gboolean -validate_opt (const char *detail, - GVariant *config, - const char *key, - OptType val_type, - gconstpointer expected, - size_t expected_len) -{ - char *config_key; - GVariant *config_value; - gboolean found = FALSE; - const guint8 *bytes; - gsize len; - const char *s; - const unsigned char *expected_array = expected; - GVariantIter iter; - - g_assert (g_variant_is_of_type (config, G_VARIANT_TYPE_VARDICT)); - - g_variant_iter_init (&iter, config); - while (g_variant_iter_next (&iter, "{&sv}", (gpointer) &config_key, (gpointer) &config_value)) { - if (!strcmp (key, config_key)) { - found = TRUE; - switch (val_type) { - case TYPE_INT: - g_assert (g_variant_is_of_type (config_value, G_VARIANT_TYPE_INT32)); - g_assert_cmpint (g_variant_get_int32 (config_value), ==, GPOINTER_TO_INT (expected)); - break; - case TYPE_BYTES: - g_assert (g_variant_is_of_type (config_value, G_VARIANT_TYPE_BYTESTRING)); - bytes = g_variant_get_fixed_array (config_value, &len, 1); - g_assert_cmpint (len, ==, expected_len); - g_assert (memcmp (bytes, expected_array, expected_len) == 0); - break; - case TYPE_KEYWORD: - case TYPE_STRING: - g_assert (g_variant_is_of_type (config_value, G_VARIANT_TYPE_STRING)); - if (expected_len == -1) - expected_len = strlen ((const char *) expected); - s = g_variant_get_string (config_value, NULL); - g_assert_cmpint (strlen (s), ==, expected_len); - g_assert_cmpstr (s, ==, expected); - break; - default: - g_assert_not_reached (); - break; - } - } - g_variant_unref (config_value); - } - - return found; -} - -static void -test_wifi_open (void) -{ - gs_unref_object NMConnection *connection = NULL; - gs_unref_object NMSupplicantConfig *config = NULL; - gs_unref_variant GVariant *config_dict = NULL; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingIPConfig *s_ip4; - char *uuid; - gboolean success; - GError *error = NULL; - GBytes *ssid; - const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - const char *bssid_str = "11:22:33:44:55:66"; - - connection = nm_simple_connection_new (); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - nm_connection_add_setting (connection, NM_SETTING (s_con)); - - uuid = nm_utils_uuid_generate (); - g_object_set (s_con, - NM_SETTING_CONNECTION_ID, "Test Wifi Open", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid_str, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_BAND, "bg", - NULL); - - g_bytes_unref (ssid); - - /* IP4 setting */ - s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); - nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - - g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); - - success = nm_connection_verify (connection, &error); - g_assert_no_error (error); - g_assert (success); - - config = nm_supplicant_config_new (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'ssid' value 'Test SSID'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'scan_ssid' value '1'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'bssid' value '11:22:33:44:55:66'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'freq_list' value *"); - g_assert (nm_supplicant_config_add_setting_wireless (config, - s_wifi, - 0, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'key_mgmt' value 'NONE'"); - g_assert (nm_supplicant_config_add_no_security (config, &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - config_dict = nm_supplicant_config_to_variant (config); - g_assert (config_dict); - - validate_opt ("wifi-open", config_dict, "scan_ssid", TYPE_INT, GINT_TO_POINTER (1), -1); - validate_opt ("wifi-open", config_dict, "ssid", TYPE_BYTES, ssid_data, sizeof (ssid_data)); - validate_opt ("wifi-open", config_dict, "bssid", TYPE_KEYWORD, bssid_str, -1); - validate_opt ("wifi-open", config_dict, "key_mgmt", TYPE_KEYWORD, "NONE", -1); -} - -static void -test_wifi_wep_key (const char *detail, - NMWepKeyType wep_type, - const char *key_data, - const unsigned char *expected, - size_t expected_size) -{ - gs_unref_object NMConnection *connection = NULL; - gs_unref_object NMSupplicantConfig *config = NULL; - gs_unref_variant GVariant *config_dict = NULL; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSettingIPConfig *s_ip4; - char *uuid; - gboolean success; - GError *error = NULL; - GBytes *ssid; - const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - const char *bssid_str = "11:22:33:44:55:66"; - - connection = nm_simple_connection_new (); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - nm_connection_add_setting (connection, NM_SETTING (s_con)); - - uuid = nm_utils_uuid_generate (); - g_object_set (s_con, - NM_SETTING_CONNECTION_ID, "Test Wifi WEP Key", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid_str, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_BAND, "bg", - NULL); - - g_bytes_unref (ssid); - - /* Wifi Security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", - NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, wep_type, - NULL); - nm_setting_wireless_security_set_wep_key (s_wsec, 0, key_data); - - /* IP4 setting */ - s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); - nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - - g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); - - success = nm_connection_verify (connection, &error); - g_assert_no_error (error); - g_assert (success); - - config = nm_supplicant_config_new (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'ssid' value 'Test SSID'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'scan_ssid' value '1'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'bssid' value '11:22:33:44:55:66'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'freq_list' value *"); - g_assert (nm_supplicant_config_add_setting_wireless (config, - s_wifi, - 0, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'key_mgmt' value 'NONE'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'wep_key0' value *"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'wep_tx_keyidx' value '0'"); - g_assert (nm_supplicant_config_add_setting_wireless_security (config, - s_wsec, - NULL, - "376aced7-b28c-46be-9a62-fcdf072571da", - 1500, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - config_dict = nm_supplicant_config_to_variant (config); - g_assert (config_dict); - - validate_opt (detail, config_dict, "scan_ssid", TYPE_INT, GINT_TO_POINTER (1), -1); - validate_opt (detail, config_dict, "ssid", TYPE_BYTES, ssid_data, sizeof (ssid_data)); - validate_opt (detail, config_dict, "bssid", TYPE_KEYWORD, bssid_str, -1); - validate_opt (detail, config_dict, "key_mgmt", TYPE_KEYWORD, "NONE", -1); - validate_opt (detail, config_dict, "wep_tx_keyidx", TYPE_INT, GINT_TO_POINTER (0), -1); - validate_opt (detail, config_dict, "wep_key0", TYPE_BYTES, expected, expected_size); -} - -static void -test_wifi_wep (void) -{ - const char *key1 = "12345"; - const unsigned char key1_expected[] = { 0x31, 0x32, 0x33, 0x34, 0x35 }; - const char *key2 = "ascii test$$$"; - const unsigned char key2_expected[] = { 0x61, 0x73, 0x63, 0x69, 0x69, 0x20, 0x74, 0x65, 0x73, 0x74, 0x24, 0x24, 0x24 }; - const char *key3 = "abcdef1234"; - const unsigned char key3_expected[] = { 0xab, 0xcd, 0xef, 0x12, 0x34 }; - const char *key4 = "96aec785c6392675f87f592972"; - const unsigned char key4_expected[] = { 0x96, 0xae, 0xc7, 0x85, 0xc6, 0x39, 0x26, 0x75, 0xf8, 0x7f, 0x59, 0x29, 0x72 }; - const char *key5 = "r34lly l33t w3p p4ssphr4s3 for t3st1ng"; - const unsigned char key5_expected[] = { 0xce, 0x68, 0x8b, 0x35, 0xf6, 0x0a, 0x2b, 0xbf, 0xc9, 0x8f, 0xed, 0x10, 0xda }; - - test_wifi_wep_key ("wifi-wep-ascii-40", NM_WEP_KEY_TYPE_KEY, key1, key1_expected, sizeof (key1_expected)); - test_wifi_wep_key ("wifi-wep-ascii-104", NM_WEP_KEY_TYPE_KEY, key2, key2_expected, sizeof (key2_expected)); - test_wifi_wep_key ("wifi-wep-hex-40", NM_WEP_KEY_TYPE_KEY, key3, key3_expected, sizeof (key3_expected)); - test_wifi_wep_key ("wifi-wep-hex-104", NM_WEP_KEY_TYPE_KEY, key4, key4_expected, sizeof (key4_expected)); - test_wifi_wep_key ("wifi-wep-passphrase-104", NM_WEP_KEY_TYPE_PASSPHRASE, key5, key5_expected, sizeof (key5_expected)); - - test_wifi_wep_key ("wifi-wep-old-hex-104", NM_WEP_KEY_TYPE_UNKNOWN, key4, key4_expected, sizeof (key4_expected)); -} - -static void -test_wifi_wpa_psk (const char *detail, - OptType key_type, - const char *key_data, - const unsigned char *expected, - size_t expected_size) -{ - gs_unref_object NMConnection *connection = NULL; - gs_unref_object NMSupplicantConfig *config = NULL; - gs_unref_variant GVariant *config_dict = NULL; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSettingIPConfig *s_ip4; - char *uuid; - gboolean success; - GError *error = NULL; - GBytes *ssid; - const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - const char *bssid_str = "11:22:33:44:55:66"; - - connection = nm_simple_connection_new (); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - nm_connection_add_setting (connection, NM_SETTING (s_con)); - - uuid = nm_utils_uuid_generate (); - g_object_set (s_con, - NM_SETTING_CONNECTION_ID, "Test Wifi WEP Key", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid_str, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_BAND, "bg", - NULL); - - g_bytes_unref (ssid); - - /* Wifi Security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", - NM_SETTING_WIRELESS_SECURITY_PSK, key_data, - NULL); - - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_proto (s_wsec, "rsn"); - nm_setting_wireless_security_add_pairwise (s_wsec, "tkip"); - nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - nm_setting_wireless_security_add_group (s_wsec, "ccmp"); - - /* IP4 setting */ - s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); - nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - - g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); - - success = nm_connection_verify (connection, &error); - g_assert_no_error (error); - g_assert (success); - - config = nm_supplicant_config_new (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'ssid' value 'Test SSID'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'scan_ssid' value '1'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'bssid' value '11:22:33:44:55:66'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'freq_list' value *"); - g_assert (nm_supplicant_config_add_setting_wireless (config, - s_wifi, - 0, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'key_mgmt' value 'WPA-PSK'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'psk' value *"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'proto' value 'WPA RSN'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'pairwise' value 'TKIP CCMP'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'group' value 'TKIP CCMP'"); - g_assert (nm_supplicant_config_add_setting_wireless_security (config, - s_wsec, - NULL, - "376aced7-b28c-46be-9a62-fcdf072571da", - 1500, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - config_dict = nm_supplicant_config_to_variant (config); - g_assert (config_dict); - - validate_opt (detail, config_dict, "scan_ssid", TYPE_INT, GINT_TO_POINTER (1), -1); - validate_opt (detail, config_dict, "ssid", TYPE_BYTES, ssid_data, sizeof (ssid_data)); - validate_opt (detail, config_dict, "bssid", TYPE_KEYWORD, bssid_str, -1); - validate_opt (detail, config_dict, "key_mgmt", TYPE_KEYWORD, "WPA-PSK", -1); - validate_opt (detail, config_dict, "proto", TYPE_KEYWORD, "WPA RSN", -1); - validate_opt (detail, config_dict, "pairwise", TYPE_KEYWORD, "TKIP CCMP", -1); - validate_opt (detail, config_dict, "group", TYPE_KEYWORD, "TKIP CCMP", -1); - validate_opt (detail, config_dict, "psk", key_type, expected, expected_size); -} - -static void -test_wifi_wpa_psk_types (void) -{ - const char *key1 = "d4721e911461d3cdef9793858e977fcda091779243abb7316c2f11605a160893"; - const unsigned char key1_expected[] = { 0xd4, 0x72, 0x1e, 0x91, 0x14, 0x61, 0xd3, 0xcd, - 0xef, 0x97, 0x93, 0x85, 0x8e, 0x97, 0x7f, 0xcd, - 0xa0, 0x91, 0x77, 0x92, 0x43, 0xab, 0xb7, 0x31, - 0x6c, 0x2f, 0x11, 0x60, 0x5a, 0x16, 0x08, 0x93 }; - const char *key2 = "r34lly l33t wp4 p4ssphr4s3 for t3st1ng"; - - test_wifi_wpa_psk ("wifi-wpa-psk-hex", TYPE_BYTES, key1, key1_expected, sizeof (key1_expected)); - test_wifi_wpa_psk ("wifi-wep-psk-passphrase", TYPE_STRING, key2, (gconstpointer) key2, strlen (key2)); -} - -static void -test_wifi_eap (void) -{ - gs_unref_object NMConnection *connection = NULL; - gs_unref_object NMSupplicantConfig *config = NULL; - gs_unref_variant GVariant *config_dict = NULL; - NMSettingConnection *s_con; - NMSettingWireless *s_wifi; - NMSettingWirelessSecurity *s_wsec; - NMSetting8021x *s_8021x; - NMSettingIPConfig *s_ip4; - char *uuid; - gboolean success; - GError *error = NULL; - GBytes *ssid; - const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - const char *bssid_str = "11:22:33:44:55:66"; - guint32 mtu = 1100; - - connection = nm_simple_connection_new (); - - /* Connection setting */ - s_con = (NMSettingConnection *) nm_setting_connection_new (); - nm_connection_add_setting (connection, NM_SETTING (s_con)); - - uuid = nm_utils_uuid_generate (); - g_object_set (s_con, - NM_SETTING_CONNECTION_ID, "Test Wifi EAP-TLS", - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_NAME, - NULL); - g_free (uuid); - - /* Wifi setting */ - s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - - ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); - - g_object_set (s_wifi, - NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid_str, - NM_SETTING_WIRELESS_MODE, "infrastructure", - NM_SETTING_WIRELESS_BAND, "bg", - NULL); - - g_bytes_unref (ssid); - - /* Wifi Security setting */ - s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wsec)); - - g_object_set (s_wsec, - NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", - NULL); - - nm_setting_wireless_security_add_proto (s_wsec, "wpa"); - nm_setting_wireless_security_add_proto (s_wsec, "rsn"); - nm_setting_wireless_security_add_pairwise (s_wsec, "tkip"); - nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp"); - nm_setting_wireless_security_add_group (s_wsec, "tkip"); - nm_setting_wireless_security_add_group (s_wsec, "ccmp"); - - /* 802-1X setting */ - s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - nm_connection_add_setting (connection, NM_SETTING (s_8021x)); - nm_setting_802_1x_add_eap_method (s_8021x, "tls"); - nm_setting_802_1x_set_client_cert (s_8021x, TEST_CERT_DIR "/test-cert.p12", NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, NULL); - nm_setting_802_1x_set_ca_cert (s_8021x, TEST_CERT_DIR "/test-ca-cert.pem", NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, NULL); - nm_setting_802_1x_set_private_key (s_8021x, TEST_CERT_DIR "/test-cert.p12", NULL, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, NULL); - - /* IP4 setting */ - s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); - nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - - g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); - - success = nm_connection_verify (connection, &error); - g_assert_no_error (error); - g_assert (success); - - config = nm_supplicant_config_new (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'ssid' value 'Test SSID'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'scan_ssid' value '1'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'bssid' value '11:22:33:44:55:66'*"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'freq_list' value *"); - g_assert (nm_supplicant_config_add_setting_wireless (config, - s_wifi, - 0, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'key_mgmt' value 'WPA-EAP'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'proto' value 'WPA RSN'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'pairwise' value 'TKIP CCMP'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*added 'group' value 'TKIP CCMP'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*Config: added 'eap' value 'TLS'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*Config: added 'fragment_size' value '1086'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "* Config: added 'ca_cert' value '*/test-ca-cert.pem'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "* Config: added 'private_key' value '*/test-cert.p12'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*Config: added 'bgscan' value 'simple:30:-65:300'"); - g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, - "*Config: added 'proactive_key_caching' value '1'"); - g_assert (nm_supplicant_config_add_setting_wireless_security (config, - s_wsec, - s_8021x, - "d5b488af-9cab-41ed-bad4-97709c58430f", - mtu, - &error)); - g_assert_no_error (error); - g_test_assert_expected_messages (); - - config_dict = nm_supplicant_config_to_variant (config); - g_assert (config_dict); - - validate_opt ("wifi-eap", config_dict, "scan_ssid", TYPE_INT, GINT_TO_POINTER (1), -1); - validate_opt ("wifi-eap", config_dict, "ssid", TYPE_BYTES, ssid_data, sizeof (ssid_data)); - validate_opt ("wifi-eap", config_dict, "bssid", TYPE_KEYWORD, bssid_str, -1); - validate_opt ("wifi-eap", config_dict, "key_mgmt", TYPE_KEYWORD, "WPA-EAP", -1); - validate_opt ("wifi-eap", config_dict, "eap", TYPE_KEYWORD, "TLS", -1); - validate_opt ("wifi-eap", config_dict, "proto", TYPE_KEYWORD, "WPA RSN", -1); - validate_opt ("wifi-eap", config_dict, "pairwise", TYPE_KEYWORD, "TKIP CCMP", -1); - validate_opt ("wifi-eap", config_dict, "group", TYPE_KEYWORD, "TKIP CCMP", -1); - validate_opt ("wifi-eap", config_dict, "fragment_size", TYPE_INT, GINT_TO_POINTER(mtu-14), -1); -} - -NMTST_DEFINE (); - -int main (int argc, char **argv) -{ - nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT"); - - g_test_add_func ("/supplicant-config/wifi-open", test_wifi_open); - g_test_add_func ("/supplicant-config/wifi-wep", test_wifi_wep); - g_test_add_func ("/supplicant-config/wifi-wpa-psk-types", test_wifi_wpa_psk_types); - g_test_add_func ("/supplicant-config/wifi-eap", test_wifi_eap); - - return g_test_run (); -} - |