diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-03-13 18:46:01 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-13 18:46:01 +0000 |
commit | 29f519b376d850ea2f9b161bb616e6bc80cbfc96 (patch) | |
tree | b31f19cf51c752a8c865bf99bb30d7e8432db07d /pkg/sentry/vfs/vfs.go | |
parent | eb4ab4f2f9fe701281d06058ff87690b1b673c25 (diff) | |
parent | 2e38408f20a084de716962d4631e0fec1fd16c16 (diff) |
Merge release-20200219.0-164-g2e38408 (automated)
Diffstat (limited to 'pkg/sentry/vfs/vfs.go')
-rwxr-xr-x | pkg/sentry/vfs/vfs.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/vfs.go b/pkg/sentry/vfs/vfs.go index 365e8b30d..2e2880171 100755 --- a/pkg/sentry/vfs/vfs.go +++ b/pkg/sentry/vfs/vfs.go @@ -174,6 +174,23 @@ type PathOperation struct { FollowFinalSymlink bool } +// AccessAt checks whether a user with creds has access to the file at +// the given path. +func (vfs *VirtualFilesystem) AccessAt(ctx context.Context, creds *auth.Credentials, ats AccessTypes, pop *PathOperation) error { + rp := vfs.getResolvingPath(creds, pop) + for { + err := rp.mount.fs.impl.AccessAt(ctx, rp, creds, ats) + if err == nil { + vfs.putResolvingPath(rp) + return nil + } + if !rp.handleError(err) { + vfs.putResolvingPath(rp) + return err + } + } +} + // GetDentryAt returns a VirtualDentry representing the given path, at which a // file must exist. A reference is taken on the returned VirtualDentry. func (vfs *VirtualFilesystem) GetDentryAt(ctx context.Context, creds *auth.Credentials, pop *PathOperation, opts *GetDentryOptions) (VirtualDentry, error) { |