Skip to content

Commit

Permalink
Fix GSS krb5 initial sequence number gap handling
Browse files Browse the repository at this point in the history
Since #2040, the dummy queue element inserted by g_order_init no
longer compares less than the initial sequence number, so we fail when
the first few sequence numbers are received out of order.  Properly
detect when a sequence number fits between the dummy element and the
first real queue element.

[ghudson@mit.edu: rewrote commit message]

(cherry picked from commit 13a9cb7)

ticket: 8094 (new)
version_fixed: 1.11.6
status: resolved
  • Loading branch information
tkuthan authored and tlyu committed Feb 6, 2015
1 parent f723f5d commit 8857ae0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib/gssapi/generic/util_ordering.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,21 @@ g_order_check(void **vqueue, gssint_uint64 seqnum)
return(GSS_S_UNSEQ_TOKEN);
}
}
/*
* Exception: if first token arrived out-of-order.
* In that case first two elements in queue are 0xFFFFFFFF and some k,
* where k > seqnum. We need to insert seqnum before k.
* We check this after the for-loop, because this should be rare.
*/
if ((QELEM(q, q->start) == (((uint64_t)0 - 1) & q->mask)) &&
((QELEM(q, q->start + 1) > seqnum))) {
queue_insert(q, q->start, seqnum);
if (q->do_replay && !q->do_sequence)
return(GSS_S_COMPLETE);
else
return(GSS_S_UNSEQ_TOKEN);

}
}

/* this should never happen */
Expand Down

0 comments on commit 8857ae0

Please sign in to comment.