aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/plugins/nm
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/plugins/nm')
-rw-r--r--src/charon/plugins/nm/gnome/auth-dialog/main.c14
-rw-r--r--src/charon/plugins/nm/gnome/properties/nm-strongswan.c24
-rw-r--r--src/charon/plugins/nm/gnome/properties/nm-strongswan.h2
-rw-r--r--src/charon/plugins/nm/nm_creds.c36
-rw-r--r--src/charon/plugins/nm/nm_creds.h4
-rw-r--r--src/charon/plugins/nm/nm_handler.c18
-rw-r--r--src/charon/plugins/nm/nm_handler.h6
-rw-r--r--src/charon/plugins/nm/nm_plugin.c22
-rw-r--r--src/charon/plugins/nm/nm_service.c84
9 files changed, 105 insertions, 105 deletions
diff --git a/src/charon/plugins/nm/gnome/auth-dialog/main.c b/src/charon/plugins/nm/gnome/auth-dialog/main.c
index 84b3387e1..4ff926b22 100644
--- a/src/charon/plugins/nm/gnome/auth-dialog/main.c
+++ b/src/charon/plugins/nm/gnome/auth-dialog/main.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
- * Copyright (C) 2004 Dan Williams
+ * Copyright (C) 2004 Dan Williams
* Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@ static char *lookup_password(char *name, char *service)
for (iter = list; iter; iter = iter->next)
{
GnomeKeyringNetworkPasswordData *data = iter->data;
-
+
if (strcmp(data->object, "password") == 0 && data->password)
{
pass = g_strdup(data->password);
@@ -97,7 +97,7 @@ static char* get_connection_type(char *uuid)
}
g_slist_foreach(list, (GFunc)g_free, NULL);
g_slist_free(list);
-
+
if (found)
{
key = g_strdup_printf ("%s/%s/%s", found,
@@ -139,14 +139,14 @@ int main (int argc, char *argv[])
argc, argv,
GNOME_PARAM_GOPTION_CONTEXT, context,
GNOME_PARAM_NONE);
-
+
if (uuid == NULL || name == NULL || service == NULL)
{
fprintf (stderr, "Have to supply UUID, name, and service\n");
g_object_unref (program);
return 1;
}
-
+
if (strcmp(service, NM_DBUS_SERVICE_STRONGSWAN) != 0)
{
fprintf(stderr, "This dialog only works with the '%s' service\n",
@@ -154,7 +154,7 @@ int main (int argc, char *argv[])
g_object_unref (program);
return 1;
}
-
+
type = get_connection_type(uuid);
if (!type)
{
@@ -221,7 +221,7 @@ int main (int argc, char *argv[])
else
{
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
+ GTK_BUTTONS_OK,
_("Configuration uses ssh-agent for authentication, "
"but ssh-agent is not running!"));
gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/src/charon/plugins/nm/gnome/properties/nm-strongswan.c b/src/charon/plugins/nm/gnome/properties/nm-strongswan.c
index 18bf097ea..0c55d3abc 100644
--- a/src/charon/plugins/nm/gnome/properties/nm-strongswan.c
+++ b/src/charon/plugins/nm/gnome/properties/nm-strongswan.c
@@ -158,7 +158,7 @@ settings_changed_cb (GtkWidget *widget, gpointer user_data)
{
StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (user_data);
StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
-
+
if (widget == glade_xml_get_widget (priv->xml, "method-combo"))
{
update_layout(glade_xml_get_widget (priv->xml, "method-combo"), priv);
@@ -173,7 +173,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
NMSettingVPN *settings;
GtkWidget *widget;
const char *value;
-
+
settings = NM_SETTING_VPN(nm_connection_get_setting(connection, NM_TYPE_SETTING_VPN));
widget = glade_xml_get_widget (priv->xml, "address-entry");
value = nm_setting_vpn_get_data_item (settings, "address");
@@ -218,7 +218,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
}
update_layout (widget, priv);
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
-
+
widget = glade_xml_get_widget (priv->xml, "usercert-label");
gtk_widget_set_no_show_all (widget, TRUE);
widget = glade_xml_get_widget (priv->xml, "usercert-button");
@@ -227,7 +227,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
if (value)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
-
+
widget = glade_xml_get_widget (priv->xml, "userkey-label");
gtk_widget_set_no_show_all (widget, TRUE);
widget = glade_xml_get_widget (priv->xml, "userkey-button");
@@ -236,7 +236,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
if (value)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
-
+
widget = glade_xml_get_widget (priv->xml, "virtual-check");
value = nm_setting_vpn_get_data_item (settings, "virtual");
if (value && strcmp(value, "yes") == 0)
@@ -244,7 +244,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
}
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
-
+
widget = glade_xml_get_widget (priv->xml, "encap-check");
value = nm_setting_vpn_get_data_item (settings, "encap");
if (value && strcmp(value, "yes") == 0)
@@ -252,7 +252,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
}
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
-
+
widget = glade_xml_get_widget (priv->xml, "ipcomp-check");
value = nm_setting_vpn_get_data_item (settings, "ipcomp");
if (value && strcmp(value, "yes") == 0)
@@ -288,7 +288,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
if (!check_validity (self, error))
return FALSE;
settings = NM_SETTING_VPN (nm_setting_vpn_new ());
-
+
g_object_set (settings, NM_SETTING_VPN_SERVICE_TYPE,
NM_DBUS_SERVICE_STRONGSWAN, NULL);
@@ -303,7 +303,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
if (str) {
nm_setting_vpn_add_data_item (settings, "certificate", str);
}
-
+
widget = glade_xml_get_widget (priv->xml, "method-combo");
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)))
{
@@ -339,15 +339,15 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
break;
}
nm_setting_vpn_add_data_item (settings, "method", str);
-
+
widget = glade_xml_get_widget (priv->xml, "virtual-check");
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "virtual", active ? "yes" : "no");
-
+
widget = glade_xml_get_widget (priv->xml, "encap-check");
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "encap", active ? "yes" : "no");
-
+
widget = glade_xml_get_widget (priv->xml, "ipcomp-check");
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
nm_setting_vpn_add_data_item (settings, "ipcomp", active ? "yes" : "no");
diff --git a/src/charon/plugins/nm/gnome/properties/nm-strongswan.h b/src/charon/plugins/nm/gnome/properties/nm-strongswan.h
index 2ebd4bed1..e2b66bb15 100644
--- a/src/charon/plugins/nm/gnome/properties/nm-strongswan.h
+++ b/src/charon/plugins/nm/gnome/properties/nm-strongswan.h
@@ -28,7 +28,7 @@ typedef enum
STRONGSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY
} StrongswanPluginUiError;
-#define STRONGSWAN_TYPE_PLUGIN_UI_ERROR (strongswan_plugin_ui_error_get_type ())
+#define STRONGSWAN_TYPE_PLUGIN_UI_ERROR (strongswan_plugin_ui_error_get_type ())
GType strongswan_plugin_ui_error_get_type (void);
#define STRONGSWAN_TYPE_PLUGIN_UI (strongswan_plugin_ui_get_type ())
diff --git a/src/charon/plugins/nm/nm_creds.c b/src/charon/plugins/nm/nm_creds.c
index 9d1b0b895..1a35105cf 100644
--- a/src/charon/plugins/nm/nm_creds.c
+++ b/src/charon/plugins/nm/nm_creds.c
@@ -29,32 +29,32 @@ struct private_nm_creds_t {
* public functions
*/
nm_creds_t public;
-
+
/**
* gateway certificate
*/
certificate_t *cert;
-
+
/**
* User name
*/
identification_t *user;
-
+
/**
* User password
*/
char *pass;
-
+
/**
* users certificate
*/
certificate_t *usercert;
-
+
/**
* users private key
*/
private_key_t *key;
-
+
/**
* read/write lock
*/
@@ -68,13 +68,13 @@ static enumerator_t *create_usercert_enumerator(private_nm_creds_t *this,
certificate_type_t cert, key_type_t key)
{
public_key_t *public;
-
+
if (cert != CERT_ANY && cert != this->usercert->get_type(this->usercert))
{
return NULL;
}
if (key != KEY_ANY)
- {
+ {
public = this->usercert->get_public_key(this->usercert);
if (!public)
{
@@ -121,7 +121,7 @@ static enumerator_t* create_cert_enumerator(private_nm_creds_t *this,
if (key != KEY_ANY)
{
public_key_t *public;
-
+
public = this->cert->get_public_key(this->cert);
if (!public)
{
@@ -156,7 +156,7 @@ static enumerator_t* create_private_enumerator(private_nm_creds_t *this,
if (id && id->get_type(id) != ID_ANY)
{
chunk_t keyid;
-
+
if (id->get_type(id) != ID_KEY_ID ||
!this->key->get_fingerprint(this->key, KEY_ID_PUBKEY_SHA1, &keyid) ||
!chunk_equals(keyid, id->get_encoding(id)))
@@ -208,7 +208,7 @@ static void shared_destroy(shared_enumerator_t *this)
/**
* Implements credential_set_t.create_cert_enumerator
*/
-static enumerator_t* create_shared_enumerator(private_nm_creds_t *this,
+static enumerator_t* create_shared_enumerator(private_nm_creds_t *this,
shared_key_type_t type, identification_t *me,
identification_t *other)
{
@@ -226,7 +226,7 @@ static enumerator_t* create_shared_enumerator(private_nm_creds_t *this,
{
return NULL;
}
-
+
enumerator = malloc_thing(shared_enumerator_t);
enumerator->public.enumerate = (void*)shared_enumerate;
enumerator->public.destroy = (void*)shared_destroy;
@@ -267,7 +267,7 @@ static void set_username_password(private_nm_creds_t *this, identification_t *id
/**
* Implementation of nm_creds_t.set_cert_and_key
*/
-static void set_cert_and_key(private_nm_creds_t *this, certificate_t *cert,
+static void set_cert_and_key(private_nm_creds_t *this, certificate_t *cert,
private_key_t *key)
{
this->lock->write_lock(this->lock);
@@ -276,7 +276,7 @@ static void set_cert_and_key(private_nm_creds_t *this, certificate_t *cert,
this->key = key;
this->usercert = cert;
this->lock->unlock(this->lock);
-}
+}
/**
* Implementation of nm_creds_t.clear
@@ -311,7 +311,7 @@ static void destroy(private_nm_creds_t *this)
nm_creds_t *nm_creds_create()
{
private_nm_creds_t *this = malloc_thing(private_nm_creds_t);
-
+
this->public.set.create_private_enumerator = (void*)create_private_enumerator;
this->public.set.create_cert_enumerator = (void*)create_cert_enumerator;
this->public.set.create_shared_enumerator = (void*)create_shared_enumerator;
@@ -322,15 +322,15 @@ nm_creds_t *nm_creds_create()
this->public.set_cert_and_key = (void(*)(nm_creds_t*, certificate_t *cert, private_key_t *key))set_cert_and_key;
this->public.clear = (void(*)(nm_creds_t*))clear;
this->public.destroy = (void(*)(nm_creds_t*))destroy;
-
+
this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
-
+
this->cert = NULL;
this->user = NULL;
this->pass = NULL;
this->usercert = NULL;
this->key = NULL;
-
+
return &this->public;
}
diff --git a/src/charon/plugins/nm/nm_creds.h b/src/charon/plugins/nm/nm_creds.h
index 421442c81..754fe53df 100644
--- a/src/charon/plugins/nm/nm_creds.h
+++ b/src/charon/plugins/nm/nm_creds.h
@@ -35,14 +35,14 @@ struct nm_creds_t {
* Implements credential_set_t
*/
credential_set_t set;
-
+
/**
* Set the trusted gateway certificate to serve by this set.
*
* @param cert certificate to serve
*/
void (*set_certificate)(nm_creds_t *this, certificate_t *cert);
-
+
/**
* Set the username/password for authentication.
*
diff --git a/src/charon/plugins/nm/nm_handler.c b/src/charon/plugins/nm/nm_handler.c
index 026c47af2..7b9c10b65 100644
--- a/src/charon/plugins/nm/nm_handler.c
+++ b/src/charon/plugins/nm/nm_handler.c
@@ -23,17 +23,17 @@ typedef struct private_nm_handler_t private_nm_handler_t;
* Private data of an nm_handler_t object.
*/
struct private_nm_handler_t {
-
+
/**
* Public nm_handler_t interface.
*/
nm_handler_t public;
-
+
/**
* list of received DNS server attributes, pointer to 4 byte data
*/
linked_list_t *dns;
-
+
/**
* list of received NBNS server attributes, pointer to 4 byte data
*/
@@ -47,7 +47,7 @@ static bool handle(private_nm_handler_t *this, ike_sa_t *ike_sa,
configuration_attribute_type_t type, chunk_t data)
{
linked_list_t *list;
-
+
switch (type)
{
case INTERNAL_IP4_DNS:
@@ -83,7 +83,7 @@ static enumerator_t* create_enumerator(private_nm_handler_t *this,
configuration_attribute_type_t type)
{
linked_list_t *list;
-
+
switch (type)
{
case INTERNAL_IP4_DNS:
@@ -105,7 +105,7 @@ static enumerator_t* create_enumerator(private_nm_handler_t *this,
static void reset(private_nm_handler_t *this)
{
void *data;
-
+
while (this->dns->remove_last(this->dns, (void**)&data) == SUCCESS)
{
free(data);
@@ -133,16 +133,16 @@ static void destroy(private_nm_handler_t *this)
nm_handler_t *nm_handler_create()
{
private_nm_handler_t *this = malloc_thing(private_nm_handler_t);
-
+
this->public.handler.handle = (bool(*)(attribute_handler_t*, ike_sa_t*, configuration_attribute_type_t, chunk_t))handle;
this->public.handler.release = (void(*)(attribute_handler_t*, ike_sa_t*, configuration_attribute_type_t, chunk_t))nop;
this->public.create_enumerator = (enumerator_t*(*)(nm_handler_t*, configuration_attribute_type_t type))create_enumerator;
this->public.reset = (void(*)(nm_handler_t*))reset;
this->public.destroy = (void(*)(nm_handler_t*))destroy;
-
+
this->dns = linked_list_create();
this->nbns = linked_list_create();
-
+
return &this->public;
}
diff --git a/src/charon/plugins/nm/nm_handler.h b/src/charon/plugins/nm/nm_handler.h
index d537bb8de..3904ce1f0 100644
--- a/src/charon/plugins/nm/nm_handler.h
+++ b/src/charon/plugins/nm/nm_handler.h
@@ -29,12 +29,12 @@ typedef struct nm_handler_t nm_handler_t;
* Handles DNS/NBNS attributes to pass to NM.
*/
struct nm_handler_t {
-
+
/**
* Implements attribute handler interface
*/
attribute_handler_t handler;
-
+
/**
* Create an enumerator over received attributes of a given kind.
*
@@ -47,7 +47,7 @@ struct nm_handler_t {
* Reset state, flush all received attributes.
*/
void (*reset)(nm_handler_t *this);
-
+
/**
* Destroy a nm_handler_t.
*/
diff --git a/src/charon/plugins/nm/nm_plugin.c b/src/charon/plugins/nm/nm_plugin.c
index 1fb46f814..46cc9c39e 100644
--- a/src/charon/plugins/nm/nm_plugin.c
+++ b/src/charon/plugins/nm/nm_plugin.c
@@ -34,22 +34,22 @@ struct private_nm_plugin_t {
* implements plugin interface
*/
nm_plugin_t public;
-
+
/**
* NetworkManager service (VPNPlugin)
*/
NMStrongswanPlugin *plugin;
-
+
/**
* Glib main loop for a thread, handles DBUS calls
*/
GMainLoop *loop;
-
+
/**
* credential set registered at the daemon
*/
nm_creds_t *creds;
-
+
/**
* attribute handler regeisterd at the daemon
*/
@@ -96,16 +96,16 @@ static void destroy(private_nm_plugin_t *this)
plugin_t *plugin_create()
{
private_nm_plugin_t *this = malloc_thing(private_nm_plugin_t);
-
+
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
-
+
this->loop = NULL;
g_type_init ();
if (!g_thread_supported())
{
g_thread_init(NULL);
}
-
+
this->creds = nm_creds_create();
this->handler = nm_handler_create();
charon->credentials->add_set(charon->credentials, &this->creds->set);
@@ -117,13 +117,13 @@ plugin_t *plugin_create()
destroy(this);
return NULL;
}
-
+
/* bypass file permissions to read from users ssh-agent */
charon->keep_cap(charon, CAP_DAC_OVERRIDE);
-
- charon->processor->queue_job(charon->processor,
+
+ charon->processor->queue_job(charon->processor,
(job_t*)callback_job_create((callback_job_cb_t)run, this, NULL, NULL));
-
+
return &this->public.plugin;
}
diff --git a/src/charon/plugins/nm/nm_service.c b/src/charon/plugins/nm/nm_service.c
index 6aa5561f1..d896a432d 100644
--- a/src/charon/plugins/nm/nm_service.c
+++ b/src/charon/plugins/nm/nm_service.c
@@ -59,7 +59,7 @@ static GValue* handler_to_val(nm_handler_t *handler,
GArray *array;
enumerator_t *enumerator;
chunk_t chunk;
-
+
enumerator = handler->create_enumerator(handler, type);
array = g_array_new (FALSE, TRUE, sizeof (guint32));
while (enumerator->enumerate(enumerator, &chunk))
@@ -70,7 +70,7 @@ static GValue* handler_to_val(nm_handler_t *handler,
val = g_slice_new0 (GValue);
g_value_init (val, DBUS_TYPE_G_UINT_ARRAY);
g_value_set_boxed (val, array);
-
+
return val;
}
@@ -84,37 +84,37 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
GHashTable *config;
host_t *me, *other;
nm_handler_t *handler;
-
+
config = g_hash_table_new(g_str_hash, g_str_equal);
me = ike_sa->get_my_host(ike_sa);
other = ike_sa->get_other_host(ike_sa);
handler = NM_STRONGSWAN_PLUGIN_GET_PRIVATE(plugin)->handler;
-
+
/* NM requires a tundev, but netkey does not use one. Passing an invalid
* iface makes NM complain, but it accepts it without fiddling on eth0. */
val = g_slice_new0 (GValue);
g_value_init (val, G_TYPE_STRING);
g_value_set_string (val, "none");
g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, val);
-
+
val = g_slice_new0(GValue);
g_value_init(val, G_TYPE_UINT);
g_value_set_uint(val, *(u_int32_t*)me->get_address(me).ptr);
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, val);
-
+
val = g_slice_new0(GValue);
g_value_init(val, G_TYPE_UINT);
g_value_set_uint(val, me->get_address(me).len * 8);
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
-
+
val = handler_to_val(handler, INTERNAL_IP4_DNS);
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_DNS, val);
-
+
val = handler_to_val(handler, INTERNAL_IP4_NBNS);
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_NBNS, val);
-
+
handler->reset(handler);
-
+
nm_vpn_plugin_set_ip4_config(plugin, config);
}
@@ -124,11 +124,11 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
static void signal_failure(NMVPNPlugin *plugin, NMVPNPluginFailure failure)
{
nm_handler_t *handler = NM_STRONGSWAN_PLUGIN_GET_PRIVATE(plugin)->handler;
-
+
handler->reset(handler);
-
+
/* TODO: NM does not handle this failure!? */
- nm_vpn_plugin_failure(plugin, failure);
+ nm_vpn_plugin_failure(plugin, failure);
nm_vpn_plugin_set_state(plugin, NM_VPN_SERVICE_STATE_STOPPED);
}
@@ -139,7 +139,7 @@ static bool ike_state_change(listener_t *listener, ike_sa_t *ike_sa,
ike_sa_state_t state)
{
NMStrongswanPluginPrivate *private = (NMStrongswanPluginPrivate*)listener;
-
+
if (private->ike_sa == ike_sa && state == IKE_DESTROYING)
{
signal_failure(private->plugin, NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED);
@@ -155,7 +155,7 @@ static bool child_state_change(listener_t *listener, ike_sa_t *ike_sa,
child_sa_t *child_sa, child_sa_state_t state)
{
NMStrongswanPluginPrivate *private = (NMStrongswanPluginPrivate*)listener;
-
+
if (private->ike_sa == ike_sa && state == CHILD_DESTROYING)
{
signal_failure(private->plugin, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
@@ -171,7 +171,7 @@ static bool child_updown(listener_t *listener, ike_sa_t *ike_sa,
child_sa_t *child_sa, bool up)
{
NMStrongswanPluginPrivate *private = (NMStrongswanPluginPrivate*)listener;
-
+
if (private->ike_sa == ike_sa)
{
if (up)
@@ -195,7 +195,7 @@ static bool child_updown(listener_t *listener, ike_sa_t *ike_sa,
static bool ike_rekey(listener_t *listener, ike_sa_t *old, ike_sa_t *new)
{
NMStrongswanPluginPrivate *private = (NMStrongswanPluginPrivate*)listener;
-
+
if (private->ike_sa == old)
{ /* follow a rekeyed IKE_SA */
private->ike_sa = new;
@@ -232,7 +232,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
.jitter = 300 /* 5min */
}
};
-
+
/**
* Read parameters
*/
@@ -280,12 +280,12 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
auth_class = AUTH_CLASS_PUBKEY;
}
}
-
+
/**
* Register credentials
*/
priv->creds->clear(priv->creds);
-
+
/* gateway/CA cert */
str = nm_setting_vpn_get_data_item(vpn, "certificate");
if (str)
@@ -315,7 +315,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
gateway = gateway->clone(gateway);
DBG1(DBG_CFG, "using gateway certificate, identity '%Y'", gateway);
}
-
+
if (auth_class == AUTH_CLASS_EAP)
{
/* username/password authentication ... */
@@ -327,7 +327,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
priv->creds->set_username_password(priv->creds, user, (char*)str);
}
}
-
+
if (auth_class == AUTH_CLASS_PUBKEY)
{
/* ... or certificate/private key authenitcation */
@@ -336,7 +336,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
{
public_key_t *public;
private_key_t *private = NULL;
-
+
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
BUILD_FROM_FILE, str, BUILD_END);
if (!cert)
@@ -347,7 +347,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
gateway->destroy(gateway);
return FALSE;
}
- /* try agent */
+ /* try agent */
str = nm_setting_vpn_get_secret(vpn, "agent");
if (agent && str)
{
@@ -368,12 +368,12 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
"Connecting to SSH agent failed.");
}
}
- /* ... or key file */
+ /* ... or key file */
str = nm_setting_vpn_get_data_item(vpn, "userkey");
if (!agent && str)
{
chunk_t secret;
-
+
secret.ptr = (char*)nm_setting_vpn_get_secret(vpn, "password");
if (secret.ptr)
{
@@ -403,7 +403,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
}
}
}
-
+
if (!user)
{
g_set_error(err, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
@@ -411,7 +411,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
gateway->destroy(gateway);
return FALSE;
}
-
+
/**
* Set up configurations
*/
@@ -432,7 +432,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
auth->add(auth, AUTH_RULE_IDENTITY, gateway);
peer_cfg->add_auth_cfg(peer_cfg, auth, FALSE);
-
+
child_cfg = child_cfg_create(priv->name, &lifetime,
NULL, TRUE, MODE_TUNNEL, /* updown, hostaccess */
ACTION_NONE, ACTION_NONE, ipcomp);
@@ -444,7 +444,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
"255.255.255.255", 65535);
child_cfg->add_traffic_selector(child_cfg, FALSE, ts);
peer_cfg->add_child_cfg(peer_cfg, child_cfg);
-
+
/**
* Prepare IKE_SA
*/
@@ -458,7 +458,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
{
peer_cfg->destroy(peer_cfg);
}
-
+
/**
* Register listener, enable initiate-failure-detection hooks
*/
@@ -466,7 +466,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
priv->listener.ike_state_change = ike_state_change;
priv->listener.child_state_change = child_state_change;
charon->bus->add_listener(charon->bus, &priv->listener);
-
+
/**
* Initiate
*/
@@ -474,7 +474,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
{
charon->bus->remove_listener(charon->bus, &priv->listener);
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager, ike_sa);
-
+
g_set_error(err, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
"Initiating failed.");
return FALSE;
@@ -484,14 +484,14 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
}
/**
- * NeedSecrets called from NM via DBUS
+ * NeedSecrets called from NM via DBUS
*/
static gboolean need_secrets(NMVPNPlugin *plugin, NMConnection *connection,
char **setting_name, GError **error)
{
NMSettingVPN *settings;
const char *method, *path;
-
+
settings = NM_SETTING_VPN(nm_connection_get_setting(connection,
NM_TYPE_SETTING_VPN));
method = nm_setting_vpn_get_data_item(settings, "method");
@@ -518,7 +518,7 @@ static gboolean need_secrets(NMVPNPlugin *plugin, NMConnection *connection,
{
private_key_t *key;
chunk_t secret;
-
+
secret.ptr = (char*)nm_setting_vpn_get_secret(settings, "password");
if (secret.ptr)
{
@@ -541,7 +541,7 @@ static gboolean need_secrets(NMVPNPlugin *plugin, NMConnection *connection,
}
/**
- * Disconnect called from NM via DBUS
+ * Disconnect called from NM via DBUS
*/
static gboolean disconnect(NMVPNPlugin *plugin, GError **err)
{
@@ -549,7 +549,7 @@ static gboolean disconnect(NMVPNPlugin *plugin, GError **err)
enumerator_t *enumerator;
ike_sa_t *ike_sa;
u_int id;
-
+
/* our ike_sa pointer might be invalid, lookup sa */
enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
while (enumerator->enumerate(enumerator, &ike_sa))
@@ -564,7 +564,7 @@ static gboolean disconnect(NMVPNPlugin *plugin, GError **err)
}
}
enumerator->destroy(enumerator);
-
+
g_set_error(err, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_GENERAL,
"Connection not found.");
return FALSE;
@@ -576,7 +576,7 @@ static gboolean disconnect(NMVPNPlugin *plugin, GError **err)
static void nm_strongswan_plugin_init(NMStrongswanPlugin *plugin)
{
NMStrongswanPluginPrivate *priv;
-
+
priv = NM_STRONGSWAN_PLUGIN_GET_PRIVATE(plugin);
priv->plugin = NM_VPN_PLUGIN(plugin);
memset(&priv->listener.log, 0, sizeof(listener_t));
@@ -591,7 +591,7 @@ static void nm_strongswan_plugin_class_init(
NMStrongswanPluginClass *strongswan_class)
{
NMVPNPluginClass *parent_class = NM_VPN_PLUGIN_CLASS(strongswan_class);
-
+
g_type_class_add_private(G_OBJECT_CLASS(strongswan_class),
sizeof(NMStrongswanPluginPrivate));
parent_class->connect = connect_;
@@ -612,7 +612,7 @@ NMStrongswanPlugin *nm_strongswan_plugin_new(nm_creds_t *creds,
if (plugin)
{
NMStrongswanPluginPrivate *priv;
-
+
priv = NM_STRONGSWAN_PLUGIN_GET_PRIVATE(plugin);
priv->creds = creds;
priv->handler = handler;