|
|
fc9aca |
From c10c09d54b7e38dae1c73be0c5b3c7e01ac57315 Mon Sep 17 00:00:00 2001
|
|
|
fc9aca |
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
|
fc9aca |
Date: Tue, 23 May 2017 15:56:27 +0200
|
|
|
fc9aca |
Subject: [PATCH 1/2] clients: fix setter for 802-1x.password-raw
|
|
|
fc9aca |
|
|
|
fc9aca |
The property is a GBytes, not a GByteArray.
|
|
|
fc9aca |
|
|
|
fc9aca |
https://bugzilla.gnome.org/show_bug.cgi?id=782836
|
|
|
fc9aca |
(cherry picked from commit 30393ee2360e8678188cc47d794f2199d50e82ba)
|
|
|
fc9aca |
(cherry picked from commit cc6c9468fc01d69505141ee8956766079dbed903)
|
|
|
fc9aca |
---
|
|
|
fc9aca |
clients/cli/settings.c | 23 ++++++++++++-----------
|
|
|
fc9aca |
1 file changed, 12 insertions(+), 11 deletions(-)
|
|
|
fc9aca |
|
|
|
fc9aca |
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
|
|
|
fc9aca |
index 87b1f50..3bcd09c 100644
|
|
|
fc9aca |
--- a/clients/cli/settings.c
|
|
|
fc9aca |
+++ b/clients/cli/settings.c
|
|
|
fc9aca |
@@ -1643,11 +1643,12 @@ nmc_util_is_domain (const char *domain)
|
|
|
fc9aca |
}
|
|
|
fc9aca |
|
|
|
fc9aca |
static gboolean
|
|
|
fc9aca |
-nmc_property_set_byte_array (NMSetting *setting, const char *prop, const char *val, GError **error)
|
|
|
fc9aca |
+nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *val, GError **error)
|
|
|
fc9aca |
{
|
|
|
fc9aca |
- char **strv = NULL, **iter;
|
|
|
fc9aca |
- char *val_strip;
|
|
|
fc9aca |
+ gs_free char *val_strip = NULL;
|
|
|
fc9aca |
+ gs_strfreev char **strv = NULL;
|
|
|
fc9aca |
const char *delimiters = " \t,";
|
|
|
fc9aca |
+ char **iter;
|
|
|
fc9aca |
long int val_int;
|
|
|
fc9aca |
GBytes *bytes;
|
|
|
fc9aca |
GByteArray *array = NULL;
|
|
|
fc9aca |
@@ -1659,10 +1660,8 @@ nmc_property_set_byte_array (NMSetting *setting, const char *prop, const char *v
|
|
|
fc9aca |
|
|
|
fc9aca |
/* First try hex string in the format of AAbbCCDd */
|
|
|
fc9aca |
bytes = nm_utils_hexstr2bin (val_strip);
|
|
|
fc9aca |
- if (bytes) {
|
|
|
fc9aca |
- array = g_bytes_unref_to_array (bytes);
|
|
|
fc9aca |
+ if (bytes)
|
|
|
fc9aca |
goto done;
|
|
|
fc9aca |
- }
|
|
|
fc9aca |
|
|
|
fc9aca |
/* Otherwise, consider the following format: AA b 0xCc D */
|
|
|
fc9aca |
strv = nmc_strsplit_set (val_strip, delimiters, 0);
|
|
|
fc9aca |
@@ -1670,19 +1669,21 @@ nmc_property_set_byte_array (NMSetting *setting, const char *prop, const char *v
|
|
|
fc9aca |
for (iter = strv; iter && *iter; iter++) {
|
|
|
fc9aca |
if (!nmc_string_to_int_base (g_strstrip (*iter), 16, TRUE, 0, 255, &val_int)) {
|
|
|
fc9aca |
g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter);
|
|
|
fc9aca |
+ g_byte_array_free (array, TRUE);
|
|
|
fc9aca |
success = FALSE;
|
|
|
fc9aca |
goto done;
|
|
|
fc9aca |
}
|
|
|
fc9aca |
g_byte_array_append (array, (const guint8 *) &val_int, 1);
|
|
|
fc9aca |
}
|
|
|
fc9aca |
+ bytes = g_byte_array_free_to_bytes (array);
|
|
|
fc9aca |
|
|
|
fc9aca |
done:
|
|
|
fc9aca |
if (success)
|
|
|
fc9aca |
- g_object_set (setting, prop, array, NULL);
|
|
|
fc9aca |
+ g_object_set (setting, prop, bytes, NULL);
|
|
|
fc9aca |
+
|
|
|
fc9aca |
+ if (bytes)
|
|
|
fc9aca |
+ g_bytes_unref (bytes);
|
|
|
fc9aca |
|
|
|
fc9aca |
- g_strfreev (strv);
|
|
|
fc9aca |
- if (array)
|
|
|
fc9aca |
- g_byte_array_free (array, TRUE);
|
|
|
fc9aca |
return success;
|
|
|
fc9aca |
}
|
|
|
fc9aca |
|
|
|
fc9aca |
@@ -2186,7 +2187,7 @@ DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase2_autheap, _802_1X_val
|
|
|
fc9aca |
static gboolean
|
|
|
fc9aca |
nmc_property_802_1X_set_password_raw (NMSetting *setting, const char *prop, const char *val, GError **error)
|
|
|
fc9aca |
{
|
|
|
fc9aca |
- return nmc_property_set_byte_array (setting, prop, val, error);
|
|
|
fc9aca |
+ return nmc_property_set_bytes (setting, prop, val, error);
|
|
|
fc9aca |
}
|
|
|
fc9aca |
|
|
|
fc9aca |
static const char *
|
|
|
fc9aca |
--
|
|
|
fc9aca |
2.9.3
|
|
|
fc9aca |
|
|
|
fc9aca |
From 3ad0b8645e890523da23f550dc6db75c40da2718 Mon Sep 17 00:00:00 2001
|
|
|
fc9aca |
From: Thomas Haller <thaller@redhat.com>
|
|
|
fc9aca |
Date: Tue, 23 May 2017 16:01:54 +0200
|
|
|
fc9aca |
Subject: [PATCH 2/2] clients: fix appending integer to result in
|
|
|
fc9aca |
nmc_property_set_bytes()
|
|
|
fc9aca |
|
|
|
fc9aca |
(cherry picked from commit d76c190dc72df042733cca13849e18bcc13eed65)
|
|
|
fc9aca |
(cherry picked from commit 06d3c95e4fc70561b12be80e5982487443d914ec)
|
|
|
fc9aca |
---
|
|
|
fc9aca |
clients/cli/settings.c | 5 ++++-
|
|
|
fc9aca |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
fc9aca |
|
|
|
fc9aca |
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
|
|
|
fc9aca |
index 3bcd09c..e0f045a 100644
|
|
|
fc9aca |
--- a/clients/cli/settings.c
|
|
|
fc9aca |
+++ b/clients/cli/settings.c
|
|
|
fc9aca |
@@ -1667,13 +1667,16 @@ nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *val, G
|
|
|
fc9aca |
strv = nmc_strsplit_set (val_strip, delimiters, 0);
|
|
|
fc9aca |
array = g_byte_array_sized_new (g_strv_length (strv));
|
|
|
fc9aca |
for (iter = strv; iter && *iter; iter++) {
|
|
|
fc9aca |
+ guint8 v8;
|
|
|
fc9aca |
+
|
|
|
fc9aca |
if (!nmc_string_to_int_base (g_strstrip (*iter), 16, TRUE, 0, 255, &val_int)) {
|
|
|
fc9aca |
g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter);
|
|
|
fc9aca |
g_byte_array_free (array, TRUE);
|
|
|
fc9aca |
success = FALSE;
|
|
|
fc9aca |
goto done;
|
|
|
fc9aca |
}
|
|
|
fc9aca |
- g_byte_array_append (array, (const guint8 *) &val_int, 1);
|
|
|
fc9aca |
+ v8 = val_int;
|
|
|
fc9aca |
+ g_byte_array_append (array, &v8, 1);
|
|
|
fc9aca |
}
|
|
|
fc9aca |
bytes = g_byte_array_free_to_bytes (array);
|
|
|
fc9aca |
|
|
|
fc9aca |
--
|
|
|
fc9aca |
2.9.3
|
|
|
fc9aca |
|