[PATCH] Add support for xlat'd challenge in rlm_eap_gtc
Alexander Clouter
alex at digriz.org.uk
Mon Nov 8 19:29:30 CET 2010
The FIXME in rlm_eap_gtc.c has gone on so long unloved. God said, let
there be xlat'ing and so there was...
This patch shamelessly steals the xlat functionality in
rlm_eap_tls.c and slaps it into rlm_eap_gtc.c, thus lettings
you do handy things such as:
----
challenge = "%{reply:Reply-Message}"
----
Signed-off-by: Alexander Clouter <alex at digriz.org.uk>
---
.../rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c
index b8d3a25..de7d6a2 100644
--- a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c
+++ b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c
@@ -110,14 +110,17 @@ static int gtc_attach(CONF_SECTION *cs, void **instance)
*/
static int gtc_initiate(void *type_data, EAP_HANDLER *handler)
{
+ char challenge_str[1024];
int length;
EAP_DS *eap_ds = handler->eap_ds;
rlm_eap_gtc_t *inst = (rlm_eap_gtc_t *) type_data;
- /*
- * FIXME: call radius_xlat on the challenge
- */
- length = strlen(inst->challenge);
+ if (!radius_xlat(challenge_str, sizeof(challenge_str), inst->challenge, handler->request, NULL)) {
+ radlog(L_ERR, "rlm_eap_gtc: xlat failed.", inst->challenge);
+ return 0;
+ }
+
+ length = strlen(challenge_str);
/*
* We're sending a request...
@@ -130,7 +133,7 @@ static int gtc_initiate(void *type_data, EAP_HANDLER *handler)
return 0;
}
- memcpy(eap_ds->request->type.data, inst->challenge, length);
+ memcpy(eap_ds->request->type.data, challenge_str, length);
eap_ds->request->type.length = length;
/*
--
1.5.6.5
More information about the Freeradius-Devel
mailing list