libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit a09b252494ee3147bd069072ebc4b147e6f05dcf
parent 547246b9cb4df5599c1b0ffb45bd41a573ab5826
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Fri, 13 May 2022 17:21:22 +0300

Updated tests to use new digest auth functions

Diffstat:
Msrc/testcurl/test_digestauth.c | 9++++-----
Msrc/testcurl/test_digestauth_concurrent.c | 9++++-----
Msrc/testcurl/test_digestauth_sha256.c | 9++++-----
Msrc/testcurl/test_digestauth_with_arguments.c | 16++++++++--------
4 files changed, 20 insertions(+), 23 deletions(-)

diff --git 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; - int ret_i; + enum MHD_DigestAuthResult ret_e; static int already_called_marker; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ @@ -298,15 +298,14 @@ ahc_echo (void *cls, MHD_destroy_response (response); return ret; } - ret_i = MHD_digest_auth_check2 (connection, + ret_e = MHD_digest_auth_check3 (connection, realm, username, password, 300, MHD_DIGEST_ALG_MD5); MHD_free (username); - if ( (ret_i == MHD_INVALID_NONCE) || - (ret_i == MHD_NO) ) + if (ret_e != MHD_DAUTH_OK) { response = MHD_create_response_from_buffer (strlen (DENIED), DENIED, @@ -317,7 +316,7 @@ ahc_echo (void *cls, realm, MY_OPAQUE, response, - (MHD_INVALID_NONCE == ret_i) ? + (MHD_DAUTH_NONCE_STALE == ret_e) ? MHD_YES : MHD_NO, MHD_DIGEST_ALG_MD5); if (MHD_YES != ret) diff --git a/src/testcurl/test_digestauth_concurrent.c b/src/testcurl/test_digestauth_concurrent.c @@ -276,7 +276,7 @@ ahc_echo (void *cls, const char *password = "testpass"; const char *realm = "test@example.com"; enum MHD_Result ret; - int ret_i; + enum MHD_DigestAuthResult ret_e; static int already_called_marker; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ @@ -309,15 +309,14 @@ ahc_echo (void *cls, MHD_destroy_response (response); return ret; } - ret_i = MHD_digest_auth_check2 (connection, + ret_e = MHD_digest_auth_check3 (connection, realm, username, password, 300, MHD_DIGEST_ALG_MD5); MHD_free (username); - if ( (ret_i == MHD_INVALID_NONCE) || - (ret_i == MHD_NO) ) + if (ret_e != MHD_DAUTH_OK) { response = MHD_create_response_from_buffer (strlen (DENIED), DENIED, @@ -328,7 +327,7 @@ ahc_echo (void *cls, realm, MY_OPAQUE, response, - (MHD_INVALID_NONCE == ret_i) ? + (MHD_DAUTH_NONCE_STALE == ret_e) ? MHD_YES : MHD_NO, MHD_DIGEST_ALG_MD5); if (MHD_YES != ret) diff --git 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; - int ret_i; + enum MHD_DigestAuthResult ret_e; static int already_called_marker; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ @@ -123,15 +123,14 @@ ahc_echo (void *cls, MHD_destroy_response (response); return ret; } - ret_i = MHD_digest_auth_check2 (connection, + ret_e = MHD_digest_auth_check3 (connection, realm, username, password, 300, MHD_DIGEST_ALG_SHA256); MHD_free (username); - if ( (ret_i == MHD_INVALID_NONCE) || - (ret_i == MHD_NO) ) + if (ret_e != MHD_DAUTH_OK) { response = MHD_create_response_from_buffer (strlen (DENIED), DENIED, @@ -142,7 +141,7 @@ ahc_echo (void *cls, realm, MY_OPAQUE, response, - (MHD_INVALID_NONCE == ret_i) ? + (MHD_DAUTH_NONCE_STALE == ret_e) ? MHD_YES : MHD_NO, MHD_DIGEST_ALG_SHA256); MHD_destroy_response (response); diff --git 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; - int ret_i; + enum MHD_DigestAuthResult ret_e; static int already_called_marker; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ @@ -115,13 +115,13 @@ ahc_echo (void *cls, MHD_destroy_response (response); return ret; } - ret_i = MHD_digest_auth_check (connection, realm, - username, - password, - 300); + ret_e = MHD_digest_auth_check3 (connection, realm, + username, + password, + 300, + MHD_DIGEST_ALG_MD5); MHD_free (username); - if ( (ret_i == MHD_INVALID_NONCE) || - (ret_i == MHD_NO) ) + if (ret_e != MHD_DAUTH_OK) { response = MHD_create_response_from_buffer (strlen (DENIED), DENIED, @@ -131,7 +131,7 @@ ahc_echo (void *cls, ret = MHD_queue_auth_fail_response2 (connection, realm, MY_OPAQUE, response, - (ret_i == MHD_INVALID_NONCE) ? + (ret_e == MHD_DAUTH_NONCE_STALE) ? MHD_YES : MHD_NO, MHD_DIGEST_ALG_MD5); MHD_destroy_response (response);