003 File Manager
Current Path:
/usr/src/contrib/wpa/src/ap
usr
/
src
/
contrib
/
wpa
/
src
/
ap
/
📁
..
📄
accounting.c
(14.53 KB)
📄
accounting.h
(1.12 KB)
📄
acs.c
(29.71 KB)
📄
acs.h
(764 B)
📄
airtime_policy.c
(6.82 KB)
📄
airtime_policy.h
(1.27 KB)
📄
ap_config.c
(33.39 KB)
📄
ap_config.h
(26.53 KB)
📄
ap_drv_ops.c
(25.84 KB)
📄
ap_drv_ops.h
(13.38 KB)
📄
ap_list.c
(6.82 KB)
📄
ap_list.h
(1.5 KB)
📄
ap_mlme.c
(5.64 KB)
📄
ap_mlme.h
(1007 B)
📄
authsrv.c
(8.72 KB)
📄
authsrv.h
(352 B)
📄
beacon.c
(40.32 KB)
📄
beacon.h
(1.25 KB)
📄
bss_load.c
(2.4 KB)
📄
bss_load.h
(376 B)
📄
ctrl_iface_ap.c
(24.3 KB)
📄
ctrl_iface_ap.h
(1.61 KB)
📄
dfs.c
(29.35 KB)
📄
dfs.h
(1.22 KB)
📄
dhcp_snoop.c
(3.36 KB)
📄
dhcp_snoop.h
(590 B)
📄
dpp_hostapd.c
(48.28 KB)
📄
dpp_hostapd.h
(1.74 KB)
📄
drv_callbacks.c
(51.68 KB)
📄
eap_user_db.c
(7.92 KB)
📄
eth_p_oui.c
(4.44 KB)
📄
eth_p_oui.h
(958 B)
📄
fils_hlp.c
(16.82 KB)
📄
fils_hlp.h
(547 B)
📄
gas_query_ap.c
(19.53 KB)
📄
gas_query_ap.h
(1.24 KB)
📄
gas_serv.c
(50.48 KB)
📄
gas_serv.h
(3.38 KB)
📄
hostapd.c
(89.58 KB)
📄
hostapd.h
(17.99 KB)
📄
hs20.c
(6.27 KB)
📄
hs20.h
(843 B)
📄
hw_features.c
(24.77 KB)
📄
hw_features.h
(1.93 KB)
📄
iapp.c
(14.59 KB)
📄
iapp.h
(833 B)
📄
ieee802_11.c
(148.71 KB)
📄
ieee802_11.h
(7.97 KB)
📄
ieee802_11_auth.c
(18.3 KB)
📄
ieee802_11_auth.h
(1.04 KB)
📄
ieee802_11_he.c
(8.77 KB)
📄
ieee802_11_ht.c
(16.22 KB)
📄
ieee802_11_shared.c
(23.95 KB)
📄
ieee802_11_vht.c
(13.4 KB)
📄
ieee802_1x.c
(83.16 KB)
📄
ieee802_1x.h
(2.84 KB)
📄
mbo_ap.c
(5.22 KB)
📄
mbo_ap.h
(1.16 KB)
📄
ndisc_snoop.c
(4.3 KB)
📄
ndisc_snoop.h
(838 B)
📄
neighbor_db.c
(6.49 KB)
📄
neighbor_db.h
(940 B)
📄
p2p_hostapd.c
(2.57 KB)
📄
p2p_hostapd.h
(888 B)
📄
pmksa_cache_auth.c
(18.79 KB)
📄
pmksa_cache_auth.h
(2.69 KB)
📄
preauth_auth.c
(6.47 KB)
📄
preauth_auth.h
(1.26 KB)
📄
rrm.c
(17.27 KB)
📄
rrm.h
(1.21 KB)
📄
sta_info.c
(41.42 KB)
📄
sta_info.h
(11.63 KB)
📄
taxonomy.c
(7.45 KB)
📄
taxonomy.h
(766 B)
📄
tkip_countermeasures.c
(2.95 KB)
📄
tkip_countermeasures.h
(451 B)
📄
utils.c
(2.29 KB)
📄
vlan.c
(756 B)
📄
vlan.h
(727 B)
📄
vlan_full.c
(18.35 KB)
📄
vlan_ifconfig.c
(1.47 KB)
📄
vlan_init.c
(5.88 KB)
📄
vlan_init.h
(1.09 KB)
📄
vlan_ioctl.c
(3.75 KB)
📄
vlan_util.c
(3.9 KB)
📄
vlan_util.h
(980 B)
📄
wmm.c
(11.47 KB)
📄
wmm.h
(653 B)
📄
wnm_ap.c
(23.69 KB)
📄
wnm_ap.h
(1.08 KB)
📄
wpa_auth.c
(140.03 KB)
📄
wpa_auth.h
(17.89 KB)
📄
wpa_auth_ft.c
(120.89 KB)
📄
wpa_auth_glue.c
(35.42 KB)
📄
wpa_auth_glue.h
(443 B)
📄
wpa_auth_i.h
(8.47 KB)
📄
wpa_auth_ie.c
(32.38 KB)
📄
wpa_auth_ie.h
(1.14 KB)
📄
wpa_auth_kay.c
(12.26 KB)
📄
wpa_auth_kay.h
(1.15 KB)
📄
wps_hostapd.c
(54.66 KB)
📄
wps_hostapd.h
(2.79 KB)
📄
x_snoop.c
(3.21 KB)
📄
x_snoop.h
(1.29 KB)
Editing: authsrv.c
/* * Authentication server setup * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "utils/includes.h" #include "utils/common.h" #include "crypto/tls.h" #include "eap_server/eap.h" #include "eap_server/eap_sim_db.h" #include "eapol_auth/eapol_auth_sm.h" #include "radius/radius_server.h" #include "hostapd.h" #include "ap_config.h" #include "sta_info.h" #include "authsrv.h" #if defined(EAP_SERVER_SIM) || defined(EAP_SERVER_AKA) #define EAP_SIM_DB #endif /* EAP_SERVER_SIM || EAP_SERVER_AKA */ #ifdef EAP_SIM_DB static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd, struct sta_info *sta, void *ctx) { if (eapol_auth_eap_pending_cb(sta->eapol_sm, ctx) == 0) return 1; return 0; } 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) { #ifdef RADIUS_SERVER radius_server_eap_pending_cb(hapd->radius_srv, session_ctx); #endif /* RADIUS_SERVER */ } } #endif /* EAP_SIM_DB */ #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; int rv = -1; eap_user = hostapd_get_eap_user(ctx, identity, identity_len, phase2); if (eap_user == NULL) goto out; if (user == NULL) return 0; os_memset(user, 0, sizeof(*user)); for (i = 0; i < EAP_MAX_METHODS; 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_memdup(eap_user->password, eap_user->password_len); if (user->password == NULL) goto out; user->password_len = eap_user->password_len; user->password_hash = eap_user->password_hash; if (eap_user->salt && eap_user->salt_len) { user->salt = os_memdup(eap_user->salt, eap_user->salt_len); if (!user->salt) goto out; user->salt_len = eap_user->salt_len; } } user->force_version = eap_user->force_version; user->macacl = eap_user->macacl; user->ttls_auth = eap_user->ttls_auth; user->remediation = eap_user->remediation; user->accept_attr = eap_user->accept_attr; user->t_c_timestamp = eap_user->t_c_timestamp; rv = 0; out: if (rv) wpa_printf(MSG_DEBUG, "%s: Failed to find user", __func__); return rv; } static int hostapd_setup_radius_srv(struct hostapd_data *hapd) { struct radius_server_conf srv; struct hostapd_bss_config *conf = hapd->conf; os_memset(&srv, 0, sizeof(srv)); srv.client_file = conf->radius_server_clients; srv.auth_port = conf->radius_server_auth_port; srv.acct_port = conf->radius_server_acct_port; srv.conf_ctx = hapd; srv.eap_sim_db_priv = hapd->eap_sim_db_priv; srv.ssl_ctx = hapd->ssl_ctx; srv.msg_ctx = hapd->msg_ctx; srv.pac_opaque_encr_key = conf->pac_opaque_encr_key; srv.eap_fast_a_id = conf->eap_fast_a_id; srv.eap_fast_a_id_len = conf->eap_fast_a_id_len; srv.eap_fast_a_id_info = conf->eap_fast_a_id_info; srv.eap_fast_prov = conf->eap_fast_prov; srv.pac_key_lifetime = conf->pac_key_lifetime; srv.pac_key_refresh_time = conf->pac_key_refresh_time; srv.eap_teap_auth = conf->eap_teap_auth; srv.eap_teap_pac_no_inner = conf->eap_teap_pac_no_inner; srv.eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind; srv.eap_sim_id = conf->eap_sim_id; srv.tnc = conf->tnc; srv.wps = hapd->wps; srv.ipv6 = conf->radius_server_ipv6; srv.get_eap_user = hostapd_radius_get_eap_user; srv.eap_req_id_text = conf->eap_req_id_text; srv.eap_req_id_text_len = conf->eap_req_id_text_len; srv.pwd_group = conf->pwd_group; srv.server_id = conf->server_id ? conf->server_id : "hostapd"; srv.sqlite_file = conf->eap_user_sqlite; #ifdef CONFIG_RADIUS_TEST srv.dump_msk_file = conf->dump_msk_file; #endif /* CONFIG_RADIUS_TEST */ #ifdef CONFIG_HS20 srv.subscr_remediation_url = conf->subscr_remediation_url; srv.subscr_remediation_method = conf->subscr_remediation_method; srv.hs20_sim_provisioning_url = conf->hs20_sim_provisioning_url; srv.t_c_server_url = conf->t_c_server_url; #endif /* CONFIG_HS20 */ srv.erp = conf->eap_server_erp; srv.erp_domain = conf->erp_domain; srv.tls_session_lifetime = conf->tls_session_lifetime; srv.tls_flags = conf->tls_flags; hapd->radius_srv = radius_server_init(&srv); if (hapd->radius_srv == NULL) { wpa_printf(MSG_ERROR, "RADIUS server initialization failed."); return -1; } return 0; } #endif /* RADIUS_SERVER */ #ifdef EAP_TLS_FUNCS static void authsrv_tls_event(void *ctx, enum tls_event ev, union tls_event_data *data) { switch (ev) { case TLS_CERT_CHAIN_SUCCESS: wpa_printf(MSG_DEBUG, "authsrv: remote certificate verification success"); break; case TLS_CERT_CHAIN_FAILURE: wpa_printf(MSG_INFO, "authsrv: certificate chain failure: reason=%d depth=%d subject='%s' err='%s'", data->cert_fail.reason, data->cert_fail.depth, data->cert_fail.subject, data->cert_fail.reason_txt); break; case TLS_PEER_CERTIFICATE: wpa_printf(MSG_DEBUG, "authsrv: peer certificate: depth=%d serial_num=%s subject=%s", data->peer_cert.depth, data->peer_cert.serial_num ? data->peer_cert.serial_num : "N/A", data->peer_cert.subject); break; case TLS_ALERT: if (data->alert.is_local) wpa_printf(MSG_DEBUG, "authsrv: local TLS alert: %s", data->alert.description); else wpa_printf(MSG_DEBUG, "authsrv: remote TLS alert: %s", data->alert.description); break; } } #endif /* EAP_TLS_FUNCS */ int authsrv_init(struct hostapd_data *hapd) { #ifdef EAP_TLS_FUNCS if (hapd->conf->eap_server && (hapd->conf->ca_cert || hapd->conf->server_cert || hapd->conf->private_key || hapd->conf->dh_file || hapd->conf->server_cert2 || hapd->conf->private_key2)) { struct tls_config conf; struct tls_connection_params params; os_memset(&conf, 0, sizeof(conf)); conf.tls_session_lifetime = hapd->conf->tls_session_lifetime; if (hapd->conf->crl_reload_interval > 0 && hapd->conf->check_crl <= 0) { wpa_printf(MSG_INFO, "Cannot enable CRL reload functionality - it depends on check_crl being set"); } else if (hapd->conf->crl_reload_interval > 0) { conf.crl_reload_interval = hapd->conf->crl_reload_interval; wpa_printf(MSG_INFO, "Enabled CRL reload functionality"); } conf.tls_flags = hapd->conf->tls_flags; conf.event_cb = authsrv_tls_event; conf.cb_ctx = hapd; hapd->ssl_ctx = tls_init(&conf); if (hapd->ssl_ctx == NULL) { wpa_printf(MSG_ERROR, "Failed to initialize TLS"); authsrv_deinit(hapd); return -1; } os_memset(¶ms, 0, sizeof(params)); params.ca_cert = hapd->conf->ca_cert; params.client_cert = hapd->conf->server_cert; params.client_cert2 = hapd->conf->server_cert2; params.private_key = hapd->conf->private_key; params.private_key2 = hapd->conf->private_key2; params.private_key_passwd = hapd->conf->private_key_passwd; params.private_key_passwd2 = hapd->conf->private_key_passwd2; params.dh_file = hapd->conf->dh_file; params.openssl_ciphers = hapd->conf->openssl_ciphers; params.openssl_ecdh_curves = hapd->conf->openssl_ecdh_curves; params.ocsp_stapling_response = hapd->conf->ocsp_stapling_response; params.ocsp_stapling_response_multi = hapd->conf->ocsp_stapling_response_multi; params.check_cert_subject = hapd->conf->check_cert_subject; if (tls_global_set_params(hapd->ssl_ctx, ¶ms)) { wpa_printf(MSG_ERROR, "Failed to set TLS parameters"); authsrv_deinit(hapd); return -1; } if (tls_global_set_verify(hapd->ssl_ctx, hapd->conf->check_crl, hapd->conf->check_crl_strict)) { wpa_printf(MSG_ERROR, "Failed to enable check_crl"); authsrv_deinit(hapd); return -1; } } #endif /* EAP_TLS_FUNCS */ #ifdef EAP_SIM_DB if (hapd->conf->eap_sim_db) { hapd->eap_sim_db_priv = eap_sim_db_init(hapd->conf->eap_sim_db, hapd->conf->eap_sim_db_timeout, hostapd_sim_db_cb, hapd); if (hapd->eap_sim_db_priv == NULL) { wpa_printf(MSG_ERROR, "Failed to initialize EAP-SIM " "database interface"); authsrv_deinit(hapd); return -1; } } #endif /* EAP_SIM_DB */ #ifdef RADIUS_SERVER if (hapd->conf->radius_server_clients && hostapd_setup_radius_srv(hapd)) return -1; #endif /* RADIUS_SERVER */ return 0; } void authsrv_deinit(struct hostapd_data *hapd) { #ifdef RADIUS_SERVER radius_server_deinit(hapd->radius_srv); hapd->radius_srv = NULL; #endif /* RADIUS_SERVER */ #ifdef EAP_TLS_FUNCS if (hapd->ssl_ctx) { tls_deinit(hapd->ssl_ctx); hapd->ssl_ctx = NULL; } #endif /* EAP_TLS_FUNCS */ #ifdef EAP_SIM_DB if (hapd->eap_sim_db_priv) { eap_sim_db_deinit(hapd->eap_sim_db_priv); hapd->eap_sim_db_priv = NULL; } #endif /* EAP_SIM_DB */ }
Upload File
Create Folder