summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-02-13 15:39:48 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-02-13 15:50:21 +0100
commitb2146a43e5591c1ae6fd94379749781858f4d057 (patch)
tree95ef3013d3137627ee02ca68093b6149dbad355d
parented07de8667b9687094fe2e08efeef5d0f9b0a936 (diff)
downloadNetworkManager-b2146a43e5591c1ae6fd94379749781858f4d057.tar.gz
cli: fix setting of private key password
We can't pass the password obtained from nm_setting_802_1x_get_*private_key_password() to nm_setting_802_1x_set_*private_key() as the latter also frees the old password. Fixes: afd281102879168f13fb4d1deff9535542ad6fc5
-rw-r--r--clients/cli/settings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index df0effa359..1c8d54626f 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -1916,6 +1916,7 @@ nmc_property_802_1X_get_phase2_private_key_full (NMSetting *setting, NmcProperty
char *val_strip = g_strstrip (g_strdup (val)); \
char *p = val_strip; \
const char *path, *password; \
+ gs_free char *password_free = NULL; \
NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_PATH; \
gboolean success; \
\
@@ -1929,7 +1930,7 @@ nmc_property_802_1X_get_phase2_private_key_full (NMSetting *setting, NmcProperty
if (g_strv_length (strv) == 2) \
password = strv[1]; \
else \
- password = pwd_func (NM_SETTING_802_1X (setting)); \
+ password = password_free = g_strdup (pwd_func (NM_SETTING_802_1X (setting))); \
success = set_func (NM_SETTING_802_1X (setting), path, password, scheme, NULL, error); \
g_free (val_strip); \
g_strfreev (strv); \