diff options
author | Thomas Haller <thaller@redhat.com> | 2014-05-27 15:43:42 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-05-29 19:01:00 +0200 |
commit | 415c86eb9ac88b0a8f614ea639baef9b5a39bca6 (patch) | |
tree | dbcd5f8b24f357fa5af064e2b5af7027d8e72e01 | |
parent | c4d90c56604e21b5b43539ee8e7707fbdf9c306e (diff) | |
download | NetworkManager-415c86eb9ac88b0a8f614ea639baef9b5a39bca6.tar.gz |
keyfile: don't check HWADDR length in mac_address_writer()
When converting the MAC address to keyfile value, simply accept
any given byte array and pass it to nm_utils_hwaddr_ntoa_len().
This no longer restricts the length of accepted addresses as known by
nm_utils_hwaddr_type(). It is up to the caller to perform any validation
of the MAC address.
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/settings/plugins/keyfile/writer.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index e95ec87493..82bea5b8aa 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.c @@ -414,22 +414,14 @@ mac_address_writer (GKeyFile *file, GByteArray *array; const char *setting_name = nm_setting_get_name (setting); char *mac; - int type; g_return_if_fail (G_VALUE_HOLDS (value, DBUS_TYPE_G_UCHAR_ARRAY)); array = (GByteArray *) g_value_get_boxed (value); - if (!array) - return; - - type = nm_utils_hwaddr_type (array->len); - if (type < 0) { - nm_log_warn (LOGD_SETTINGS, "%s: invalid %s / %s MAC address length %d", - __func__, setting_name, key, array->len); + if (!array || !array->len) return; - } - mac = nm_utils_hwaddr_ntoa (array->data, type); + mac = nm_utils_hwaddr_ntoa_len (array->data, array->len); nm_keyfile_plugin_kf_set_string (file, setting_name, key, mac); g_free (mac); } |