bsd: Get rid of printf size_t warnings with 64-bit builds
[wpasupplicant] / hostapd / wps_hostapd.c
index 5e9f6b6..34fe409 100644 (file)
@@ -234,6 +234,28 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
        if (hapd->conf->wps_cred_processing == 1)
                return 0;
 
+       os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len);
+       hapd->wps->ssid_len = cred->ssid_len;
+       hapd->wps->encr_types = cred->encr_type;
+       hapd->wps->auth_types = cred->auth_type;
+       if (cred->key == NULL) {
+               os_free(hapd->wps->network_key);
+               hapd->wps->network_key = NULL;
+               hapd->wps->network_key_len = 0;
+       } else {
+               if (hapd->wps->network_key == NULL ||
+                   hapd->wps->network_key_len < cred->key_len) {
+                       hapd->wps->network_key_len = 0;
+                       os_free(hapd->wps->network_key);
+                       hapd->wps->network_key = os_malloc(cred->key_len);
+                       if (hapd->wps->network_key == NULL)
+                               return -1;
+               }
+               hapd->wps->network_key_len = cred->key_len;
+               os_memcpy(hapd->wps->network_key, cred->key, cred->key_len);
+       }
+       hapd->wps->wps_state = WPS_STATE_CONFIGURED;
+
        len = os_strlen(hapd->iface->config_fname) + 5;
        tmp_fname = os_malloc(len);
        if (tmp_fname == NULL)
@@ -682,7 +704,7 @@ void hostapd_deinit_wps(struct hostapd_data *hapd)
 
 
 int hostapd_wps_add_pin(struct hostapd_data *hapd, const char *uuid,
-                       const char *pin)
+                       const char *pin, int timeout)
 {
        u8 u[UUID_LEN];
        int any = 0;
@@ -694,7 +716,8 @@ int hostapd_wps_add_pin(struct hostapd_data *hapd, const char *uuid,
        else if (uuid_str2bin(uuid, u))
                return -1;
        return wps_registrar_add_pin(hapd->wps->registrar, any ? NULL : u,
-                                    (const u8 *) pin, os_strlen(pin));
+                                    (const u8 *) pin, os_strlen(pin),
+                                    timeout);
 }
 
 
@@ -744,7 +767,8 @@ int hostapd_wps_start_oob(struct hostapd_data *hapd, char *device_type,
        if ((wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_E ||
             wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_R) &&
            hostapd_wps_add_pin(hapd, "any",
-                               wpabuf_head(wps->oob_conf.dev_password)) < 0)
+                               wpabuf_head(wps->oob_conf.dev_password), 0) <
+           0)
                goto error;
 
        return 0;