diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-13 17:21:22 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-13 17:21:22 +0300 |
commit | a09b252494ee3147bd069072ebc4b147e6f05dcf (patch) | |
tree | bde92bd01298466562c1fe90be2b48822654d06f | |
parent | 547246b9cb4df5599c1b0ffb45bd41a573ab5826 (diff) | |
download | libmicrohttpd-a09b252494ee3147bd069072ebc4b147e6f05dcf.tar.gz libmicrohttpd-a09b252494ee3147bd069072ebc4b147e6f05dcf.zip |
Updated tests to use new digest auth functions
-rw-r--r-- | src/testcurl/test_digestauth.c | 9 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_concurrent.c | 9 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_sha256.c | 9 | ||||
-rw-r--r-- | src/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 index a2b38b2e..e05e4f31 100644 --- a/src/testcurl/test_digestauth.c +++ b/src/testcurl/test_digestauth.c | |||
@@ -265,7 +265,7 @@ ahc_echo (void *cls, | |||
265 | const char *password = "testpass"; | 265 | const char *password = "testpass"; |
266 | const char *realm = "test@example.com"; | 266 | const char *realm = "test@example.com"; |
267 | enum MHD_Result ret; | 267 | enum MHD_Result ret; |
268 | int ret_i; | 268 | enum MHD_DigestAuthResult ret_e; |
269 | static int already_called_marker; | 269 | static int already_called_marker; |
270 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 270 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
271 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 271 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
@@ -298,15 +298,14 @@ ahc_echo (void *cls, | |||
298 | MHD_destroy_response (response); | 298 | MHD_destroy_response (response); |
299 | return ret; | 299 | return ret; |
300 | } | 300 | } |
301 | ret_i = MHD_digest_auth_check2 (connection, | 301 | ret_e = MHD_digest_auth_check3 (connection, |
302 | realm, | 302 | realm, |
303 | username, | 303 | username, |
304 | password, | 304 | password, |
305 | 300, | 305 | 300, |
306 | MHD_DIGEST_ALG_MD5); | 306 | MHD_DIGEST_ALG_MD5); |
307 | MHD_free (username); | 307 | MHD_free (username); |
308 | if ( (ret_i == MHD_INVALID_NONCE) || | 308 | if (ret_e != MHD_DAUTH_OK) |
309 | (ret_i == MHD_NO) ) | ||
310 | { | 309 | { |
311 | response = MHD_create_response_from_buffer (strlen (DENIED), | 310 | response = MHD_create_response_from_buffer (strlen (DENIED), |
312 | DENIED, | 311 | DENIED, |
@@ -317,7 +316,7 @@ ahc_echo (void *cls, | |||
317 | realm, | 316 | realm, |
318 | MY_OPAQUE, | 317 | MY_OPAQUE, |
319 | response, | 318 | response, |
320 | (MHD_INVALID_NONCE == ret_i) ? | 319 | (MHD_DAUTH_NONCE_STALE == ret_e) ? |
321 | MHD_YES : MHD_NO, | 320 | MHD_YES : MHD_NO, |
322 | MHD_DIGEST_ALG_MD5); | 321 | MHD_DIGEST_ALG_MD5); |
323 | if (MHD_YES != ret) | 322 | if (MHD_YES != ret) |
diff --git a/src/testcurl/test_digestauth_concurrent.c b/src/testcurl/test_digestauth_concurrent.c index ecb1771e..5795c686 100644 --- a/src/testcurl/test_digestauth_concurrent.c +++ b/src/testcurl/test_digestauth_concurrent.c | |||
@@ -276,7 +276,7 @@ ahc_echo (void *cls, | |||
276 | const char *password = "testpass"; | 276 | const char *password = "testpass"; |
277 | const char *realm = "test@example.com"; | 277 | const char *realm = "test@example.com"; |
278 | enum MHD_Result ret; | 278 | enum MHD_Result ret; |
279 | int ret_i; | 279 | enum MHD_DigestAuthResult ret_e; |
280 | static int already_called_marker; | 280 | static int already_called_marker; |
281 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 281 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
282 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 282 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
@@ -309,15 +309,14 @@ ahc_echo (void *cls, | |||
309 | MHD_destroy_response (response); | 309 | MHD_destroy_response (response); |
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | ret_i = MHD_digest_auth_check2 (connection, | 312 | ret_e = MHD_digest_auth_check3 (connection, |
313 | realm, | 313 | realm, |
314 | username, | 314 | username, |
315 | password, | 315 | password, |
316 | 300, | 316 | 300, |
317 | MHD_DIGEST_ALG_MD5); | 317 | MHD_DIGEST_ALG_MD5); |
318 | MHD_free (username); | 318 | MHD_free (username); |
319 | if ( (ret_i == MHD_INVALID_NONCE) || | 319 | if (ret_e != MHD_DAUTH_OK) |
320 | (ret_i == MHD_NO) ) | ||
321 | { | 320 | { |
322 | response = MHD_create_response_from_buffer (strlen (DENIED), | 321 | response = MHD_create_response_from_buffer (strlen (DENIED), |
323 | DENIED, | 322 | DENIED, |
@@ -328,7 +327,7 @@ ahc_echo (void *cls, | |||
328 | realm, | 327 | realm, |
329 | MY_OPAQUE, | 328 | MY_OPAQUE, |
330 | response, | 329 | response, |
331 | (MHD_INVALID_NONCE == ret_i) ? | 330 | (MHD_DAUTH_NONCE_STALE == ret_e) ? |
332 | MHD_YES : MHD_NO, | 331 | MHD_YES : MHD_NO, |
333 | MHD_DIGEST_ALG_MD5); | 332 | MHD_DIGEST_ALG_MD5); |
334 | if (MHD_YES != ret) | 333 | if (MHD_YES != ret) |
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c index bb0e786c..bfab4a7e 100644 --- a/src/testcurl/test_digestauth_sha256.c +++ b/src/testcurl/test_digestauth_sha256.c | |||
@@ -94,7 +94,7 @@ ahc_echo (void *cls, | |||
94 | const char *password = "testpass"; | 94 | const char *password = "testpass"; |
95 | const char *realm = "test@example.com"; | 95 | const char *realm = "test@example.com"; |
96 | enum MHD_Result ret; | 96 | enum MHD_Result ret; |
97 | int ret_i; | 97 | enum MHD_DigestAuthResult ret_e; |
98 | static int already_called_marker; | 98 | static int already_called_marker; |
99 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 99 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
100 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 100 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
@@ -123,15 +123,14 @@ ahc_echo (void *cls, | |||
123 | MHD_destroy_response (response); | 123 | MHD_destroy_response (response); |
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | ret_i = MHD_digest_auth_check2 (connection, | 126 | ret_e = MHD_digest_auth_check3 (connection, |
127 | realm, | 127 | realm, |
128 | username, | 128 | username, |
129 | password, | 129 | password, |
130 | 300, | 130 | 300, |
131 | MHD_DIGEST_ALG_SHA256); | 131 | MHD_DIGEST_ALG_SHA256); |
132 | MHD_free (username); | 132 | MHD_free (username); |
133 | if ( (ret_i == MHD_INVALID_NONCE) || | 133 | if (ret_e != MHD_DAUTH_OK) |
134 | (ret_i == MHD_NO) ) | ||
135 | { | 134 | { |
136 | response = MHD_create_response_from_buffer (strlen (DENIED), | 135 | response = MHD_create_response_from_buffer (strlen (DENIED), |
137 | DENIED, | 136 | DENIED, |
@@ -142,7 +141,7 @@ ahc_echo (void *cls, | |||
142 | realm, | 141 | realm, |
143 | MY_OPAQUE, | 142 | MY_OPAQUE, |
144 | response, | 143 | response, |
145 | (MHD_INVALID_NONCE == ret_i) ? | 144 | (MHD_DAUTH_NONCE_STALE == ret_e) ? |
146 | MHD_YES : MHD_NO, | 145 | MHD_YES : MHD_NO, |
147 | MHD_DIGEST_ALG_SHA256); | 146 | MHD_DIGEST_ALG_SHA256); |
148 | MHD_destroy_response (response); | 147 | MHD_destroy_response (response); |
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c index 602c1180..773fd5f5 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, | |||
87 | const char *password = "testpass"; | 87 | const char *password = "testpass"; |
88 | const char *realm = "test@example.com"; | 88 | const char *realm = "test@example.com"; |
89 | enum MHD_Result ret; | 89 | enum MHD_Result ret; |
90 | int ret_i; | 90 | enum MHD_DigestAuthResult ret_e; |
91 | static int already_called_marker; | 91 | static int already_called_marker; |
92 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 92 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
93 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 93 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
@@ -115,13 +115,13 @@ ahc_echo (void *cls, | |||
115 | MHD_destroy_response (response); | 115 | MHD_destroy_response (response); |
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | ret_i = MHD_digest_auth_check (connection, realm, | 118 | ret_e = MHD_digest_auth_check3 (connection, realm, |
119 | username, | 119 | username, |
120 | password, | 120 | password, |
121 | 300); | 121 | 300, |
122 | MHD_DIGEST_ALG_MD5); | ||
122 | MHD_free (username); | 123 | MHD_free (username); |
123 | if ( (ret_i == MHD_INVALID_NONCE) || | 124 | if (ret_e != MHD_DAUTH_OK) |
124 | (ret_i == MHD_NO) ) | ||
125 | { | 125 | { |
126 | response = MHD_create_response_from_buffer (strlen (DENIED), | 126 | response = MHD_create_response_from_buffer (strlen (DENIED), |
127 | DENIED, | 127 | DENIED, |
@@ -131,7 +131,7 @@ ahc_echo (void *cls, | |||
131 | ret = MHD_queue_auth_fail_response2 (connection, realm, | 131 | ret = MHD_queue_auth_fail_response2 (connection, realm, |
132 | MY_OPAQUE, | 132 | MY_OPAQUE, |
133 | response, | 133 | response, |
134 | (ret_i == MHD_INVALID_NONCE) ? | 134 | (ret_e == MHD_DAUTH_NONCE_STALE) ? |
135 | MHD_YES : MHD_NO, | 135 | MHD_YES : MHD_NO, |
136 | MHD_DIGEST_ALG_MD5); | 136 | MHD_DIGEST_ALG_MD5); |
137 | MHD_destroy_response (response); | 137 | MHD_destroy_response (response); |