[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 05/09: check_nonce_nc(): improved readability, fixed com
From: |
gnunet |
Subject: |
[libmicrohttpd] 05/09: check_nonce_nc(): improved readability, fixed comments |
Date: |
Sun, 01 May 2022 16:08:51 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit a3527f080a807060ddc4ae4bb4e395194c1bfd16
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun May 1 15:59:14 2022 +0300
check_nonce_nc(): improved readability, fixed comments
---
src/microhttpd/digestauth.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 81e50785..d4c0f247 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -614,6 +614,8 @@ check_nonce_nc (struct MHD_Connection *connection,
if ( (0 != memcmp (nn->nonce, nonce, noncelen)) ||
(0 != nn->nonce[noncelen]) )
ret = false; /* Nonce does not match, fail */
+ else if (nc == nn->nc)
+ ret = false; /* 'nc' was already used */
/* Note that we use 64 here, as we do not store the
bit for 'nn->nc' itself in 'nn->nmask' */
else if ( (nc < nn->nc) &&
@@ -625,11 +627,11 @@ check_nonce_nc (struct MHD_Connection *connection,
nn->nmask |= (1LLU << (nn->nc - nc - 1));
ret = true;
}
- else if (nc <= nn->nc)
- ret = false; /* Nonce does not match, fail */
+ else if (nc < nn->nc)
+ ret = false; /* 'nc' does not match, fail */
else
{
- /* Nonce is larger, shift bitmask and bump limit */
+ /* 'nc' is larger, shift bitmask and bump limit */
if (64 > nc - nn->nc)
nn->nmask <<= (nc - nn->nc); /* small jump, less than mask width */
else
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (06336118 -> 76b68f65), gnunet, 2022/05/01
- [libmicrohttpd] 04/09: check_nonce_nc(): simplified, gnunet, 2022/05/01
- [libmicrohttpd] 01/09: microhttpd.h: fixed list of required types, gnunet, 2022/05/01
- [libmicrohttpd] 02/09: digestauth: when checking 'nc' reuse always check nonce match first, gnunet, 2022/05/01
- [libmicrohttpd] 03/09: struct MHD_NonceNc: improved doxy, gnunet, 2022/05/01
- [libmicrohttpd] 07/09: check_nonce_nc(): fixed missing set of the bit for the old 'nc' value, gnunet, 2022/05/01
- [libmicrohttpd] 06/09: check_nonce_nc(): moved 'nc' overflow check out of mutex lock, gnunet, 2022/05/01
- [libmicrohttpd] 05/09: check_nonce_nc(): improved readability, fixed comments,
gnunet <=
- [libmicrohttpd] 09/09: check_nonce_nc(): sorted checks according to probability, gnunet, 2022/05/01
- [libmicrohttpd] 08/09: check_nonce_nc(): additionally improved readability, fixed comments, gnunet, 2022/05/01