From 5052b3acb5d041ed9dd00397a36563850faacf00 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Feb 2013 17:29:01 +0200 Subject: [PATCH] l2tp: Set the username/password before starting daemon This is required in order to avoid free memory access that is happening if we call vpn_provider_set_string() with same string that is already in the settings db. --- vpn/plugins/l2tp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vpn/plugins/l2tp.c b/vpn/plugins/l2tp.c index 2a16ca6..a322178 100644 --- a/vpn/plugins/l2tp.c +++ b/vpn/plugins/l2tp.c @@ -642,10 +642,6 @@ static int run_connect(struct vpn_provider *provider, goto done; } - vpn_provider_set_string(provider, "L2TP.User", username); - vpn_provider_set_string_hide_value(provider, "L2TP.Password", - password); - DBG("username %s password %p", username, password); l2tp_name = g_strdup_printf("/var/run/connman/connman-xl2tpd.conf"); @@ -714,6 +710,10 @@ static void request_input_cb(struct vpn_provider *provider, else if (error != NULL) DBG("error %s", error); + vpn_provider_set_string(provider, "L2TP.User", username); + vpn_provider_set_string_hide_value(provider, "L2TP.Password", + password); + run_connect(provider, data->task, data->if_name, data->cb, data->user_data, username, password); -- 2.7.4