CVE-2021-20277 ldb tests: ldb_match tests with extra spaces
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 5 Mar 2021 07:13:01 +0000 (20:13 +1300)
committerStefan Metzmacher <metze@samba.org>
Wed, 24 Mar 2021 12:05:32 +0000 (12:05 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14655

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/tests/ldb_match_test.c

index 3028aed072c678ca8226a13dd4c744eb791a7ec2..ba6ea56be158bc39296e7f66fdc929add5120a4a 100644 (file)
@@ -181,6 +181,8 @@ static void test_wildcard_match(void **state)
        size_t failed = 0;
        size_t i;
        struct wildcard_test tests[] = {
        size_t failed = 0;
        size_t i;
        struct wildcard_test tests[] = {
+               TEST_ENTRY("                     1  0", "1*0*", true, true),
+               TEST_ENTRY("                     1  0", "1 *0", true, true),
                TEST_ENTRY("The value.......end", "*end", true, true),
                TEST_ENTRY("The value.......end", "*fend", false, true),
                TEST_ENTRY("The value.......end", "*eel", false, true),
                TEST_ENTRY("The value.......end", "*end", true, true),
                TEST_ENTRY("The value.......end", "*fend", false, true),
                TEST_ENTRY("The value.......end", "*eel", false, true),
@@ -203,8 +205,12 @@ static void test_wildcard_match(void **state)
                TEST_ENTRY("1\n0\r0\t000.0.0.0.0", "1*0*0*0*0*0*0*0*0", true,
                           true),
                /*
                TEST_ENTRY("1\n0\r0\t000.0.0.0.0", "1*0*0*0*0*0*0*0*0", true,
                           true),
                /*
-                *  We allow NUL bytes in non-casefolding syntaxes.
+                *  We allow NUL bytes and redundant spaces in non-casefolding
+                *  syntaxes.
                 */
                 */
+               TEST_ENTRY("                  1  0", "*1  0", true, false),
+               TEST_ENTRY("                  1  0", "*1  0", true, false),
+               TEST_ENTRY("1    0", "*1 0", false, false),
                TEST_ENTRY("1\x00 x", "1*x", true, false),
                TEST_ENTRY("1\x00 x", "*x", true, false),
                TEST_ENTRY("1\x00 x", "*x*", true, false),
                TEST_ENTRY("1\x00 x", "1*x", true, false),
                TEST_ENTRY("1\x00 x", "*x", true, false),
                TEST_ENTRY("1\x00 x", "*x*", true, false),