]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS ER: Fix Credential to use correct Enrollee MAC Address
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 27 May 2010 12:22:44 +0000 (15:22 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 27 May 2010 12:22:44 +0000 (15:22 +0300)
When starting the protocol run with an Enrollee, clone the AP Settings
and replace the AP MAC Address with the Enrollee MAC Address so that the
correct value is then used in the Credential attribute in M8.

src/wps/wps_er.c
src/wps/wps_er.h

index f29eb9c09417291986d91ffde99d560e5cf4dcf0..d750ecdb2204ff46b22c21b3efef2dd1228b34df 100644 (file)
@@ -85,6 +85,7 @@ static void wps_er_sta_free(struct wps_er_sta *sta)
        os_free(sta->dev_name);
        http_client_free(sta->http);
        eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
+       os_free(sta->cred);
        os_free(sta);
 }
 
@@ -953,6 +954,17 @@ static void wps_er_sta_start(struct wps_er_sta *sta, struct wpabuf *msg)
                return;
        sta->wps->er = 1;
        sta->wps->use_cred = sta->ap->ap_settings;
+       if (sta->ap->ap_settings) {
+               os_free(sta->cred);
+               sta->cred = os_malloc(sizeof(*sta->cred));
+               if (sta->cred) {
+                       os_memcpy(sta->cred, sta->ap->ap_settings,
+                                 sizeof(*sta->cred));
+                       sta->cred->cred_attr = NULL;
+                       os_memcpy(sta->cred->mac_addr, sta->addr, ETH_ALEN);
+                       sta->wps->use_cred = sta->cred;
+               }
+       }
 
        wps_er_sta_process(sta, msg, WSC_MSG);
 }
index f08af913b3285fd988d4c3a08478bbf009fe9cc1..b13b950fbeaa68f90e33584eaf2a69f017cfa786 100644 (file)
@@ -33,6 +33,7 @@ struct wps_er_sta {
        char *dev_name;
        struct wps_data *wps;
        struct http_client *http;
+       struct wps_credential *cred;
 };
 
 struct wps_er_ap {