2014-08-29 16:43:40 +08:00
|
|
|
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
|
|
|
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Unix-specific path to the passwd and group formatted files.
|
|
|
|
const (
|
2015-01-27 20:54:19 +08:00
|
|
|
unixPasswdPath = "/etc/passwd"
|
|
|
|
unixGroupPath = "/etc/group"
|
2014-08-29 16:43:40 +08:00
|
|
|
)
|
|
|
|
|
2015-01-27 20:54:19 +08:00
|
|
|
func GetPasswdPath() (string, error) {
|
|
|
|
return unixPasswdPath, nil
|
2014-08-29 16:43:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetPasswd() (io.ReadCloser, error) {
|
2015-01-27 20:54:19 +08:00
|
|
|
return os.Open(unixPasswdPath)
|
2014-08-29 16:43:40 +08:00
|
|
|
}
|
|
|
|
|
2015-01-27 20:54:19 +08:00
|
|
|
func GetGroupPath() (string, error) {
|
|
|
|
return unixGroupPath, nil
|
2014-08-29 16:43:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetGroup() (io.ReadCloser, error) {
|
2015-01-27 20:54:19 +08:00
|
|
|
return os.Open(unixGroupPath)
|
2014-08-29 16:43:40 +08:00
|
|
|
}
|