fusefrontend: Handle PlaintextNames mode in Unlink
In PlaintextNames mode the "gocryptfs.longname." prefix does not have any special meaning. We should not attempt to delete any .name files. Partially fixes https://github.com/rfjakob/gocryptfs/issues/174
This commit is contained in:
parent
eba49402e4
commit
2591900b69
@ -388,7 +388,7 @@ func (fs *FS) Unlink(path string, context *fuse.Context) (code fuse.Status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cName := filepath.Base(cPath)
|
cName := filepath.Base(cPath)
|
||||||
if nametransform.IsLongContent(cName) {
|
if !fs.args.PlaintextNames && nametransform.IsLongContent(cName) {
|
||||||
var dirfd *os.File
|
var dirfd *os.File
|
||||||
dirfd, err = os.Open(filepath.Dir(cPath))
|
dirfd, err = os.Open(filepath.Dir(cPath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -794,4 +794,21 @@ func TestMkfifo(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = os.Remove(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the Symlink call works with paths starting with "gocryptfs.longname."
|
||||||
|
func TestSymlink(t *testing.T) {
|
||||||
|
path := test_helpers.DefaultPlainDir + "/gocryptfs.longname.XXX"
|
||||||
|
err := syscall.Symlink("target", path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
err = os.Remove(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user