mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
fix (plg_backend_nfs): edge case for groups size limit
This commit is contained in:
parent
861fe2ad4a
commit
1cfa0bb919
1 changed files with 12 additions and 1 deletions
|
|
@ -102,7 +102,15 @@ func extractFromEtcGroup(username string, primary uint32) []uint32 {
|
|||
s := strings.Split(string(line), ":")
|
||||
if len(s) != 4 {
|
||||
continue
|
||||
} else if username != s[3] {
|
||||
}
|
||||
userInGroup := false
|
||||
for _, user := range strings.Split(s[3], ",") {
|
||||
if user == username {
|
||||
userInGroup = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if userInGroup == false {
|
||||
continue
|
||||
}
|
||||
if gid, err := strconv.Atoi(s[2]); err == nil {
|
||||
|
|
@ -111,6 +119,9 @@ func extractFromEtcGroup(username string, primary uint32) []uint32 {
|
|||
gids = append(gids, ugid)
|
||||
}
|
||||
}
|
||||
if len(gids) > 16 { // limit of NFS in AUTH_UNIX
|
||||
gids = gids[len(gids)-16 : len(gids)]
|
||||
}
|
||||
cacheForGroup.Set(map[string]string{"username": username}, gids)
|
||||
}
|
||||
return gids
|
||||
|
|
|
|||
Loading…
Reference in a new issue