commit 9df7785fee20f73e13b6e042b65cf573776c3425
parent c1f791afc403e672c0c52c439af2320a9f13bc50
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Thu, 29 Nov 2018 14:41:38 -0800
eap-tls-common: Add phase 2 failure flag
This flag is used by the extensions to signal the failure
during phase 2 execution.
Diffstat:
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/eap-tls-common.c b/src/eap-tls-common.c
@@ -95,6 +95,7 @@ struct eap_tls_state {
struct l_tls *tunnel;
bool method_completed:1;
+ bool phase2_failed:1;
struct databuf *plain_buf;
struct databuf *tx_pdu_buf;
@@ -117,6 +118,7 @@ static void __eap_tls_common_state_reset(struct eap_tls_state *eap_tls)
{
eap_tls->version_negotiated = EAP_TLS_VERSION_NOT_NEGOTIATED;
eap_tls->method_completed = false;
+ eap_tls->phase2_failed = false;
eap_tls->expecting_frag_ack = false;
if (eap_tls->tunnel) {
@@ -587,12 +589,19 @@ proceed:
eap_tls->rx_pdu_buf = NULL;
}
- if (!eap_tls->tx_pdu_buf)
+ if (!eap_tls->tx_pdu_buf) {
+ if (eap_tls->phase2_failed)
+ goto error;
+
return;
+ }
eap_tls_send_response(eap, eap_tls->tx_pdu_buf->data,
eap_tls->tx_pdu_buf->len);
+ if (eap_tls->phase2_failed)
+ goto error;
+
return;
error:
@@ -751,3 +760,10 @@ void eap_tls_common_set_completed(struct eap_state *eap)
eap_tls->method_completed = true;
}
+
+void eap_tls_common_set_phase2_faild(struct eap_state *eap)
+{
+ struct eap_tls_state *eap_tls = eap_get_data(eap);
+
+ eap_tls->phase2_failed = true;
+}
diff --git a/src/eap-tls-common.h b/src/eap-tls-common.h
@@ -52,6 +52,7 @@ struct eap_tls_variant_ops {
void eap_tls_common_state_free(struct eap_state *eap);
void eap_tls_common_set_completed(struct eap_state *eap);
+void eap_tls_common_set_phase2_faild(struct eap_state *eap);
void eap_tls_common_handle_request(struct eap_state *eap,
const uint8_t *pkt, size_t len);