From: Jeremy Allison Date: Tue, 21 Apr 2020 18:49:44 +0000 (-0700) Subject: s3: torture: Add the tests from resolve_realpath_name() to canonicalize_absolute_path(). X-Git-Tag: ldb-2.2.0~896 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cea0cc5b5f37e8ec612ce3a33705ffb4670a070;p=thirdparty%2Fsamba.git s3: torture: Add the tests from resolve_realpath_name() to canonicalize_absolute_path(). canonicalize_absolute_path() has a bug. In canonicalize_absolute_path() ///a/./././///component/../////path/ -> /a//path It should go to /a/path. Mark as knownfail. Adding these tests so I can ultimately remove resolve_realpath_name() and re-use the existing canonicalize_absolute_path() code in vfs_widelinks.c Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/selftest/knownfail.d/local_canonicalize_path b/selftest/knownfail.d/local_canonicalize_path new file mode 100644 index 00000000000..477c60a68eb --- /dev/null +++ b/selftest/knownfail.d/local_canonicalize_path @@ -0,0 +1,2 @@ +samba3.smbtorture_s3.LOCAL-CANONICALIZE-PATH + diff --git a/source3/torture/torture.c b/source3/torture/torture.c index c3f387cd0e2..aa02163636e 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -14066,6 +14066,25 @@ static bool run_local_canonicalize_path(int dummy) ".././././", ".././././../../../boo", "./..", + "/", + "/../../", + "/foo/../", + "/./././", + "/./././.", + "/.../././.", + "/./././.foo", + "/./././.foo.", + "/./././foo.", + "/foo/bar/..", + "/foo/bar/../baz/", + "////////////////", + "/////////./././././.", + "/./.././../.boo/../baz", + "/a/component/path", + "/a/component/path/", + "/a/component/path/..", + "/a/component/../path/", + "///a/./././///component/../////path/", NULL }; const char *dst[] = { @@ -14077,6 +14096,25 @@ static bool run_local_canonicalize_path(int dummy) "/", "/boo", "/", + "/", + "/", + "/", + "/", + "/", + "/...", + "/.foo", + "/.foo.", + "/foo.", + "/foo", + "/foo/baz", + "/", + "/", + "/baz", + "/a/component/path", + "/a/component/path", + "/a/component", + "/a/path", + "/a/path", NULL }; unsigned int i;