mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-02 03:54:59 +08:00
fix (plg_backend_nfs): support auxiliary gids
This commit is contained in:
@ -9,26 +9,28 @@ import (
|
||||
"github.com/vmware/go-nfs-client/nfs/xdr"
|
||||
)
|
||||
|
||||
// ref: https://datatracker.ietf.org/doc/html/rfc5531#section-8.2
|
||||
// so far we only have implemented AUTH_SYS but one day we might want to add support
|
||||
// for RPCSEC_GSS as detailed in https://datatracker.ietf.org/doc/html/rfc2203
|
||||
type AuthUnix struct {
|
||||
Stamp uint32
|
||||
Machinename string
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
GidLen uint32
|
||||
Gids []uint32
|
||||
}
|
||||
|
||||
func NewAuth(machineName string, uid, gid uint32) rpc.Auth {
|
||||
func NewUnixAuth(machineName string, uid, gid uint32, gids []uint32) rpc.Auth {
|
||||
w := new(bytes.Buffer)
|
||||
xdr.Write(w, AuthUnix{
|
||||
Stamp: rand.New(rand.NewSource(time.Now().UnixNano())).Uint32(),
|
||||
Machinename: machineName,
|
||||
Uid: uid,
|
||||
Gid: gid,
|
||||
GidLen: 1,
|
||||
Uid: 1000,
|
||||
Gid: 1000,
|
||||
Gids: gids,
|
||||
})
|
||||
return rpc.Auth{
|
||||
1,
|
||||
1, // = AUTH_SYS in RFC5531
|
||||
w.Bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user