From 0805a63df1b5f915b228727f6074c2506922d0ad Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 20 Jan 2019 12:59:59 +0100 Subject: syscallcompat: drop Faccessat AT_SYMLINK_NOFOLLOW helper unix.Faccessat has added support for AT_SYMLINK_NOFOLLOW in July 2018, https://github.com/golang/sys/commit/bd9dbc187b6e1dacfdd2722a87e83093c2d7bd6e#diff-341484dbbe3180cd7a31ef2ad2d679b6 which means we no longer need our own helper. Closes https://github.com/rfjakob/gocryptfs/issues/347 --- internal/fusefrontend/fs.go | 2 +- internal/fusefrontend/openbackingdir_test.go | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'internal/fusefrontend') diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index 096e663..decd13f 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -626,7 +626,7 @@ func (fs *FS) Access(relPath string, mode uint32, context *fuse.Context) (code f if err != nil { return fuse.ToStatus(err) } - err = syscallcompat.Faccessat(dirfd, cName, mode) + err = unix.Faccessat(dirfd, cName, mode, unix.AT_SYMLINK_NOFOLLOW) syscall.Close(dirfd) return fuse.ToStatus(err) } diff --git a/internal/fusefrontend/openbackingdir_test.go b/internal/fusefrontend/openbackingdir_test.go index 82cc74d..9c2358e 100644 --- a/internal/fusefrontend/openbackingdir_test.go +++ b/internal/fusefrontend/openbackingdir_test.go @@ -7,7 +7,6 @@ import ( "golang.org/x/sys/unix" - "github.com/rfjakob/gocryptfs/internal/syscallcompat" "github.com/rfjakob/gocryptfs/tests/test_helpers" ) @@ -46,11 +45,11 @@ func TestOpenBackingDir(t *testing.T) { t.Fatal("cName should be .") } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } - err = syscallcompat.Faccessat(dirfd, ".", unix.R_OK) + err = unix.Faccessat(dirfd, ".", unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } @@ -63,7 +62,7 @@ func TestOpenBackingDir(t *testing.T) { if cName == "" { t.Fatal("cName should not be empty") } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } @@ -76,7 +75,7 @@ func TestOpenBackingDir(t *testing.T) { if cName == "" { t.Fatal("cName should not be empty") } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } @@ -95,7 +94,7 @@ func TestOpenBackingDir(t *testing.T) { if len(cName) >= 255 { t.Fatalf("cName is too long: %q", cName) } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } @@ -126,11 +125,11 @@ func TestOpenBackingDirPlaintextNames(t *testing.T) { if cName != "." { t.Fatal("cName should be .") } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } - err = syscallcompat.Faccessat(dirfd, ".", unix.R_OK) + err = unix.Faccessat(dirfd, ".", unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } @@ -143,7 +142,7 @@ func TestOpenBackingDirPlaintextNames(t *testing.T) { if cName != "dir1" { t.Fatalf("wrong cName: %q", cName) } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } @@ -156,7 +155,7 @@ func TestOpenBackingDirPlaintextNames(t *testing.T) { if cName != "dir2" { t.Fatalf("wrong cName: %q", cName) } - err = syscallcompat.Faccessat(dirfd, cName, unix.R_OK) + err = unix.Faccessat(dirfd, cName, unix.R_OK, unix.AT_SYMLINK_NOFOLLOW) if err != nil { t.Error(err) } -- cgit v1.2.3