diff options
| author | Michael Biebl <biebl@debian.org> | 2015-01-22 00:29:39 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2015-01-22 00:29:39 +0100 |
| commit | 2c032d8f1c6292c1338a615e6ec40252889ba85c (patch) | |
| tree | 1f77182220b2b0264288ba4a476ab47e5bc48716 /src/supplicant-manager | |
| parent | 33491bc4279481db8ae47213e34a6d695a0e8830 (diff) | |
Imported Upstream version 1.0.0 upstream/1.0.0
Diffstat (limited to 'src/supplicant-manager')
| -rw-r--r-- | src/supplicant-manager/nm-call-store.c | 10 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-call-store.h | 6 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-config.c | 115 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-config.h | 4 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-interface.c | 20 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-interface.h | 5 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-manager.c | 14 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-manager.h | 6 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-settings-verify.c | 4 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-settings-verify.h | 6 | ||||
| -rw-r--r-- | src/supplicant-manager/nm-supplicant-types.h | 4 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/Makefile.am | 6 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/Makefile.in | 12 | ||||
| -rw-r--r-- | src/supplicant-manager/tests/test-supplicant-config.c | 77 |
14 files changed, 146 insertions, 143 deletions
diff --git a/src/supplicant-manager/nm-call-store.c b/src/supplicant-manager/nm-call-store.c index 4b427549..6e910a96 100644 --- a/src/supplicant-manager/nm-call-store.c +++ b/src/supplicant-manager/nm-call-store.c @@ -19,6 +19,8 @@ * Copyright (C) 2010 Red Hat, Inc. */ +#include "config.h" + #include "nm-call-store.h" #include "nm-logging.h" @@ -44,7 +46,13 @@ nm_call_store_add (NMCallStore *store, g_return_if_fail (store != NULL); g_return_if_fail (proxy != NULL); - g_return_if_fail (call != NULL); + + if (!call) { + /* Allow calling nm_call_store_add() with NULL @call for convenience. + * This way you can pass the result of dbus_g_proxy_begin_call() directly + * to nm_call_store_add() without checking for NULL. */ + return; + } calls = g_hash_table_lookup (store, proxy); if (!calls) { diff --git a/src/supplicant-manager/nm-call-store.h b/src/supplicant-manager/nm-call-store.h index b24c97a4..bcee54cf 100644 --- a/src/supplicant-manager/nm-call-store.h +++ b/src/supplicant-manager/nm-call-store.h @@ -18,8 +18,8 @@ * (C) Copyright 2007 Novell, Inc. */ -#ifndef NM_CALLBACK_STORE_H -#define NM_CALLBACK_STORE_H +#ifndef __NETWORKMANAGER_CALLBACK_STORE_H__ +#define __NETWORKMANAGER_CALLBACK_STORE_H__ #include <glib-object.h> #include <dbus/dbus-glib.h> @@ -38,4 +38,4 @@ void nm_call_store_remove (NMCallStore *store, void nm_call_store_clear (NMCallStore *store); void nm_call_store_destroy (NMCallStore *store); -#endif /* NM_CALLBACK_STORE_H */ +#endif /* __NETWORKMANAGER_CALLBACK_STORE_H__ */ diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index 438b436e..9ae87095 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -19,14 +19,11 @@ * Copyright (C) 2007 - 2008 Novell, Inc. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "config.h" #include <string.h> #include <stdlib.h> #include <glib.h> -#include <netinet/ether.h> #include <dbus/dbus-glib.h> #include "nm-supplicant-config.h" @@ -166,7 +163,7 @@ nm_supplicant_config_add_option (NMSupplicantConfig *self, static gboolean nm_supplicant_config_add_blob (NMSupplicantConfig *self, const char *key, - const GByteArray *value, + GBytes *value, const char *blobid) { NMSupplicantConfigPrivate *priv; @@ -174,16 +171,20 @@ nm_supplicant_config_add_blob (NMSupplicantConfig *self, 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 (value->len > 0, 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 *) value->data, value->len); + type = nm_supplicant_settings_verify_setting (key, (const char *) data, data_len); if (type == TYPE_INVALID) { nm_log_warn (LOGD_SUPPLICANT, "Key '%s' and/or it's contained value is invalid.", key); return FALSE; @@ -195,8 +196,8 @@ nm_supplicant_config_add_blob (NMSupplicantConfig *self, return FALSE; } - blob = g_byte_array_sized_new (value->len); - g_byte_array_append (blob, value->data, value->len); + 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); @@ -328,9 +329,6 @@ nm_supplicant_config_get_blobs (NMSupplicantConfig * self) return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->blobs; } -#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_ARG(x) ((guint8*)(x))[0],((guint8*)(x))[1],((guint8*)(x))[2],((guint8*)(x))[3],((guint8*)(x))[4],((guint8*)(x))[5] - #define TWO_GHZ_FREQS "2412,2417,2422,2427,2432,2437,2442,2447,2452,2457,2462,2467,2472,2484" #define FIVE_GHZ_FREQS "4915,4920,4925,4935,4940,4945,4960,4980,5035,5040,5045,5055,5060,5080," \ "5170,5180,5190,5200,5210,5220,5230,5240,5260,5280,5300,5320,5500," \ @@ -346,7 +344,8 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, NMSupplicantConfigPrivate *priv; gboolean is_adhoc, is_ap; const char *mode, *band; - const GByteArray *id; + GBytes *ssid; + const char *bssid; g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), FALSE); g_return_val_if_fail (setting != NULL, FALSE); @@ -361,8 +360,11 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, else priv->ap_scan = 1; - id = nm_setting_wireless_get_ssid (setting); - if (!nm_supplicant_config_add_option (self, "ssid", (char *) id->data, id->len, FALSE)) { + 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)) { nm_log_warn (LOGD_SUPPLICANT, "Error adding SSID to supplicant config."); return FALSE; } @@ -401,19 +403,14 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, return FALSE; } - id = nm_setting_wireless_get_bssid (setting); - if (id && id->len) { - char *str_bssid; - - str_bssid = g_strdup_printf (MAC_FMT, MAC_ARG (id->data)); + bssid = nm_setting_wireless_get_bssid (setting); + if (bssid) { if (!nm_supplicant_config_add_option (self, "bssid", - str_bssid, strlen (str_bssid), + bssid, strlen (bssid), FALSE)) { - g_free (str_bssid); nm_log_warn (LOGD_SUPPLICANT, "Error adding BSSID to supplicant config."); return FALSE; } - g_free (str_bssid); } band = nm_setting_wireless_get_band (setting); @@ -496,7 +493,7 @@ get_blob_id (const char *name, const char *seed_uid) } #define ADD_BLOB_VAL(field, name, con_uid) \ - if (field && field->len) { \ + if (field && g_bytes_get_size (field)) { \ char *uid = get_blob_id (name, con_uid); \ success = nm_supplicant_config_add_blob (self, name, field, uid); \ g_free (uid); \ @@ -543,8 +540,8 @@ add_wep_key (NMSupplicantConfig *self, const char *name, NMWepKeyType wep_type) { - char *value; - gboolean success; + GBytes *bytes; + gboolean success = FALSE; size_t key_len = key ? strlen (key) : 0; if (!key || !key_len) @@ -553,9 +550,15 @@ add_wep_key (NMSupplicantConfig *self, if ( (wep_type == NM_WEP_KEY_TYPE_UNKNOWN) || (wep_type == NM_WEP_KEY_TYPE_KEY)) { if ((key_len == 10) || (key_len == 26)) { - value = nm_utils_hexstr2bin (key, strlen (key)); - success = nm_supplicant_config_add_option (self, name, value, key_len / 2, TRUE); - g_free (value); + bytes = nm_utils_hexstr2bin (key); + if (bytes) { + success = nm_supplicant_config_add_option (self, + name, + g_bytes_get_data (bytes, NULL), + g_bytes_get_size (bytes), + TRUE); + g_bytes_unref (bytes); + } if (!success) { nm_log_warn (LOGD_SUPPLICANT, "Error adding %s to supplicant config.", name); return FALSE; @@ -591,8 +594,7 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self, NMSetting8021x *setting_8021x, const char *con_uuid) { - char *value; - gboolean success; + gboolean success = FALSE; const char *key_mgmt, *auth_alg; const char *psk; @@ -613,10 +615,18 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self, size_t psk_len = strlen (psk); if (psk_len == 64) { + GBytes *bytes; + /* Hex PSK */ - value = nm_utils_hexstr2bin (psk, psk_len); - success = nm_supplicant_config_add_option (self, "psk", value, psk_len / 2, TRUE); - g_free (value); + bytes = nm_utils_hexstr2bin (psk); + if (bytes) { + success = nm_supplicant_config_add_option (self, + "psk", + g_bytes_get_data (bytes, NULL), + g_bytes_get_size (bytes), + TRUE); + g_bytes_unref (bytes); + } if (!success) { nm_log_warn (LOGD_SUPPLICANT, "Error adding 'psk' to supplicant config."); return FALSE; @@ -654,6 +664,7 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self, 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); + char *value; if (!add_wep_key (self, wep0, "wep_key0", wep_type)) return FALSE; @@ -732,7 +743,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, const char *peapver, *value, *path; gboolean success, added; GString *phase1, *phase2; - const GByteArray *array; + GBytes *bytes; gboolean fast = FALSE; guint32 i, num_eap; gboolean fast_provisoning_allowed = FALSE; @@ -748,12 +759,12 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, if (!add_string_val (self, value, "password", FALSE, TRUE)) return FALSE; } else { - array = nm_setting_802_1x_get_password_raw (setting); - if (array) { + bytes = nm_setting_802_1x_get_password_raw (setting); + if (bytes) { success = nm_supplicant_config_add_option (self, "password", - (const char *)array->data, - array->len, + (const char *) g_bytes_get_data (bytes, NULL), + g_bytes_get_size (bytes), TRUE); if (!success) { nm_log_warn (LOGD_SUPPLICANT, "Error adding password-raw to supplicant config."); @@ -894,8 +905,8 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, /* CA certificate */ switch (nm_setting_802_1x_get_ca_cert_scheme (setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: - array = nm_setting_802_1x_get_ca_cert_blob (setting); - ADD_BLOB_VAL (array, "ca_cert", con_uuid); + bytes = nm_setting_802_1x_get_ca_cert_blob (setting); + ADD_BLOB_VAL (bytes, "ca_cert", con_uuid); break; case NM_SETTING_802_1X_CK_SCHEME_PATH: path = nm_setting_802_1x_get_ca_cert_path (setting); @@ -909,8 +920,8 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, /* Phase 2 CA certificate */ switch (nm_setting_802_1x_get_phase2_ca_cert_scheme (setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: - array = nm_setting_802_1x_get_phase2_ca_cert_blob (setting); - ADD_BLOB_VAL (array, "ca_cert2", con_uuid); + bytes = nm_setting_802_1x_get_phase2_ca_cert_blob (setting); + ADD_BLOB_VAL (bytes, "ca_cert2", con_uuid); break; case NM_SETTING_802_1X_CK_SCHEME_PATH: path = nm_setting_802_1x_get_phase2_ca_cert_path (setting); @@ -937,8 +948,8 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, added = FALSE; switch (nm_setting_802_1x_get_private_key_scheme (setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: - array = nm_setting_802_1x_get_private_key_blob (setting); - ADD_BLOB_VAL (array, "private_key", con_uuid); + bytes = nm_setting_802_1x_get_private_key_blob (setting); + ADD_BLOB_VAL (bytes, "private_key", con_uuid); added = TRUE; break; case NM_SETTING_802_1X_CK_SCHEME_PATH: @@ -975,8 +986,8 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, */ switch (nm_setting_802_1x_get_client_cert_scheme (setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: - array = nm_setting_802_1x_get_client_cert_blob (setting); - ADD_BLOB_VAL (array, "client_cert", con_uuid); + bytes = nm_setting_802_1x_get_client_cert_blob (setting); + ADD_BLOB_VAL (bytes, "client_cert", con_uuid); break; case NM_SETTING_802_1X_CK_SCHEME_PATH: path = nm_setting_802_1x_get_client_cert_path (setting); @@ -993,8 +1004,8 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, added = FALSE; switch (nm_setting_802_1x_get_phase2_private_key_scheme (setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: - array = nm_setting_802_1x_get_phase2_private_key_blob (setting); - ADD_BLOB_VAL (array, "private_key2", con_uuid); + bytes = nm_setting_802_1x_get_phase2_private_key_blob (setting); + ADD_BLOB_VAL (bytes, "private_key2", con_uuid); added = TRUE; break; case NM_SETTING_802_1X_CK_SCHEME_PATH: @@ -1021,7 +1032,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, * isn't decrypted at all. */ value = nm_setting_802_1x_get_phase2_private_key_password (setting); - if (!add_string_val (self, value, "private_key_passwd2", FALSE, TRUE)) + if (!add_string_val (self, value, "private_key2_passwd", FALSE, TRUE)) return FALSE; } @@ -1031,8 +1042,8 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, */ switch (nm_setting_802_1x_get_phase2_client_cert_scheme (setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: - array = nm_setting_802_1x_get_phase2_client_cert_blob (setting); - ADD_BLOB_VAL (array, "client_cert2", con_uuid); + bytes = nm_setting_802_1x_get_phase2_client_cert_blob (setting); + ADD_BLOB_VAL (bytes, "client_cert2", con_uuid); break; case NM_SETTING_802_1X_CK_SCHEME_PATH: path = nm_setting_802_1x_get_phase2_client_cert_path (setting); diff --git a/src/supplicant-manager/nm-supplicant-config.h b/src/supplicant-manager/nm-supplicant-config.h index 75d6b779..482e3545 100644 --- a/src/supplicant-manager/nm-supplicant-config.h +++ b/src/supplicant-manager/nm-supplicant-config.h @@ -19,8 +19,8 @@ * Copyright (C) 2007 - 2008 Novell, Inc. */ -#ifndef NM_SUPPLICANT_CONFIG_H -#define NM_SUPPLICANT_CONFIG_H +#ifndef __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ +#define __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ #include <glib-object.h> #include <nm-setting-wireless.h> diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index 15138dc8..02b82b7e 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -19,7 +19,8 @@ * Copyright (C) 2006 - 2008 Novell, Inc. */ -#include <config.h> +#include "config.h" + #include <stdio.h> #include <string.h> #include <glib.h> @@ -1033,12 +1034,11 @@ add_blob_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data); NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); GError *err = NULL; - guint tmp; priv->blobs_left--; nm_call_store_remove (priv->assoc_pcalls, proxy, call_id); - if (!dbus_g_proxy_end_call (proxy, call_id, &err, G_TYPE_UINT, &tmp, G_TYPE_INVALID)) { + if (!dbus_g_proxy_end_call (proxy, call_id, &err, G_TYPE_INVALID)) { nm_log_warn (LOGD_SUPPLICANT, "Couldn't set network certificates: %s.", err->message); emit_error_helper (self, err); g_error_free (err); @@ -1080,7 +1080,7 @@ add_network_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) add_blob_cb, self, NULL, - DBUS_TYPE_STRING, name, + G_TYPE_STRING, name, DBUS_TYPE_G_UCHAR_ARRAY, data, G_TYPE_INVALID); nm_call_store_add (priv->assoc_pcalls, priv->iface_proxy, call); @@ -1472,12 +1472,12 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass) object_class->get_property = get_property; /* Properties */ - g_object_class_install_property (object_class, PROP_SCANNING, - g_param_spec_boolean ("scanning", - "Scanning", - "Scanning", - FALSE, - G_PARAM_READABLE)); + g_object_class_install_property + (object_class, PROP_SCANNING, + g_param_spec_boolean ("scanning", "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); /* Signals */ signals[STATE] = diff --git a/src/supplicant-manager/nm-supplicant-interface.h b/src/supplicant-manager/nm-supplicant-interface.h index 633c16cc..0112e40e 100644 --- a/src/supplicant-manager/nm-supplicant-interface.h +++ b/src/supplicant-manager/nm-supplicant-interface.h @@ -19,11 +19,10 @@ * Copyright (C) 2007 - 2008 Novell, Inc. */ -#ifndef NM_SUPPLICANT_INTERFACE_H -#define NM_SUPPLICANT_INTERFACE_H +#ifndef __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ +#define __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ #include <glib-object.h> -#include <dbus/dbus.h> #include "nm-supplicant-types.h" /* diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c index f146b239..01e35929 100644 --- a/src/supplicant-manager/nm-supplicant-manager.c +++ b/src/supplicant-manager/nm-supplicant-manager.c @@ -19,6 +19,8 @@ * Copyright (C) 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <glib.h> #include <dbus/dbus.h> @@ -405,11 +407,11 @@ nm_supplicant_manager_class_init (NMSupplicantManagerClass *klass) object_class->set_property = set_property; object_class->dispose = dispose; - g_object_class_install_property (object_class, PROP_AVAILABLE, - g_param_spec_boolean (NM_SUPPLICANT_MANAGER_AVAILABLE, - "Available", - "Available", - FALSE, - G_PARAM_READABLE)); + g_object_class_install_property + (object_class, PROP_AVAILABLE, + g_param_spec_boolean (NM_SUPPLICANT_MANAGER_AVAILABLE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/src/supplicant-manager/nm-supplicant-manager.h b/src/supplicant-manager/nm-supplicant-manager.h index 9e2f3b21..5e7f1eb5 100644 --- a/src/supplicant-manager/nm-supplicant-manager.h +++ b/src/supplicant-manager/nm-supplicant-manager.h @@ -19,8 +19,8 @@ * Copyright (C) 2007 - 2008 Novell, Inc. */ -#ifndef NM_SUPPLICANT_MANAGER_H -#define NM_SUPPLICANT_MANAGER_H +#ifndef __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ +#define __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ #include <glib-object.h> #include "nm-supplicant-types.h" @@ -65,4 +65,4 @@ void nm_supplicant_manager_iface_release (NMSupplicantManager *mgr, gboolean nm_supplicant_manager_available (NMSupplicantManager *mgr); -#endif /* NM_SUPPLICANT_MANAGER_H */ +#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 index f7d4ca58..1328fd51 100644 --- a/src/supplicant-manager/nm-supplicant-settings-verify.c +++ b/src/supplicant-manager/nm-supplicant-settings-verify.c @@ -18,6 +18,8 @@ * Copyright (C) 2006 - 2012 Red Hat, Inc. */ +#include "config.h" + #include <glib.h> #include <stdio.h> #include <stdlib.h> @@ -137,7 +139,7 @@ static const struct Opt opt_table[] = { { "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_BYTES, 0, 0, FALSE, NULL }, + { "freq_list", TYPE_KEYWORD, 0, 0, FALSE, NULL }, }; diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.h b/src/supplicant-manager/nm-supplicant-settings-verify.h index eb213e0e..920343ba 100644 --- a/src/supplicant-manager/nm-supplicant-settings-verify.h +++ b/src/supplicant-manager/nm-supplicant-settings-verify.h @@ -18,8 +18,8 @@ * Copyright (C) 2006 - 2008 Red Hat, Inc. */ -#ifndef NM_SUPPLICANT_SETTINGS_VERIFY_H -#define NM_SUPPLICANT_SETTINGS_VERIFY_H +#ifndef __NETWORKMANAGER_SUPPLICANT_SETTINGS_VERIFY_H__ +#define __NETWORKMANAGER_SUPPLICANT_SETTINGS_VERIFY_H__ typedef enum { TYPE_INVALID = 0, @@ -35,4 +35,4 @@ OptType nm_supplicant_settings_verify_setting (const char * key, const guint32 len); -#endif /* NM_SUPPLICANT_SETTINGS_VERIFY_H */ +#endif /* __NETWORKMANAGER_SUPPLICANT_SETTINGS_VERIFY_H__ */ diff --git a/src/supplicant-manager/nm-supplicant-types.h b/src/supplicant-manager/nm-supplicant-types.h index 16e4a6ba..619f0c3e 100644 --- a/src/supplicant-manager/nm-supplicant-types.h +++ b/src/supplicant-manager/nm-supplicant-types.h @@ -18,8 +18,8 @@ * Copyright (C) 2006 - 2008 Red Hat, Inc. */ -#ifndef NM_SUPPLICANT_TYPES_H -#define NM_SUPPLICANT_TYPES_H +#ifndef __NETWORKMANAGER_SUPPLICANT_TYPES_H__ +#define __NETWORKMANAGER_SUPPLICANT_TYPES_H__ typedef struct _NMSupplicantManager NMSupplicantManager; typedef struct _NMSupplicantInterface NMSupplicantInterface; diff --git a/src/supplicant-manager/tests/Makefile.am b/src/supplicant-manager/tests/Makefile.am index 9defe66b..452ccdc1 100644 --- a/src/supplicant-manager/tests/Makefile.am +++ b/src/supplicant-manager/tests/Makefile.am @@ -1,11 +1,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ + -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 \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) diff --git a/src/supplicant-manager/tests/Makefile.in b/src/supplicant-manager/tests/Makefile.in index 42a7f6ff..567b6c77 100644 --- a/src/supplicant-manager/tests/Makefile.in +++ b/src/supplicant-manager/tests/Makefile.in @@ -204,6 +204,8 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ +BLUEZ5_LIBS = @BLUEZ5_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -327,6 +329,7 @@ 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_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ @@ -346,6 +349,7 @@ 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@ @@ -372,7 +376,7 @@ SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_BASE_DIR = @UDEV_BASE_DIR@ +UDEV_DIR = @UDEV_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ @@ -453,12 +457,12 @@ with_resolvconf = @with_resolvconf@ with_valgrind = @with_valgrind@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ + -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 \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) diff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c index ce884a8d..5aa3fa2d 100644 --- a/src/supplicant-manager/tests/test-supplicant-config.c +++ b/src/supplicant-manager/tests/test-supplicant-config.c @@ -18,11 +18,12 @@ * Copyright (C) 2008 - 2011 Red Hat, Inc. */ +#include "config.h" + #include <stdio.h> #include <stdarg.h> #include <unistd.h> #include <string.h> -#include <netinet/ether.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> @@ -31,13 +32,7 @@ #include <dbus/dbus-glib.h> -#include <nm-utils.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-ip4-config.h> -#include <nm-setting-8021x.h> +#include "nm-core-internal.h" #include "nm-supplicant-config.h" #include "nm-supplicant-settings-verify.h" @@ -115,19 +110,17 @@ test_wifi_open (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSupplicantConfig *config; GHashTable *hash; char *uuid; gboolean success; GError *error = NULL; - GByteArray *ssid; + GBytes *ssid; const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - GByteArray *bssid; - const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }; const char *bssid_str = "11:22:33:44:55:66"; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); @@ -146,26 +139,22 @@ test_wifi_open (void) s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - bssid = g_byte_array_sized_new (sizeof (bssid_data)); - g_byte_array_append (bssid, bssid_data, sizeof (bssid_data)); + ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); g_object_set (s_wifi, NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid, + NM_SETTING_WIRELESS_BSSID, bssid_str, NM_SETTING_WIRELESS_MODE, "infrastructure", NM_SETTING_WIRELESS_BAND, "bg", NULL); - g_byte_array_free (ssid, TRUE); - g_byte_array_free (bssid, TRUE); + g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, "wifi-open", "failed to verify connection: %s", @@ -216,19 +205,17 @@ test_wifi_wep_key (const char *detail, NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSupplicantConfig *config; GHashTable *hash; char *uuid; gboolean success; GError *error = NULL; - GByteArray *ssid; + GBytes *ssid; const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - GByteArray *bssid; - const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }; const char *bssid_str = "11:22:33:44:55:66"; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); @@ -247,20 +234,16 @@ test_wifi_wep_key (const char *detail, s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - bssid = g_byte_array_sized_new (sizeof (bssid_data)); - g_byte_array_append (bssid, bssid_data, sizeof (bssid_data)); + ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); g_object_set (s_wifi, NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid, + NM_SETTING_WIRELESS_BSSID, bssid_str, NM_SETTING_WIRELESS_MODE, "infrastructure", NM_SETTING_WIRELESS_BAND, "bg", NULL); - g_byte_array_free (ssid, TRUE); - g_byte_array_free (bssid, TRUE); + g_bytes_unref (ssid); /* Wifi Security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); @@ -273,10 +256,10 @@ test_wifi_wep_key (const char *detail, nm_setting_wireless_security_set_wep_key (s_wsec, 0, key_data); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, detail, "failed to verify connection: %s", @@ -359,19 +342,17 @@ test_wifi_wpa_psk (const char *detail, NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSupplicantConfig *config; GHashTable *hash; char *uuid; gboolean success; GError *error = NULL; - GByteArray *ssid; + GBytes *ssid; const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 }; - GByteArray *bssid; - const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }; const char *bssid_str = "11:22:33:44:55:66"; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); @@ -390,20 +371,16 @@ test_wifi_wpa_psk (const char *detail, s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); - ssid = g_byte_array_sized_new (sizeof (ssid_data)); - g_byte_array_append (ssid, ssid_data, sizeof (ssid_data)); - bssid = g_byte_array_sized_new (sizeof (bssid_data)); - g_byte_array_append (bssid, bssid_data, sizeof (bssid_data)); + ssid = g_bytes_new (ssid_data, sizeof (ssid_data)); g_object_set (s_wifi, NM_SETTING_WIRELESS_SSID, ssid, - NM_SETTING_WIRELESS_BSSID, bssid, + NM_SETTING_WIRELESS_BSSID, bssid_str, NM_SETTING_WIRELESS_MODE, "infrastructure", NM_SETTING_WIRELESS_BAND, "bg", NULL); - g_byte_array_free (ssid, TRUE); - g_byte_array_free (bssid, TRUE); + g_bytes_unref (ssid); /* Wifi Security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); @@ -422,10 +399,10 @@ test_wifi_wpa_psk (const char *detail, nm_setting_wireless_security_add_group (s_wsec, "ccmp"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, detail, "failed to verify connection: %s", |