Debian Codegraph @

passwd/passwd.go

raw symbols SCIP
1 // +build !windows
2
3 package passwd
4
5 import "strconv"
6
7 // Parse a UID string. The string should either be a username or a decimal user
8 // ID. Returns the user ID or an error.
9 func ParseUID(uid string) (int, error) {
10 n, err := strconv.ParseUint(uid, 10, 31)
11 if err != nil {
12 return parseUserName(uid)
13 }
14 return int(n), nil
15 }
16
17 // Parse a GID string. The string should either be a group name or a decimal group
18 // ID. Returns the group ID or an error.
19 func ParseGID(gid string) (int, error) {
20 n, err := strconv.ParseUint(gid, 10, 31)
21 if err != nil {
22 return parseGroupName(gid)
23 }
24 return int(n), nil
25 }
26
27 // Given a UID string (a username or decimal user ID string), find the primary
28 // GID for the given UID and return it.
29 func GetGIDForUID(uid string) (int, error) {
30 return getGIDForUID(uid)
31 }
32
33 // Given a group ID, returns an array of the supplementary group IDs that group
34 // implies.
35 func GetExtraGIDs(gid int) (gids []int, err error) {
36 return getExtraGIDs(gid)
37 }