Commit 7f93a496 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Forbid backslashes in group names.

We used to only forbid them under Windows.
parent 41076461
......@@ -420,10 +420,14 @@ func Add(name string, desc *Description) (*Group, error) {
}
func validGroupName(name string) bool {
if filepath.Separator != '/' &&
strings.ContainsRune(name, filepath.Separator) {
if strings.ContainsRune(name, '\\') {
return false
}
if s := filepath.Separator; s != '/' && s != '\\' {
if strings.ContainsRune(name, s) {
return false
}
}
s := path.Clean("/" + name)
if s == "/" {
......
......@@ -338,6 +338,7 @@ func TestValidGroupName(t *testing.T) {
{"foo/..", false},
{"foo/./bar", false},
{"foo/../bar", false},
{"foo\\bar", false},
{"foo", true},
{"foo/bar", true},
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment