user: *: fix function signatures
This patch changes the incorrectly named functions GetPasswdFile, GetGroupFile, GetExecUserFile and several internal components to GetPasswdPath, GetGroupPath, etc -- as these are far more appropriate names and more clearly convey to users what the arguments represent. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
This commit is contained in:
parent
42fed751fb
commit
b322073f27
|
@ -9,22 +9,22 @@ import (
|
||||||
|
|
||||||
// Unix-specific path to the passwd and group formatted files.
|
// Unix-specific path to the passwd and group formatted files.
|
||||||
const (
|
const (
|
||||||
unixPasswdFile = "/etc/passwd"
|
unixPasswdPath = "/etc/passwd"
|
||||||
unixGroupFile = "/etc/group"
|
unixGroupPath = "/etc/group"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetPasswdFile() (string, error) {
|
func GetPasswdPath() (string, error) {
|
||||||
return unixPasswdFile, nil
|
return unixPasswdPath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPasswd() (io.ReadCloser, error) {
|
func GetPasswd() (io.ReadCloser, error) {
|
||||||
return os.Open(unixPasswdFile)
|
return os.Open(unixPasswdPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGroupFile() (string, error) {
|
func GetGroupPath() (string, error) {
|
||||||
return unixGroupFile, nil
|
return unixGroupPath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGroup() (io.ReadCloser, error) {
|
func GetGroup() (io.ReadCloser, error) {
|
||||||
return os.Open(unixGroupFile)
|
return os.Open(unixGroupPath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package user
|
||||||
|
|
||||||
import "io"
|
import "io"
|
||||||
|
|
||||||
func GetPasswdFile() (string, error) {
|
func GetPasswdPath() (string, error) {
|
||||||
return "", ErrUnsupported
|
return "", ErrUnsupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ func GetPasswd() (io.ReadCloser, error) {
|
||||||
return nil, ErrUnsupported
|
return nil, ErrUnsupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGroupFile() (string, error) {
|
func GetGroupPath() (string, error) {
|
||||||
return "", ErrUnsupported
|
return "", ErrUnsupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,11 +197,11 @@ type ExecUser struct {
|
||||||
Home string
|
Home string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetExecUserFile is a wrapper for GetExecUser. It reads data from each of the
|
// GetExecUserPath is a wrapper for GetExecUser. It reads data from each of the
|
||||||
// given file paths and uses that data as the arguments to GetExecUser. If the
|
// given file paths and uses that data as the arguments to GetExecUser. If the
|
||||||
// files cannot be opened for any reason, the error is ignored and a nil
|
// files cannot be opened for any reason, the error is ignored and a nil
|
||||||
// io.Reader is passed instead.
|
// io.Reader is passed instead.
|
||||||
func GetExecUserFile(userSpec string, defaults *ExecUser, passwdPath, groupPath string) (*ExecUser, error) {
|
func GetExecUserPath(userSpec string, defaults *ExecUser, passwdPath, groupPath string) (*ExecUser, error) {
|
||||||
passwd, err := os.Open(passwdPath)
|
passwd, err := os.Open(passwdPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
passwd = nil
|
passwd = nil
|
||||||
|
|
Loading…
Reference in New Issue