"(expected e.g. %q or %q)",
path, xs[0], "0644", "01777")
}
- if perm > 07777 {
+ if perm < 0 || perm > 07777 {
return fmt.Errorf("%s: invalid permission %#o "+
"(expected e.g. %#o or %#o)",
path, perm, 0644, 01777)
},
fmt.Errorf("permissions-invalid-permission-int/permissions.yaml: invalid permission 066066 (expected e.g. 0644 or 01777)"),
},
+ {
+ "permissions-invalid-permission-negative",
+ map[string]*safcm.File{
+ "/": {
+ Path: "/",
+ Mode: fs.ModeDir | 0755,
+ Uid: -1,
+ Gid: -1,
+ },
+ "/etc": {
+ Path: "/etc",
+ Mode: fs.ModeDir | 0755,
+ Uid: -1,
+ Gid: -1,
+ },
+ "/etc/resolv.conf": {
+ Path: "/etc/resolv.conf",
+ Mode: 0644,
+ Uid: -1,
+ Gid: -1,
+ Data: []byte("nameserver ::1\n"),
+ },
+ },
+ fmt.Errorf("permissions-invalid-permission-negative/permissions.yaml: invalid permission -042 (expected e.g. 0644 or 01777)"),
+ },
}
for _, tc := range tests {