mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
Remove conditional no-RADIUS build from src/radius
Make it responsibility of the src/radius user to handle conditional build rules.
This commit is contained in:
parent
0bc377fa93
commit
74784010af
@ -275,6 +275,7 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
|
||||
else
|
||||
reply_len += res;
|
||||
}
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
if (reply_len >= 0) {
|
||||
res = radius_client_get_mib(hapd->radius,
|
||||
reply + reply_len,
|
||||
@ -284,6 +285,7 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
|
||||
else
|
||||
reply_len += res;
|
||||
}
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
|
||||
reply_len = hostapd_ctrl_iface_sta_first(hapd, reply,
|
||||
reply_size);
|
||||
|
@ -75,7 +75,9 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
|
||||
time_t now;
|
||||
struct sta_info *sta;
|
||||
int i;
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
char *buf;
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
if (!hapd->conf->dump_log_name) {
|
||||
wpa_printf(MSG_DEBUG, "Dump file not defined - ignoring dump "
|
||||
@ -143,6 +145,7 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
|
||||
ieee802_1x_dump_state(f, " ", sta);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
buf = os_malloc(4096);
|
||||
if (buf) {
|
||||
int count = radius_client_get_mib(hapd->radius, buf, 4096);
|
||||
@ -162,6 +165,7 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
|
||||
fprintf(f, "%s", buf);
|
||||
os_free(buf);
|
||||
}
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,6 @@
|
||||
#include "tkip_countermeasures.h"
|
||||
|
||||
|
||||
static int hostapd_radius_get_eap_user(void *ctx, const u8 *identity,
|
||||
size_t identity_len, int phase2,
|
||||
struct eap_user *user);
|
||||
static int hostapd_flush_old_stations(struct hostapd_data *hapd);
|
||||
static int hostapd_setup_wpa(struct hostapd_data *hapd);
|
||||
static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
|
||||
@ -68,8 +65,11 @@ static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
|
||||
static void hostapd_sim_db_cb(void *ctx, void *session_ctx)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
if (ap_for_each_sta(hapd, hostapd_sim_db_cb_sta, session_ctx) == 0)
|
||||
if (ap_for_each_sta(hapd, hostapd_sim_db_cb_sta, session_ctx) == 0) {
|
||||
#ifdef RADIUS_SERVER
|
||||
radius_server_eap_pending_cb(hapd->radius_srv, session_ctx);
|
||||
#endif /* RADIUS_SERVER */
|
||||
}
|
||||
}
|
||||
#endif /* EAP_SERVER */
|
||||
|
||||
@ -135,9 +135,11 @@ int hostapd_reload_config(struct hostapd_iface *iface)
|
||||
for (j = 0; j < iface->num_bss; j++)
|
||||
hostapd_flush_old_stations(iface->bss[j]);
|
||||
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
/* TODO: update dynamic data based on changed configuration
|
||||
* items (e.g., open/close sockets, etc.) */
|
||||
radius_client_flush(hapd->radius, 0);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
oldconf = hapd->iconf;
|
||||
hapd->iconf = newconf;
|
||||
@ -304,10 +306,14 @@ static void hostapd_cleanup(struct hostapd_data *hapd)
|
||||
ieee802_1x_deinit(hapd);
|
||||
vlan_deinit(hapd);
|
||||
hostapd_acl_deinit(hapd);
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
radius_client_deinit(hapd->radius);
|
||||
hapd->radius = NULL;
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
#ifdef RADIUS_SERVER
|
||||
radius_server_deinit(hapd->radius_srv);
|
||||
hapd->radius_srv = NULL;
|
||||
#endif /* RADIUS_SERVER */
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
l2_packet_deinit(hapd->l2);
|
||||
@ -923,6 +929,47 @@ static int hostapd_setup_wpa(struct hostapd_data *hapd)
|
||||
}
|
||||
|
||||
|
||||
#ifdef RADIUS_SERVER
|
||||
|
||||
static int hostapd_radius_get_eap_user(void *ctx, const u8 *identity,
|
||||
size_t identity_len, int phase2,
|
||||
struct eap_user *user)
|
||||
{
|
||||
const struct hostapd_eap_user *eap_user;
|
||||
int i, count;
|
||||
|
||||
eap_user = hostapd_get_eap_user(ctx, identity, identity_len, phase2);
|
||||
if (eap_user == NULL)
|
||||
return -1;
|
||||
|
||||
if (user == NULL)
|
||||
return 0;
|
||||
|
||||
os_memset(user, 0, sizeof(*user));
|
||||
count = EAP_USER_MAX_METHODS;
|
||||
if (count > EAP_MAX_METHODS)
|
||||
count = EAP_MAX_METHODS;
|
||||
for (i = 0; i < count; i++) {
|
||||
user->methods[i].vendor = eap_user->methods[i].vendor;
|
||||
user->methods[i].method = eap_user->methods[i].method;
|
||||
}
|
||||
|
||||
if (eap_user->password) {
|
||||
user->password = os_malloc(eap_user->password_len);
|
||||
if (user->password == NULL)
|
||||
return -1;
|
||||
os_memcpy(user->password, eap_user->password,
|
||||
eap_user->password_len);
|
||||
user->password_len = eap_user->password_len;
|
||||
user->password_hash = eap_user->password_hash;
|
||||
}
|
||||
user->force_version = eap_user->force_version;
|
||||
user->ttls_auth = eap_user->ttls_auth;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int hostapd_setup_radius_srv(struct hostapd_data *hapd,
|
||||
struct hostapd_bss_config *conf)
|
||||
{
|
||||
@ -957,6 +1004,8 @@ static int hostapd_setup_radius_srv(struct hostapd_data *hapd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* RADIUS_SERVER */
|
||||
|
||||
|
||||
/**
|
||||
* hostapd_setup_bss - Per-BSS setup (initialization)
|
||||
@ -1061,11 +1110,13 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
|
||||
|
||||
if (wpa_debug_level == MSG_MSGDUMP)
|
||||
conf->radius->msg_dumps = 1;
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
hapd->radius = radius_client_init(hapd, conf->radius);
|
||||
if (hapd->radius == NULL) {
|
||||
wpa_printf(MSG_ERROR, "RADIUS client initialization failed.");
|
||||
return -1;
|
||||
}
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
if (hostapd_acl_init(hapd)) {
|
||||
wpa_printf(MSG_ERROR, "ACL initialization failed.");
|
||||
@ -1120,9 +1171,11 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
|
||||
|
||||
ieee802_11_set_beacon(hapd);
|
||||
|
||||
#ifdef RADIUS_SERVER
|
||||
if (conf->radius_server_clients &&
|
||||
hostapd_setup_radius_srv(hapd, conf))
|
||||
return -1;
|
||||
#endif /* RADIUS_SERVER */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1150,45 +1203,6 @@ static void hostapd_tx_queue_params(struct hostapd_iface *iface)
|
||||
}
|
||||
|
||||
|
||||
static int hostapd_radius_get_eap_user(void *ctx, const u8 *identity,
|
||||
size_t identity_len, int phase2,
|
||||
struct eap_user *user)
|
||||
{
|
||||
const struct hostapd_eap_user *eap_user;
|
||||
int i, count;
|
||||
|
||||
eap_user = hostapd_get_eap_user(ctx, identity, identity_len, phase2);
|
||||
if (eap_user == NULL)
|
||||
return -1;
|
||||
|
||||
if (user == NULL)
|
||||
return 0;
|
||||
|
||||
os_memset(user, 0, sizeof(*user));
|
||||
count = EAP_USER_MAX_METHODS;
|
||||
if (count > EAP_MAX_METHODS)
|
||||
count = EAP_MAX_METHODS;
|
||||
for (i = 0; i < count; i++) {
|
||||
user->methods[i].vendor = eap_user->methods[i].vendor;
|
||||
user->methods[i].method = eap_user->methods[i].method;
|
||||
}
|
||||
|
||||
if (eap_user->password) {
|
||||
user->password = os_malloc(eap_user->password_len);
|
||||
if (user->password == NULL)
|
||||
return -1;
|
||||
os_memcpy(user->password, eap_user->password,
|
||||
eap_user->password_len);
|
||||
user->password_len = eap_user->password_len;
|
||||
user->password_hash = eap_user->password_hash;
|
||||
}
|
||||
user->force_version = eap_user->force_version;
|
||||
user->ttls_auth = eap_user->ttls_auth;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int setup_interface(struct hostapd_iface *iface)
|
||||
{
|
||||
struct hostapd_data *hapd = iface->bss[0];
|
||||
|
@ -47,7 +47,9 @@ static void _pmksa_cache_free_entry(struct rsn_pmksa_cache_entry *entry)
|
||||
if (entry == NULL)
|
||||
return;
|
||||
os_free(entry->identity);
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
radius_free_class(&entry->radius_class);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
os_free(entry);
|
||||
}
|
||||
|
||||
@ -141,7 +143,9 @@ static void pmksa_cache_from_eapol_data(struct rsn_pmksa_cache_entry *entry,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
radius_copy_class(&entry->radius_class, &eapol->radius_class);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
entry->eap_type_authsrv = eapol->eap_type_authsrv;
|
||||
entry->vlan_id = ((struct sta_info *) eapol->sta)->vlan_id;
|
||||
@ -166,8 +170,10 @@ void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
|
||||
eapol->identity, eapol->identity_len);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
radius_free_class(&eapol->radius_class);
|
||||
radius_copy_class(&eapol->radius_class, &entry->radius_class);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
if (eapol->radius_class.attr) {
|
||||
wpa_printf(MSG_DEBUG, "Copied %lu Class attribute(s) from "
|
||||
"PMKSA", (unsigned long) eapol->radius_class.count);
|
||||
@ -300,7 +306,9 @@ pmksa_cache_add_okc(struct rsn_pmksa_cache *pmksa,
|
||||
old_entry->identity_len);
|
||||
}
|
||||
}
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
radius_copy_class(&entry->radius_class, &old_entry->radius_class);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
entry->eap_type_authsrv = old_entry->eap_type_authsrv;
|
||||
entry->vlan_id = old_entry->vlan_id;
|
||||
entry->opportunistic = 1;
|
||||
|
@ -188,7 +188,9 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
|
||||
ieee802_1x_free_station(sta);
|
||||
wpa_auth_sta_deinit(sta->wpa_sm);
|
||||
rsn_preauth_free_station(hapd, sta);
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
radius_client_flush_auth(hapd->radius, sta->addr);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
os_free(sta->last_assoc_req);
|
||||
os_free(sta->challenge);
|
||||
|
@ -280,20 +280,8 @@ struct radius_class_data {
|
||||
size_t count;
|
||||
};
|
||||
|
||||
#ifndef CONFIG_NO_RADIUS
|
||||
void radius_free_class(struct radius_class_data *c);
|
||||
int radius_copy_class(struct radius_class_data *dst,
|
||||
const struct radius_class_data *src);
|
||||
#else /* CONFIG_NO_RADIUS */
|
||||
static inline void radius_free_class(struct radius_class_data *c)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int radius_copy_class(struct radius_class_data *dst,
|
||||
const struct radius_class_data *src)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
#endif /* RADIUS_H */
|
||||
|
@ -251,34 +251,6 @@ int radius_client_send(struct radius_client_data *radius,
|
||||
struct radius_msg *msg,
|
||||
RadiusType msg_type, const u8 *addr);
|
||||
u8 radius_client_get_id(struct radius_client_data *radius);
|
||||
|
||||
#ifdef CONFIG_NO_RADIUS
|
||||
static inline void radius_client_flush(struct radius_client_data *radius,
|
||||
int only_auth)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct radius_client_data *
|
||||
radius_client_init(void *ctx, struct hostapd_radius_servers *conf)
|
||||
{
|
||||
return (void *) -1;
|
||||
}
|
||||
|
||||
static inline void radius_client_deinit(struct radius_client_data *radius)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void radius_client_flush_auth(struct radius_client_data *radius,
|
||||
const u8 *addr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int radius_client_get_mib(struct radius_client_data *radius,
|
||||
char *buf, size_t buflen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else /* CONFIG_NO_RADIUS */
|
||||
void radius_client_flush(struct radius_client_data *radius, int only_auth);
|
||||
struct radius_client_data *
|
||||
radius_client_init(void *ctx, struct hostapd_radius_servers *conf);
|
||||
@ -287,6 +259,5 @@ void radius_client_flush_auth(struct radius_client_data *radius,
|
||||
const u8 *addr);
|
||||
int radius_client_get_mib(struct radius_client_data *radius, char *buf,
|
||||
size_t buflen);
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
#endif /* RADIUS_CLIENT_H */
|
||||
|
@ -192,8 +192,6 @@ struct radius_server_conf {
|
||||
};
|
||||
|
||||
|
||||
#ifdef RADIUS_SERVER
|
||||
|
||||
struct radius_server_data *
|
||||
radius_server_init(struct radius_server_conf *conf);
|
||||
|
||||
@ -204,29 +202,4 @@ int radius_server_get_mib(struct radius_server_data *data, char *buf,
|
||||
|
||||
void radius_server_eap_pending_cb(struct radius_server_data *data, void *ctx);
|
||||
|
||||
#else /* RADIUS_SERVER */
|
||||
|
||||
static inline struct radius_server_data *
|
||||
radius_server_init(struct radius_server_conf *conf)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void radius_server_deinit(struct radius_server_data *data)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int radius_server_get_mib(struct radius_server_data *data,
|
||||
char *buf, size_t buflen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
radius_server_eap_pending_cb(struct radius_server_data *data, void *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* RADIUS_SERVER */
|
||||
|
||||
#endif /* RADIUS_SERVER_H */
|
||||
|
@ -1145,11 +1145,12 @@ OBJS_wpa += tests/link_test.o
|
||||
endif
|
||||
OBJS_wpa += $(OBJS_l2)
|
||||
OBJS += wpa_supplicant.o events.o blacklist.o wpas_glue.o scan.o
|
||||
OBJS_t := $(OBJS) $(OBJS_l2) eapol_test.o ../src/radius/radius_client.o
|
||||
ifndef CONFIG_IBSS_RSN
|
||||
OBJS_t := $(OBJS) $(OBJS_l2) eapol_test.o
|
||||
OBJS_t += ../src/radius/radius_client.o
|
||||
OBJS_t += ../src/radius/radius.o
|
||||
endif
|
||||
ifndef CONFIG_AP
|
||||
OBJS_t += ../src/utils/ip_addr.o
|
||||
endif
|
||||
OBJS_t2 := $(OBJS) $(OBJS_l2) preauth_test.o
|
||||
OBJS += $(CONFIG_MAIN).o
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user