WPS: Use WEP key index 1..4 instead of 0..3 when configuring AP

This commit is contained in:
Jouni Malinen 2009-02-18 20:17:47 +02:00
parent 522b5b6ed3
commit d3cba719ff

View file

@ -326,9 +326,12 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
else else
fprintf(nconf, "auth_algs=1\n"); fprintf(nconf, "auth_algs=1\n");
if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx < 4) { if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx <= 4) {
fprintf(nconf, "wep_default_key=%d\n", cred->key_idx); int key_idx = cred->key_idx;
fprintf(nconf, "wep_key%d=", cred->key_idx); if (key_idx)
key_idx--;
fprintf(nconf, "wep_default_key=%d\n", key_idx);
fprintf(nconf, "wep_key%d=", key_idx);
if (cred->key_len != 10 && cred->key_len != 26) if (cred->key_len != 10 && cred->key_len != 26)
fputc('"', nconf); fputc('"', nconf);
for (i = 0; i < cred->key_len; i++) for (i = 0; i < cred->key_len; i++)