gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (bf25ee3a -> e3d7574a)


From: gnunet
Subject: [libmicrohttpd] branch master updated (bf25ee3a -> e3d7574a)
Date: Thu, 01 Apr 2021 20:38:56 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from bf25ee3a Implemented new API function MHD_run_wait().
     new a25f48da digestauth: do not use size of buffer as size of digest
     new 876be043 digestauth: fixed compiler warning
     new fb9100e3 connection.c: mute compiler warning
     new d27d2b38 test_get_iovec: fixed compiler warning
     new afbcfc12 test_add_conn: muted compiler warning
     new 9826b05e testzzuf: test thoroughly if heavy tests are enabled
     new 93291187 configure: assume that systems assert() is functional if 
available
     new 81beb041 websocket_threaded_example: muted compiler warning
     new 05cd7f03 digestauth.c: trust configure detection of variable length 
arrays
     new e3d7574a ax_have_epoll: speed-up detection

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                              | 16 ++---------
 m4/ax_have_epoll.m4                       |  2 +-
 src/examples/websocket_threaded_example.c |  2 +-
 src/microhttpd/connection.c               |  1 +
 src/microhttpd/digestauth.c               | 48 +++++++++++++++----------------
 src/testcurl/test_add_conn.c              |  2 ++
 src/testcurl/test_get_iovec.c             |  4 +--
 src/testzzuf/Makefile.am                  |  4 +++
 src/testzzuf/socat.c                      |  4 +++
 9 files changed, 41 insertions(+), 42 deletions(-)

diff --git a/configure.ac b/configure.ac
index f3c0cde3..e6cc7214 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2352,20 +2352,8 @@ AS_VAR_IF([[enable_asserts]], [["yes"]],
                      [[mhd_cv_sys_assert_avail='no']])
      ]
    )
-   AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["yes"]],
-     [
-      AC_CACHE_CHECK([[whether system assert() is usable]], 
[mhd_cv_sys_assert_use],
-        [
-         AC_RUN_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])],
-                       [[mhd_cv_sys_assert_use='no']],
-                       [[mhd_cv_sys_assert_use='yes']],
-                       [[mhd_cv_sys_assert_use='assuming yes']])
-        ]
-      )
-      AS_VAR_IF([[mhd_cv_sys_assert_use]], [["no"]], [],
-        [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() 
and assert.h])])
-     ]
-   )
+   AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["no"]], [],
+     [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() 
and assert.h])])
    AS_UNSET([mhd_assert_test_prg])
   ],
   [AC_DEFINE([[NDEBUG]], [[1]], [Define to disable usage of debug asserts.])]
diff --git a/m4/ax_have_epoll.m4 b/m4/ax_have_epoll.m4
index 8b23e1aa..3098de69 100644
--- a/m4/ax_have_epoll.m4
+++ b/m4/ax_have_epoll.m4
@@ -46,7 +46,7 @@
 
 AC_DEFUN([AX_HAVE_EPOLL], [dnl
   ax_have_epoll_cppflags="${CPPFLAGS}"
-  AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} 
-DHAVE_LINUX_VERSION_H"])
+  AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} 
-DHAVE_LINUX_VERSION_H"], [], [AC_INCLUDES_DEFAULT])
   AC_MSG_CHECKING([for Linux epoll(7) interface])
   AC_CACHE_VAL([ax_cv_have_epoll], [dnl
     AC_LINK_IFELSE([dnl
diff --git a/src/examples/websocket_threaded_example.c 
b/src/examples/websocket_threaded_example.c
index b508198d..1502501b 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -492,7 +492,7 @@ ws_get_accept_value (const char *key, char **val)
     return MHD_NO;
   }
   strncpy (str, key, (WS_KEY_LEN + 1));
-  strncat (str, WS_GUID, WS_GUID_LEN);
+  strncpy (str + WS_KEY_LEN, WS_GUID, WS_GUID_LEN + 1);
   SHA1Reset (&ctx);
   SHA1Input (&ctx, (const unsigned char *) str, WS_KEY_GUID_LEN);
   SHA1Result (&ctx, hash);
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 25d920e2..db130e18 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1277,6 +1277,7 @@ build_header_response (struct MHD_Connection *connection)
   must_add_chunked_encoding = false;
   must_add_keep_alive = false;
   must_add_content_length = false;
+  content_length_len = 0; /* Mute compiler warning only */
   response_has_close = false;
   switch (connection->state)
   {
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 5fc9c588..649fef62 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -63,7 +63,7 @@
 /**
  * Macro to avoid using VLAs if the compiler does not support them.
  */
-#if __STDC_NO_VLA__
+#ifndef HAVE_C_VARARRAYS
 /**
  * Return #MAX_DIGEST.
  *
@@ -216,14 +216,15 @@ digest_calc_ha1_from_digest (const char *alg,
                              const char *nonce,
                              const char *cnonce)
 {
+  const unsigned int digest_size = da->digest_size;
   if ( (MHD_str_equal_caseless_ (alg,
                                  "md5-sess")) ||
        (MHD_str_equal_caseless_ (alg,
                                  "sha-256-sess")) )
   {
-    uint8_t dig[VLA_ARRAY_LEN_DIGEST (da->digest_size)];
+    uint8_t dig[VLA_ARRAY_LEN_DIGEST (digest_size)];
 
-    VLA_CHECK_LEN_DIGEST (da->digest_size);
+    VLA_CHECK_LEN_DIGEST (digest_size);
     da->init (da->ctx);
     da->update (da->ctx,
                 digest,
@@ -243,13 +244,13 @@ digest_calc_ha1_from_digest (const char *alg,
     da->digest (da->ctx,
                 dig);
     cvthex (dig,
-            sizeof (dig),
+            digest_size,
             da->sessionkey);
   }
   else
   {
     cvthex (digest,
-            da->digest_size,
+            digest_size,
             da->sessionkey);
   }
 }
@@ -334,11 +335,12 @@ digest_calc_response (const char *ha1,
                       const char *hentity,
                       struct DigestAlgorithm *da)
 {
-  unsigned char ha2[VLA_ARRAY_LEN_DIGEST (da->digest_size)];
-  unsigned char resphash[VLA_ARRAY_LEN_DIGEST (da->digest_size)];
+  const unsigned int digest_size = da->digest_size;
+  unsigned char ha2[VLA_ARRAY_LEN_DIGEST (digest_size)];
+  unsigned char resphash[VLA_ARRAY_LEN_DIGEST (digest_size)];
   (void) hentity; /* Unused. Silence compiler warning. */
 
-  VLA_CHECK_LEN_DIGEST (da->digest_size);
+  VLA_CHECK_LEN_DIGEST (digest_size);
   da->init (da->ctx);
   da->update (da->ctx,
               (const unsigned char *) method,
@@ -367,13 +369,13 @@ digest_calc_response (const char *ha1,
   da->digest (da->ctx,
               ha2);
   cvthex (ha2,
-          da->digest_size,
+          digest_size,
           da->sessionkey);
   da->init (da->ctx);
   /* calculate response */
   da->update (da->ctx,
               (const unsigned char *) ha1,
-              da->digest_size * 2);
+              digest_size * 2);
   da->update (da->ctx,
               (const unsigned char *) ":",
               1);
@@ -406,11 +408,11 @@ digest_calc_response (const char *ha1,
   }
   da->update (da->ctx,
               (const unsigned char *) da->sessionkey,
-              da->digest_size * 2);
+              digest_size * 2);
   da->digest (da->ctx,
               resphash);
   cvthex (resphash,
-          sizeof(resphash),
+          digest_size,
           da->sessionkey);
 }
 
@@ -680,10 +682,10 @@ calculate_nonce (uint32_t nonce_time,
                  char *nonce)
 {
   unsigned char timestamp[TIMESTAMP_BIN_SIZE];
-  unsigned char tmpnonce[VLA_ARRAY_LEN_DIGEST (da->digest_size)];
-  char timestamphex[TIMESTAMP_BIN_SIZE * 2 + 1];
+  const unsigned int digest_size = da->digest_size;
+  unsigned char tmpnonce[VLA_ARRAY_LEN_DIGEST (digest_size)];
 
-  VLA_CHECK_LEN_DIGEST (da->digest_size);
+  VLA_CHECK_LEN_DIGEST (digest_size);
   da->init (da->ctx);
   timestamp[0] = (unsigned char) ((nonce_time & 0xff000000) >> 0x18);
   timestamp[1] = (unsigned char) ((nonce_time & 0x00ff0000) >> 0x10);
@@ -720,14 +722,11 @@ calculate_nonce (uint32_t nonce_time,
   da->digest (da->ctx,
               tmpnonce);
   cvthex (tmpnonce,
-          sizeof (tmpnonce),
+          digest_size,
           nonce);
   cvthex (timestamp,
           sizeof (timestamp),
-          timestamphex);
-  strncat (nonce,
-           timestamphex,
-           8);
+          nonce + digest_size * 2);
 }
 
 
@@ -868,19 +867,20 @@ digest_auth_check_all (struct MHD_Connection *connection,
   const char *header;
   char nonce[MAX_NONCE_LENGTH];
   char cnonce[MAX_NONCE_LENGTH];
-  char ha1[VLA_ARRAY_LEN_DIGEST (da->digest_size) * 2 + 1];
+  const unsigned int digest_size = da->digest_size;
+  char ha1[VLA_ARRAY_LEN_DIGEST (digest_size) * 2 + 1];
   char qop[15]; /* auth,auth-int */
   char nc[20];
   char response[MAX_AUTH_RESPONSE_LENGTH];
   const char *hentity = NULL; /* "auth-int" is not supported */
-  char noncehashexp[NONCE_STD_LEN (VLA_ARRAY_LEN_DIGEST (da->digest_size)) + 
1];
+  char noncehashexp[NONCE_STD_LEN (VLA_ARRAY_LEN_DIGEST (digest_size)) + 1];
   uint32_t nonce_time;
   uint32_t t;
   size_t left; /* number of characters left in 'header' for 'uri' */
   uint64_t nci;
   char *qmark;
 
-  VLA_CHECK_LEN_DIGEST (da->digest_size);
+  VLA_CHECK_LEN_DIGEST (digest_size);
   if (MHD_NO == MHD_lookup_connection_value_n (connection,
                                                MHD_HEADER_KIND,
                                                MHD_HTTP_HEADER_AUTHORIZATION,
@@ -1081,7 +1081,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
     }
     memcpy (ha1,
             da->sessionkey,
-            sizeof (ha1));
+            digest_size * 2 + 1);
     /* This will initialize da->sessionkey (respexp) */
     digest_calc_response (ha1,
                           nonce,
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c
index daa45206..c1dbdd40 100644
--- a/src/testcurl/test_add_conn.c
+++ b/src/testcurl/test_add_conn.c
@@ -821,6 +821,8 @@ testExternalGet (void)
   if (! c_no_listen)
     c_d = curlEasyInitForTest ("http://127.0.0.1"; EXPECTED_URI_FULL_PATH,
                                d_port, &cbc_d);
+  else
+    c_d = NULL; /* To mute compiler warning only */
 
   c_a = curlEasyInitForTest ("http://127.0.0.1"; EXPECTED_URI_FULL_PATH,
                              a_port, &cbc_a);
diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c
index 0c58f26f..45658c96 100644
--- a/src/testcurl/test_get_iovec.c
+++ b/src/testcurl/test_get_iovec.c
@@ -99,7 +99,7 @@ iovncont_free_callback (void *cls)
   unsigned int i;
 
   for (i = 0; i < TESTSTR_IOVCNT; ++i)
-    free (iov[i].iov_base);
+    free ((void*) iov[i].iov_base);
   free (iov);
 }
 
@@ -245,7 +245,7 @@ err_out:
   for (j = 0; j < TESTSTR_IOVCNT; ++j)
   {
     if (NULL != iov[j].iov_base)
-      free (iov[j].iov_base);
+      free ((void*) iov[j].iov_base);
   }
   free (iov);
   return MHD_NO;
diff --git a/src/testzzuf/Makefile.am b/src/testzzuf/Makefile.am
index c657f34e..b26d0c84 100644
--- a/src/testzzuf/Makefile.am
+++ b/src/testzzuf/Makefile.am
@@ -8,6 +8,10 @@ endif
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/include \
   $(LIBCURL_CPPFLAGS)
+  
+if HEAVY_TESTS
+AM_CPPFLAGS += -D_MHD_HEAVY_TESTS=1
+endif  
 
 EXTRA_DIST = README socat.c
 
diff --git a/src/testzzuf/socat.c b/src/testzzuf/socat.c
index 29b086bb..85423aad 100644
--- a/src/testzzuf/socat.c
+++ b/src/testzzuf/socat.c
@@ -43,7 +43,11 @@
  * long for most user's patience.  So this small
  * value is the default.
  */
+#ifndef _MHD_HEAVY_TESTS
 #define LOOP_COUNT 10
+#else  /* ! _MHD_HEAVY_TESTS */
+#define LOOP_COUNT 200
+#endif /* ! _MHD_HEAVY_TESTS */
 
 #define CURL_TIMEOUT 50L
 

-- 
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]