3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

eap-wsc: Send credential obtained events

This commit is contained in:
Denis Kenzior 2016-09-13 13:32:47 -05:00
parent 9fde037b8f
commit 4518394b0e
3 changed files with 39 additions and 2 deletions

View File

@ -73,7 +73,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \
src/network.h src/network.c \ src/network.h src/network.c \
src/wscutil.h src/wscutil.c \ src/wscutil.h src/wscutil.c \
src/wsc.h src/wsc.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.h src/eap.c \
src/eap-tls.c src/eap-ttls.c \ src/eap-tls.c src/eap-ttls.c \
src/backtrace.h src/backtrace.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/eapol.h src/eapol.c \
src/eap.h src/eap.c \ src/eap.h src/eap.c \
src/util.h src/util.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 unit_test_wsc_LDADD = ell/libell-internal.la
TESTS = $(unit_tests) TESTS = $(unit_tests)

View File

@ -33,6 +33,7 @@
#include "eap.h" #include "eap.h"
#include "wscutil.h" #include "wscutil.h"
#include "util.h" #include "util.h"
#include "eap-wsc.h"
#define EAP_WSC_OFFSET 12 #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 wsc_m8_encrypted_settings m8es;
struct iovec creds[3]; struct iovec creds[3];
size_t n_creds; size_t n_creds;
size_t i;
/* Spec unclear what to do here, see comments in eap_wsc_send_nack */ /* Spec unclear what to do here, see comments in eap_wsc_send_nack */
if (wsc_parse_m8(pdu, len, &m8, &encrypted) != 0) { 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)) if (!keywrap_authenticator_check(wsc, decrypted, decrypted_len))
goto invalid_settings; 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); l_free(decrypted);
eap_wsc_send_done(eap); eap_wsc_send_done(eap);

25
src/eap-wsc.h Normal file
View File

@ -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,
};