|
@@ -1,6 +1,6 @@
|
|
|
/*
|
|
|
* RADIUS authentication server
|
|
|
- * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
|
|
+ * Copyright (c) 2005-2009, 2011, Jouni Malinen <j@w1.fi>
|
|
|
*
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
@@ -292,6 +292,10 @@ struct radius_server_data {
|
|
|
* msg_ctx - Context data for wpa_msg() calls
|
|
|
*/
|
|
|
void *msg_ctx;
|
|
|
+
|
|
|
+#ifdef CONFIG_RADIUS_TEST
|
|
|
+ char *dump_msk_file;
|
|
|
+#endif /* CONFIG_RADIUS_TEST */
|
|
|
};
|
|
|
|
|
|
|
|
@@ -574,6 +578,24 @@ radius_server_encapsulate_eap(struct radius_server_data *data,
|
|
|
|
|
|
if (code == RADIUS_CODE_ACCESS_ACCEPT && sess->eap_if->eapKeyData) {
|
|
|
int len;
|
|
|
+#ifdef CONFIG_RADIUS_TEST
|
|
|
+ if (data->dump_msk_file) {
|
|
|
+ FILE *f;
|
|
|
+ char buf[2 * 64 + 1];
|
|
|
+ f = fopen(data->dump_msk_file, "a");
|
|
|
+ if (f) {
|
|
|
+ len = sess->eap_if->eapKeyDataLen;
|
|
|
+ if (len > 64)
|
|
|
+ len = 64;
|
|
|
+ len = wpa_snprintf_hex(
|
|
|
+ buf, sizeof(buf),
|
|
|
+ sess->eap_if->eapKeyData, len);
|
|
|
+ buf[len] = '\0';
|
|
|
+ fprintf(f, "%s\n", buf);
|
|
|
+ fclose(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif /* CONFIG_RADIUS_TEST */
|
|
|
if (sess->eap_if->eapKeyDataLen > 64) {
|
|
|
len = 32;
|
|
|
} else {
|
|
@@ -1277,6 +1299,11 @@ radius_server_init(struct radius_server_conf *conf)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_RADIUS_TEST
|
|
|
+ if (conf->dump_msk_file)
|
|
|
+ data->dump_msk_file = os_strdup(conf->dump_msk_file);
|
|
|
+#endif /* CONFIG_RADIUS_TEST */
|
|
|
+
|
|
|
data->clients = radius_server_read_clients(conf->client_file,
|
|
|
conf->ipv6);
|
|
|
if (data->clients == NULL) {
|
|
@@ -1328,6 +1355,9 @@ void radius_server_deinit(struct radius_server_data *data)
|
|
|
os_free(data->eap_fast_a_id);
|
|
|
os_free(data->eap_fast_a_id_info);
|
|
|
os_free(data->eap_req_id_text);
|
|
|
+#ifdef CONFIG_RADIUS_TEST
|
|
|
+ os_free(data->dump_msk_file);
|
|
|
+#endif /* CONFIG_RADIUS_TEST */
|
|
|
os_free(data);
|
|
|
}
|
|
|
|