]> Cypherpunks repositories - gostls13.git/commit
os/user: add non-cgo versions of Lookup, LookupId
authorKevin Burke <kev@inburke.com>
Wed, 1 Mar 2017 18:31:57 +0000 (10:31 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 4 Mar 2017 17:37:29 +0000 (17:37 +0000)
commitc2eb06193f70475650a85a0e279f865181c1cece
tree1e4590b4b2b55a7c7c4ea3146499371581825c11
parent4fc45ae8794eaa84505629e82997b90503c89aa2
os/user: add non-cgo versions of Lookup, LookupId

If you cross compile for a Unix target and call user.Lookup("root")
or user.LookupId("0"), we'll try to read the answer out of
/etc/passwd instead of returning an "unimplemented" error.

The equivalent cgo function calls getpwuid_r in glibc, which
may reach out to the NSS database or allow callers to register
extensions. The pure Go implementation only reads from /etc/passwd.

Change-Id: I56a302d634b15ba5097f9f0d6a758c68e486ba6d
Reviewed-on: https://go-review.googlesource.com/37664
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/os/user/lookup_stubs.go
src/os/user/lookup_unix.go
src/os/user/lookup_unix_test.go
src/os/user/user_test.go