mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
digestauth: fixed logic of free nonce-nc slot detection
This commit is contained in:
@@ -845,11 +845,8 @@ is_slot_available (const struct MHD_NonceNc *const nn,
|
||||
if (0 == nn->nonce[0])
|
||||
return true; /* The slot is empty */
|
||||
|
||||
if (0 != nn->nc)
|
||||
return true; /* Client already used the nonce in this slot at least
|
||||
one time, re-use the slot */
|
||||
|
||||
if (0 == memcmp (nn->nonce, new_nonce, new_nonce_len + 1))
|
||||
if ((0 == memcmp (nn->nonce, new_nonce, new_nonce_len)) &&
|
||||
(0 == nn->nonce[new_nonce_len]))
|
||||
{
|
||||
/* The slot has the same nonce already, the same nonce was already generated
|
||||
* and used, this slot cannot be used with the same nonce as it would
|
||||
@@ -857,6 +854,10 @@ is_slot_available (const struct MHD_NonceNc *const nn,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 != nn->nc)
|
||||
return true; /* Client already used the nonce in this slot at least
|
||||
one time, re-use the slot */
|
||||
|
||||
timestamp_valid = get_nonce_timestamp (nn->nonce, 0, ×tamp);
|
||||
mhd_assert (timestamp_valid);
|
||||
if (! timestamp_valid)
|
||||
|
||||
Reference in New Issue
Block a user