aboutsummaryrefslogtreecommitdiff
path: root/internal/nametransform/names_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-12-19 14:43:56 +0100
committerJakob Unterwurzacher2021-12-19 14:43:56 +0100
commit64be5de75f42e415198ff5e77de509680b69e0e1 (patch)
tree8897db6d0de0a4c11921bba72de621e30f0ce501 /internal/nametransform/names_test.go
parenteb42e541828336e9b19e1bc5e087a419835b0c85 (diff)
fusefrontend: allow slashes in xattr names
xattr names have fewer restrictions than file names, relax the validation. Fixes https://github.com/rfjakob/gocryptfs/issues/627
Diffstat (limited to 'internal/nametransform/names_test.go')
-rw-r--r--internal/nametransform/names_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/nametransform/names_test.go b/internal/nametransform/names_test.go
index b4e98d4..3c26c43 100644
--- a/internal/nametransform/names_test.go
+++ b/internal/nametransform/names_test.go
@@ -75,3 +75,26 @@ func TestIsValidName(t *testing.T) {
}
}
}
+
+func TestIsValidXattrName(t *testing.T) {
+ cases := []struct {
+ in string
+ want bool
+ }{
+ {"", false},
+ {".", true},
+ {"..", true},
+ {"...", true},
+ {"asdasd/asdasd", true},
+ {"asdasd\000asdasd", false},
+ {"hello", true},
+ {strings.Repeat("x", 255), true},
+ {strings.Repeat("x", 256), true},
+ }
+ for _, c := range cases {
+ have := isValidXattrName(c.in)
+ if (have == nil) != c.want {
+ t.Errorf("isValidXattrName(%q): want %v have %v", c.in, c.want, have)
+ }
+ }
+}