xauth: add a configuration string option to be passed to XAuth instances
The configuration string is appended to the XAuth backend name, separated by a colon. The configuration string is passed untouched to the backend, where it can change the behavior of the XAuth module.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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, seperated 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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user