[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 09/19: test_digestauth{,_sha256,_with_aguments}: moved b
From: |
gnunet |
Subject: |
[libmicrohttpd] 09/19: test_digestauth{,_sha256,_with_aguments}: moved back to Digest Auth APIv2 |
Date: |
Thu, 28 Jul 2022 06:26:13 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 5da848a157202cc8ebfc0dbdc39ec4529160d36e
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Jul 25 10:01:00 2022 +0300
test_digestauth{,_sha256,_with_aguments}: moved back to Digest Auth APIv2
Fixed compiler warnings
---
src/testcurl/test_digestauth.c | 22 ++++++++++-----------
src/testcurl/test_digestauth_sha256.c | 20 +++++++++----------
src/testcurl/test_digestauth_with_arguments.c | 28 +++++++++++++++------------
3 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
index 872eebc4..42ddd874 100644
--- a/src/testcurl/test_digestauth.c
+++ b/src/testcurl/test_digestauth.c
@@ -265,7 +265,7 @@ ahc_echo (void *cls,
const char *password = "testpass";
const char *realm = "test@example.com";
enum MHD_Result ret;
- enum MHD_DigestAuthResult ret_e;
+ int ret_i;
static int already_called_marker;
(void) cls; (void) url; /* Unused. Silent compiler
warning. */
(void) method; (void) version; (void) upload_data; /* Unused. Silent
compiler warning. */
@@ -297,14 +297,14 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- ret_e = MHD_digest_auth_check3 (connection,
+ ret_i = MHD_digest_auth_check2 (connection,
realm,
username,
password,
300,
MHD_DIGEST_ALG_MD5);
MHD_free (username);
- if (ret_e != MHD_DAUTH_OK)
+ if (ret_i != MHD_YES)
{
response = MHD_create_response_from_buffer_static (strlen (DENIED),
DENIED);
@@ -314,7 +314,7 @@ ahc_echo (void *cls,
realm,
MY_OPAQUE,
response,
- (MHD_DAUTH_NONCE_STALE == ret_e) ?
+ (MHD_INVALID_NONCE == ret_i) ?
MHD_YES : MHD_NO,
MHD_DIGEST_ALG_MD5);
if (MHD_YES != ret)
@@ -337,7 +337,7 @@ ahc_echo (void *cls,
static CURL *
-setupCURL (void *cbc, int port)
+setupCURL (void *cbc, uint16_t port)
{
CURL *c;
char url[512];
@@ -348,7 +348,7 @@ setupCURL (void *cbc, int port)
/* A workaround for some old libcurl versions, which ignore the specified
* port by CURLOPT_PORT when digest authorisation is used. */
res = snprintf (url, (sizeof(url) / sizeof(url[0])),
- "http://127.0.0.1:%d%s", port, MHD_URI_BASE_PATH);
+ "http://127.0.0.1:%d%s", (int) port, MHD_URI_BASE_PATH);
if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res))
externalErrorExitDesc ("Cannot form request URL");
}
@@ -387,15 +387,15 @@ setupCURL (void *cbc, int port)
}
-static int
-testDigestAuth ()
+static unsigned int
+testDigestAuth (void)
{
CURL *c;
struct MHD_Daemon *d;
struct CBC cbc;
char buf[2048];
char rnd[8];
- int port;
+ uint16_t port;
#ifndef WINDOWS
int fd;
size_t len;
@@ -446,7 +446,7 @@ testDigestAuth ()
#endif
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL,
- &ahc_echo, PAGE,
+ &ahc_echo, NULL,
MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
MHD_OPTION_NONCE_NC_SIZE, 300,
MHD_OPTION_END);
@@ -461,7 +461,7 @@ testDigestAuth ()
if ( (NULL == dinfo) ||
(0 == dinfo->port) )
mhdErrorExitDesc ("MHD_get_daemon_info() failed");
- port = (int) dinfo->port;
+ port = dinfo->port;
}
c = setupCURL (&cbc, port);
diff --git a/src/testcurl/test_digestauth_sha256.c
b/src/testcurl/test_digestauth_sha256.c
index b34dff9f..dfaf1ec8 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -94,7 +94,7 @@ ahc_echo (void *cls,
const char *password = "testpass";
const char *realm = "test@example.com";
enum MHD_Result ret;
- enum MHD_DigestAuthResult ret_e;
+ int ret_i;
static int already_called_marker;
(void) cls; (void) url; /* Unused. Silent compiler
warning. */
(void) method; (void) version; (void) upload_data; /* Unused. Silent
compiler warning. */
@@ -122,14 +122,14 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- ret_e = MHD_digest_auth_check3 (connection,
+ ret_i = MHD_digest_auth_check2 (connection,
realm,
username,
password,
300,
MHD_DIGEST_ALG_SHA256);
MHD_free (username);
- if (ret_e != MHD_DAUTH_OK)
+ if (ret_i != MHD_YES)
{
response = MHD_create_response_from_buffer_static (strlen (DENIED),
DENIED);
@@ -139,7 +139,7 @@ ahc_echo (void *cls,
realm,
MY_OPAQUE,
response,
- (MHD_DAUTH_NONCE_STALE == ret_e) ?
+ (MHD_INVALID_NONCE == ret_i) ?
MHD_YES : MHD_NO,
MHD_DIGEST_ALG_SHA256);
MHD_destroy_response (response);
@@ -155,8 +155,8 @@ ahc_echo (void *cls,
}
-static int
-testDigestAuth ()
+static unsigned int
+testDigestAuth (void)
{
CURL *c;
CURLcode errornum;
@@ -164,7 +164,7 @@ testDigestAuth ()
struct CBC cbc;
char buf[2048];
char rnd[8];
- int port;
+ uint16_t port;
char url[128];
#ifndef WINDOWS
int fd;
@@ -239,7 +239,7 @@ testDigestAuth ()
#endif
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
port, NULL, NULL,
- &ahc_echo, PAGE,
+ &ahc_echo, NULL,
MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
MHD_OPTION_NONCE_NC_SIZE, 300,
MHD_OPTION_END);
@@ -257,12 +257,12 @@ testDigestAuth ()
MHD_stop_daemon (d);
return 32;
}
- port = (int) dinfo->port;
+ port = dinfo->port;
}
snprintf (url,
sizeof (url),
"http://127.0.0.1:%d/bar%%20foo?key=value",
- port);
+ (int) port);
c = curl_easy_init ();
curl_easy_setopt (c, CURLOPT_URL, url);
curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer);
diff --git a/src/testcurl/test_digestauth_with_arguments.c
b/src/testcurl/test_digestauth_with_arguments.c
index 631169e8..a606f363 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
const char *password = "testpass";
const char *realm = "test@example.com";
enum MHD_Result ret;
- enum MHD_DigestAuthResult ret_e;
+ int ret_i;
static int already_called_marker;
(void) cls; (void) url; /* Unused. Silent compiler
warning. */
(void) method; (void) version; (void) upload_data; /* Unused. Silent
compiler warning. */
@@ -114,24 +114,28 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- ret_e = MHD_digest_auth_check3 (connection, realm,
+ ret_i = MHD_digest_auth_check2 (connection,
+ realm,
username,
password,
300,
MHD_DIGEST_ALG_MD5);
MHD_free (username);
- if (ret_e != MHD_DAUTH_OK)
+ if (ret_i != MHD_YES)
{
response = MHD_create_response_from_buffer_static (strlen (DENIED),
DENIED);
if (NULL == response)
- return MHD_NO;
- ret = MHD_queue_auth_fail_response2 (connection, realm,
+ fprintf (stderr, "MHD_create_response_from_buffer() failed.\n");
+ ret = MHD_queue_auth_fail_response2 (connection,
+ realm,
MY_OPAQUE,
response,
- (ret_e == MHD_DAUTH_NONCE_STALE) ?
+ (MHD_INVALID_NONCE == ret_i) ?
MHD_YES : MHD_NO,
MHD_DIGEST_ALG_MD5);
+ if (MHD_YES != ret)
+ fprintf (stderr, "MHD_queue_auth_fail_response2() failed.\n");
MHD_destroy_response (response);
return ret;
}
@@ -143,8 +147,8 @@ ahc_echo (void *cls,
}
-static int
-testDigestAuth ()
+static unsigned int
+testDigestAuth (void)
{
CURL *c;
CURLcode errornum;
@@ -152,7 +156,7 @@ testDigestAuth ()
struct CBC cbc;
char buf[2048];
char rnd[8];
- int port;
+ uint16_t port;
char url[128];
#ifndef WINDOWS
int fd;
@@ -216,7 +220,7 @@ testDigestAuth ()
}
#endif
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
- port, NULL, NULL, &ahc_echo, PAGE,
+ port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
MHD_OPTION_NONCE_NC_SIZE, 300,
MHD_OPTION_END);
@@ -230,13 +234,13 @@ testDigestAuth ()
{
MHD_stop_daemon (d); return 32;
}
- port = (int) dinfo->port;
+ port = dinfo->port;
}
snprintf (url,
sizeof (url),
"http://127.0.0.1:%d/bar%%20foo?"
"key=value&more=even%%20more&empty&=no_key&&same=one&&same=two",
- port);
+ (int) port);
c = curl_easy_init ();
curl_easy_setopt (c, CURLOPT_URL, url);
curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 03/19: gen_auth: cosmetics, (continued)
- [libmicrohttpd] 03/19: gen_auth: cosmetics, gnunet, 2022/07/28
- [libmicrohttpd] 04/19: digest_auth_check(): reduced scope of one-time variable, gnunet, 2022/07/28
- [libmicrohttpd] 06/19: digest_auth_check(): added check for too large realm value, gnunet, 2022/07/28
- [libmicrohttpd] 02/19: gen_auth: fixed detection of userhash in Digest Auth requests, gnunet, 2022/07/28
- [libmicrohttpd] 07/19: Updated doxy for old Digest Auth API function, gnunet, 2022/07/28
- [libmicrohttpd] 10/19: test_digestauth_emu_ext: cosmetics, additional check, gnunet, 2022/07/28
- [libmicrohttpd] 11/19: tests_digestauth*: added workarounds for libcurl bug, gnunet, 2022/07/28
- [libmicrohttpd] 01/19: digestauth: fixed copy-paste error in request algo parsing, gnunet, 2022/07/28
- [libmicrohttpd] 08/19: digestauth: term correction in comment, gnunet, 2022/07/28
- [libmicrohttpd] 05/19: digest_auth_check(): added support for userhash, gnunet, 2022/07/28
- [libmicrohttpd] 09/19: test_digestauth{,_sha256,_with_aguments}: moved back to Digest Auth APIv2,
gnunet <=
- [libmicrohttpd] 14/19: MHD_add_response_entry(): refactoring + added internal function, gnunet, 2022/07/28
- [libmicrohttpd] 12/19: test_digestauth_concurrent: fixed compiler warnings, gnunet, 2022/07/28
- [libmicrohttpd] 17/19: test_digestauth2: added new group of tests for Digest Auth checking, gnunet, 2022/07/28
- [libmicrohttpd] 16/19: Added MHD_queue_auth_required_response3(); Refactored public Digest Auth API v3, gnunet, 2022/07/28
- [libmicrohttpd] 13/19: Updated Digest Auth enums in the header, gnunet, 2022/07/28
- [libmicrohttpd] 18/19: MHD_FEATURE_*: added some values related to Digest Auth, gnunet, 2022/07/28
- [libmicrohttpd] 15/19: Digest Auth public structs: removed redundant member, gnunet, 2022/07/28
- [libmicrohttpd] 19/19: Makefile: cosmetics, gnunet, 2022/07/28