Use id command for user lookup on MacOS (#384)

When building client without CGO, user.Lookup
attempts to get user from /etc/passwd
Which doesn't have the user as MacOS uses
opendirectoryd as user directory
This commit is contained in:
Maycon Santos
2022-07-07 16:13:46 +02:00
committed by GitHub
parent 7e1b20da5d
commit ff729f6755
3 changed files with 58 additions and 1 deletions

10
client/ssh/lookup.go Normal file
View File

@ -0,0 +1,10 @@
//go:build !darwin
// +build !darwin
package ssh
import "os/user"
func userNameLookup(username string) (*user.User, error) {
return user.Lookup(username)
}