]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Check Device Password ID attribute only if present in AP search
authorMasashi Honma <honma@ictec.co.jp>
Thu, 22 Jan 2009 13:12:18 +0000 (15:12 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 22 Jan 2009 13:12:18 +0000 (15:12 +0200)
I can't pass the "Wi-Fi WPS Test Plan Version 1.0 [5.1.4. Add to AP
using PIN Config method and PASS PHRASE through wired external
registrar]". The wpa_supplicant-0.6.7 can't recoginize the testbed
AP(BCM94704AGRRev-E.2.4) as WPS PIN AP. Because after PIN entered, the
AP sends Selected Registrar attribute=0 and not send Device Password ID
attribute.

The proposed change as-is removed validation of Selected Registrar
attribute completely. However, that part is not included in this commit
since it can cause problems for environments with multiple WPS-enabled
APs. Another workaround for this will be considered in wpa_supplicant
scanning process (e.g., start trying to use WPS with APs that do not set
Selected Registrar to TRUE after couple of scan runs that do not find
any APs with Selected Registrar TRUE).

src/wps/wps.c

index 67438de717b90613751d1685c9c1c0b36b015f63..015eb07490f7c53e7d5298fbc2457400905cce81 100644 (file)
@@ -186,7 +186,7 @@ int wps_is_selected_pbc_registrar(const struct wpabuf *msg)
 
 
 /**
- * wps_is_selected_pbc_registrar - Check whether WPS IE indicates active PIN
+ * wps_is_selected_pin_registrar - Check whether WPS IE indicates active PIN
  * @msg: WPS IE contents from Beacon or Probe Response frame
  * Returns: 1 if PIN Registrar is active, 0 if not
  */
@@ -202,9 +202,13 @@ int wps_is_selected_pin_registrar(const struct wpabuf *msg)
         * Device Password ID here.
         */
 
-       if (wps_parse_msg(msg, &attr) < 0 ||
-           !attr.selected_registrar || *attr.selected_registrar == 0 ||
-           !attr.dev_password_id ||
+       if (wps_parse_msg(msg, &attr) < 0)
+               return 0;
+
+       if (!attr.selected_registrar || *attr.selected_registrar == 0)
+               return 0;
+
+       if (attr.dev_password_id != NULL &&
            WPA_GET_BE16(attr.dev_password_id) == DEV_PW_PUSHBUTTON)
                return 0;