diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-07-26 20:59:51 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-07-30 22:28:43 +0300 |
commit | 0b70234172886f76f4f9ba4463400b9e8f1fae02 (patch) | |
tree | 6c8ef15848fc89be00c989c09c4f3e9cab2a15a0 /src/testcurl | |
parent | 3213c703dd3f02c82efe3a90a77292711fbc3f6d (diff) | |
download | libmicrohttpd-0b70234172886f76f4f9ba4463400b9e8f1fae02.tar.gz libmicrohttpd-0b70234172886f76f4f9ba4463400b9e8f1fae02.zip |
test_digestauth2: test the new option
Diffstat (limited to 'src/testcurl')
-rw-r--r-- | src/testcurl/test_digestauth2.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/testcurl/test_digestauth2.c b/src/testcurl/test_digestauth2.c index c00dd1b1..7951546c 100644 --- a/src/testcurl/test_digestauth2.c +++ b/src/testcurl/test_digestauth2.c | |||
@@ -979,31 +979,35 @@ testDigestAuth (void) | |||
979 | { | 979 | { |
980 | struct MHD_Daemon *d; | 980 | struct MHD_Daemon *d; |
981 | uint16_t port; | 981 | uint16_t port; |
982 | uint8_t salt[8]; | ||
983 | struct CBC cbc; | 982 | struct CBC cbc; |
984 | char buf[2048]; | 983 | char buf[2048]; |
985 | CURL *c; | 984 | CURL *c; |
986 | int failed = 0; | 985 | int failed = 0; |
987 | 986 | ||
988 | if (! gen_good_rnd (salt, sizeof(salt))) | ||
989 | { | ||
990 | fprintf (stderr, "WARNING: the random buffer (used as salt value) is not " | ||
991 | "initialised completely, nonce generation may be " | ||
992 | "predictable in this test.\n"); | ||
993 | fflush (stderr); | ||
994 | } | ||
995 | |||
996 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 987 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
997 | port = 0; | 988 | port = 0; |
998 | else | 989 | else |
999 | port = 4210; | 990 | port = 4210; |
1000 | 991 | ||
1001 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, | 992 | if (1) |
1002 | port, NULL, NULL, | 993 | { |
1003 | &ahc_echo, NULL, | 994 | uint8_t salt[8]; /* Use local variable to test MHD "copy" function */ |
1004 | MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (salt), salt, | 995 | if (! gen_good_rnd (salt, sizeof(salt))) |
1005 | MHD_OPTION_NONCE_NC_SIZE, 300, | 996 | { |
1006 | MHD_OPTION_END); | 997 | fprintf (stderr, "WARNING: the random buffer (used as salt value) is not " |
998 | "initialised completely, nonce generation may be " | ||
999 | "predictable in this test.\n"); | ||
1000 | fflush (stderr); | ||
1001 | } | ||
1002 | |||
1003 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, | ||
1004 | port, NULL, NULL, | ||
1005 | &ahc_echo, NULL, | ||
1006 | MHD_OPTION_DIGEST_AUTH_RANDOM_COPY, | ||
1007 | sizeof (salt), salt, | ||
1008 | MHD_OPTION_NONCE_NC_SIZE, 300, | ||
1009 | MHD_OPTION_END); | ||
1010 | } | ||
1007 | if (d == NULL) | 1011 | if (d == NULL) |
1008 | return 1; | 1012 | return 1; |
1009 | if (0 == port) | 1013 | if (0 == port) |