[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 110/156: digest auth: fixed parallel access to the hash
From: |
gnunet |
Subject: |
[libmicrohttpd] 110/156: digest auth: fixed parallel access to the hash table |
Date: |
Sun, 28 May 2023 17:52:43 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to tag v0.9.77
in repository libmicrohttpd.
commit a9903c25d639d97ad93d524eeeab8dd3eb377bdf
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu May 18 16:52:46 2023 +0300
digest auth: fixed parallel access to the hash table
---
src/microhttpd/daemon.c | 6 +++++-
src/microhttpd/digestauth.c | 2 +-
src/microhttpd/internal.h | 9 +++++++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index b9192406..3801e438 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -257,7 +257,7 @@ MHD_free (void *ptr)
* @param daemon handle to a daemon
* @return master daemon handle
*/
-static struct MHD_Daemon *
+struct MHD_Daemon *
MHD_get_master (struct MHD_Daemon *daemon)
{
while (NULL != daemon->master)
@@ -7277,6 +7277,10 @@ MHD_start_daemon_va (unsigned int flags,
d->master = daemon;
d->worker_pool_size = 0;
d->worker_pool = NULL;
+#if defined(DAUTH_SUPPORT) && defined(MHD_USE_THREADS)
+ /* Avoid accidental re-use of the mutex copies */
+ memset (&d->nnc_lock, -1, sizeof(d->nnc_lock));
+#endif /* DAUTH_SUPPORT && MHD_USE_THREADS */
if (! MHD_mutex_init_ (&d->new_connections_mutex))
{
#ifdef HAVE_MESSAGES
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index dd8ea81d..360fa0e4 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -529,7 +529,7 @@ check_nonce_nc (struct MHD_Connection *connection,
const char *nonce,
uint64_t nc)
{
- struct MHD_Daemon *daemon = connection->daemon;
+ struct MHD_Daemon *const daemon = MHD_get_master (connection->daemon);
struct MHD_NonceNc *nn;
uint32_t off;
uint32_t mod;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index f5c965ec..cf51a5e0 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -2395,6 +2395,15 @@ MHD_check_response_header_token_ci (const struct
MHD_Response *response,
MHD_check_response_header_token_ci ((r),(k),MHD_STATICSTR_LEN_ (k), \
(tkn),MHD_STATICSTR_LEN_ (tkn))
+/**
+ * Trace up to and return master daemon. If the supplied daemon
+ * is a master, then return the daemon itself.
+ *
+ * @param daemon handle to a daemon
+ * @return master daemon handle
+ */
+struct MHD_Daemon *
+MHD_get_master (struct MHD_Daemon *daemon);
/**
* Internal version of #MHD_suspend_connection().
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 127/156: Updated test keys to use SHA-256 hash instead of SHA-1, (continued)
- [libmicrohttpd] 127/156: Updated test keys to use SHA-256 hash instead of SHA-1, gnunet, 2023/05/28
- [libmicrohttpd] 135/156: W32 VS projects: target Win8 or later on ARM and ARM64 arches, gnunet, 2023/05/28
- [libmicrohttpd] 136/156: W32 VS projects: added ARM and ARM64 configurations, gnunet, 2023/05/28
- [libmicrohttpd] 102/156: configure: removed 'gettext' from the final report, gnunet, 2023/05/28
- [libmicrohttpd] 109/156: test_client_put_stop: avoid stress-testing the OS, gnunet, 2023/05/28
- [libmicrohttpd] 115/156: test_post: fixed caseless key name match, gnunet, 2023/05/28
- [libmicrohttpd] 120/156: Simplified usage of the function name magic macros, gnunet, 2023/05/28
- [libmicrohttpd] 131/156: ChangeLog: updated, gnunet, 2023/05/28
- [libmicrohttpd] 138/156: Fixed compiler warning on x32, gnunet, 2023/05/28
- [libmicrohttpd] 78/156: Added tests with single and double folded header, gnunet, 2023/05/28
- [libmicrohttpd] 110/156: digest auth: fixed parallel access to the hash table,
gnunet <=
- [libmicrohttpd] 114/156: examples/largepost.c: fixed code style, gnunet, 2023/05/28
- [libmicrohttpd] 125/156: .gitignore: force include all *.{c,h} files, gnunet, 2023/05/28
- [libmicrohttpd] 113/156: examples/largepost.c: fixed caseless method match, gnunet, 2023/05/28
- [libmicrohttpd] 129/156: Detect sysctl() symbols in configure, gnunet, 2023/05/28
- [libmicrohttpd] 98/156: .gitignore: added universal patter to ignore test binaries, gnunet, 2023/05/28
- [libmicrohttpd] 140/156: Added support for custom command for tarball compression, gnunet, 2023/05/28
- [libmicrohttpd] 143/156: Fixed compiler warning when built without poll() support, gnunet, 2023/05/28
- [libmicrohttpd] 141/156: contrib/make-dist.sh: added use of zopfli if available, gnunet, 2023/05/28
- [libmicrohttpd] 142/156: daemon.c: redesigned code for clarity and formatting, gnunet, 2023/05/28
- [libmicrohttpd] 144/156: Avoided potential compiler warnings, gnunet, 2023/05/28