mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 22:30:19 +01:00
keyfile: convert relative cert/key paths to absolute ones when reading
Passing a relative path to wpa_supplicant does no good since the supplicant may not have the same working directory as NetworkManager. Relative paths used in keyfiles are assumed to be relative to the keyfile itself anyway, so actually use the absolute path we compute for the cert/key instead of leaving it relative.
This commit is contained in:
parent
c1dd530798
commit
06ec2a5382
2 changed files with 10 additions and 4 deletions
|
|
@ -865,7 +865,7 @@ cert_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char
|
|||
/* Construct the proper value as required for the PATH scheme */
|
||||
val = g_byte_array_sized_new (strlen (SCHEME_PATH) + array->len + 1);
|
||||
g_byte_array_append (val, (const guint8 *) SCHEME_PATH, strlen (SCHEME_PATH));
|
||||
g_byte_array_append (val, array->data, array->len);
|
||||
g_byte_array_append (val, (const guint8 *) path, strlen (path));
|
||||
g_byte_array_append (val, (const guint8 *) "\0", 1);
|
||||
g_object_set (setting, key, val, NULL);
|
||||
g_byte_array_free (val, TRUE);
|
||||
|
|
|
|||
|
|
@ -2019,6 +2019,7 @@ test_read_wired_8021x_tls_new_connection (void)
|
|||
NMSetting8021x *s_8021x;
|
||||
GError *error = NULL;
|
||||
const char *tmp;
|
||||
char *tmp2;
|
||||
gboolean success;
|
||||
|
||||
connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_TLS_NEW_FILE, &error);
|
||||
|
|
@ -2053,15 +2054,20 @@ test_read_wired_8021x_tls_new_connection (void)
|
|||
tmp = nm_setting_802_1x_get_private_key_password (s_8021x);
|
||||
g_assert (g_strcmp0 (tmp, "12345testing") == 0);
|
||||
|
||||
tmp2 = g_strdup_printf (TEST_KEYFILES_DIR "/test-ca-cert.pem");
|
||||
tmp = nm_setting_802_1x_get_ca_cert_path (s_8021x);
|
||||
g_assert (g_strcmp0 (tmp, "test-ca-cert.pem") == 0);
|
||||
g_assert_cmpstr (tmp, ==, tmp2);
|
||||
g_free (tmp2);
|
||||
|
||||
tmp2 = g_strdup_printf (TEST_KEYFILES_DIR "/test-key-and-cert.pem");
|
||||
|
||||
tmp = nm_setting_802_1x_get_client_cert_path (s_8021x);
|
||||
g_assert (g_strcmp0 (tmp, "test-key-and-cert.pem") == 0);
|
||||
g_assert_cmpstr (tmp, ==, tmp2);
|
||||
|
||||
tmp = nm_setting_802_1x_get_private_key_path (s_8021x);
|
||||
g_assert (g_strcmp0 (tmp, "test-key-and-cert.pem") == 0);
|
||||
g_assert_cmpstr (tmp, ==, tmp2);
|
||||
|
||||
g_free (tmp2);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue