[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/10: digestauth: added asserts, fixed internal doxy
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/10: digestauth: added asserts, fixed internal doxy |
Date: |
Wed, 01 Nov 2023 11:52:16 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 492bce058e6f02399913e3374a75cdbe6db1d0c6
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Oct 10 09:11:19 2023 +0300
digestauth: added asserts, fixed internal doxy
---
src/microhttpd/digestauth.c | 43 ++++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 12fa2f3a..69f9c227 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -1,7 +1,7 @@
/*
This file is part of libmicrohttpd
Copyright (C) 2010, 2011, 2012, 2015, 2018 Daniel Pittman and Christian
Grothoff
- Copyright (C) 2014-2022 Evgeny Grin (Karlson2k)
+ Copyright (C) 2014-2023 Evgeny Grin (Karlson2k)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -2502,15 +2502,18 @@ is_param_equal_caseless (const struct MHD_RqDAuthParam
*param,
* used as one-time nonces because nonce-count is not supported in this old
RFC.
* Communication in this mode is very inefficient, especially if the client
* requests several resources one-by-one as for every request new nonce must be
- * generated and client repeat all requests twice (first time to get a new
- * nonce and second time to perform an authorised request).
+ * generated and client repeat all requests twice (the first time to get a new
+ * nonce and the second time to perform an authorised request).
*
* @param connection the MHD connection structure
- * @param realm the realm presented to the client
- * @param username the username needs to be authenticated
- * @param password the password used in the authentication
- * @param userdigest the optional precalculated binary hash of the string
- * "username:realm:password"
+ * @param realm the realm for authorization of the client
+ * @param username the username to be authenticated, must be in clear text
+ * even if userhash is used by the client
+ * @param password the password used in the authentication,
+ * must be NULL if @a userdigest is not NULL
+ * @param userdigest the precalculated binary hash of the string
+ * "username:realm:password",
+ * must be NULL if @a password is not NULL
* @param nonce_timeout the period of seconds since nonce generation, when
* the nonce is recognised as valid and not stale.
* @param max_nc the maximum allowed nc (Nonce Count) value, if client's nc
@@ -2521,7 +2524,7 @@ is_param_equal_caseless (const struct MHD_RqDAuthParam
*param,
* @param malgo3 digest algorithms allowed to use, fail if algorithm specified
* by the client is not allowed by this parameter
* @param[out] pbuf the pointer to pointer to internally malloc'ed buffer,
- * to be free if not NULL upon return
+ * to be freed if not NULL upon return
* @return #MHD_DAUTH_OK if authenticated,
* error code otherwise.
* @ingroup authentication
@@ -2563,6 +2566,9 @@ digest_auth_check_all_inner (struct MHD_Connection
*connection,
size_t username_len;
size_t realm_len;
+ mhd_assert ((NULL != password) || (NULL != userdigest));
+ mhd_assert (! ((NULL != userdigest) && (NULL != password)));
+
tmp2_size = 0;
params = MHD_get_rq_dauth_params_ (connection);
@@ -2834,7 +2840,7 @@ digest_auth_check_all_inner (struct MHD_Connection
*connection,
/*
* First level vetting for the nonce validity: if the timestamp
* attached to the nonce exceeds `nonce_timeout', then the nonce is
- * invalid.
+ * stale.
*/
if (TRIM_TO_TIMESTAMP (t - nonce_time) > (nonce_timeout * 1000))
return MHD_DAUTH_NONCE_STALE; /* too old */
@@ -3044,15 +3050,18 @@ digest_auth_check_all_inner (struct MHD_Connection
*connection,
* used as one-time nonces because nonce-count is not supported in this old
RFC.
* Communication in this mode is very inefficient, especially if the client
* requests several resources one-by-one as for every request new nonce must be
- * generated and client repeat all requests twice (first time to get a new
- * nonce and second time to perform an authorised request).
+ * generated and client repeat all requests twice (the first time to get a new
+ * nonce and the second time to perform an authorised request).
*
* @param connection the MHD connection structure
- * @param realm the realm presented to the client
- * @param username the username needs to be authenticated
- * @param password the password used in the authentication
- * @param userdigest the optional precalculated binary hash of the string
- * "username:realm:password"
+ * @param realm the realm for authorization of the client
+ * @param username the username to be authenticated, must be in clear text
+ * even if userhash is used by the client
+ * @param password the password used in the authentication,
+ * must be NULL if @a userdigest is not NULL
+ * @param userdigest the precalculated binary hash of the string
+ * "username:realm:password",
+ * must be NULL if @a password is not NULL
* @param nonce_timeout the period of seconds since nonce generation, when
* the nonce is recognised as valid and not stale.
* @param max_nc the maximum allowed nc (Nonce Count) value, if client's nc
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (90fcf2fc -> 75e2addd), gnunet, 2023/11/01
- [libmicrohttpd] 03/10: daemon.c: cosmetics, gnunet, 2023/11/01
- [libmicrohttpd] 04/10: daemon: muted possible compiler warning, gnunet, 2023/11/01
- [libmicrohttpd] 02/10: Upgraded connection: cosmetics, gnunet, 2023/11/01
- [libmicrohttpd] 01/10: digestauth: added asserts, fixed internal doxy,
gnunet <=
- [libmicrohttpd] 07/10: configure: warn if building without threads, gnunet, 2023/11/01
- [libmicrohttpd] 09/10: Adjusted default value of maximum connections, gnunet, 2023/11/01
- [libmicrohttpd] 06/10: configure: cosmetics, gnunet, 2023/11/01
- [libmicrohttpd] 10/10: internal.h: added macros for polling mode detection, gnunet, 2023/11/01
- [libmicrohttpd] 08/10: configure: added detection of FD_SETSIZE value and ability to override it, gnunet, 2023/11/01
- [libmicrohttpd] 05/10: microhttpd.h: updated doxy for MHD_USE_PEDANTIC_CHECKS, gnunet, 2023/11/01