Updated to hostap_2_6
[mech_eap.git] / libeap / src / eapol_auth / eapol_auth_sm.c
index ff33d28..ff673bb 100644 (file)
@@ -866,10 +866,13 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
                sm->radius_cui = wpabuf_alloc_copy(radius_cui,
                                                   os_strlen(radius_cui));
 
-       sm->acct_multi_session_id_lo = eapol->acct_multi_session_id_lo++;
-       if (eapol->acct_multi_session_id_lo == 0)
-               eapol->acct_multi_session_id_hi++;
-       sm->acct_multi_session_id_hi = eapol->acct_multi_session_id_hi;
+#ifndef CONFIG_NO_RADIUS
+       if (radius_gen_session_id((u8 *) &sm->acct_multi_session_id,
+                                 sizeof(sm->acct_multi_session_id)) < 0) {
+               eapol_auth_free(sm);
+               return NULL;
+       }
+#endif /* CONFIG_NO_RADIUS */
 
        return sm;
 }
@@ -884,6 +887,9 @@ void eapol_auth_free(struct eapol_state_machine *sm)
        eloop_cancel_timeout(eapol_sm_step_cb, sm, NULL);
        if (sm->eap)
                eap_server_sm_deinit(sm->eap);
+
+       wpabuf_free(sm->radius_cui);
+       os_free(sm->identity);
        os_free(sm);
 }
 
@@ -1271,7 +1277,6 @@ struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
                                             struct eapol_auth_cb *cb)
 {
        struct eapol_authenticator *eapol;
-       struct os_time now;
 
        eapol = os_zalloc(sizeof(*eapol));
        if (eapol == NULL)
@@ -1300,12 +1305,6 @@ struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
        eapol->cb.erp_get_key = cb->erp_get_key;
        eapol->cb.erp_add_key = cb->erp_add_key;
 
-       /* Acct-Multi-Session-Id should be unique over reboots. If reliable
-        * clock is not available, this could be replaced with reboot counter,
-        * etc. */
-       os_get_time(&now);
-       eapol->acct_multi_session_id_hi = now.sec;
-
        return eapol;
 }