s3: lib: Fix canonicalize_absolute_path() to pass the tests from resolve_realpath_name()
authorJeremy Allison <jra@samba.org>
Tue, 21 Apr 2020 19:58:02 +0000 (12:58 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 22 Apr 2020 08:15:35 +0000 (08:15 +0000)
Remove the knownfail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
selftest/knownfail.d/local_canonicalize_path [deleted file]
source3/lib/util_path.c

diff --git a/selftest/knownfail.d/local_canonicalize_path b/selftest/knownfail.d/local_canonicalize_path
deleted file mode 100644 (file)
index 477c60a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-samba3.smbtorture_s3.LOCAL-CANONICALIZE-PATH
-
index 63d01b81000550c0bc9c38d5c55522c593ae4e6a..fed0cc34d1c3c648f397eb8b0a39e2ebba43a162 100644 (file)
@@ -130,7 +130,13 @@ char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path)
                                s++;
                        }
                        if ((d > destname + 1) && (*s != '\0')) {
-                               *d++ = '/';
+                               if (!start_of_name_component) {
+                                       /*
+                                        * Only write a / if we
+                                        * haven't just written one.
+                                        */
+                                       *d++ = '/';
+                               }
                        }
                        start_of_name_component = true;
                        continue;
@@ -178,6 +184,12 @@ char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path)
                                        continue;
                                }
 
+                               /*
+                                * Step forward one to leave the
+                                * last written '/' alone.
+                                */
+                               d++;
+
                                /*
                                 * We're still at the start of a name
                                 * component, just the previous one.