pptp: Set the username/password before starting daemon
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Wed, 13 Feb 2013 15:29:02 +0000 (17:29 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 19 Feb 2013 10:51:44 +0000 (12:51 +0200)
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/pptp.c

index c0d7c00..01b5e2b 100644 (file)
@@ -441,10 +441,6 @@ static int run_connect(struct vpn_provider *provider,
                goto done;
        }
 
-       vpn_provider_set_string(provider, "PPTP.User", username);
-       vpn_provider_set_string_hide_value(provider, "PPTP.Password",
-                                                               password);
-
        DBG("username %s password %p", username, password);
 
        str = g_strdup_printf("%s %s --nolaunchpppd --loglevel 2",
@@ -520,6 +516,10 @@ static void request_input_cb(struct vpn_provider *provider,
        else if (error != NULL)
                DBG("error %s", error);
 
+       vpn_provider_set_string(provider, "PPTP.User", username);
+       vpn_provider_set_string_hide_value(provider, "PPTP.Password",
+                                                               password);
+
        run_connect(provider, data->task, data->if_name, data->cb,
                data->user_data, username, password);