|
@@ -25,18 +25,20 @@ int wps_build_manufacturer(struct wps_device_data *dev, struct wpabuf *msg)
|
|
|
wpa_printf(MSG_DEBUG, "WPS: * Manufacturer");
|
|
|
wpabuf_put_be16(msg, ATTR_MANUFACTURER);
|
|
|
len = dev->manufacturer ? os_strlen(dev->manufacturer) : 0;
|
|
|
+#ifndef CONFIG_WPS_STRICT
|
|
|
if (len == 0) {
|
|
|
/*
|
|
|
* Some deployed WPS implementations fail to parse zero-length
|
|
|
- * attributes. As a workaround, send a null character if the
|
|
|
+ * attributes. As a workaround, send a space character if the
|
|
|
* device attribute string is empty.
|
|
|
*/
|
|
|
wpabuf_put_be16(msg, 1);
|
|
|
- wpabuf_put_u8(msg, '\0');
|
|
|
- } else {
|
|
|
- wpabuf_put_be16(msg, len);
|
|
|
- wpabuf_put_data(msg, dev->manufacturer, len);
|
|
|
+ wpabuf_put_u8(msg, ' ');
|
|
|
+ return 0;
|
|
|
}
|
|
|
+#endif /* CONFIG_WPS_STRICT */
|
|
|
+ wpabuf_put_be16(msg, len);
|
|
|
+ wpabuf_put_data(msg, dev->manufacturer, len);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -47,18 +49,20 @@ int wps_build_model_name(struct wps_device_data *dev, struct wpabuf *msg)
|
|
|
wpa_printf(MSG_DEBUG, "WPS: * Model Name");
|
|
|
wpabuf_put_be16(msg, ATTR_MODEL_NAME);
|
|
|
len = dev->model_name ? os_strlen(dev->model_name) : 0;
|
|
|
+#ifndef CONFIG_WPS_STRICT
|
|
|
if (len == 0) {
|
|
|
/*
|
|
|
* Some deployed WPS implementations fail to parse zero-length
|
|
|
- * attributes. As a workaround, send a null character if the
|
|
|
+ * attributes. As a workaround, send a space character if the
|
|
|
* device attribute string is empty.
|
|
|
*/
|
|
|
wpabuf_put_be16(msg, 1);
|
|
|
- wpabuf_put_u8(msg, '\0');
|
|
|
- } else {
|
|
|
- wpabuf_put_be16(msg, len);
|
|
|
- wpabuf_put_data(msg, dev->model_name, len);
|
|
|
+ wpabuf_put_u8(msg, ' ');
|
|
|
+ return 0;
|
|
|
}
|
|
|
+#endif /* CONFIG_WPS_STRICT */
|
|
|
+ wpabuf_put_be16(msg, len);
|
|
|
+ wpabuf_put_data(msg, dev->model_name, len);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -69,18 +73,20 @@ int wps_build_model_number(struct wps_device_data *dev, struct wpabuf *msg)
|
|
|
wpa_printf(MSG_DEBUG, "WPS: * Model Number");
|
|
|
wpabuf_put_be16(msg, ATTR_MODEL_NUMBER);
|
|
|
len = dev->model_number ? os_strlen(dev->model_number) : 0;
|
|
|
+#ifndef CONFIG_WPS_STRICT
|
|
|
if (len == 0) {
|
|
|
/*
|
|
|
* Some deployed WPS implementations fail to parse zero-length
|
|
|
- * attributes. As a workaround, send a null character if the
|
|
|
+ * attributes. As a workaround, send a space character if the
|
|
|
* device attribute string is empty.
|
|
|
*/
|
|
|
wpabuf_put_be16(msg, 1);
|
|
|
- wpabuf_put_u8(msg, '\0');
|
|
|
- } else {
|
|
|
- wpabuf_put_be16(msg, len);
|
|
|
- wpabuf_put_data(msg, dev->model_number, len);
|
|
|
+ wpabuf_put_u8(msg, ' ');
|
|
|
+ return 0;
|
|
|
}
|
|
|
+#endif /* CONFIG_WPS_STRICT */
|
|
|
+ wpabuf_put_be16(msg, len);
|
|
|
+ wpabuf_put_data(msg, dev->model_number, len);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -92,18 +98,20 @@ static int wps_build_serial_number(struct wps_device_data *dev,
|
|
|
wpa_printf(MSG_DEBUG, "WPS: * Serial Number");
|
|
|
wpabuf_put_be16(msg, ATTR_SERIAL_NUMBER);
|
|
|
len = dev->serial_number ? os_strlen(dev->serial_number) : 0;
|
|
|
+#ifndef CONFIG_WPS_STRICT
|
|
|
if (len == 0) {
|
|
|
/*
|
|
|
* Some deployed WPS implementations fail to parse zero-length
|
|
|
- * attributes. As a workaround, send a null character if the
|
|
|
+ * attributes. As a workaround, send a space character if the
|
|
|
* device attribute string is empty.
|
|
|
*/
|
|
|
wpabuf_put_be16(msg, 1);
|
|
|
- wpabuf_put_u8(msg, '\0');
|
|
|
- } else {
|
|
|
- wpabuf_put_be16(msg, len);
|
|
|
- wpabuf_put_data(msg, dev->serial_number, len);
|
|
|
+ wpabuf_put_u8(msg, ' ');
|
|
|
+ return 0;
|
|
|
}
|
|
|
+#endif /* CONFIG_WPS_STRICT */
|
|
|
+ wpabuf_put_be16(msg, len);
|
|
|
+ wpabuf_put_data(msg, dev->serial_number, len);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -124,18 +132,20 @@ int wps_build_dev_name(struct wps_device_data *dev, struct wpabuf *msg)
|
|
|
wpa_printf(MSG_DEBUG, "WPS: * Device Name");
|
|
|
wpabuf_put_be16(msg, ATTR_DEV_NAME);
|
|
|
len = dev->device_name ? os_strlen(dev->device_name) : 0;
|
|
|
+#ifndef CONFIG_WPS_STRICT
|
|
|
if (len == 0) {
|
|
|
/*
|
|
|
* Some deployed WPS implementations fail to parse zero-length
|
|
|
- * attributes. As a workaround, send a null character if the
|
|
|
+ * attributes. As a workaround, send a space character if the
|
|
|
* device attribute string is empty.
|
|
|
*/
|
|
|
wpabuf_put_be16(msg, 1);
|
|
|
- wpabuf_put_u8(msg, '\0');
|
|
|
- } else {
|
|
|
- wpabuf_put_be16(msg, len);
|
|
|
- wpabuf_put_data(msg, dev->device_name, len);
|
|
|
+ wpabuf_put_u8(msg, ' ');
|
|
|
+ return 0;
|
|
|
}
|
|
|
+#endif /* CONFIG_WPS_STRICT */
|
|
|
+ wpabuf_put_be16(msg, len);
|
|
|
+ wpabuf_put_data(msg, dev->device_name, len);
|
|
|
return 0;
|
|
|
}
|
|
|
|