diff --git a/Makefile.am b/Makefile.am index 40888730..d2365b28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,7 +73,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \ src/network.h src/network.c \ src/wscutil.h src/wscutil.c \ src/wsc.h src/wsc.c \ - src/eap-wsc.c \ + src/eap-wsc.h src/eap-wsc.c \ src/eap.h src/eap.c \ src/eap-tls.c src/eap-ttls.c \ src/backtrace.h src/backtrace.c \ @@ -189,7 +189,7 @@ unit_test_wsc_SOURCES = unit/test-wsc.c src/wscutil.h src/wscutil.c \ src/eapol.h src/eapol.c \ src/eap.h src/eap.c \ src/util.h src/util.c \ - src/eap-wsc.c + src/eap-wsc.h src/eap-wsc.c unit_test_wsc_LDADD = ell/libell-internal.la TESTS = $(unit_tests) diff --git a/src/eap-wsc.c b/src/eap-wsc.c index eb0339c1..139a9aa3 100644 --- a/src/eap-wsc.c +++ b/src/eap-wsc.c @@ -33,6 +33,7 @@ #include "eap.h" #include "wscutil.h" #include "util.h" +#include "eap-wsc.h" #define EAP_WSC_OFFSET 12 @@ -405,6 +406,7 @@ static void eap_wsc_handle_m8(struct eap_state *eap, struct wsc_m8_encrypted_settings m8es; struct iovec creds[3]; size_t n_creds; + size_t i; /* Spec unclear what to do here, see comments in eap_wsc_send_nack */ if (wsc_parse_m8(pdu, len, &m8, &encrypted) != 0) { @@ -430,6 +432,16 @@ static void eap_wsc_handle_m8(struct eap_state *eap, if (!keywrap_authenticator_check(wsc, decrypted, decrypted_len)) goto invalid_settings; + for (i = 0; i < n_creds; i++) { + struct wsc_credential cred; + + if (wsc_parse_credential(creds[i].iov_base, creds[i].iov_len, + &cred) != 0) + continue; + + eap_method_event(eap, EAP_WSC_EVENT_CREDENTIAL_OBTAINED, &cred); + } + l_free(decrypted); eap_wsc_send_done(eap); diff --git a/src/eap-wsc.h b/src/eap-wsc.h new file mode 100644 index 00000000..4efdd4d3 --- /dev/null +++ b/src/eap-wsc.h @@ -0,0 +1,25 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2016 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +enum EAP_WSC_EVENT { + EAP_WSC_EVENT_CREDENTIAL_OBTAINED = 0x0050f200, +};