aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/asuser_freebsd.go
blob: 4d349be36c39d1dd5d348de1f1545ce34f720d17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package syscallcompat

import (
	"golang.org/x/sys/unix"

	"github.com/hanwen/go-fuse/v3/fuse"

	"github.com/rfjakob/gocryptfs/v2/internal/tlog"
)

// asUser runs `f()` under the effective uid, gid, groups specified
// in `context`.
//
// If `context` is nil, `f()` is executed directly without switching user id.
//
// FreeBSD does not support changing uid/gid per thread. If context is not nil,
// an error is returned.
func asUser(f func() (int, error), context *fuse.Caller) (int, error) {
	if context == nil {
		return f()
	}
	tlog.Warn.Printf("asUser: error, only nil context is supported\n")
	return 0, unix.EOPNOTSUPP
}