diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-08-25 20:02:30 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-08-25 20:04:47 +0300 |
commit | a2916400661cb7c468af5744ea284ec9157abac9 (patch) | |
tree | 6ff41ef1d6e94544293226fe9bccee51c96a8a57 | |
parent | 5e5efd92797e01595ea69826cde808d8e13ae26e (diff) | |
download | libmicrohttpd-a2916400661cb7c468af5744ea284ec9157abac9.tar.gz libmicrohttpd-a2916400661cb7c468af5744ea284ec9157abac9.zip |
digestauth: keep results of algo and QOP parsing, renamed public struct member
-rw-r--r-- | src/include/microhttpd.h | 4 | ||||
-rw-r--r-- | src/microhttpd/Makefile.am | 2 | ||||
-rw-r--r-- | src/microhttpd/digestauth.c | 163 | ||||
-rw-r--r-- | src/microhttpd/digestauth.h | 58 | ||||
-rw-r--r-- | src/microhttpd/gen_auth.c | 129 | ||||
-rw-r--r-- | src/microhttpd/internal.h | 46 | ||||
-rw-r--r-- | src/microhttpd/mhd_str.h | 42 | ||||
-rw-r--r-- | src/microhttpd/mhd_str_types.h | 68 | ||||
-rw-r--r-- | src/microhttpd/test_auth_parse.c | 460 | ||||
-rw-r--r-- | src/testcurl/test_digestauth2.c | 4 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_emu_ext.c | 4 | ||||
-rw-r--r-- | w32/common/libmicrohttpd-files.vcxproj | 1 | ||||
-rw-r--r-- | w32/common/libmicrohttpd-filters.vcxproj | 3 |
13 files changed, 631 insertions, 353 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index d50672ec..a824b72f 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -4789,7 +4789,7 @@ enum MHD_DigestAuthMultiQOP | |||
4789 | * | 4789 | * |
4790 | * Application may modify buffers as needed until #MHD_free() is called for | 4790 | * Application may modify buffers as needed until #MHD_free() is called for |
4791 | * pointer to this structure | 4791 | * pointer to this structure |
4792 | * @note Available since #MHD_VERSION 0x00097525 | 4792 | * @note Available since #MHD_VERSION 0x00097533 |
4793 | */ | 4793 | */ |
4794 | struct MHD_DigestAuthInfo | 4794 | struct MHD_DigestAuthInfo |
4795 | { | 4795 | { |
@@ -4799,7 +4799,7 @@ struct MHD_DigestAuthInfo | |||
4799 | * @warning Do not be confused with #MHD_DigestAuthAlgorithm, | 4799 | * @warning Do not be confused with #MHD_DigestAuthAlgorithm, |
4800 | * which uses other values! | 4800 | * which uses other values! |
4801 | */ | 4801 | */ |
4802 | enum MHD_DigestAuthAlgo3 algo; | 4802 | enum MHD_DigestAuthAlgo3 algo3; |
4803 | 4803 | ||
4804 | /** | 4804 | /** |
4805 | * The type of username used by client. | 4805 | * The type of username used by client. |
diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am index 58ab10a8..b4339f08 100644 --- a/src/microhttpd/Makefile.am +++ b/src/microhttpd/Makefile.am | |||
@@ -82,7 +82,7 @@ libmicrohttpd_la_SOURCES = \ | |||
82 | mhd_mono_clock.c mhd_mono_clock.h \ | 82 | mhd_mono_clock.c mhd_mono_clock.h \ |
83 | mhd_limits.h \ | 83 | mhd_limits.h \ |
84 | sysfdsetsize.c sysfdsetsize.h \ | 84 | sysfdsetsize.c sysfdsetsize.h \ |
85 | mhd_str.c mhd_str.h \ | 85 | mhd_str.c mhd_str.h mhd_str_types.h\ |
86 | mhd_send.h mhd_send.c \ | 86 | mhd_send.h mhd_send.c \ |
87 | mhd_assert.h \ | 87 | mhd_assert.h \ |
88 | mhd_sockets.c mhd_sockets.h \ | 88 | mhd_sockets.c mhd_sockets.h \ |
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index 569e8991..cc6cd0ac 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -134,37 +134,6 @@ | |||
134 | #define MAX_AUTH_RESPONSE_LENGTH (MAX_DIGEST * 2) | 134 | #define MAX_AUTH_RESPONSE_LENGTH (MAX_DIGEST * 2) |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * The token for MD5 algorithm. | ||
138 | */ | ||
139 | #define _MHD_MD5_TOKEN "MD5" | ||
140 | |||
141 | /** | ||
142 | * The token for SHA-256 algorithm. | ||
143 | */ | ||
144 | #define _MHD_SHA256_TOKEN "SHA-256" | ||
145 | |||
146 | /** | ||
147 | * The token for SHA-512/256 algorithm. | ||
148 | * Unsupported currently by MHD for authentication. | ||
149 | */ | ||
150 | #define _MHD_SHA512_256_TOKEN "SHA-512-256" | ||
151 | |||
152 | /** | ||
153 | * The suffix token for "session" algorithms. | ||
154 | */ | ||
155 | #define _MHD_SESS_TOKEN "-sess" | ||
156 | |||
157 | /** | ||
158 | * The "auth" token for QOP | ||
159 | */ | ||
160 | #define MHD_TOKEN_AUTH_ "auth" | ||
161 | |||
162 | /** | ||
163 | * The "auth-int" token for QOP | ||
164 | */ | ||
165 | #define MHD_TOKEN_AUTH_INT_ "auth-int" | ||
166 | |||
167 | /** | ||
168 | * The required prefix of parameter with the extended notation | 137 | * The required prefix of parameter with the extended notation |
169 | */ | 138 | */ |
170 | #define MHD_DAUTH_EXT_PARAM_PREFIX "UTF-8'" | 139 | #define MHD_DAUTH_EXT_PARAM_PREFIX "UTF-8'" |
@@ -729,89 +698,6 @@ get_rq_unames_size (const struct MHD_RqDAuth *params, | |||
729 | 698 | ||
730 | 699 | ||
731 | /** | 700 | /** |
732 | * Get client's Digest Authorization algorithm type. | ||
733 | * If no algorithm is specified by client, MD5 is assumed. | ||
734 | * @param params the Digest Authorization parameters | ||
735 | * @return the algorithm type | ||
736 | */ | ||
737 | static enum MHD_DigestAuthAlgo3 | ||
738 | get_rq_algo (const struct MHD_RqDAuth *params) | ||
739 | { | ||
740 | const struct MHD_RqDAuthParam *const algo_param = | ||
741 | ¶ms->algorithm; | ||
742 | if (NULL == algo_param->value.str) | ||
743 | return MHD_DIGEST_AUTH_ALGO3_MD5; /* Assume MD5 by default */ | ||
744 | |||
745 | if (algo_param->quoted) | ||
746 | { | ||
747 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
748 | algo_param->value.len, \ | ||
749 | _MHD_MD5_TOKEN)) | ||
750 | return MHD_DIGEST_AUTH_ALGO3_MD5; | ||
751 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
752 | algo_param->value.len, \ | ||
753 | _MHD_SHA256_TOKEN)) | ||
754 | return MHD_DIGEST_AUTH_ALGO3_SHA256; | ||
755 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
756 | algo_param->value.len, \ | ||
757 | _MHD_MD5_TOKEN _MHD_SESS_TOKEN)) | ||
758 | return MHD_DIGEST_AUTH_ALGO3_MD5_SESSION; | ||
759 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
760 | algo_param->value.len, \ | ||
761 | _MHD_SHA256_TOKEN \ | ||
762 | _MHD_SESS_TOKEN)) | ||
763 | return MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION; | ||
764 | |||
765 | /* Algorithms below are not supported by MHD for authentication */ | ||
766 | |||
767 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
768 | algo_param->value.len, \ | ||
769 | _MHD_SHA512_256_TOKEN)) | ||
770 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256; | ||
771 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
772 | algo_param->value.len, \ | ||
773 | _MHD_SHA512_256_TOKEN \ | ||
774 | _MHD_SESS_TOKEN)) | ||
775 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION; | ||
776 | |||
777 | /* No known algorithm has been detected */ | ||
778 | return MHD_DIGEST_AUTH_ALGO3_INVALID; | ||
779 | } | ||
780 | /* The algorithm value is not quoted */ | ||
781 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_MD5_TOKEN, \ | ||
782 | algo_param->value.str, \ | ||
783 | algo_param->value.len)) | ||
784 | return MHD_DIGEST_AUTH_ALGO3_MD5; | ||
785 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA256_TOKEN, \ | ||
786 | algo_param->value.str, \ | ||
787 | algo_param->value.len)) | ||
788 | return MHD_DIGEST_AUTH_ALGO3_SHA256; | ||
789 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_MD5_TOKEN _MHD_SESS_TOKEN, \ | ||
790 | algo_param->value.str, \ | ||
791 | algo_param->value.len)) | ||
792 | return MHD_DIGEST_AUTH_ALGO3_MD5_SESSION; | ||
793 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA256_TOKEN _MHD_SESS_TOKEN, \ | ||
794 | algo_param->value.str, \ | ||
795 | algo_param->value.len)) | ||
796 | return MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION; | ||
797 | |||
798 | /* Algorithms below are not supported by MHD for authentication */ | ||
799 | |||
800 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA512_256_TOKEN, \ | ||
801 | algo_param->value.str, \ | ||
802 | algo_param->value.len)) | ||
803 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256; | ||
804 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA512_256_TOKEN _MHD_SESS_TOKEN, \ | ||
805 | algo_param->value.str, \ | ||
806 | algo_param->value.len)) | ||
807 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION; | ||
808 | |||
809 | /* No known algorithm has been detected */ | ||
810 | return MHD_DIGEST_AUTH_ALGO3_INVALID; | ||
811 | } | ||
812 | |||
813 | |||
814 | /** | ||
815 | * Get unquoted version of Digest Authorization parameter. | 701 | * Get unquoted version of Digest Authorization parameter. |
816 | * This function automatically zero-teminate the result. | 702 | * This function automatically zero-teminate the result. |
817 | * @param param the parameter to extract | 703 | * @param param the parameter to extract |
@@ -973,45 +859,6 @@ get_rq_uname (const struct MHD_RqDAuth *params, | |||
973 | 859 | ||
974 | 860 | ||
975 | /** | 861 | /** |
976 | * Get QOP ('quality of protection') type. | ||
977 | * @param params the Digest Authorization parameters | ||
978 | * @return detected QOP ('quality of protection') type. | ||
979 | */ | ||
980 | static enum MHD_DigestAuthQOP | ||
981 | get_rq_qop (const struct MHD_RqDAuth *params) | ||
982 | { | ||
983 | const struct MHD_RqDAuthParam *const qop_param = | ||
984 | ¶ms->qop; | ||
985 | if (NULL == qop_param->value.str) | ||
986 | return MHD_DIGEST_AUTH_QOP_NONE; | ||
987 | if (qop_param->quoted) | ||
988 | { | ||
989 | if (MHD_str_equal_caseless_quoted_s_bin_n (qop_param->value.str, \ | ||
990 | qop_param->value.len, \ | ||
991 | "auth")) | ||
992 | return MHD_DIGEST_AUTH_QOP_AUTH; | ||
993 | if (MHD_str_equal_caseless_quoted_s_bin_n (qop_param->value.str, \ | ||
994 | qop_param->value.len, \ | ||
995 | "auth-int")) | ||
996 | return MHD_DIGEST_AUTH_QOP_AUTH_INT; | ||
997 | } | ||
998 | else | ||
999 | { | ||
1000 | if (MHD_str_equal_caseless_s_bin_n_ ("auth", \ | ||
1001 | qop_param->value.str, \ | ||
1002 | qop_param->value.len)) | ||
1003 | return MHD_DIGEST_AUTH_QOP_AUTH; | ||
1004 | if (MHD_str_equal_caseless_s_bin_n_ ("auth-int", \ | ||
1005 | qop_param->value.str, \ | ||
1006 | qop_param->value.len)) | ||
1007 | return MHD_DIGEST_AUTH_QOP_AUTH_INT; | ||
1008 | } | ||
1009 | /* No know QOP has been detected */ | ||
1010 | return MHD_DIGEST_AUTH_QOP_INVALID; | ||
1011 | } | ||
1012 | |||
1013 | |||
1014 | /** | ||
1015 | * Result of request's Digest Authorization 'nc' value extraction | 862 | * Result of request's Digest Authorization 'nc' value extraction |
1016 | */ | 863 | */ |
1017 | enum MHD_GetRqNCResult | 864 | enum MHD_GetRqNCResult |
@@ -1124,7 +971,7 @@ MHD_digest_auth_get_request_info3 (struct MHD_Connection *connection) | |||
1124 | unif_buf_ptr = (uint8_t *) (info + 1); | 971 | unif_buf_ptr = (uint8_t *) (info + 1); |
1125 | unif_buf_used = 0; | 972 | unif_buf_used = 0; |
1126 | 973 | ||
1127 | info->algo = get_rq_algo (params); | 974 | info->algo3 = params->algo3; |
1128 | 975 | ||
1129 | if ( (MHD_DIGEST_AUTH_UNAME_TYPE_MISSING != uname_type) && | 976 | if ( (MHD_DIGEST_AUTH_UNAME_TYPE_MISSING != uname_type) && |
1130 | (MHD_DIGEST_AUTH_UNAME_TYPE_INVALID != uname_type) ) | 977 | (MHD_DIGEST_AUTH_UNAME_TYPE_INVALID != uname_type) ) |
@@ -1159,7 +1006,7 @@ MHD_digest_auth_get_request_info3 (struct MHD_Connection *connection) | |||
1159 | 1006 | ||
1160 | mhd_assert (unif_buf_size >= unif_buf_used); | 1007 | mhd_assert (unif_buf_size >= unif_buf_used); |
1161 | 1008 | ||
1162 | info->qop = get_rq_qop (params); | 1009 | info->qop = params->qop; |
1163 | 1010 | ||
1164 | if (NULL != params->cnonce.value.str) | 1011 | if (NULL != params->cnonce.value.str) |
1165 | info->cnonce_len = params->cnonce.value.len; | 1012 | info->cnonce_len = params->cnonce.value.len; |
@@ -2110,7 +1957,7 @@ digest_auth_check_all_inner (struct MHD_Connection *connection, | |||
2110 | 1957 | ||
2111 | /* ** Initial parameters checks and setup ** */ | 1958 | /* ** Initial parameters checks and setup ** */ |
2112 | /* Get client's algorithm */ | 1959 | /* Get client's algorithm */ |
2113 | c_algo = get_rq_algo (params); | 1960 | c_algo = params->algo3; |
2114 | /* Check whether client's algorithm is allowed by function parameter */ | 1961 | /* Check whether client's algorithm is allowed by function parameter */ |
2115 | if (((unsigned int) c_algo) != | 1962 | if (((unsigned int) c_algo) != |
2116 | (((unsigned int) c_algo) & ((unsigned int) malgo3))) | 1963 | (((unsigned int) c_algo) & ((unsigned int) malgo3))) |
@@ -2135,7 +1982,7 @@ digest_auth_check_all_inner (struct MHD_Connection *connection, | |||
2135 | if (! digest_setup (&da, get_base_digest_algo (c_algo))) | 1982 | if (! digest_setup (&da, get_base_digest_algo (c_algo))) |
2136 | MHD_PANIC (_ ("Wrong 'malgo3' value, API violation")); | 1983 | MHD_PANIC (_ ("Wrong 'malgo3' value, API violation")); |
2137 | /* Check 'mqop' value */ | 1984 | /* Check 'mqop' value */ |
2138 | c_qop = get_rq_qop (params); | 1985 | c_qop = params->qop; |
2139 | /* Check whether client's algorithm is allowed by function parameter */ | 1986 | /* Check whether client's algorithm is allowed by function parameter */ |
2140 | if (((unsigned int) c_qop) != | 1987 | if (((unsigned int) c_qop) != |
2141 | (((unsigned int) c_qop) & ((unsigned int) mqop))) | 1988 | (((unsigned int) c_qop) & ((unsigned int) mqop))) |
@@ -2479,7 +2326,7 @@ digest_auth_check_all_inner (struct MHD_Connection *connection, | |||
2479 | /* Update digest with ':' */ | 2326 | /* Update digest with ':' */ |
2480 | digest_update_with_colon (&da); | 2327 | digest_update_with_colon (&da); |
2481 | /* Update digest with 'qop' value */ | 2328 | /* Update digest with 'qop' value */ |
2482 | unq_res = get_unquoted_param (¶ms->qop, tmp1, ptmp2, &tmp2_size, | 2329 | unq_res = get_unquoted_param (¶ms->qop_raw, tmp1, ptmp2, &tmp2_size, |
2483 | &unquoted); | 2330 | &unquoted); |
2484 | if (_MHD_UNQ_OK != unq_res) | 2331 | if (_MHD_UNQ_OK != unq_res) |
2485 | return MHD_DAUTH_ERROR; | 2332 | return MHD_DAUTH_ERROR; |
diff --git a/src/microhttpd/digestauth.h b/src/microhttpd/digestauth.h index af54bc63..e8844f27 100644 --- a/src/microhttpd/digestauth.h +++ b/src/microhttpd/digestauth.h | |||
@@ -50,43 +50,35 @@ | |||
50 | #define _MHD_AUTH_DIGEST_BASE "Digest" | 50 | #define _MHD_AUTH_DIGEST_BASE "Digest" |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Parameter of request's Digest Authorization header | 53 | * The token for MD5 algorithm. |
54 | */ | 54 | */ |
55 | struct MHD_RqDAuthParam | 55 | #define _MHD_MD5_TOKEN "MD5" |
56 | { | ||
57 | /** | ||
58 | * The string with length, NOT zero-terminated | ||
59 | */ | ||
60 | struct _MHD_str_w_len value; | ||
61 | /** | ||
62 | * True if string must be "unquoted" before processing. | ||
63 | * This member is false if the string is used in DQUOTE marks, but no | ||
64 | * backslash-escape is used in the string. | ||
65 | */ | ||
66 | bool quoted; | ||
67 | }; | ||
68 | 56 | ||
69 | /** | 57 | /** |
70 | * Request client's Digest Authorization header parameters | 58 | * The token for SHA-256 algorithm. |
71 | */ | 59 | */ |
72 | struct MHD_RqDAuth | 60 | #define _MHD_SHA256_TOKEN "SHA-256" |
73 | { | 61 | |
74 | struct MHD_RqDAuthParam nonce; | 62 | /** |
75 | struct MHD_RqDAuthParam opaque; | 63 | * The token for SHA-512/256 algorithm. |
76 | struct MHD_RqDAuthParam algorithm; | 64 | * Unsupported currently by MHD for authentication. |
77 | struct MHD_RqDAuthParam response; | 65 | */ |
78 | struct MHD_RqDAuthParam username; | 66 | #define _MHD_SHA512_256_TOKEN "SHA-512-256" |
79 | struct MHD_RqDAuthParam username_ext; | 67 | |
80 | struct MHD_RqDAuthParam realm; | 68 | /** |
81 | struct MHD_RqDAuthParam uri; | 69 | * The suffix token for "session" algorithms. |
82 | struct MHD_RqDAuthParam qop; | 70 | */ |
83 | struct MHD_RqDAuthParam cnonce; | 71 | #define _MHD_SESS_TOKEN "-sess" |
84 | struct MHD_RqDAuthParam nc; | 72 | |
85 | /** | 73 | /** |
86 | * True if 'userhash' parameter is used with value 'true'. | 74 | * The "auth" token for QOP |
87 | */ | 75 | */ |
88 | bool userhash; | 76 | #define MHD_TOKEN_AUTH_ "auth" |
89 | }; | 77 | |
78 | /** | ||
79 | * The "auth-int" token for QOP | ||
80 | */ | ||
81 | #define MHD_TOKEN_AUTH_INT_ "auth-int" | ||
90 | 82 | ||
91 | #endif /* ! MHD_DIGESTAUTH_H */ | 83 | #endif /* ! MHD_DIGESTAUTH_H */ |
92 | 84 | ||
diff --git a/src/microhttpd/gen_auth.c b/src/microhttpd/gen_auth.c index 5c383f1a..c86d35ba 100644 --- a/src/microhttpd/gen_auth.c +++ b/src/microhttpd/gen_auth.c | |||
@@ -274,6 +274,125 @@ struct dauth_token_param | |||
274 | struct MHD_RqDAuthParam *const param; | 274 | struct MHD_RqDAuthParam *const param; |
275 | }; | 275 | }; |
276 | 276 | ||
277 | |||
278 | /** | ||
279 | * Get client's Digest Authorization algorithm type. | ||
280 | * If no algorithm is specified by client, MD5 is assumed. | ||
281 | * @param params the Digest Authorization 'algorithm' parameter | ||
282 | * @return the algorithm type | ||
283 | */ | ||
284 | static enum MHD_DigestAuthAlgo3 | ||
285 | get_rq_dauth_algo (const struct MHD_RqDAuthParam *const algo_param) | ||
286 | { | ||
287 | if (NULL == algo_param->value.str) | ||
288 | return MHD_DIGEST_AUTH_ALGO3_MD5; /* Assume MD5 by default */ | ||
289 | |||
290 | if (algo_param->quoted) | ||
291 | { | ||
292 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
293 | algo_param->value.len, \ | ||
294 | _MHD_MD5_TOKEN)) | ||
295 | return MHD_DIGEST_AUTH_ALGO3_MD5; | ||
296 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
297 | algo_param->value.len, \ | ||
298 | _MHD_SHA256_TOKEN)) | ||
299 | return MHD_DIGEST_AUTH_ALGO3_SHA256; | ||
300 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
301 | algo_param->value.len, \ | ||
302 | _MHD_MD5_TOKEN _MHD_SESS_TOKEN)) | ||
303 | return MHD_DIGEST_AUTH_ALGO3_MD5_SESSION; | ||
304 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
305 | algo_param->value.len, \ | ||
306 | _MHD_SHA256_TOKEN \ | ||
307 | _MHD_SESS_TOKEN)) | ||
308 | return MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION; | ||
309 | |||
310 | /* Algorithms below are not supported by MHD for authentication */ | ||
311 | |||
312 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
313 | algo_param->value.len, \ | ||
314 | _MHD_SHA512_256_TOKEN)) | ||
315 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256; | ||
316 | if (MHD_str_equal_caseless_quoted_s_bin_n (algo_param->value.str, \ | ||
317 | algo_param->value.len, \ | ||
318 | _MHD_SHA512_256_TOKEN \ | ||
319 | _MHD_SESS_TOKEN)) | ||
320 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION; | ||
321 | |||
322 | /* No known algorithm has been detected */ | ||
323 | return MHD_DIGEST_AUTH_ALGO3_INVALID; | ||
324 | } | ||
325 | /* The algorithm value is not quoted */ | ||
326 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_MD5_TOKEN, \ | ||
327 | algo_param->value.str, \ | ||
328 | algo_param->value.len)) | ||
329 | return MHD_DIGEST_AUTH_ALGO3_MD5; | ||
330 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA256_TOKEN, \ | ||
331 | algo_param->value.str, \ | ||
332 | algo_param->value.len)) | ||
333 | return MHD_DIGEST_AUTH_ALGO3_SHA256; | ||
334 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_MD5_TOKEN _MHD_SESS_TOKEN, \ | ||
335 | algo_param->value.str, \ | ||
336 | algo_param->value.len)) | ||
337 | return MHD_DIGEST_AUTH_ALGO3_MD5_SESSION; | ||
338 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA256_TOKEN _MHD_SESS_TOKEN, \ | ||
339 | algo_param->value.str, \ | ||
340 | algo_param->value.len)) | ||
341 | return MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION; | ||
342 | |||
343 | /* Algorithms below are not supported by MHD for authentication */ | ||
344 | |||
345 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA512_256_TOKEN, \ | ||
346 | algo_param->value.str, \ | ||
347 | algo_param->value.len)) | ||
348 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256; | ||
349 | if (MHD_str_equal_caseless_s_bin_n_ (_MHD_SHA512_256_TOKEN _MHD_SESS_TOKEN, \ | ||
350 | algo_param->value.str, \ | ||
351 | algo_param->value.len)) | ||
352 | return MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION; | ||
353 | |||
354 | /* No known algorithm has been detected */ | ||
355 | return MHD_DIGEST_AUTH_ALGO3_INVALID; | ||
356 | } | ||
357 | |||
358 | |||
359 | /** | ||
360 | * Get QOP ('quality of protection') type. | ||
361 | * @param qop_param the Digest Authorization 'QOP' parameter | ||
362 | * @return detected QOP ('quality of protection') type. | ||
363 | */ | ||
364 | static enum MHD_DigestAuthQOP | ||
365 | get_rq_dauth_qop (const struct MHD_RqDAuthParam *const qop_param) | ||
366 | { | ||
367 | if (NULL == qop_param->value.str) | ||
368 | return MHD_DIGEST_AUTH_QOP_NONE; | ||
369 | if (qop_param->quoted) | ||
370 | { | ||
371 | if (MHD_str_equal_caseless_quoted_s_bin_n (qop_param->value.str, \ | ||
372 | qop_param->value.len, \ | ||
373 | MHD_TOKEN_AUTH_)) | ||
374 | return MHD_DIGEST_AUTH_QOP_AUTH; | ||
375 | if (MHD_str_equal_caseless_quoted_s_bin_n (qop_param->value.str, \ | ||
376 | qop_param->value.len, \ | ||
377 | MHD_TOKEN_AUTH_INT_)) | ||
378 | return MHD_DIGEST_AUTH_QOP_AUTH_INT; | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | if (MHD_str_equal_caseless_s_bin_n_ (MHD_TOKEN_AUTH_, \ | ||
383 | qop_param->value.str, \ | ||
384 | qop_param->value.len)) | ||
385 | return MHD_DIGEST_AUTH_QOP_AUTH; | ||
386 | if (MHD_str_equal_caseless_s_bin_n_ (MHD_TOKEN_AUTH_INT_, \ | ||
387 | qop_param->value.str, \ | ||
388 | qop_param->value.len)) | ||
389 | return MHD_DIGEST_AUTH_QOP_AUTH_INT; | ||
390 | } | ||
391 | /* No know QOP has been detected */ | ||
392 | return MHD_DIGEST_AUTH_QOP_INVALID; | ||
393 | } | ||
394 | |||
395 | |||
277 | /** | 396 | /** |
278 | * Parse request Authorization header parameters for Digest Authentication | 397 | * Parse request Authorization header parameters for Digest Authentication |
279 | * @param str the header string, everything after "Digest " substring | 398 | * @param str the header string, everything after "Digest " substring |
@@ -306,16 +425,17 @@ parse_dauth_params (const char *str, | |||
306 | static const struct _MHD_cstr_w_len userhash_tk = | 425 | static const struct _MHD_cstr_w_len userhash_tk = |
307 | _MHD_S_STR_W_LEN ("userhash"); | 426 | _MHD_S_STR_W_LEN ("userhash"); |
308 | struct MHD_RqDAuthParam userhash; | 427 | struct MHD_RqDAuthParam userhash; |
428 | struct MHD_RqDAuthParam algorithm; | ||
309 | struct dauth_token_param map[] = { | 429 | struct dauth_token_param map[] = { |
310 | {&nonce_tk, &(pdauth->nonce)}, | 430 | {&nonce_tk, &(pdauth->nonce)}, |
311 | {&opaque_tk, &(pdauth->opaque)}, | 431 | {&opaque_tk, &(pdauth->opaque)}, |
312 | {&algorithm_tk, &(pdauth->algorithm)}, | 432 | {&algorithm_tk, &algorithm}, |
313 | {&response_tk, &(pdauth->response)}, | 433 | {&response_tk, &(pdauth->response)}, |
314 | {&username_tk, &(pdauth->username)}, | 434 | {&username_tk, &(pdauth->username)}, |
315 | {&username_ext_tk, &(pdauth->username_ext)}, | 435 | {&username_ext_tk, &(pdauth->username_ext)}, |
316 | {&realm_tk, &(pdauth->realm)}, | 436 | {&realm_tk, &(pdauth->realm)}, |
317 | {&uri_tk, &(pdauth->uri)}, | 437 | {&uri_tk, &(pdauth->uri)}, |
318 | {&qop_tk, &(pdauth->qop)}, | 438 | {&qop_tk, &(pdauth->qop_raw)}, |
319 | {&cnonce_tk, &(pdauth->cnonce)}, | 439 | {&cnonce_tk, &(pdauth->cnonce)}, |
320 | {&nc_tk, &(pdauth->nc)}, | 440 | {&nc_tk, &(pdauth->nc)}, |
321 | {&userhash_tk, &userhash} | 441 | {&userhash_tk, &userhash} |
@@ -324,6 +444,7 @@ parse_dauth_params (const char *str, | |||
324 | size_t p; | 444 | size_t p; |
325 | 445 | ||
326 | memset (&userhash, 0, sizeof(userhash)); | 446 | memset (&userhash, 0, sizeof(userhash)); |
447 | memset (&algorithm, 0, sizeof(algorithm)); | ||
327 | i = 0; | 448 | i = 0; |
328 | 449 | ||
329 | /* Skip all whitespaces at start */ | 450 | /* Skip all whitespaces at start */ |
@@ -454,6 +575,7 @@ parse_dauth_params (const char *str, | |||
454 | } | 575 | } |
455 | 576 | ||
456 | /* Postprocess values */ | 577 | /* Postprocess values */ |
578 | |||
457 | if (NULL != userhash.value.str) | 579 | if (NULL != userhash.value.str) |
458 | { | 580 | { |
459 | if (userhash.quoted) | 581 | if (userhash.quoted) |
@@ -470,6 +592,9 @@ parse_dauth_params (const char *str, | |||
470 | else | 592 | else |
471 | pdauth->userhash = false; | 593 | pdauth->userhash = false; |
472 | 594 | ||
595 | pdauth->algo3 = get_rq_dauth_algo (&algorithm); | ||
596 | pdauth->qop = get_rq_dauth_qop (&pdauth->qop_raw); | ||
597 | |||
473 | return true; | 598 | return true; |
474 | } | 599 | } |
475 | 600 | ||
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 3a81b2a2..3fa773a7 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #include "mhd_locks.h" | 62 | #include "mhd_locks.h" |
63 | #include "mhd_sockets.h" | 63 | #include "mhd_sockets.h" |
64 | #include "mhd_itc_types.h" | 64 | #include "mhd_itc_types.h" |
65 | #include "mhd_str_types.h" | ||
65 | #if defined(BAUTH_SUPPORT) || defined(DAUTH_SUPPORT) | 66 | #if defined(BAUTH_SUPPORT) || defined(DAUTH_SUPPORT) |
66 | #include "gen_auth.h" | 67 | #include "gen_auth.h" |
67 | #endif /* BAUTH_SUPPORT || DAUTH_SUPPORT*/ | 68 | #endif /* BAUTH_SUPPORT || DAUTH_SUPPORT*/ |
@@ -2282,6 +2283,51 @@ struct MHD_Daemon | |||
2282 | }; | 2283 | }; |
2283 | 2284 | ||
2284 | 2285 | ||
2286 | #ifdef DAUTH_SUPPORT | ||
2287 | |||
2288 | /** | ||
2289 | * Parameter of request's Digest Authorization header | ||
2290 | */ | ||
2291 | struct MHD_RqDAuthParam | ||
2292 | { | ||
2293 | /** | ||
2294 | * The string with length, NOT zero-terminated | ||
2295 | */ | ||
2296 | struct _MHD_str_w_len value; | ||
2297 | /** | ||
2298 | * True if string must be "unquoted" before processing. | ||
2299 | * This member is false if the string is used in DQUOTE marks, but no | ||
2300 | * backslash-escape is used in the string. | ||
2301 | */ | ||
2302 | bool quoted; | ||
2303 | }; | ||
2304 | |||
2305 | /** | ||
2306 | * Request client's Digest Authorization header parameters | ||
2307 | */ | ||
2308 | struct MHD_RqDAuth | ||
2309 | { | ||
2310 | struct MHD_RqDAuthParam nonce; | ||
2311 | struct MHD_RqDAuthParam opaque; | ||
2312 | struct MHD_RqDAuthParam response; | ||
2313 | struct MHD_RqDAuthParam username; | ||
2314 | struct MHD_RqDAuthParam username_ext; | ||
2315 | struct MHD_RqDAuthParam realm; | ||
2316 | struct MHD_RqDAuthParam uri; | ||
2317 | /* The raw QOP value, used in the 'response' calculation */ | ||
2318 | struct MHD_RqDAuthParam qop_raw; | ||
2319 | struct MHD_RqDAuthParam cnonce; | ||
2320 | struct MHD_RqDAuthParam nc; | ||
2321 | |||
2322 | /* Decoded values are below */ | ||
2323 | bool userhash; /* True if 'userhash' parameter has value 'true'. */ | ||
2324 | enum MHD_DigestAuthAlgo3 algo3; | ||
2325 | enum MHD_DigestAuthQOP qop; | ||
2326 | }; | ||
2327 | |||
2328 | |||
2329 | #endif /* DAUTH_SUPPORT */ | ||
2330 | |||
2285 | /** | 2331 | /** |
2286 | * Insert an element at the head of a DLL. Assumes that head, tail and | 2332 | * Insert an element at the head of a DLL. Assumes that head, tail and |
2287 | * element are structs with prev and next fields. | 2333 | * element are structs with prev and next fields. |
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h index 284ad853..cd0af55f 100644 --- a/src/microhttpd/mhd_str.h +++ b/src/microhttpd/mhd_str.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <stdbool.h> | 38 | #include <stdbool.h> |
39 | #endif /* HAVE_STDBOOL_H */ | 39 | #endif /* HAVE_STDBOOL_H */ |
40 | 40 | ||
41 | #include "mhd_str_types.h" | ||
42 | |||
41 | #if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED) | 43 | #if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED) |
42 | #define _SSIZE_T_DEFINED | 44 | #define _SSIZE_T_DEFINED |
43 | typedef intptr_t ssize_t; | 45 | typedef intptr_t ssize_t; |
@@ -47,46 +49,6 @@ typedef intptr_t ssize_t; | |||
47 | #include "mhd_limits.h" | 49 | #include "mhd_limits.h" |
48 | #endif /* MHD_FAVOR_SMALL_CODE */ | 50 | #endif /* MHD_FAVOR_SMALL_CODE */ |
49 | 51 | ||
50 | #ifndef MHD_STATICSTR_LEN_ | ||
51 | /** | ||
52 | * Determine length of static string / macro strings at compile time. | ||
53 | */ | ||
54 | #define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1) | ||
55 | #endif /* ! MHD_STATICSTR_LEN_ */ | ||
56 | |||
57 | /** | ||
58 | * Constant string with length | ||
59 | */ | ||
60 | struct _MHD_cstr_w_len | ||
61 | { | ||
62 | const char *const str; | ||
63 | const size_t len; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * String with length | ||
68 | */ | ||
69 | struct _MHD_str_w_len | ||
70 | { | ||
71 | const char *str; | ||
72 | size_t len; | ||
73 | }; | ||
74 | |||
75 | /** | ||
76 | * Modifiable string with length | ||
77 | */ | ||
78 | struct _MHD_mstr_w_len | ||
79 | { | ||
80 | char *str; | ||
81 | size_t len; | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * Static string initialiser for struct _MHD_str_w_len | ||
86 | */ | ||
87 | #define _MHD_S_STR_W_LEN(str) { str, MHD_STATICSTR_LEN_(str) } | ||
88 | |||
89 | |||
90 | /* | 52 | /* |
91 | * Block of functions/macros that use US-ASCII charset as required by HTTP | 53 | * Block of functions/macros that use US-ASCII charset as required by HTTP |
92 | * standards. Not affected by current locale settings. | 54 | * standards. Not affected by current locale settings. |
diff --git a/src/microhttpd/mhd_str_types.h b/src/microhttpd/mhd_str_types.h new file mode 100644 index 00000000..c846ebef --- /dev/null +++ b/src/microhttpd/mhd_str_types.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2015-2022 Karlson2k (Evgeny Grin) | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file microhttpd/mhd_str_types.h | ||
22 | * @brief Header for string manipulating helpers types | ||
23 | * @author Karlson2k (Evgeny Grin) | ||
24 | */ | ||
25 | |||
26 | #ifndef MHD_STR_TYPES_H | ||
27 | #define MHD_STR_TYPES_H 1 | ||
28 | |||
29 | #ifndef MHD_STATICSTR_LEN_ | ||
30 | /** | ||
31 | * Determine length of static string / macro strings at compile time. | ||
32 | */ | ||
33 | #define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1) | ||
34 | #endif /* ! MHD_STATICSTR_LEN_ */ | ||
35 | |||
36 | /** | ||
37 | * Constant string with length | ||
38 | */ | ||
39 | struct _MHD_cstr_w_len | ||
40 | { | ||
41 | const char *const str; | ||
42 | const size_t len; | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * String with length | ||
47 | */ | ||
48 | struct _MHD_str_w_len | ||
49 | { | ||
50 | const char *str; | ||
51 | size_t len; | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * Modifiable string with length | ||
56 | */ | ||
57 | struct _MHD_mstr_w_len | ||
58 | { | ||
59 | char *str; | ||
60 | size_t len; | ||
61 | }; | ||
62 | |||
63 | /** | ||
64 | * Static string initialiser for struct _MHD_str_w_len | ||
65 | */ | ||
66 | #define _MHD_S_STR_W_LEN(str) { str, MHD_STATICSTR_LEN_(str) } | ||
67 | |||
68 | #endif /* MHD_STR_TYPES_H */ | ||
diff --git a/src/microhttpd/test_auth_parse.c b/src/microhttpd/test_auth_parse.c index b9507f97..8c11499b 100644 --- a/src/microhttpd/test_auth_parse.c +++ b/src/microhttpd/test_auth_parse.c | |||
@@ -956,13 +956,15 @@ cmp_dauth_param (const char *pname, const struct MHD_RqDAuthParam *param, | |||
956 | if (0 != ret) | 956 | if (0 != ret) |
957 | { | 957 | { |
958 | fprintf (stderr, "Parameter '%s' parsed incorrectly:\n", pname); | 958 | fprintf (stderr, "Parameter '%s' parsed incorrectly:\n", pname); |
959 | fprintf (stderr, "\tRESULT :\tvalue.str: %s", | 959 | fprintf (stderr, "\tRESULT :\tvalue.str: %.*s", |
960 | (int) (param->value.str ? param->value.len : 6), | ||
960 | param->value.str ? param->value.str : "(NULL)"); | 961 | param->value.str ? param->value.str : "(NULL)"); |
961 | fprintf (stderr, "\tvalue.len: %u", | 962 | fprintf (stderr, "\tvalue.len: %u", |
962 | (unsigned) param->value.len); | 963 | (unsigned) param->value.len); |
963 | fprintf (stderr, "\tquoted: %s\n", | 964 | fprintf (stderr, "\tquoted: %s\n", |
964 | (unsigned) param->quoted ? "true" : "false"); | 965 | (unsigned) param->quoted ? "true" : "false"); |
965 | fprintf (stderr, "\tEXPECTED:\tvalue.str: %s", | 966 | fprintf (stderr, "\tEXPECTED:\tvalue.str: %.*s", |
967 | (int) (expected_value ? expected_len : 6), | ||
966 | expected_value ? expected_value : "(NULL)"); | 968 | expected_value ? expected_value : "(NULL)"); |
967 | fprintf (stderr, "\tvalue.len: %u", | 969 | fprintf (stderr, "\tvalue.len: %u", |
968 | (unsigned) expected_len); | 970 | (unsigned) expected_len); |
@@ -977,13 +979,14 @@ cmp_dauth_param (const char *pname, const struct MHD_RqDAuthParam *param, | |||
977 | static unsigned int | 979 | static unsigned int |
978 | expect_digest_n (const char *hdr, size_t hdr_len, | 980 | expect_digest_n (const char *hdr, size_t hdr_len, |
979 | const char *nonce, | 981 | const char *nonce, |
980 | const char *algorithm, | 982 | enum MHD_DigestAuthAlgo3 algo3, |
981 | const char *response, | 983 | const char *response, |
982 | const char *username, | 984 | const char *username, |
983 | const char *username_ext, | 985 | const char *username_ext, |
984 | const char *realm, | 986 | const char *realm, |
985 | const char *uri, | 987 | const char *uri, |
986 | const char *qop, | 988 | const char *qop_raw, |
989 | enum MHD_DigestAuthQOP qop, | ||
987 | const char *cnonce, | 990 | const char *cnonce, |
988 | const char *nc, | 991 | const char *nc, |
989 | int userhash, | 992 | int userhash, |
@@ -1003,14 +1006,31 @@ expect_digest_n (const char *hdr, size_t hdr_len, | |||
1003 | ret = 0; | 1006 | ret = 0; |
1004 | 1007 | ||
1005 | ret += cmp_dauth_param ("nonce", &h->nonce, nonce); | 1008 | ret += cmp_dauth_param ("nonce", &h->nonce, nonce); |
1006 | ret += cmp_dauth_param ("algorithm", &h->algorithm, algorithm); | 1009 | if (h->algo3 != algo3) |
1010 | { | ||
1011 | ret += 1; | ||
1012 | fprintf (stderr, "Parameter 'algorithm' detected incorrectly:\n"); | ||
1013 | fprintf (stderr, "\tRESULT :\t%u\n", | ||
1014 | (unsigned) h->algo3); | ||
1015 | fprintf (stderr, "\tEXPECTED:\t%u\n", | ||
1016 | (unsigned) algo3); | ||
1017 | } | ||
1007 | ret += cmp_dauth_param ("response", &h->response, response); | 1018 | ret += cmp_dauth_param ("response", &h->response, response); |
1008 | ret += cmp_dauth_param ("username", &h->username, username); | 1019 | ret += cmp_dauth_param ("username", &h->username, username); |
1009 | ret += cmp_dauth_param ("username_ext", &h->username_ext, | 1020 | ret += cmp_dauth_param ("username_ext", &h->username_ext, |
1010 | username_ext); | 1021 | username_ext); |
1011 | ret += cmp_dauth_param ("realm", &h->realm, realm); | 1022 | ret += cmp_dauth_param ("realm", &h->realm, realm); |
1012 | ret += cmp_dauth_param ("uri", &h->uri, uri); | 1023 | ret += cmp_dauth_param ("uri", &h->uri, uri); |
1013 | ret += cmp_dauth_param ("qop", &h->qop, qop); | 1024 | ret += cmp_dauth_param ("qop", &h->qop_raw, qop_raw); |
1025 | if (h->qop != qop) | ||
1026 | { | ||
1027 | ret += 1; | ||
1028 | fprintf (stderr, "Parameter 'qop' detected incorrectly:\n"); | ||
1029 | fprintf (stderr, "\tRESULT :\t%u\n", | ||
1030 | (unsigned) h->qop); | ||
1031 | fprintf (stderr, "\tEXPECTED:\t%u\n", | ||
1032 | (unsigned) qop); | ||
1033 | } | ||
1014 | ret += cmp_dauth_param ("cnonce", &h->cnonce, cnonce); | 1034 | ret += cmp_dauth_param ("cnonce", &h->cnonce, cnonce); |
1015 | ret += cmp_dauth_param ("nc", &h->nc, nc); | 1035 | ret += cmp_dauth_param ("nc", &h->nc, nc); |
1016 | if (h->userhash != ! (! userhash)) | 1036 | if (h->userhash != ! (! userhash)) |
@@ -1035,102 +1055,286 @@ expect_digest_n (const char *hdr, size_t hdr_len, | |||
1035 | } | 1055 | } |
1036 | 1056 | ||
1037 | 1057 | ||
1038 | #define expect_digest(h,no,a,rs,un,ux,rm,ur,q,c,nc,uh) \ | 1058 | #define expect_digest(h,no,a,rs,un,ux,rm,ur,qr,qe,c,nc,uh) \ |
1039 | expect_digest_n(h,MHD_STATICSTR_LEN_(h),\ | 1059 | expect_digest_n(h,MHD_STATICSTR_LEN_(h),\ |
1040 | no,a,rs,un,ux,rm,ur,q,c,nc,uh,__LINE__) | 1060 | no,a,rs,un,ux,rm,ur,qr,qe,c,nc,uh,__LINE__) |
1041 | 1061 | ||
1042 | static unsigned int | 1062 | static unsigned int |
1043 | check_digest (void) | 1063 | check_digest (void) |
1044 | { | 1064 | { |
1045 | unsigned int r = 0; /**< The number of errors */ | 1065 | unsigned int r = 0; /**< The number of errors */ |
1046 | 1066 | ||
1047 | r += expect_digest ("Digest", NULL, NULL, NULL, NULL, NULL, NULL, \ | 1067 | r += expect_digest ("Digest", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1048 | NULL, NULL, NULL, NULL, 0); | 1068 | NULL, NULL, NULL, NULL, NULL, \ |
1049 | r += expect_digest ("Digest nc=1", NULL, NULL, NULL, NULL, NULL, NULL, \ | 1069 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); |
1050 | NULL, NULL, NULL, "1", 0); | 1070 | r += expect_digest ("Digest nc=1", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1051 | r += expect_digest ("Digest nc=\"1\"", NULL, NULL, NULL, NULL, NULL, NULL, \ | 1071 | NULL, NULL, NULL, NULL, NULL, NULL, \ |
1052 | NULL, NULL, NULL, "1", 0); | 1072 | MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1053 | r += expect_digest ("Digest nc=\"1\" ", NULL, NULL, NULL, NULL, NULL, \ | 1073 | r += expect_digest ("Digest nc=\"1\"", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1054 | NULL, NULL, NULL, NULL, "1", 0); | 1074 | NULL, NULL, NULL, NULL, NULL, \ |
1055 | r += expect_digest ("Digest ,nc=\"1\" ", NULL, NULL, NULL, NULL, NULL, \ | 1075 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1056 | NULL, NULL, NULL, NULL, "1", 0); | 1076 | r += expect_digest ("Digest nc=\"1\" ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1057 | r += expect_digest ("Digest nc=\"1\", ", NULL, NULL, NULL, NULL, NULL, \ | 1077 | NULL, NULL, NULL, NULL, NULL, \ |
1058 | NULL, NULL, NULL, NULL, "1", 0); | 1078 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1059 | r += expect_digest ("Digest nc=\"1\" , ", NULL, NULL, NULL, NULL, NULL, \ | 1079 | r += expect_digest ("Digest ,nc=\"1\" ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1060 | NULL, NULL, NULL, NULL, "1", 0); | 1080 | NULL, NULL, NULL, NULL, NULL, \ |
1061 | r += expect_digest ("Digest nc=1, ", NULL, NULL, NULL, NULL, NULL, NULL, \ | 1081 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1062 | NULL, NULL, NULL, "1", 0); | 1082 | r += expect_digest ("Digest nc=\"1\", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1063 | r += expect_digest ("Digest nc=1 , ", NULL, NULL, NULL, NULL, NULL, NULL, \ | 1083 | NULL, NULL, NULL, NULL, NULL, \ |
1064 | NULL, NULL, NULL, "1", 0); | 1084 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1065 | r += expect_digest ("Digest ,,,nc=1, ", NULL, NULL, NULL, NULL, NULL, \ | 1085 | r += expect_digest ("Digest nc=\"1\" , ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1066 | NULL, NULL, NULL, NULL, "1", 0); | 1086 | NULL, NULL, NULL, NULL, NULL, \ |
1067 | r += expect_digest ("Digest ,,,nc=1 , ", NULL, NULL, NULL, NULL, NULL, \ | 1087 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1068 | NULL, NULL, NULL, NULL, "1", 0); | 1088 | r += expect_digest ("Digest nc=1, ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1069 | r += expect_digest ("Digest ,,,nc=\"1 \", ", NULL, NULL, NULL, NULL, \ | 1089 | NULL, NULL, NULL, NULL, NULL, \ |
1070 | NULL, NULL, NULL, NULL, NULL, "1 ", 0); | 1090 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1071 | r += expect_digest ("Digest nc=\"1 \"", NULL, NULL, NULL, NULL, NULL, NULL, \ | 1091 | r += expect_digest ("Digest nc=1 , ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1072 | NULL, NULL, NULL, "1 ", 0); | 1092 | NULL, NULL, NULL, NULL, NULL, \ |
1073 | r += expect_digest ("Digest nc=\"1 \" ,", NULL, NULL, NULL, NULL, NULL, \ | 1093 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1074 | NULL, NULL, NULL, NULL, "1 ", 0); | 1094 | r += expect_digest ("Digest ,,,nc=1, ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1075 | r += expect_digest ("Digest nc=\"1 \", ", NULL, NULL, NULL, NULL, NULL, \ | 1095 | NULL, NULL, NULL, NULL, NULL, \ |
1076 | NULL, NULL, NULL, NULL, "1 ", 0); | 1096 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1077 | r += expect_digest ("Digest nc=\"1;\", ", NULL, NULL, NULL, NULL, NULL, \ | 1097 | r += expect_digest ("Digest ,,,nc=1 , ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1078 | NULL, NULL, NULL, NULL, "1;", 0); | 1098 | NULL, NULL, NULL, NULL, NULL, \ |
1079 | r += expect_digest ("Digest nc=\"1\\;\", ", NULL, NULL, NULL, NULL, NULL, \ | 1099 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0); |
1080 | NULL, NULL, NULL, NULL, "1\\;", 0); | 1100 | r += expect_digest ("Digest ,,,nc=\"1 \", ", NULL, \ |
1081 | 1101 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | |
1082 | r += expect_digest ("Digest userhash=false", NULL, NULL, NULL, NULL, NULL, \ | 1102 | NULL, NULL, NULL, NULL, NULL, \ |
1083 | NULL, NULL, NULL, NULL, NULL, 0); | 1103 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0); |
1084 | r += expect_digest ("Digest userhash=\"false\"", NULL, NULL, NULL, NULL, NULL, \ | 1104 | r += expect_digest ("Digest nc=\"1 \"", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1085 | NULL, NULL, NULL, NULL, NULL, 0); | 1105 | NULL, NULL, NULL, NULL, NULL, \ |
1086 | r += expect_digest ("Digest userhash=foo", NULL, NULL, NULL, NULL, NULL, \ | 1106 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0); |
1087 | NULL, NULL, NULL, NULL, NULL, 0); | 1107 | r += expect_digest ("Digest nc=\"1 \" ,", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1088 | r += expect_digest ("Digest userhash=true", NULL, NULL, NULL, NULL, NULL, \ | 1108 | NULL, NULL, NULL, NULL, NULL, \ |
1089 | NULL, NULL, NULL, NULL, NULL, 1); | 1109 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0); |
1090 | r += expect_digest ("Digest userhash=\"true\"", NULL, NULL, NULL, NULL, NULL, \ | 1110 | r += expect_digest ("Digest nc=\"1 \", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1091 | NULL, NULL, NULL, NULL, NULL, 1); | 1111 | NULL, NULL, NULL, NULL, NULL, \ |
1092 | r += expect_digest ("Digest userhash=\"\\t\\r\\u\\e\"", NULL, NULL, NULL, \ | 1112 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0); |
1093 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | 1113 | r += expect_digest ("Digest nc=\"1;\", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1094 | r += expect_digest ("Digest userhash=TRUE", NULL, NULL, NULL, NULL, NULL, \ | 1114 | NULL, NULL, NULL, NULL, NULL, \ |
1095 | NULL, NULL, NULL, NULL, NULL, 1); | 1115 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1;", 0); |
1096 | r += expect_digest ("Digest userhash=True", NULL, NULL, NULL, NULL, NULL, \ | 1116 | r += expect_digest ("Digest nc=\"1\\;\", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1097 | NULL, NULL, NULL, NULL, NULL, 1); | 1117 | NULL, NULL, NULL, NULL, NULL, \ |
1098 | r += expect_digest ("Digest userhash = true", NULL, NULL, NULL, NULL, \ | 1118 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1\\;", 0); |
1099 | NULL, NULL, NULL, NULL, NULL, NULL, 1); | 1119 | |
1100 | r += expect_digest ("Digest userhash=True2", NULL, NULL, NULL, NULL, NULL, \ | 1120 | r += expect_digest ("Digest userhash=false", NULL, \ |
1101 | NULL, NULL, NULL, NULL, NULL, 0); | 1121 | MHD_DIGEST_AUTH_ALGO3_MD5, \ |
1102 | r += expect_digest ("Digest userhash=\" true\"", NULL, NULL, NULL, NULL, \ | 1122 | NULL, NULL, NULL, NULL, NULL, \ |
1103 | NULL, NULL, NULL, NULL, NULL, NULL, 0); | 1123 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); |
1124 | r += expect_digest ("Digest userhash=\"false\"", NULL, \ | ||
1125 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1126 | NULL, NULL, NULL, NULL, NULL, \ | ||
1127 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1128 | r += expect_digest ("Digest userhash=foo", NULL, \ | ||
1129 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1130 | NULL, NULL, NULL, NULL, NULL, \ | ||
1131 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1132 | r += expect_digest ("Digest userhash=true", NULL, \ | ||
1133 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1134 | NULL, NULL, NULL, NULL, NULL, \ | ||
1135 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1); | ||
1136 | r += expect_digest ("Digest userhash=\"true\"", NULL, \ | ||
1137 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1138 | NULL, NULL, NULL, NULL, NULL, \ | ||
1139 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1); | ||
1140 | r += expect_digest ("Digest userhash=\"\\t\\r\\u\\e\"", NULL, \ | ||
1141 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1142 | NULL, NULL, NULL, NULL, NULL, \ | ||
1143 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1); | ||
1144 | r += expect_digest ("Digest userhash=TRUE", NULL, \ | ||
1145 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1146 | NULL, NULL, NULL, NULL, NULL, \ | ||
1147 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1); | ||
1148 | r += expect_digest ("Digest userhash=True", NULL, \ | ||
1149 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1150 | NULL, NULL, NULL, NULL, NULL, \ | ||
1151 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1); | ||
1152 | r += expect_digest ("Digest userhash = true", NULL, \ | ||
1153 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1154 | NULL, NULL, NULL, NULL, NULL, \ | ||
1155 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1); | ||
1156 | r += expect_digest ("Digest userhash=True2", NULL, \ | ||
1157 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1158 | NULL, NULL, NULL, NULL, NULL, \ | ||
1159 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1160 | r += expect_digest ("Digest userhash=\" true\"", NULL, \ | ||
1161 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1162 | NULL, NULL, NULL, NULL, NULL, \ | ||
1163 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1164 | |||
1165 | r += expect_digest ("Digest algorithm=MD5", NULL, \ | ||
1166 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1167 | NULL, NULL, NULL, NULL, NULL, \ | ||
1168 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1169 | r += expect_digest ("Digest algorithm=md5", NULL, \ | ||
1170 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1171 | NULL, NULL, NULL, NULL, NULL, \ | ||
1172 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1173 | r += expect_digest ("Digest algorithm=Md5", NULL, \ | ||
1174 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1175 | NULL, NULL, NULL, NULL, NULL, \ | ||
1176 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1177 | r += expect_digest ("Digest algorithm=mD5", NULL, \ | ||
1178 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1179 | NULL, NULL, NULL, NULL, NULL, \ | ||
1180 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1181 | r += expect_digest ("Digest algorithm=\"MD5\"", NULL, \ | ||
1182 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1183 | NULL, NULL, NULL, NULL, NULL, \ | ||
1184 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1185 | r += expect_digest ("Digest algorithm=\"\\M\\D\\5\"", NULL, \ | ||
1186 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1187 | NULL, NULL, NULL, NULL, NULL, \ | ||
1188 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1189 | r += expect_digest ("Digest algorithm=\"\\m\\d\\5\"", NULL, \ | ||
1190 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1191 | NULL, NULL, NULL, NULL, NULL, \ | ||
1192 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1193 | r += expect_digest ("Digest algorithm=SHA-256", NULL, \ | ||
1194 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1195 | NULL, NULL, NULL, NULL, NULL, \ | ||
1196 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1197 | r += expect_digest ("Digest algorithm=sha-256", NULL, \ | ||
1198 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1199 | NULL, NULL, NULL, NULL, NULL, \ | ||
1200 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1201 | r += expect_digest ("Digest algorithm=Sha-256", NULL, \ | ||
1202 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1203 | NULL, NULL, NULL, NULL, NULL, \ | ||
1204 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1205 | r += expect_digest ("Digest algorithm=\"SHA-256\"", NULL, \ | ||
1206 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1207 | NULL, NULL, NULL, NULL, NULL, \ | ||
1208 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1209 | r += expect_digest ("Digest algorithm=\"SHA\\-25\\6\"", NULL, \ | ||
1210 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1211 | NULL, NULL, NULL, NULL, NULL, \ | ||
1212 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1213 | r += expect_digest ("Digest algorithm=\"shA-256\"", NULL, \ | ||
1214 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1215 | NULL, NULL, NULL, NULL, NULL, \ | ||
1216 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1217 | r += expect_digest ("Digest algorithm=MD5-sess", NULL, \ | ||
1218 | MHD_DIGEST_AUTH_ALGO3_MD5_SESSION, \ | ||
1219 | NULL, NULL, NULL, NULL, NULL, \ | ||
1220 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1221 | r += expect_digest ("Digest algorithm=MD5-SESS", NULL, \ | ||
1222 | MHD_DIGEST_AUTH_ALGO3_MD5_SESSION, \ | ||
1223 | NULL, NULL, NULL, NULL, NULL, \ | ||
1224 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1225 | r += expect_digest ("Digest algorithm=md5-Sess", NULL, \ | ||
1226 | MHD_DIGEST_AUTH_ALGO3_MD5_SESSION, \ | ||
1227 | NULL, NULL, NULL, NULL, NULL, \ | ||
1228 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1229 | r += expect_digest ("Digest algorithm=SHA-256-seSS", NULL, \ | ||
1230 | MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION, \ | ||
1231 | NULL, NULL, NULL, NULL, NULL, \ | ||
1232 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1233 | r += expect_digest ("Digest algorithm=SHA-512-256", NULL, \ | ||
1234 | MHD_DIGEST_AUTH_ALGO3_SHA512_256, \ | ||
1235 | NULL, NULL, NULL, NULL, NULL, \ | ||
1236 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1237 | r += expect_digest ("Digest algorithm=SHA-512-256-sess", NULL, \ | ||
1238 | MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION, \ | ||
1239 | NULL, NULL, NULL, NULL, NULL, \ | ||
1240 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1241 | r += expect_digest ("Digest algorithm=MD5-2", NULL, \ | ||
1242 | MHD_DIGEST_AUTH_ALGO3_INVALID, \ | ||
1243 | NULL, NULL, NULL, NULL, NULL, \ | ||
1244 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1245 | r += expect_digest ("Digest algorithm=MD5-sess2", NULL, \ | ||
1246 | MHD_DIGEST_AUTH_ALGO3_INVALID, \ | ||
1247 | NULL, NULL, NULL, NULL, NULL, \ | ||
1248 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1249 | r += expect_digest ("Digest algorithm=SHA-256-512", NULL, \ | ||
1250 | MHD_DIGEST_AUTH_ALGO3_INVALID, \ | ||
1251 | NULL, NULL, NULL, NULL, NULL, \ | ||
1252 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1253 | r += expect_digest ("Digest algorithm=", NULL, \ | ||
1254 | MHD_DIGEST_AUTH_ALGO3_INVALID, \ | ||
1255 | NULL, NULL, NULL, NULL, NULL, \ | ||
1256 | NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0); | ||
1257 | |||
1258 | r += expect_digest ("Digest qop=auth", NULL, \ | ||
1259 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1260 | NULL, NULL, NULL, NULL, NULL, \ | ||
1261 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0); | ||
1262 | r += expect_digest ("Digest qop=\"auth\"", NULL, \ | ||
1263 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1264 | NULL, NULL, NULL, NULL, NULL, \ | ||
1265 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0); | ||
1266 | r += expect_digest ("Digest qop=Auth", NULL, \ | ||
1267 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1268 | NULL, NULL, NULL, NULL, NULL, \ | ||
1269 | "Auth", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0); | ||
1270 | r += expect_digest ("Digest qop=AUTH", NULL, \ | ||
1271 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1272 | NULL, NULL, NULL, NULL, NULL, \ | ||
1273 | "AUTH", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0); | ||
1274 | r += expect_digest ("Digest qop=\"\\A\\ut\\H\"", NULL, \ | ||
1275 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1276 | NULL, NULL, NULL, NULL, NULL, \ | ||
1277 | "\\A\\ut\\H", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0); | ||
1278 | r += expect_digest ("Digest qop=\"auth \"", NULL, \ | ||
1279 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1280 | NULL, NULL, NULL, NULL, NULL, \ | ||
1281 | "auth ", MHD_DIGEST_AUTH_QOP_INVALID, NULL, NULL, 0); | ||
1282 | r += expect_digest ("Digest qop=auth-int", NULL, \ | ||
1283 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1284 | NULL, NULL, NULL, NULL, NULL, \ | ||
1285 | "auth-int", MHD_DIGEST_AUTH_QOP_AUTH_INT, NULL, NULL, 0); | ||
1286 | r += expect_digest ("Digest qop=\"auth-int\"", NULL, \ | ||
1287 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1288 | NULL, NULL, NULL, NULL, NULL, \ | ||
1289 | "auth-int", MHD_DIGEST_AUTH_QOP_AUTH_INT, NULL, NULL, 0); | ||
1290 | r += expect_digest ("Digest qop=\"auTh-iNt\"", NULL, \ | ||
1291 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1292 | NULL, NULL, NULL, NULL, NULL, \ | ||
1293 | "auTh-iNt", MHD_DIGEST_AUTH_QOP_AUTH_INT, NULL, NULL, 0); | ||
1294 | r += expect_digest ("Digest qop=\"auTh-iNt2\"", NULL, \ | ||
1295 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1296 | NULL, NULL, NULL, NULL, NULL, \ | ||
1297 | "auTh-iNt2", MHD_DIGEST_AUTH_QOP_INVALID, NULL, NULL, 0); | ||
1104 | 1298 | ||
1105 | r += expect_digest ("Digest username=\"test@example.com\", " \ | 1299 | r += expect_digest ("Digest username=\"test@example.com\", " \ |
1106 | "realm=\"users@example.com\", nonce=\"32141232413abcde\", " \ | 1300 | "realm=\"users@example.com\", " \ |
1107 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1301 | "nonce=\"32141232413abcde\", " \ |
1302 | "uri=\"/example\", qop=auth, nc=00000001, " \ | ||
1303 | "cnonce=\"0a4f113b\", " \ | ||
1108 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1304 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1109 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", NULL, \ | 1305 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \ |
1306 | MHD_DIGEST_AUTH_ALGO3_MD5, \ | ||
1110 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1307 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1111 | NULL, "users@example.com", "/example", "auth", \ | 1308 | NULL, "users@example.com", "/example", \ |
1309 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, \ | ||
1112 | "0a4f113b", "00000001", 0); | 1310 | "0a4f113b", "00000001", 0); |
1113 | r += expect_digest ("Digest username=\"test@example.com\", " \ | 1311 | r += expect_digest ("Digest username=\"test@example.com\", " \ |
1114 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1312 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1115 | "nonce=\"32141232413abcde\", " \ | 1313 | "nonce=\"32141232413abcde\", " \ |
1116 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1314 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1117 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1315 | "uri=\"/example\", qop=auth, nc=00000001, " \ |
1316 | "cnonce=\"0a4f113b\", " \ | ||
1118 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1317 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1119 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ | 1318 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \ |
1319 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1120 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1320 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1121 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1321 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1122 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1322 | "users@example.com", "/example", \ |
1323 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1123 | "00000001", 0); | 1324 | "00000001", 0); |
1124 | r += expect_digest ("Digest username=test@example.com, " \ | 1325 | r += expect_digest ("Digest username=test@example.com, " \ |
1125 | "realm=users@example.com, algorithm=\"SHA-256\", " \ | 1326 | "realm=users@example.com, algorithm=\"SHA-256-sess\", " \ |
1126 | "nonce=32141232413abcde, " \ | 1327 | "nonce=32141232413abcde, " \ |
1127 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1328 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1128 | "uri=/example, qop=\"auth\", nc=\"00000001\", cnonce=0a4f113b, " \ | 1329 | "uri=/example, qop=\"auth\", nc=\"00000001\", " \ |
1330 | "cnonce=0a4f113b, " \ | ||
1129 | "response=6629fae49393a05397450978507c4ef1, " \ | 1331 | "response=6629fae49393a05397450978507c4ef1, " \ |
1130 | "opaque=sadfljk32sdaf", "32141232413abcde", "SHA-256", \ | 1332 | "opaque=sadfljk32sdaf", "32141232413abcde", \ |
1333 | MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION, \ | ||
1131 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1334 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1132 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1335 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1133 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1336 | "users@example.com", "/example", \ |
1337 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1134 | "00000001", 0); | 1338 | "00000001", 0); |
1135 | r += expect_digest ("Digest username = \"test@example.com\", " \ | 1339 | r += expect_digest ("Digest username = \"test@example.com\", " \ |
1136 | "realm\t=\t\"users@example.com\", algorithm\t= SHA-256, " \ | 1340 | "realm\t=\t\"users@example.com\", algorithm\t= SHA-256, " \ |
@@ -1140,21 +1344,25 @@ check_digest (void) | |||
1140 | "cnonce\t\t\t= \"0a4f113b\", " \ | 1344 | "cnonce\t\t\t= \"0a4f113b\", " \ |
1141 | "response =\"6629fae49393a05397450978507c4ef1\", " \ | 1345 | "response =\"6629fae49393a05397450978507c4ef1\", " \ |
1142 | "opaque=\t\t\"sadfljk32sdaf\"", "32141232413abcde", \ | 1346 | "opaque=\t\t\"sadfljk32sdaf\"", "32141232413abcde", \ |
1143 | "SHA-256", \ | 1347 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ |
1144 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1348 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1145 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1349 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1146 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1350 | "users@example.com", "/example", \ |
1351 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1147 | "00000001", 0); | 1352 | "00000001", 0); |
1148 | r += expect_digest ("Digest username=\"test@example.com\"," \ | 1353 | r += expect_digest ("Digest username=\"test@example.com\"," \ |
1149 | "realm=\"users@example.com\",algorithm=SHA-256," \ | 1354 | "realm=\"users@example.com\",algorithm=SHA-512-256," \ |
1150 | "nonce=\"32141232413abcde\"," \ | 1355 | "nonce=\"32141232413abcde\"," \ |
1151 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \ | 1356 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \ |
1152 | "uri=\"/example\",qop=auth,nc=00000001,cnonce=\"0a4f113b\"," \ | 1357 | "uri=\"/example\",qop=auth,nc=00000001," \ |
1358 | "cnonce=\"0a4f113b\"," \ | ||
1153 | "response=\"6629fae49393a05397450978507c4ef1\"," \ | 1359 | "response=\"6629fae49393a05397450978507c4ef1\"," \ |
1154 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ | 1360 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \ |
1361 | MHD_DIGEST_AUTH_ALGO3_SHA512_256, \ | ||
1155 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1362 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1156 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1363 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1157 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1364 | "users@example.com", "/example", \ |
1365 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1158 | "00000001", 0); | 1366 | "00000001", 0); |
1159 | r += expect_digest ("Digest username=\"test@example.com\"," \ | 1367 | r += expect_digest ("Digest username=\"test@example.com\"," \ |
1160 | "realm=\"users@example.com\",algorithm=SHA-256," \ | 1368 | "realm=\"users@example.com\",algorithm=SHA-256," \ |
@@ -1162,107 +1370,128 @@ check_digest (void) | |||
1162 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \ | 1370 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \ |
1163 | "uri=\"/example\",qop=auth,nc=00000001,cnonce=\"0a4f113b\"," \ | 1371 | "uri=\"/example\",qop=auth,nc=00000001,cnonce=\"0a4f113b\"," \ |
1164 | "response=\"6629fae49393a05397450978507c4ef1\"," \ | 1372 | "response=\"6629fae49393a05397450978507c4ef1\"," \ |
1165 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ | 1373 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \ |
1374 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1166 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1375 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1167 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1376 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1168 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1377 | "users@example.com", "/example", \ |
1378 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1169 | "00000001", 0); | 1379 | "00000001", 0); |
1170 | r += expect_digest ("Digest abc=zyx, username=\"test@example.com\", " \ | 1380 | r += expect_digest ("Digest abc=zyx, username=\"test@example.com\", " \ |
1171 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1381 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1172 | "nonce=\"32141232413abcde\", " \ | 1382 | "nonce=\"32141232413abcde\", " \ |
1173 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1383 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1174 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1384 | "uri=\"/example\", qop=auth, nc=00000001, " \ |
1385 | "cnonce=\"0a4f113b\", " \ | ||
1175 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1386 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1176 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ | 1387 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \ |
1388 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1177 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1389 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1178 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1390 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1179 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1391 | "users@example.com", "/example", \ |
1392 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1180 | "00000001", 0); | 1393 | "00000001", 0); |
1181 | r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ | 1394 | r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ |
1182 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1395 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1183 | "nonce=\"32141232413abcde\", " \ | 1396 | "nonce=\"32141232413abcde\", " \ |
1184 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1397 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1185 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1398 | "uri=\"/example\", qop=auth, nc=00000001, " \ |
1399 | "cnonce=\"0a4f113b\", " \ | ||
1186 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1400 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1187 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ | 1401 | "opaque=\"sadfljk32sdaf\"", "32141232413abcde", |
1402 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1188 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1403 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1189 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1404 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1190 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1405 | "users@example.com", "/example", \ |
1406 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1191 | "00000001", 0); | 1407 | "00000001", 0); |
1192 | r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ | 1408 | r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ |
1193 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1409 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1194 | "nonce=\"32141232413abcde\", " \ | 1410 | "nonce=\"32141232413abcde\", " \ |
1195 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1411 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1196 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1412 | "uri=\"/example\", qop=auth, nc=00000001, " |
1413 | "cnonce=\"0a4f113b\", " \ | ||
1197 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1414 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1198 | "opaque=\"sadfljk32sdaf\",,,,,", "32141232413abcde", \ | 1415 | "opaque=\"sadfljk32sdaf\",,,,,", "32141232413abcde", \ |
1199 | "SHA-256", \ | 1416 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ |
1200 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1417 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1201 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1418 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1202 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1419 | "users@example.com", "/example", \ |
1420 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1203 | "00000001", 0); | 1421 | "00000001", 0); |
1204 | r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ | 1422 | r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ |
1205 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1423 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1206 | "nonce=\"32141232413abcde\", " \ | 1424 | "nonce=\"32141232413abcde\", " \ |
1207 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1425 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1208 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1426 | "uri=\"/example\", qop=auth, nc=00000001, " \ |
1427 | "cnonce=\"0a4f113b\", " \ | ||
1209 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1428 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1210 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ | 1429 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ |
1211 | "SHA-256", \ | 1430 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ |
1212 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1431 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1213 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1432 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1214 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1433 | "users@example.com", "/example", \ |
1434 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1215 | "00000001", 0); | 1435 | "00000001", 0); |
1216 | r += expect_digest ("Digest abc=\"zyx\", username=\"test@example.com\", " \ | 1436 | r += expect_digest ("Digest abc=\"zyx\", username=\"test@example.com\", " \ |
1217 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1437 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1218 | "nonce=\"32141232413abcde\", " \ | 1438 | "nonce=\"32141232413abcde\", " \ |
1219 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1439 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1220 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1440 | "uri=\"/example\", qop=auth, nc=00000001, " |
1441 | "cnonce=\"0a4f113b\", " \ | ||
1221 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1442 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1222 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ | 1443 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ |
1223 | "SHA-256", \ | 1444 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ |
1224 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1445 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1225 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1446 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1226 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1447 | "users@example.com", "/example", \ |
1448 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1227 | "00000001", 0); | 1449 | "00000001", 0); |
1228 | r += expect_digest ("Digest abc=\"zyx, abc\", " \ | 1450 | r += expect_digest ("Digest abc=\"zyx, abc\", " \ |
1229 | "username=\"test@example.com\", " \ | 1451 | "username=\"test@example.com\", " \ |
1230 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1452 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1231 | "nonce=\"32141232413abcde\", " \ | 1453 | "nonce=\"32141232413abcde\", " \ |
1232 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1454 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1233 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1455 | "uri=\"/example\", qop=auth, nc=00000001, " |
1456 | "cnonce=\"0a4f113b\", " \ | ||
1234 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1457 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1235 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ | 1458 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ |
1236 | "SHA-256", \ | 1459 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ |
1237 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1460 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1238 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1461 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1239 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1462 | "users@example.com", "/example", \ |
1463 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1240 | "00000001", 0); | 1464 | "00000001", 0); |
1241 | r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \ | 1465 | r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \ |
1242 | "username=\"test@example.com\", " \ | 1466 | "username=\"test@example.com\", " \ |
1243 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1467 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1244 | "nonce=\"32141232413abcde\", " \ | 1468 | "nonce=\"32141232413abcde\", " \ |
1245 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1469 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1246 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1470 | "uri=\"/example\", qop=auth, nc=00000001, " \ |
1471 | "cnonce=\"0a4f113b\", " \ | ||
1247 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1472 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1248 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ | 1473 | "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ |
1249 | "SHA-256", \ | 1474 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ |
1250 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1475 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1251 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1476 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1252 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1477 | "users@example.com", "/example", \ |
1478 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1253 | "00000001", 0); | 1479 | "00000001", 0); |
1254 | r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \ | 1480 | r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \ |
1255 | "username=\"test@example.com\", " \ | 1481 | "username=\"test@example.com\", " \ |
1256 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1482 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1257 | "nonce=\"32141232413abcde\", " \ | 1483 | "nonce=\"32141232413abcde\", " \ |
1258 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1484 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1259 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1485 | "uri=\"/example\", qop=auth, nc=00000001, " \ |
1486 | "cnonce=\"0a4f113b\", " \ | ||
1260 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1487 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1261 | "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \ | 1488 | "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \ |
1262 | "32141232413abcde", "SHA-256", \ | 1489 | "32141232413abcde", \ |
1490 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1263 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1491 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1264 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1492 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1265 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1493 | "users@example.com", "/example", \ |
1494 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1266 | "00000001", 0); | 1495 | "00000001", 0); |
1267 | r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \ | 1496 | r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \ |
1268 | "username=\"test@example.com\", " \ | 1497 | "username=\"test@example.com\", " \ |
@@ -1272,23 +1501,28 @@ check_digest (void) | |||
1272 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1501 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ |
1273 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1502 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1274 | "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \ | 1503 | "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \ |
1275 | "32141232413abcde", "SHA-256", \ | 1504 | "32141232413abcde", |
1505 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1276 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1506 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1277 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1507 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1278 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1508 | "users@example.com", "/example", \ |
1509 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1279 | "00000001", 0); | 1510 | "00000001", 0); |
1280 | r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \ | 1511 | r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \ |
1281 | "username=\"test@example.com\", " \ | 1512 | "username=\"test@example.com\", " \ |
1282 | "realm=\"users@example.com\", algorithm=SHA-256, " \ | 1513 | "realm=\"users@example.com\", algorithm=SHA-256, " \ |
1283 | "nonce=\"32141232413abcde\", " \ | 1514 | "nonce=\"32141232413abcde\", " \ |
1284 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ | 1515 | "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ |
1285 | "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ | 1516 | "uri=\"/example\", qop=auth, nc=00000001, " |
1517 | "cnonce=\"0a4f113b\", " \ | ||
1286 | "response=\"6629fae49393a05397450978507c4ef1\", " \ | 1518 | "response=\"6629fae49393a05397450978507c4ef1\", " \ |
1287 | "opaque=\"sadfljk32sdaf\", foo=\",nc=02\"", | 1519 | "opaque=\"sadfljk32sdaf\", foo=\",nc=02\"", |
1288 | "32141232413abcde", "SHA-256", \ | 1520 | "32141232413abcde", \ |
1521 | MHD_DIGEST_AUTH_ALGO3_SHA256, \ | ||
1289 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ | 1522 | "6629fae49393a05397450978507c4ef1", "test@example.com", \ |
1290 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ | 1523 | "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ |
1291 | "users@example.com", "/example", "auth", "0a4f113b", \ | 1524 | "users@example.com", "/example", \ |
1525 | "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \ | ||
1292 | "00000001", 0); | 1526 | "00000001", 0); |
1293 | 1527 | ||
1294 | return r; | 1528 | return r; |
diff --git a/src/testcurl/test_digestauth2.c b/src/testcurl/test_digestauth2.c index 800d57b2..e3c12d85 100644 --- a/src/testcurl/test_digestauth2.c +++ b/src/testcurl/test_digestauth2.c | |||
@@ -548,12 +548,12 @@ ahc_echo (void *cls, | |||
548 | else if (NULL != dinfo->userhash_bin) | 548 | else if (NULL != dinfo->userhash_bin) |
549 | mhdErrorExitDesc ("'userhash_bin' is NOT NULL"); | 549 | mhdErrorExitDesc ("'userhash_bin' is NOT NULL"); |
550 | } | 550 | } |
551 | if (algo3 != dinfo->algo) | 551 | if (algo3 != dinfo->algo3) |
552 | { | 552 | { |
553 | fprintf (stderr, "Unexpected 'algo'.\n" | 553 | fprintf (stderr, "Unexpected 'algo'.\n" |
554 | "Expected: %d\tRecieved: %d. ", | 554 | "Expected: %d\tRecieved: %d. ", |
555 | (int) algo3, | 555 | (int) algo3, |
556 | (int) dinfo->algo); | 556 | (int) dinfo->algo3); |
557 | mhdErrorExitDesc ("Wrong 'algo'"); | 557 | mhdErrorExitDesc ("Wrong 'algo'"); |
558 | } | 558 | } |
559 | if (! test_rfc2069) | 559 | if (! test_rfc2069) |
diff --git a/src/testcurl/test_digestauth_emu_ext.c b/src/testcurl/test_digestauth_emu_ext.c index 468279ca..fc4f4aaa 100644 --- a/src/testcurl/test_digestauth_emu_ext.c +++ b/src/testcurl/test_digestauth_emu_ext.c | |||
@@ -417,12 +417,12 @@ ahc_echo (void *cls, | |||
417 | } | 417 | } |
418 | else if (NULL != dinfo->userhash_bin) | 418 | else if (NULL != dinfo->userhash_bin) |
419 | mhdErrorExitDesc ("'userhash_bin' is NOT NULL"); | 419 | mhdErrorExitDesc ("'userhash_bin' is NOT NULL"); |
420 | else if (MHD_DIGEST_AUTH_ALGO3_MD5 != dinfo->algo) | 420 | else if (MHD_DIGEST_AUTH_ALGO3_MD5 != dinfo->algo3) |
421 | { | 421 | { |
422 | fprintf (stderr, "Unexpected 'algo'.\n" | 422 | fprintf (stderr, "Unexpected 'algo'.\n" |
423 | "Expected: %d\tRecieved: %d. ", | 423 | "Expected: %d\tRecieved: %d. ", |
424 | (int) MHD_DIGEST_AUTH_ALGO3_MD5, | 424 | (int) MHD_DIGEST_AUTH_ALGO3_MD5, |
425 | (int) dinfo->algo); | 425 | (int) dinfo->algo3); |
426 | mhdErrorExitDesc ("Wrong 'algo'"); | 426 | mhdErrorExitDesc ("Wrong 'algo'"); |
427 | } | 427 | } |
428 | else if (MHD_STATICSTR_LEN_ (CNONCE_EMU) != dinfo->cnonce_len) | 428 | else if (MHD_STATICSTR_LEN_ (CNONCE_EMU) != dinfo->cnonce_len) |
diff --git a/w32/common/libmicrohttpd-files.vcxproj b/w32/common/libmicrohttpd-files.vcxproj index 982227c0..1818f0df 100644 --- a/w32/common/libmicrohttpd-files.vcxproj +++ b/w32/common/libmicrohttpd-files.vcxproj | |||
@@ -52,6 +52,7 @@ | |||
52 | <ClInclude Include="$(MhdSrc)microhttpd\tsearch.h" /> | 52 | <ClInclude Include="$(MhdSrc)microhttpd\tsearch.h" /> |
53 | <ClInclude Include="$(MhdSrc)microhttpd\sysfdsetsize.h" /> | 53 | <ClInclude Include="$(MhdSrc)microhttpd\sysfdsetsize.h" /> |
54 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_str.h" /> | 54 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_str.h" /> |
55 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_str_types.h" /> | ||
55 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_threads.h" /> | 56 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_threads.h" /> |
56 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_locks.h" /> | 57 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_locks.h" /> |
57 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_send.h" /> | 58 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_send.h" /> |
diff --git a/w32/common/libmicrohttpd-filters.vcxproj b/w32/common/libmicrohttpd-filters.vcxproj index 7bc1fe3c..76c0c56e 100644 --- a/w32/common/libmicrohttpd-filters.vcxproj +++ b/w32/common/libmicrohttpd-filters.vcxproj | |||
@@ -100,6 +100,9 @@ | |||
100 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_str.h"> | 100 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_str.h"> |
101 | <Filter>Internal Headers</Filter> | 101 | <Filter>Internal Headers</Filter> |
102 | </ClInclude> | 102 | </ClInclude> |
103 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_str_types.h"> | ||
104 | <Filter>Internal Headers</Filter> | ||
105 | </ClInclude> | ||
103 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_threads.h"> | 106 | <ClInclude Include="$(MhdSrc)microhttpd\mhd_threads.h"> |
104 | <Filter>Internal Headers</Filter> | 107 | <Filter>Internal Headers</Filter> |
105 | </ClInclude> | 108 | </ClInclude> |