Skip to contentSkip to conversation

unit: Update event handler in WSC, eapol tests

PATCH In review Will Dietz 1 participant 1 message Nov 5, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20191104211542.GB2146@dtznix

Will Dietz

author
#1 lore raw

PATCH 9/16 unit: Update event handler in WSC, eapol tests

Forwarding this as well, sigh. Sorry folks.

---------- Forwarded message ---------
From: Will Dietz <[email protected]>
Date: Mon, Nov 4, 2019, 9:15 PM
Subject: Re: [PATCH 09/16] unit: Update event handler in WSC, eapol tests
To: Andrew Zaborowski <[email protected]>

Quoted 1 line · Will Dietz

On Mon, 28 Oct 2019 15:05:01 +0100, Andrew Zaborowski <

Quoted 11 lines · [email protected]> wrote:

Review

Quoted 11 lines
 {
    struct verify_data *data = user_data;
(quoted diff) +4 -2
+   va_list args;
+
+   va_start(args, user_data);
 
    switch (event) {
    case HANDSHAKE_EVENT_FAILED:
-           assert(l_get_u16(event_data) ==
-                           MMPDU_REASON_CODE_IEEE8021X_FAILED);
+           assert(va_arg(args, int) ==

MMPDU_REASON_CODE_IEEE8021X_FAILED);

Quoted 22 lines

Review

Quoted 8 lines
            data->eapol_failed = true;
            break;
(quoted diff) +6 -0
+   case HANDSHAKE_EVENT_EAP_NOTIFY:
+   {
+           const struct wsc_credential *cred;
+
+           assert(va_arg(args, unsigned int) !=
+                   EAP_WSC_EVENT_CREDENTIAL_OBTAINED);

This condition appears to have been inverted accidentally :3. I noticed because this causes the test to (always) fail. Compare to the logic this replaces:

Review

Quoted 4 lines
(quoted diff) +0 -4
-
-   if (event != EAP_WSC_EVENT_CREDENTIAL_OBTAINED)
-           assert(false);
-

I'm not in a position to properly submit a patch currently, but if there's agreement on this please go ahead and fix :). (flipping the '!=' to '==' in the assert does the trick, etc.)

Quoted 1 line

~Will

Nit while visiting the file: the va_start calls don't have matching va_end calls, which are present in wsc.c which test-wsc.c appears based on.

Not a big deal, but happened to notice while inspecting.

~Will