From f6d23cfd9e0a89da100b03f9ef2a9b882cbd88f6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 15 Nov 2009 18:54:37 +0200 Subject: [PATCH] WPS ER: Do not try to process AP Settings in proxied M7 to ER In this case, the Enrollee is not an AP, so do not try to process AP Settings in M7. --- src/wps/wps_er.c | 1 + src/wps/wps_i.h | 5 +++++ src/wps/wps_registrar.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wps/wps_er.c b/src/wps/wps_er.c index eac31e919..7625a8bb2 100644 --- a/src/wps/wps_er.c +++ b/src/wps/wps_er.c @@ -949,6 +949,7 @@ static void wps_er_sta_start(struct wps_er_sta *sta, struct wpabuf *msg) sta->wps = wps_init(&cfg); if (sta->wps == NULL) return; + sta->wps->er = 1; wps_er_sta_process(sta, msg, WSC_MSG); } diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h index 2d8c7b7e4..1bf50b90b 100644 --- a/src/wps/wps_i.h +++ b/src/wps/wps_i.h @@ -34,6 +34,11 @@ struct wps_data { */ int registrar; + /** + * er - Whether the local end is an external registrar + */ + int er; + enum { /* Enrollee states */ SEND_M1, RECV_M2, SEND_M3, RECV_M4, SEND_M5, RECV_M6, SEND_M7, diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index bf8c6f8a5..76fdb2df5 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -2215,7 +2215,7 @@ static void wps_cred_update(struct wps_credential *dst, static int wps_process_ap_settings_r(struct wps_data *wps, struct wps_parse_attr *attr) { - if (wps->wps->ap) + if (wps->wps->ap || wps->er) return 0; /* AP Settings Attributes in M7 when Enrollee is an AP */ @@ -2273,7 +2273,7 @@ static enum wps_process_res wps_process_m7(struct wps_data *wps, decrypted = wps_decrypt_encr_settings(wps, attr->encr_settings, attr->encr_settings_len); if (decrypted == NULL) { - wpa_printf(MSG_DEBUG, "WPS: Failed to decrypted Encrypted " + wpa_printf(MSG_DEBUG, "WPS: Failed to decrypt Encrypted " "Settings attribute"); wps->state = SEND_WSC_NACK; return WPS_CONTINUE;