aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_digestauth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/test_digestauth.c')
-rw-r--r--src/testcurl/test_digestauth.c22
1 files changed, 11 insertions, 11 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,
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 enum MHD_DigestAuthResult ret_e; 268 int ret_i;
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. */
@@ -297,14 +297,14 @@ ahc_echo (void *cls,
297 MHD_destroy_response (response); 297 MHD_destroy_response (response);
298 return ret; 298 return ret;
299 } 299 }
300 ret_e = MHD_digest_auth_check3 (connection, 300 ret_i = MHD_digest_auth_check2 (connection,
301 realm, 301 realm,
302 username, 302 username,
303 password, 303 password,
304 300, 304 300,
305 MHD_DIGEST_ALG_MD5); 305 MHD_DIGEST_ALG_MD5);
306 MHD_free (username); 306 MHD_free (username);
307 if (ret_e != MHD_DAUTH_OK) 307 if (ret_i != MHD_YES)
308 { 308 {
309 response = MHD_create_response_from_buffer_static (strlen (DENIED), 309 response = MHD_create_response_from_buffer_static (strlen (DENIED),
310 DENIED); 310 DENIED);
@@ -314,7 +314,7 @@ ahc_echo (void *cls,
314 realm, 314 realm,
315 MY_OPAQUE, 315 MY_OPAQUE,
316 response, 316 response,
317 (MHD_DAUTH_NONCE_STALE == ret_e) ? 317 (MHD_INVALID_NONCE == ret_i) ?
318 MHD_YES : MHD_NO, 318 MHD_YES : MHD_NO,
319 MHD_DIGEST_ALG_MD5); 319 MHD_DIGEST_ALG_MD5);
320 if (MHD_YES != ret) 320 if (MHD_YES != ret)
@@ -337,7 +337,7 @@ ahc_echo (void *cls,
337 337
338 338
339static CURL * 339static CURL *
340setupCURL (void *cbc, int port) 340setupCURL (void *cbc, uint16_t port)
341{ 341{
342 CURL *c; 342 CURL *c;
343 char url[512]; 343 char url[512];
@@ -348,7 +348,7 @@ setupCURL (void *cbc, int port)
348 /* A workaround for some old libcurl versions, which ignore the specified 348 /* A workaround for some old libcurl versions, which ignore the specified
349 * port by CURLOPT_PORT when digest authorisation is used. */ 349 * port by CURLOPT_PORT when digest authorisation is used. */
350 res = snprintf (url, (sizeof(url) / sizeof(url[0])), 350 res = snprintf (url, (sizeof(url) / sizeof(url[0])),
351 "http://127.0.0.1:%d%s", port, MHD_URI_BASE_PATH); 351 "http://127.0.0.1:%d%s", (int) port, MHD_URI_BASE_PATH);
352 if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res)) 352 if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res))
353 externalErrorExitDesc ("Cannot form request URL"); 353 externalErrorExitDesc ("Cannot form request URL");
354 } 354 }
@@ -387,15 +387,15 @@ setupCURL (void *cbc, int port)
387} 387}
388 388
389 389
390static int 390static unsigned int
391testDigestAuth () 391testDigestAuth (void)
392{ 392{
393 CURL *c; 393 CURL *c;
394 struct MHD_Daemon *d; 394 struct MHD_Daemon *d;
395 struct CBC cbc; 395 struct CBC cbc;
396 char buf[2048]; 396 char buf[2048];
397 char rnd[8]; 397 char rnd[8];
398 int port; 398 uint16_t port;
399#ifndef WINDOWS 399#ifndef WINDOWS
400 int fd; 400 int fd;
401 size_t len; 401 size_t len;
@@ -446,7 +446,7 @@ testDigestAuth ()
446#endif 446#endif
447 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 447 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
448 port, NULL, NULL, 448 port, NULL, NULL,
449 &ahc_echo, PAGE, 449 &ahc_echo, NULL,
450 MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd, 450 MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
451 MHD_OPTION_NONCE_NC_SIZE, 300, 451 MHD_OPTION_NONCE_NC_SIZE, 300,
452 MHD_OPTION_END); 452 MHD_OPTION_END);
@@ -461,7 +461,7 @@ testDigestAuth ()
461 if ( (NULL == dinfo) || 461 if ( (NULL == dinfo) ||
462 (0 == dinfo->port) ) 462 (0 == dinfo->port) )
463 mhdErrorExitDesc ("MHD_get_daemon_info() failed"); 463 mhdErrorExitDesc ("MHD_get_daemon_info() failed");
464 port = (int) dinfo->port; 464 port = dinfo->port;
465 } 465 }
466 c = setupCURL (&cbc, port); 466 c = setupCURL (&cbc, port);
467 467