static void test_eapol_clean(struct eapol_test_data *e, struct wpa_supplicant *wpa_s) { radius_client_deinit(e->radius); os_free(e->last_eap_radius); if (e->last_recv_radius) { radius_msg_free(e->last_recv_radius); os_free(e->last_recv_radius); } os_free(e->eap_identity); e->eap_identity = NULL; eapol_sm_deinit(wpa_s->eapol); wpa_s->eapol = NULL; if (e->radius_conf && e->radius_conf->auth_server) { os_free(e->radius_conf->auth_server->shared_secret); os_free(e->radius_conf->auth_server); } os_free(e->radius_conf); e->radius_conf = NULL; scard_deinit(wpa_s->scard); if (wpa_s->ctrl_iface) { wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface); wpa_s->ctrl_iface = NULL; } wpa_config_free(wpa_s->conf); }
static void test_eapol_clean(struct eapol_test_data *e, struct wpa_supplicant *wpa_s) { struct extra_radius_attr *p, *prev; radius_client_deinit(e->radius); os_free(e->last_eap_radius); radius_msg_free(e->last_recv_radius); e->last_recv_radius = NULL; os_free(e->eap_identity); e->eap_identity = NULL; eapol_sm_deinit(wpa_s->eapol); wpa_s->eapol = NULL; if (e->radius_conf && e->radius_conf->auth_server) { os_free(e->radius_conf->auth_server->shared_secret); os_free(e->radius_conf->auth_server); } os_free(e->radius_conf); e->radius_conf = NULL; scard_deinit(wpa_s->scard); if (wpa_s->ctrl_iface) { wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface); wpa_s->ctrl_iface = NULL; } wpa_config_free(wpa_s->conf); p = e->extra_attrs; while (p) { prev = p; p = p->next; os_free(prev); } }
static void test_eapol_clean(struct eapol_test_data *e, struct wpa_supplicant *wpa_s) { // this block was moved to eap_radius.c (eap_radius_open()) #ifdef UNUSED_CODE radius_client_deinit(e->radius); free(e->last_eap_radius); if (e->last_recv_radius) { radius_msg_free(e->last_recv_radius); free(e->last_recv_radius); } #endif free(e->eap_identity); e->eap_identity = NULL; free(e->user_identity); e->user_identity = NULL; free(e->user_password); e->user_password = NULL; eapol_sm_deinit(wpa_s->eapol); wpa_s->eapol = NULL; if (e->radius_conf && e->radius_conf->auth_server) { free(e->radius_conf->auth_server->shared_secret); free(e->radius_conf->auth_server); } free(e->radius_conf); e->radius_conf = NULL; //scard_deinit(wpa_s->scard); //wpa_supplicant_ctrl_iface_deinit(wpa_s); // printf("Calling wpa_config_free\n"); wpa_config_free(wpa_s->conf); // printf("Out of wpa_config_free\n"); }
/** * wpas_dbus_iface_set_smartcard_modules - Set smartcard related module paths * @message: Pointer to incoming dbus message * @wpa_s: wpa_supplicant structure for a network interface * Returns: A dbus message containing a UINT32 indicating success (1) or * failure (0) * * Handler function for "setSmartcardModules" method call. */ DBusMessage * wpas_dbus_iface_set_smartcard_modules( DBusMessage *message, struct wpa_supplicant *wpa_s) { DBusMessageIter iter, iter_dict; char *opensc_engine_path = NULL; char *pkcs11_engine_path = NULL; char *pkcs11_module_path = NULL; struct wpa_dbus_dict_entry entry; if (!dbus_message_iter_init(message, &iter)) goto error; if (!wpa_dbus_dict_open_read(&iter, &iter_dict)) goto error; while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) goto error; if (!strcmp(entry.key, "opensc_engine_path") && (entry.type == DBUS_TYPE_STRING)) { opensc_engine_path = os_strdup(entry.str_value); if (opensc_engine_path == NULL) goto error; } else if (!strcmp(entry.key, "pkcs11_engine_path") && (entry.type == DBUS_TYPE_STRING)) { pkcs11_engine_path = os_strdup(entry.str_value); if (pkcs11_engine_path == NULL) goto error; } else if (!strcmp(entry.key, "pkcs11_module_path") && (entry.type == DBUS_TYPE_STRING)) { pkcs11_module_path = os_strdup(entry.str_value); if (pkcs11_module_path == NULL) goto error; } else { wpa_dbus_dict_entry_clear(&entry); goto error; } wpa_dbus_dict_entry_clear(&entry); } #ifdef EAP_TLS_OPENSSL os_free(wpa_s->conf->opensc_engine_path); wpa_s->conf->opensc_engine_path = opensc_engine_path; os_free(wpa_s->conf->pkcs11_engine_path); wpa_s->conf->pkcs11_engine_path = pkcs11_engine_path; os_free(wpa_s->conf->pkcs11_module_path); wpa_s->conf->pkcs11_module_path = pkcs11_module_path; #endif /* EAP_TLS_OPENSSL */ eapol_sm_deinit(wpa_s->eapol); wpa_supplicant_init_eapol(wpa_s); return wpas_dbus_new_success_reply(message); error: os_free(opensc_engine_path); os_free(pkcs11_engine_path); os_free(pkcs11_module_path); return wpas_dbus_new_invalid_opts_error(message, NULL); }
void rsn_preauth_deinit(struct wpa_supplicant *wpa_s) { if (!wpa_s->preauth_eapol) return; eloop_cancel_timeout(rsn_preauth_timeout, wpa_s, NULL); eapol_sm_deinit(wpa_s->preauth_eapol); wpa_s->preauth_eapol = NULL; memset(wpa_s->preauth_bssid, 0, ETH_ALEN); l2_packet_deinit(wpa_s->l2_preauth); wpa_s->l2_preauth = NULL; }
/** * rsn_preauth_deinit - Abort RSN pre-authentication * @sm: Pointer to WPA state machine data from wpa_sm_init() * * This function aborts the current RSN pre-authentication (if one is started) * and frees resources allocated for it. */ void rsn_preauth_deinit(struct wpa_sm *sm) { if (sm == NULL || !sm->preauth_eapol) return; eloop_cancel_timeout(rsn_preauth_timeout, sm, NULL); eapol_sm_deinit(sm->preauth_eapol); sm->preauth_eapol = NULL; memset(sm->preauth_bssid, 0, ETH_ALEN); l2_packet_deinit(sm->l2_preauth); sm->l2_preauth = NULL; }
static void test_eapol_clean(struct wpa_supplicant *wpa_s) { radius_client_deinit(wpa_s); free(wpa_s->last_eap_radius); if (wpa_s->last_recv_radius) { radius_msg_free(wpa_s->last_recv_radius); free(wpa_s->last_recv_radius); } eapol_sm_deinit(wpa_s->eapol); wpa_s->eapol = NULL; if (wpa_s->auth_server) { free(wpa_s->auth_server->shared_secret); free(wpa_s->auth_server); } scard_deinit(wpa_s->scard); wpa_supplicant_ctrl_iface_deinit(wpa_s); wpa_config_free(wpa_s->conf); }