gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 04/04: digestauth: always use master daemon only


From: gnunet
Subject: [libmicrohttpd] 04/04: digestauth: always use master daemon only
Date: Fri, 06 May 2022 21:22:14 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit cd5ad7aaadd8f169f79ba3564d49d7f2889093b8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri May 6 22:21:57 2022 +0300

    digestauth: always use master daemon only
---
 src/microhttpd/daemon.c     |  9 +++++++++
 src/microhttpd/digestauth.c | 14 +++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f0708737..6b7d8355 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -7481,6 +7481,15 @@ MHD_start_daemon_va (unsigned int flags,
           MHD_mutex_destroy_chk_ (&d->new_connections_mutex);
           goto thread_failed;
         }
+        /* Some members must be used only in master daemon */
+#ifdef DAUTH_SUPPORT
+        d->nnc = NULL;
+        d->nonce_nc_size = 0;
+#if defined(MHD_USE_THREADS)
+        memset (d->nnc_lock, 1, sizeof(daemon->nnc_lock));
+#endif /* MHD_USE_THREADS */
+#endif /* DAUTH_SUPPORT */
+
 
         /* Spawn the worker thread */
         if (! MHD_create_named_thread_ (&d->pid,
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index a95455d3..a92d99ed 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -590,7 +590,7 @@ check_nonce_nc (struct MHD_Connection *connection,
                 size_t noncelen,
                 uint64_t nc)
 {
-  struct MHD_Daemon *daemon = connection->daemon;
+  struct MHD_Daemon *daemon = MHD_get_master (connection->daemon);
   struct MHD_NonceNc *nn;
   uint32_t mod;
   bool ret;
@@ -896,7 +896,7 @@ calculate_add_nonce (struct MHD_Connection *const 
connection,
                      struct DigestAlgorithm *da,
                      char *nonce)
 {
-  struct MHD_Daemon *const daemon = connection->daemon;
+  struct MHD_Daemon *const daemon = MHD_get_master (connection->daemon);
   struct MHD_NonceNc *nn;
   const size_t nonce_size = NONCE_STD_LEN (da->digest_size);
   bool ret;
@@ -906,8 +906,8 @@ calculate_add_nonce (struct MHD_Connection *const 
connection,
 
   calculate_nonce (timestamp,
                    connection->method,
-                   connection->daemon->digest_auth_random,
-                   connection->daemon->digest_auth_rand_size,
+                   daemon->digest_auth_random,
+                   daemon->digest_auth_rand_size,
                    connection->url,
                    realm,
                    da,
@@ -969,7 +969,7 @@ calculate_add_nonce_with_retry (struct MHD_Connection 
*const connection,
     const size_t digest_size = da->digest_size;
     char nonce2[NONCE_STD_LEN (VLA_ARRAY_LEN_DIGEST (digest_size)) + 1];
     uint64_t timestamp2;
-    if (0 == connection->daemon->nonce_nc_size)
+    if (0 == MHD_get_master (connection->daemon)->nonce_nc_size)
       return false; /* No need to re-try */
 
     timestamp2 = MHD_monotonic_msec_counter ();
@@ -1142,7 +1142,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
                        const uint8_t *digest,
                        unsigned int nonce_timeout)
 {
-  struct MHD_Daemon *daemon = connection->daemon;
+  struct MHD_Daemon *daemon = MHD_get_master (connection->daemon);
   size_t len;
   const char *header;
   char nonce[MAX_NONCE_LENGTH];
@@ -1655,7 +1655,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection 
*connection,
   if (NULL == response)
     return MHD_NO;
 
-  if (0 == connection->daemon->nonce_nc_size)
+  if (0 == MHD_get_master (connection->daemon)->nonce_nc_size)
   {
 #ifdef HAVE_MESSAGES
     MHD_DLOG (connection->daemon,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]