charon-cmd: add --eap-identity and --xauth-username options

This commit is contained in:
Martin Willi
2013-07-29 09:00:49 +02:00
parent 3a399574c2
commit 44bb1dc3da
4 changed files with 37 additions and 0 deletions
+25
View File
@@ -101,6 +101,11 @@ struct private_cmd_connection_t {
*/
char *identity;
/**
* XAuth/EAP identity
*/
char *xautheap;
/**
* Is a private key configured
*/
@@ -187,6 +192,22 @@ static void add_auth_cfg(private_cmd_connection_t *this, peer_cfg_t *peer_cfg,
if (local)
{
id = identification_create_from_string(this->identity);
if (this->xautheap)
{
switch (class)
{
case AUTH_CLASS_EAP:
auth->add(auth, AUTH_RULE_EAP_IDENTITY,
identification_create_from_string(this->xautheap));
break;
case AUTH_CLASS_XAUTH:
auth->add(auth, AUTH_RULE_XAUTH_IDENTITY,
identification_create_from_string(this->xautheap));
break;
default:
break;
}
}
}
else
{
@@ -411,6 +432,10 @@ METHOD(cmd_connection_t, handle, bool,
case CMD_OPT_IDENTITY:
this->identity = arg;
break;
case CMD_OPT_EAP_IDENTITY:
case CMD_OPT_XAUTH_USER:
this->xautheap = arg;
break;
case CMD_OPT_RSA:
case CMD_OPT_AGENT:
case CMD_OPT_PKCS12: