[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 10/19: test_digestauth_emu_ext: cosmetics, additional ch
From: |
gnunet |
Subject: |
[libmicrohttpd] 10/19: test_digestauth_emu_ext: cosmetics, additional check |
Date: |
Thu, 28 Jul 2022 06:26: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 aa49d6053c6d97cac0d10f9e39993962103dfb37
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Jul 22 19:24:43 2022 +0300
test_digestauth_emu_ext: cosmetics, additional check
---
src/testcurl/test_digestauth_emu_ext.c | 36 ++++++++++++++++++----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/testcurl/test_digestauth_emu_ext.c
b/src/testcurl/test_digestauth_emu_ext.c
index 740f43eb..2cd2519f 100644
--- a/src/testcurl/test_digestauth_emu_ext.c
+++ b/src/testcurl/test_digestauth_emu_ext.c
@@ -237,7 +237,7 @@ _checkCURLE_OK_func (CURLcode code, const char *curlFunc,
#define USERNAME "titkos szuper" "\xC3\xBC" "gyn" "\xC3\xB6" "k"
/* percent-encoded username */
#define USERNAME_PCTENC "titkos%20szuper%C3%BCgyn%C3%B6k"
-#define PASSWORD "fake pass"
+#define PASSWORD_VALUE "fake pass"
#define OPAQUE_VALUE "opaque-content"
#define NONCE_EMU "badbadbadbadbadbadbadbadbadbadbadbadbadbadba"
#define CNONCE_EMU "utututututututututututututututututututututs="
@@ -354,6 +354,14 @@ ahc_echo (void *cls,
creds = MHD_digest_auth_get_username3 (connection);
if (NULL == creds)
mhdErrorExitDesc ("MHD_digest_auth_get_username3() returned NULL");
+ else if (MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED != creds->uname_type)
+ {
+ fprintf (stderr, "Unexpected 'uname_type'.\n"
+ "Expected: %d\tRecieved: %d. ",
+ (int) MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED,
+ (int) creds->uname_type);
+ mhdErrorExitDesc ("Wrong 'uname_type'");
+ }
else if (NULL == creds->username)
mhdErrorExitDesc ("'username' is NULL");
else if (creds->username_len != MHD_STATICSTR_LEN_ (USERNAME))
@@ -377,7 +385,12 @@ ahc_echo (void *cls,
mhdErrorExitDesc ("'userhash_bin' is NOT NULL");
else if (0 != creds->userhash_bin_size)
mhdErrorExitDesc ("'userhash_bin_size' is NOT zero");
- else if (MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED != creds->uname_type)
+ MHD_free (creds);
+
+ dinfo = MHD_digest_auth_get_request_info3 (connection);
+ if (NULL == dinfo)
+ mhdErrorExitDesc ("MHD_digest_auth_get_username3() returned NULL");
+ else if (MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED != dinfo->uname_type)
{
fprintf (stderr, "Unexpected 'uname_type'.\n"
"Expected: %d\tRecieved: %d. ",
@@ -385,11 +398,6 @@ ahc_echo (void *cls,
(int) creds->uname_type);
mhdErrorExitDesc ("Wrong 'uname_type'");
}
- MHD_free (creds);
-
- dinfo = MHD_digest_auth_get_request_info3 (connection);
- if (NULL == dinfo)
- mhdErrorExitDesc ("MHD_digest_auth_get_username3() returned NULL");
else if (NULL == dinfo->username)
mhdErrorExitDesc ("'username' is NULL");
else if (dinfo->username_len != MHD_STATICSTR_LEN_ (USERNAME))
@@ -413,14 +421,6 @@ ahc_echo (void *cls,
mhdErrorExitDesc ("'userhash_bin' is NOT NULL");
else if (0 != dinfo->userhash_bin_size)
mhdErrorExitDesc ("'userhash_bin_size' is NOT zero");
- else if (MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED != dinfo->uname_type)
- {
- fprintf (stderr, "Unexpected 'uname_type'.\n"
- "Expected: %d\tRecieved: %d. ",
- (int) MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED,
- (int) dinfo->uname_type);
- mhdErrorExitDesc ("Wrong 'uname_type'");
- }
else if (MHD_DIGEST_AUTH_ALGO3_MD5 != dinfo->algo)
{
fprintf (stderr, "Unexpected 'algo'.\n"
@@ -485,7 +485,8 @@ ahc_echo (void *cls,
}
MHD_free (dinfo);
- check_res = MHD_digest_auth_check3 (connection, REALM, USERNAME, PASSWORD,
+ check_res = MHD_digest_auth_check3 (connection, REALM, USERNAME,
+ PASSWORD_VALUE,
300, MHD_DIGEST_ALG_MD5);
switch (check_res)
@@ -563,7 +564,8 @@ ahc_echo (void *cls,
}
MHD_free (username);
- check_res = MHD_digest_auth_check (connection, REALM, USERNAME, PASSWORD,
+ check_res = MHD_digest_auth_check (connection, REALM, USERNAME,
+ PASSWORD_VALUE,
300);
if (MHD_INVALID_NONCE != check_res)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (22796735 -> 2949c070), gnunet, 2022/07/28
- [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 <=
- [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, 2022/07/28
- [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