- * Copyright (C) 2010 BMW Car IT GmbH. All rights reserved.
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2010,2013-2014 BMW Car IT GmbH.
+ * Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
{ "PPPD.RequirMPPE40", "require-mppe-40", NULL, OPT_BOOL },
{ "PPPD.RequirMPPE128", "require-mppe-128", NULL, OPT_BOOL },
{ "PPPD.RequirMPPEStateful", "mppe-stateful", NULL, OPT_BOOL },
{ "PPPD.RequirMPPE40", "require-mppe-40", NULL, OPT_BOOL },
{ "PPPD.RequirMPPE128", "require-mppe-128", NULL, OPT_BOOL },
{ "PPPD.RequirMPPEStateful", "mppe-stateful", NULL, OPT_BOOL },
- { "PPPD.NoVJ", "no-vj-comp", NULL, OPT_BOOL },
+ { "PPPD.NoVJ", "novj", NULL, OPT_BOOL },
return NULL;
user = vpn_provider_get_string(provider, "PPTP.User");
passwd = vpn_provider_get_string(provider, "PPTP.Password");
return NULL;
user = vpn_provider_get_string(provider, "PPTP.User");
passwd = vpn_provider_get_string(provider, "PPTP.Password");
return NULL;
dbus_message_append_args(reply, DBUS_TYPE_STRING, &user,
return NULL;
dbus_message_append_args(reply, DBUS_TYPE_STRING, &user,
dbus_message_iter_get_basic(&iter, &reason);
dbus_message_iter_next(&iter);
dbus_message_iter_get_basic(&iter, &reason);
dbus_message_iter_next(&iter);
DBG("authentication failure");
vpn_provider_set_string(provider, "PPTP.User", NULL);
DBG("authentication failure");
vpn_provider_set_string(provider, "PPTP.User", NULL);
- if (!strcmp(key, "INTERNAL_IP4_ADDRESS")) {
- vpn_provider_set_string(provider, "Address", value);
+ if (!strcmp(key, "INTERNAL_IP4_ADDRESS"))
- if (!strcmp(key, "INTERNAL_IP4_NETMASK")) {
- vpn_provider_set_string(provider, "Netmask", value);
+ if (!strcmp(key, "INTERNAL_IP4_NETMASK"))
- if (!strcmp(key, "INTERNAL_IP4_DNS")) {
- vpn_provider_set_string(provider, "DNS", value);
+ if (!strcmp(key, "INTERNAL_IP4_DNS"))
if (!strcmp(key, "INTERNAL_IFNAME"))
ifname = g_strdup(value);
if (!strcmp(key, "INTERNAL_IFNAME"))
ifname = g_strdup(value);
vpn_provider_set_string(provider, "Gateway", value);
gateway = g_strdup(value);
}
vpn_provider_set_string(provider, "Gateway", value);
gateway = g_strdup(value);
}
connman_ipaddress_set_ipv4(ipaddress, addressv4, netmask,
gateway);
connman_ipaddress_set_ipv4(ipaddress, addressv4, netmask,
gateway);
static void pptp_write_bool_option(struct connman_task *task,
const char *key, const char *value)
{
static void pptp_write_bool_option(struct connman_task *task,
const char *key, const char *value)
{
if (strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "true") == 0 ||
strcmp(value, "1") == 0)
if (strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "true") == 0 ||
strcmp(value, "1") == 0)
static void request_input_reply(DBusMessage *reply, void *user_data)
{
struct request_input_reply *pptp_reply = user_data;
static void request_input_reply(DBusMessage *reply, void *user_data)
{
struct request_input_reply *pptp_reply = user_data;
const char *error = NULL;
char *username = NULL, *password = NULL;
char *key;
DBusMessageIter iter, dict;
const char *error = NULL;
char *username = NULL, *password = NULL;
char *key;
DBusMessageIter iter, dict;
- if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
+ if (!reply)
+ goto done;
+
+ data = pptp_reply->user_data;
+
+ err = vpn_agent_check_and_process_reply_error(reply,
+ pptp_reply->provider, data->task, data->cb,
+ data->user_data);
+ if (err) {
+ /* Ensure cb is called only once */
+ data->cb = NULL;
+ data->user_data = NULL;
const char *error, void *user_data);
static int request_input(struct vpn_provider *provider,
const char *error, void *user_data);
static int request_input(struct vpn_provider *provider,
- connman_agent_get_info(&agent_sender, &agent_path);
-
- if (provider == NULL || agent_path == NULL || callback == NULL)
+ agent = connman_agent_get_info(dbus_sender, &agent_sender,
+ &agent_path);
+ if (!provider || !agent || !agent_path || !callback)
vpn_agent_append_user_info(&dict, provider, "PPTP.User");
vpn_agent_append_host_and_name(&dict, provider);
vpn_agent_append_user_info(&dict, provider, "PPTP.User");
vpn_agent_append_host_and_name(&dict, provider);
connman_dbus_dict_close(&iter, &dict);
pptp_reply = g_try_new0(struct request_input_reply, 1);
connman_dbus_dict_close(&iter, &dict);
pptp_reply = g_try_new0(struct request_input_reply, 1);
err = connman_agent_queue_message(provider, message,
connman_timeout_input_request(),
err = connman_agent_queue_message(provider, message,
connman_timeout_input_request(),
if (err < 0 && err != -EBUSY) {
DBG("error %d sending agent request", err);
dbus_message_unref(message);
if (err < 0 && err != -EBUSY) {
DBG("error %d sending agent request", err);
dbus_message_unref(message);
- host = vpn_provider_get_string(provider, "Host");
- if (host == NULL) {
- connman_error("Host not set; cannot enable VPN");
- err = -EINVAL;
- goto done;
- }
-
- if (username == NULL || password == NULL) {
+ if (!username || !password) {
connman_task_add_argument(task, "nodetach", NULL);
connman_task_add_argument(task, "lock", NULL);
connman_task_add_argument(task, "nodetach", NULL);
connman_task_add_argument(task, "lock", NULL);
connman_task_add_argument(task, "usepeerdns", NULL);
connman_task_add_argument(task, "noipdefault", NULL);
connman_task_add_argument(task, "noauth", NULL);
connman_task_add_argument(task, "usepeerdns", NULL);
connman_task_add_argument(task, "noipdefault", NULL);
connman_task_add_argument(task, "noauth", NULL);
for (i = 0; i < (int)ARRAY_SIZE(pptp_options); i++) {
opt_s = vpn_provider_get_string(provider,
pptp_options[i].cm_opt);
for (i = 0; i < (int)ARRAY_SIZE(pptp_options); i++) {
opt_s = vpn_provider_get_string(provider,
pptp_options[i].cm_opt);
run_connect(provider, data->task, data->if_name, data->cb,
data->user_data, username, password);
run_connect(provider, data->task, data->if_name, data->cb,
data->user_data, username, password);
static int pptp_connect(struct vpn_provider *provider,
struct connman_task *task, const char *if_name,
static int pptp_connect(struct vpn_provider *provider,
struct connman_task *task, const char *if_name,
struct pptp_private_data *data;
data = g_try_new0(struct pptp_private_data, 1);
struct pptp_private_data *data;
data = g_try_new0(struct pptp_private_data, 1);
- err = request_input(provider, request_input_cb, data);
+ err = request_input(provider, request_input_cb, dbus_sender,
+ data);
- vpn_provider_set_string(provider, "PPTP.Password", NULL);
+ if (!provider)
+ return;
+
+ vpn_provider_set_string_hide_value(provider, "PPTP.Password", NULL);
+
+ connman_agent_cancel(provider);