commit 56c4b4ae9caaab7cb64954154cc9996fde4e92c8
parent 7f4634ccdd897c109e5c5ee4abc76b5e1c6d8d2f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 5 Jun 2022 14:28:21 +0300
test_auth_parse: added more checks with unclose quotation for digest auth
Diffstat:
1 file changed, 66 insertions(+), 0 deletions(-)
diff --git a/src/microhttpd/test_auth_parse.c b/src/microhttpd/test_auth_parse.c
@@ -611,6 +611,72 @@ check_type (void)
r += expect_result_type (1, "Digest foo=bar,=", EXPECT_TYPE_FOR_DIGEST_INVLD);
r += expect_result_type (1, "Digest foo=bar, =", \
EXPECT_TYPE_FOR_DIGEST_INVLD);
+ /* Unclosed quotation */
+ r += expect_result_type (1, "Digest nc=\"", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\"abc", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\" ", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\"abc ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\" abc", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\" abc", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\"\\", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\"\\\"", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\" \\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\"\\\" ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\" \\\" ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc=\"\\\"\\\"\\\"\\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"abc", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \" ", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"abc ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \" abc", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \" abc", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"\\", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"\\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \" \\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"\\\" ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \" \\\" ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest nc= \"\\\"\\\"\\\"\\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\"", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\"bar", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\" ", EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\"bar ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\" bar", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\" bar", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo= \" bar", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\", bar", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\" bar,", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\"\\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\" \\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\"\\\" ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\" \\\" ", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
+ r += expect_result_type (1, "Digest foo=\"\\\"\\\"\\\"\\\"", \
+ EXPECT_TYPE_FOR_DIGEST_INVLD);
/* Full set of parameters with semicolon inside */
r += expect_result_type (1, "Digest username=\"test@example.com\", " \
"realm=\"users@example.com\", nonce=\"32141232413abcde\", " \