summaryrefslogtreecommitdiff
path: root/src/libcharon/sa/xauth
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
commit5313d2d78ca150515f7f5eb39801c100690b6b29 (patch)
treec78e420367283bb1b16f14210b12687cdfbd26eb /src/libcharon/sa/xauth
parent6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff)
downloadvyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz
vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libcharon/sa/xauth')
-rw-r--r--src/libcharon/sa/xauth/xauth_manager.c17
-rw-r--r--src/libcharon/sa/xauth/xauth_manager.h6
-rw-r--r--src/libcharon/sa/xauth/xauth_method.h4
3 files changed, 24 insertions, 3 deletions
diff --git a/src/libcharon/sa/xauth/xauth_manager.c b/src/libcharon/sa/xauth/xauth_manager.c
index 5709dc652..17eecc2c9 100644
--- a/src/libcharon/sa/xauth/xauth_manager.c
+++ b/src/libcharon/sa/xauth/xauth_manager.c
@@ -107,6 +107,17 @@ METHOD(xauth_manager_t, create_instance, xauth_method_t*,
enumerator_t *enumerator;
xauth_entry_t *entry;
xauth_method_t *method = NULL;
+ char *profile = NULL;
+
+ if (name)
+ {
+ profile = strchr(name, ':');
+ if (profile)
+ {
+ name = strndup(name, profile - name);
+ profile++;
+ }
+ }
this->lock->read_lock(this->lock);
enumerator = this->methods->create_enumerator(this->methods);
@@ -118,7 +129,7 @@ METHOD(xauth_manager_t, create_instance, xauth_method_t*,
}
if (role == entry->role && (!name || streq(name, entry->name)))
{
- method = entry->constructor(server, peer);
+ method = entry->constructor(server, peer, profile);
if (method)
{
break;
@@ -127,6 +138,10 @@ METHOD(xauth_manager_t, create_instance, xauth_method_t*,
}
enumerator->destroy(enumerator);
this->lock->unlock(this->lock);
+ if (profile)
+ {
+ free(name);
+ }
return method;
}
diff --git a/src/libcharon/sa/xauth/xauth_manager.h b/src/libcharon/sa/xauth/xauth_manager.h
index 929d5de8f..65b3c58a3 100644
--- a/src/libcharon/sa/xauth/xauth_manager.h
+++ b/src/libcharon/sa/xauth/xauth_manager.h
@@ -55,7 +55,11 @@ struct xauth_manager_t {
/**
* Create a new XAuth method instance.
*
- * @param name backend name, as it was registered with
+ * The name may contain an option string, separated by a colon. This option
+ * string gets passed to the XAuth constructor to specify the behavior
+ * of the XAuth method.
+ *
+ * @param name backend name, with optional config string
* @param role XAUTH_SERVER or XAUTH_PEER
* @param server identity of the server
* @param peer identity of the peer (client)
diff --git a/src/libcharon/sa/xauth/xauth_method.h b/src/libcharon/sa/xauth/xauth_method.h
index 9f6067dbf..701b4dc77 100644
--- a/src/libcharon/sa/xauth/xauth_method.h
+++ b/src/libcharon/sa/xauth/xauth_method.h
@@ -104,10 +104,12 @@ struct xauth_method_t {
*
* @param server ID of the server to use for credential lookup
* @param peer ID of the peer to use for credential lookup
+ * @param profile configuration string to pass to XAuth method, or NULL
* @return implementation of the eap_method_t interface
*/
typedef xauth_method_t *(*xauth_constructor_t)(identification_t *server,
- identification_t *peer);
+ identification_t *peer,
+ char *profile);
/**
* Helper function to (un-)register XAuth methods from plugin features.