Merge branch 'moonshot' of ssh://moonshot.suchdamage.org:822/srv/git/libeap into...
[libeap.git] / wpa_supplicant / ibss_rsn.c
index 5c9dfa1..0e33253 100644 (file)
@@ -261,7 +261,8 @@ static int auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg,
                 * In IBSS RSN, the pairwise key from the 4-way handshake
                 * initiated by the peer with highest MAC address is used.
                 */
-               if (os_memcmp(ibss_rsn->wpa_s->own_addr, addr, ETH_ALEN) < 0) {
+               if (addr == NULL ||
+                   os_memcmp(ibss_rsn->wpa_s->own_addr, addr, ETH_ALEN) < 0) {
                        wpa_printf(MSG_DEBUG, "AUTH: Do not use this PTK");
                        return 0;
                }
@@ -326,9 +327,11 @@ static int ibss_rsn_auth_init(struct ibss_rsn *ibss_rsn,
                return -1;
        }
 
-       wpa_auth_sm_event(peer->auth, WPA_ASSOC);
+       if (wpa_auth_sm_event(peer->auth, WPA_ASSOC))
+               return -1;
 
-       wpa_auth_sta_associated(ibss_rsn->auth_group, peer->auth);
+       if (wpa_auth_sta_associated(ibss_rsn->auth_group, peer->auth))
+               return -1;
 
        return 0;
 }