~ubuntu-branches/ubuntu/lucid/wpasupplicant/lucid-updates

« back to all changes in this revision

Viewing changes to pmksa_cache.c

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2006-10-05 08:04:01 UTC
  • mfrom: (1.1.5 upstream) (3 etch)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061005080401-r8lqlix4390yos7b
Tags: 0.5.5-2
* Update madwifi headers to latest SVN. (Closes: #388316)
* Remove failed attempt at action locking. [debian/functions.sh,
  debian/wpa_action.sh]
* Add hysteresis checking functions, to avoid "event loops" while
  using wpa-roam. [debian/functions.sh, debian/wpa_action.sh]
* Change of co-maintainer email address.
* Add ishex() function to functions.sh to determine wpa-psk value type in
  plaintext or hex. This effectively eliminates the need for the bogus and
  somewhat confusing wpa-passphrase contruct specific to our scripts and
  allows wpa-psk to work with either a 8 to 63 character long plaintext
  string or 64 character long hex string.
* Adjust README.modes to not refer to the redundant wpa-passphrase stuff.
* Add big fat NOTE about acceptable wpa-psk's to top of example gallery.
* Strip surrounding quotes from wpa-ssid if present, instead of just whining
  about them.
* Update email address in copyright blurb of functions.sh, ifupdown.sh and
  wpa_action.sh.  

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
                                pmksa->pmksa = pos->next;
197
197
                        else
198
198
                                prev->next = pos->next;
 
199
                        if (pos == pmksa->sm->cur_pmksa) {
 
200
                                /* We are about to replace the current PMKSA
 
201
                                 * cache entry. This happens when the PMKSA
 
202
                                 * caching attempt fails, so we don't want to
 
203
                                 * force pmksa_cache_free_entry() to disconnect
 
204
                                 * at this point. Let's just make sure the old
 
205
                                 * PMKSA cache entry will not be used in the
 
206
                                 * future.
 
207
                                 */
 
208
                                wpa_printf(MSG_DEBUG, "RSN: replacing current "
 
209
                                           "PMKSA entry");
 
210
                                pmksa->sm->cur_pmksa = NULL;
 
211
                        }
199
212
                        wpa_printf(MSG_DEBUG, "RSN: Replace PMKSA entry for "
200
213
                                   "the current AP");
201
214
                        pmksa_cache_free_entry(pmksa, pos, 1);
426
439
 */
427
440
int pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len)
428
441
{
429
 
        int i;
 
442
        int i, ret;
430
443
        char *pos = buf;
431
444
        struct rsn_pmksa_cache_entry *entry;
432
445
        struct os_time now;
433
446
 
434
447
        os_get_time(&now);
435
 
        pos += snprintf(pos, buf + len - pos,
436
 
                        "Index / AA / PMKID / expiration (in seconds) / "
437
 
                        "opportunistic\n");
 
448
        ret = snprintf(pos, buf + len - pos,
 
449
                       "Index / AA / PMKID / expiration (in seconds) / "
 
450
                       "opportunistic\n");
 
451
        if (ret < 0 || ret >= buf + len - pos)
 
452
                return pos - buf;
 
453
        pos += ret;
438
454
        i = 0;
439
455
        entry = sm->pmksa->pmksa;
440
456
        while (entry) {
441
457
                i++;
442
 
                pos += snprintf(pos, buf + len - pos, "%d " MACSTR " ",
443
 
                                i, MAC2STR(entry->aa));
 
458
                ret = snprintf(pos, buf + len - pos, "%d " MACSTR " ",
 
459
                               i, MAC2STR(entry->aa));
 
460
                if (ret < 0 || ret >= buf + len - pos)
 
461
                        return pos - buf;
 
462
                pos += ret;
444
463
                pos += wpa_snprintf_hex(pos, buf + len - pos, entry->pmkid,
445
464
                                        PMKID_LEN);
446
 
                pos += snprintf(pos, buf + len - pos, " %d %d\n",
447
 
                                (int) (entry->expiration - now.sec),
448
 
                                entry->opportunistic);
 
465
                ret = snprintf(pos, buf + len - pos, " %d %d\n",
 
466
                               (int) (entry->expiration - now.sec),
 
467
                               entry->opportunistic);
 
468
                if (ret < 0 || ret >= buf + len - pos)
 
469
                        return pos - buf;
 
470
                pos += ret;
449
471
                entry = entry->next;
450
472
        }
451
473
        return pos - buf;