Commit 443e0559 authored by Nathan Dorfman's avatar Nathan Dorfman

ipsec: clean up startup commands, error handling, pointless strlens

parent 34847cc7
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* (C) Copyright 2011 Alexey Torkhov <atorkhov@gmail.com> * (C) Copyright 2011 Alexey Torkhov <atorkhov@gmail.com>
* (C) Copyright 2011 Geo Carncross <geocar@gmail.com> * (C) Copyright 2011 Geo Carncross <geocar@gmail.com>
* (C) Copyright 2012 Sergey Prokhorov <me@seriyps.ru> * (C) Copyright 2012 Sergey Prokhorov <me@seriyps.ru>
* (C) Copyright 2014 Nathan Dorfman <ndorf@rtfm.net>
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
...@@ -62,6 +63,8 @@ ...@@ -62,6 +63,8 @@
# define DIST_VERSION VERSION # define DIST_VERSION VERSION
#endif #endif
#define PATH_PREFIX "PATH=/usr/local/sbin:/usr/sbin:/sbin"
static gboolean debug = FALSE; static gboolean debug = FALSE;
/********************************************************/ /********************************************************/
...@@ -129,6 +132,15 @@ enum { ...@@ -129,6 +132,15 @@ enum {
}; };
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
static gboolean
nm_l2tp_ipsec_error(GError **error, const char *msg) {
g_set_error_literal (error,
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
_(msg));
return FALSE;
}
static gboolean static gboolean
_service_cache_credentials (NML2tpPppService *self, _service_cache_credentials (NML2tpPppService *self,
NMConnection *connection, NMConnection *connection,
...@@ -143,47 +155,25 @@ _service_cache_credentials (NML2tpPppService *self, ...@@ -143,47 +155,25 @@ _service_cache_credentials (NML2tpPppService *self,
s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN); s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
if (!s_vpn) { if (!s_vpn) {
g_set_error_literal (error, return nm_l2tp_ipsec_error(error, "Could not load NetworkManager connection settings.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
_("Could not find secrets (connection invalid, no vpn setting)."));
return FALSE;
} }
/* Username; try L2TP specific username first, then generic username */ /* Username; try L2TP specific username first, then generic username */
username = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_USER); username = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_USER);
if (username && strlen (username)) { if (!username || !*username) {
/* FIXME: This check makes about 0 sense. */
if (!username || !strlen (username)) {
g_set_error_literal (error,
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
_("Invalid VPN username."));
return FALSE;
}
} else {
username = nm_setting_vpn_get_user_name (s_vpn); username = nm_setting_vpn_get_user_name (s_vpn);
if (!username || !strlen (username)) { if (!username || !*username) {
g_set_error_literal (error, return nm_l2tp_ipsec_error(error, "Missing VPN username.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
_("Missing VPN username."));
return FALSE;
} }
} }
password = nm_setting_vpn_get_secret (s_vpn, NM_L2TP_KEY_PASSWORD); password = nm_setting_vpn_get_secret (s_vpn, NM_L2TP_KEY_PASSWORD);
if (!password || !strlen (password)) { if (!password || !*password) {
g_set_error_literal (error, return nm_l2tp_ipsec_error(error, "Missing or invalid VPN password.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
_("Missing or invalid VPN password."));
return FALSE;
} }
domain = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_DOMAIN); domain = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_DOMAIN);
if (domain && strlen (domain)) if (domain && *domain) priv->domain = g_strdup(domain);
priv->domain = g_strdup(domain);
priv->username = g_strdup(username); priv->username = g_strdup(username);
priv->password = g_strdup(password); priv->password = g_strdup(password);
...@@ -299,25 +289,18 @@ impl_l2tp_service_need_secrets (NML2tpPppService *self, ...@@ -299,25 +289,18 @@ impl_l2tp_service_need_secrets (NML2tpPppService *self,
g_signal_emit (G_OBJECT (self), signals[PLUGIN_ALIVE], 0); g_signal_emit (G_OBJECT (self), signals[PLUGIN_ALIVE], 0);
if (!strlen (priv->username) || !strlen (priv->password)) { if (!*priv->username || !*priv->password) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "No cached credentials.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
"%s",
_("No cached credentials."));
goto error;
} }
/* Success */ /* Success */
if (priv->domain && strlen (priv->domain)) if (priv->domain && *priv->domain) {
*out_username = g_strdup_printf ("%s\\%s", priv->domain, priv->username); *out_username = g_strdup_printf ("%s\\%s", priv->domain, priv->username);
else } else {
*out_username = g_strdup (priv->username); *out_username = g_strdup (priv->username);
}
*out_password = g_strdup (priv->password); *out_password = g_strdup (priv->password);
return TRUE; return TRUE;
error:
return FALSE;
} }
static gboolean static gboolean
...@@ -411,8 +394,7 @@ validate_gateway (const char *gateway) ...@@ -411,8 +394,7 @@ validate_gateway (const char *gateway)
{ {
const char *p = gateway; const char *p = gateway;
if (!gateway || !strlen (gateway)) if (!gateway || !*gateway) return FALSE;
return FALSE;
/* Ensure it's a valid DNS name or IP address */ /* Ensure it's a valid DNS name or IP address */
p = gateway; p = gateway;
...@@ -429,8 +411,7 @@ validate_ipsec_id (const char *id) ...@@ -429,8 +411,7 @@ validate_ipsec_id (const char *id)
{ {
const char *p = id; const char *p = id;
if (!id || !strlen (id)) if (!id || !*id) return TRUE;
return TRUE;
/* Ensure it's a valid id-name */ /* Ensure it's a valid id-name */
p = id; p = id;
...@@ -555,27 +536,20 @@ nm_l2tp_properties_validate (NMSettingVPN *s_vpn, ...@@ -555,27 +536,20 @@ nm_l2tp_properties_validate (NMSettingVPN *s_vpn,
nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info); nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info);
if (!info.have_items) { if (!info.have_items) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "No VPN configuration options.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"%s",
_("No VPN configuration options."));
return FALSE;
} }
if (*error) if (*error) return FALSE;
return FALSE;
/* Ensure required properties exist */ /* Ensure required properties exist */
for (i = 0; valid_properties[i].name; i++) { for (i = 0; valid_properties[i].name; i++) {
ValidProperty prop = valid_properties[i]; ValidProperty prop = valid_properties[i];
const char *value; const char *value;
if (!prop.required) if (!prop.required) continue;
continue;
value = nm_setting_vpn_get_data_item (s_vpn, prop.name); value = nm_setting_vpn_get_data_item (s_vpn, prop.name);
if (!value || !strlen (value)) { if (!value || !*value) {
g_set_error (error, g_set_error (error,
NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
...@@ -595,12 +569,7 @@ nm_l2tp_secrets_validate (NMSettingVPN *s_vpn, GError **error) ...@@ -595,12 +569,7 @@ nm_l2tp_secrets_validate (NMSettingVPN *s_vpn, GError **error)
nm_setting_vpn_foreach_secret (s_vpn, validate_one_property, &info); nm_setting_vpn_foreach_secret (s_vpn, validate_one_property, &info);
if (!info.have_items) { if (!info.have_items) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "No VPN secrets!");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"%s",
_("No VPN secrets!"));
return FALSE;
} }
return *error ? FALSE : TRUE; return *error ? FALSE : TRUE;
...@@ -856,7 +825,7 @@ nm_l2tp_stop_ipsec(void) ...@@ -856,7 +825,7 @@ nm_l2tp_stop_ipsec(void)
g_message("ipsec prepare for shut down"); g_message("ipsec prepare for shut down");
if (!(ipsec_binary=nm_find_ipsec())) return; if (!(ipsec_binary=nm_find_ipsec())) return;
sprintf(session_name, "nm-ipsec-l2tpd-%d", getpid()); sprintf(session_name, "nm-ipsec-l2tp-%d", getpid());
whack_argv = g_ptr_array_new (); whack_argv = g_ptr_array_new ();
g_ptr_array_add (whack_argv, (gpointer) g_strdup (ipsec_binary)); g_ptr_array_add (whack_argv, (gpointer) g_strdup (ipsec_binary));
g_ptr_array_add (whack_argv, (gpointer) g_strdup ("whack")); g_ptr_array_add (whack_argv, (gpointer) g_strdup ("whack"));
...@@ -885,49 +854,30 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin, ...@@ -885,49 +854,30 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin,
const char *ipsec_binary; const char *ipsec_binary;
const char *value; const char *value;
char tmp_secrets[128]; char tmp_secrets[128];
char cmd1[4096],cmd11[4096],cmd2[4096];
char session_name[128]; char session_name[128];
guint sys=0, sys_tmp=0; char cmdbuf[256];
int sys = 0;
int fd; int fd;
FILE *fp; FILE *fp;
gboolean rc = FALSE;
if (!(ipsec_binary=nm_find_ipsec())) { if (!(ipsec_binary=nm_find_ipsec())) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not find the ipsec binary. Is Openswan installed?");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Could not find the ipsec binary."));
return FALSE;
} }
sprintf(session_name, "nm-ipsec-l2tpd-%d", getpid());
sys += system("test -e /var/run/pluto/ipsec.info && . /var/run/pluto/ipsec.info;" sprintf(session_name, "nm-ipsec-l2tp-%d", getpid());
"PATH=/usr/local/sbin:/usr/sbin:/sbin; export PATH;"
sys = system("test -e /var/run/pluto/ipsec.info && . /var/run/pluto/ipsec.info;"
PATH_PREFIX "; export PATH;"
"if [ \"x$defaultrouteaddr\" = \"x\" ]; then ipsec setup restart; fi"); "if [ \"x$defaultrouteaddr\" = \"x\" ]; then ipsec setup restart; fi");
if ( sys != sys_tmp ) { if (sys) {
sys_tmp = sys; return nm_l2tp_ipsec_error(error, "Could not restart the ipsec service.");
g_warning("Possible error in IPSec setup: determine defaultrouteaddr or in \"ipsec setup restart\"");
} }
sys += system("PATH=/usr/local/sbin:/usr/sbin:/sbin ipsec whack" sys = system(PATH_PREFIX " ipsec whack --listen");
" --listen"); if (sys) {
if ( sys != sys_tmp ) { return nm_l2tp_ipsec_error(error, "Could not talk to IPsec key exchange service.");
sys_tmp = sys;
g_warning("Possible error in IPSec setup: ipsec whack --listen");
} }
sprintf(cmd1,"test -e /var/run/pluto/ipsec.info && . /var/run/pluto/ipsec.info;"
"PATH=/usr/local/sbin:/usr/sbin:/sbin ipsec addconn "
" ${defaultrouteaddr:+--defaultroute} $defaultrouteaddr"
" ${defaultroutenexthop:+--defaultroutenexthop} $defaultroutenexthop"
" --config /var/run/nm-ipsec-l2tp.%d/ipsec.conf --verbose"
" %s", getpid(),session_name);
sprintf(cmd11, "PATH=/usr/local/sbin:/usr/sbin:/sbin ipsec auto "
" --config /var/run/nm-ipsec-l2tp.%d/ipsec.conf --verbose"
" --add %s", getpid(),session_name);
sprintf(cmd2,"PATH=/usr/local/sbin:/usr/sbin:/sbin ipsec auto "
" --config /var/run/nm-ipsec-l2tp.%d/ipsec.conf --verbose"
" --up %s",getpid(),session_name);
/* the way this works is sadly very messy /* the way this works is sadly very messy
we replace the user's /etc/ipsec.secrets file we replace the user's /etc/ipsec.secrets file
...@@ -937,12 +887,7 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin, ...@@ -937,12 +887,7 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin,
*/ */
sprintf(tmp_secrets, "/etc/ipsec.secrets.%d",getpid()); sprintf(tmp_secrets, "/etc/ipsec.secrets.%d",getpid());
if(-1==rename("/etc/ipsec.secrets", tmp_secrets) && errno != EEXIST) { if(-1==rename("/etc/ipsec.secrets", tmp_secrets) && errno != EEXIST) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not save existing /etc/ipsec.secrets file.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Cannot save /etc/ipsec.secrets"));
return FALSE;
} }
fp = NULL; fp = NULL;
...@@ -951,12 +896,7 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin, ...@@ -951,12 +896,7 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin,
} }
if (NULL == fp) { if (NULL == fp) {
rename(tmp_secrets, "/etc/ipsec.secrets"); rename(tmp_secrets, "/etc/ipsec.secrets");
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not write /etc/ipsec.secrets file.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Cannot open /etc/ipsec.secrets for writing"));
return FALSE;
} }
value = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_IPSEC_GROUP_NAME); value = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_IPSEC_GROUP_NAME);
fprintf(fp, "%s%s ",value?"@":"", value?value:"%any"); fprintf(fp, "%s%s ",value?"@":"", value?value:"%any");
...@@ -970,44 +910,36 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin, ...@@ -970,44 +910,36 @@ nm_l2tp_start_ipsec(NML2tpPlugin *plugin,
fclose(fp); fclose(fp);
close(fd); close(fd);
sys += system("PATH=\"/sbin:/usr/sbin:/usr/local/sbin:$PATH\" ipsec secrets"); sys = system(PATH_PREFIX " ipsec secrets");
if ( sys != sys_tmp ) { if (!sys) {
sys_tmp = sys; sprintf(cmdbuf, PATH_PREFIX " ipsec auto "
g_warning("Possible error in IPSec setup: ipsec secrets"); " --config /var/run/nm-ipsec-l2tp.%d/ipsec.conf --verbose"
} " --add '%s'", getpid(),session_name);
sys += system(cmd11); sys = system(cmdbuf);
if ( sys != sys_tmp ) { if (!sys) {
sys_tmp = sys; sprintf(cmdbuf, PATH_PREFIX " ipsec auto "
g_warning("Possible error in IPSec setup: %s",cmd11); " --config /var/run/nm-ipsec-l2tp.%d/ipsec.conf --verbose"
} " --up '%s'",getpid(),session_name);
sys += system(cmd1); sys = system(cmdbuf);
if ( sys != sys_tmp ) { if (!sys) {
sys_tmp = sys; rc = TRUE;
g_warning("Possible error in IPSec setup: %s",cmd1); g_message(_("ipsec ready for action"));
} } else {
sys += system(cmd2); nm_l2tp_ipsec_error(error, "Could not establish IPsec tunnel.");
if ( sys != sys_tmp ) { }
sys_tmp = sys; } else {
g_warning("Possible error in IPSec setup: %s",cmd2); nm_l2tp_ipsec_error(error, "Could not configure IPsec tunnel.");
}
} else {
nm_l2tp_ipsec_error(error, "Could not load new IPsec secret.");
} }
rename(tmp_secrets, "/etc/ipsec.secrets"); if (rename(tmp_secrets, "/etc/ipsec.secrets") ||
sys += system("PATH=\"/sbin:/usr/sbin:/usr/local/sbin:$PATH\" ipsec secrets"); system(PATH_PREFIX " ipsec secrets")) {
if ( sys != sys_tmp ) { g_warning(_("Could not restore saved /etc/ipsec.secrets from %s."), _(tmp_secrets));
sys_tmp = sys;
g_warning("Possible error in IPSec setup: ipsec secrets");
}
if (sys != 0) {
g_set_error (error,
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Possible error in IPSec setup."));
return FALSE;
} }
g_message(_("ipsec ready for action")); return rc;
return TRUE;
} }
static gboolean static gboolean
...@@ -1023,12 +955,7 @@ nm_l2tp_start_l2tpd_binary (NML2tpPlugin *plugin, ...@@ -1023,12 +955,7 @@ nm_l2tp_start_l2tpd_binary (NML2tpPlugin *plugin,
l2tpd_binary = nm_find_l2tpd (); l2tpd_binary = nm_find_l2tpd ();
if (!l2tpd_binary) { if (!l2tpd_binary) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not find the xl2tpd binary.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Could not find the xl2tpd binary."));
return FALSE;
} }
l2tpd_argv = g_ptr_array_new (); l2tpd_argv = g_ptr_array_new ();
...@@ -1168,12 +1095,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1168,12 +1095,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
ipsec_fd = open (filename, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); ipsec_fd = open (filename, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
g_free (filename); g_free (filename);
if (ipsec_fd == -1) { if (ipsec_fd == -1) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not write ipsec config.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Could not write ipsec config."));
return FALSE;
} }
write_config_option (ipsec_fd, "version 2.0\n" write_config_option (ipsec_fd, "version 2.0\n"
"config setup\n" "config setup\n"
...@@ -1182,7 +1104,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1182,7 +1104,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
" protostack=netkey\n" " protostack=netkey\n"
" keep_alive=60\n" " keep_alive=60\n"
"\n"); "\n");
write_config_option (ipsec_fd, "conn nm-ipsec-l2tpd-%d\n", pid); write_config_option (ipsec_fd, "conn nm-ipsec-l2tp-%d\n", pid);
write_config_option (ipsec_fd, write_config_option (ipsec_fd,
" auto=add\n" " auto=add\n"
" type=transport\n" " type=transport\n"
...@@ -1214,12 +1136,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1214,12 +1136,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
if (conf_fd == -1) { if (conf_fd == -1) {
close(ipsec_fd); close(ipsec_fd);
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not write xl2tpd config.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Could not write xl2tpd config."));
return FALSE;
} }
filename = g_strdup_printf ("/var/run/nm-ppp-options.xl2tpd.%d", pid); filename = g_strdup_printf ("/var/run/nm-ppp-options.xl2tpd.%d", pid);
...@@ -1229,12 +1146,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1229,12 +1146,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
if (pppopt_fd == -1) { if (pppopt_fd == -1) {
close(ipsec_fd); close(ipsec_fd);
close(conf_fd); close(conf_fd);
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not write ppp options.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Could not write ppp options."));
return FALSE;
} }
/* L2TP options */ /* L2TP options */
...@@ -1263,7 +1175,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1263,7 +1175,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
if (priv->service) if (priv->service)
service_priv = NM_L2TP_PPP_SERVICE_GET_PRIVATE (priv->service); service_priv = NM_L2TP_PPP_SERVICE_GET_PRIVATE (priv->service);
if (service_priv && strlen (service_priv->username)) { if (service_priv && *service_priv->username) {
write_config_option (conf_fd, "name = %s\n", service_priv->username); write_config_option (conf_fd, "name = %s\n", service_priv->username);
} }
if (debug) if (debug)
...@@ -1293,7 +1205,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1293,7 +1205,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
and pppd on Linux clients won't work without the same option */ and pppd on Linux clients won't work without the same option */
write_config_option (pppopt_fd, "noccp\n"); write_config_option (pppopt_fd, "noccp\n");
if (service_priv && strlen (service_priv->username)) { if (service_priv && *service_priv->username) {
write_config_option (pppopt_fd, "name %s\n", service_priv->username); write_config_option (pppopt_fd, "name %s\n", service_priv->username);
} }
...@@ -1304,7 +1216,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1304,7 +1216,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
} }
value = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_LCP_ECHO_FAILURE); value = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_LCP_ECHO_FAILURE);
if (value && strlen (value)) { if (value && *value) {
long int tmp_int; long int tmp_int;
/* Convert to integer and then back to string for security's sake /* Convert to integer and then back to string for security's sake
...@@ -1322,7 +1234,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin, ...@@ -1322,7 +1234,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
} }
value = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_LCP_ECHO_INTERVAL); value = nm_setting_vpn_get_data_item (s_vpn, NM_L2TP_KEY_LCP_ECHO_INTERVAL);
if (value && strlen (value)) { if (value && *value) {
long int tmp_int; long int tmp_int;
/* Convert to integer and then back to string for security's sake /* Convert to integer and then back to string for security's sake
...@@ -1467,12 +1379,7 @@ real_connect (NMVPNPlugin *plugin, ...@@ -1467,12 +1379,7 @@ real_connect (NMVPNPlugin *plugin,
priv->service = nm_l2tp_ppp_service_new (connection, error); priv->service = nm_l2tp_ppp_service_new (connection, error);
if (!priv->service) { if (!priv->service) {
g_set_error (error, return nm_l2tp_ipsec_error(error, "Could not start pppd plugin helper service.");
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"%s",
_("Could not start pppd plugin helper service."));
return FALSE;
} }
priv->connection = g_object_ref (connection); priv->connection = g_object_ref (connection);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment