go.mod: github.com/opencontainers/runc v1.1.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
		
							
								
								
									
										21
									
								
								vendor/github.com/opencontainers/runc/libcontainer/user/user.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/opencontainers/runc/libcontainer/user/user.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -120,7 +120,7 @@ func ParsePasswdFileFilter(path string, filter func(User) bool) ([]User, error)
 | 
			
		||||
 | 
			
		||||
func ParsePasswdFilter(r io.Reader, filter func(User) bool) ([]User, error) {
 | 
			
		||||
	if r == nil {
 | 
			
		||||
		return nil, fmt.Errorf("nil source for passwd-formatted data")
 | 
			
		||||
		return nil, errors.New("nil source for passwd-formatted data")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var (
 | 
			
		||||
@@ -178,7 +178,7 @@ func ParseGroupFileFilter(path string, filter func(Group) bool) ([]Group, error)
 | 
			
		||||
 | 
			
		||||
func ParseGroupFilter(r io.Reader, filter func(Group) bool) ([]Group, error) {
 | 
			
		||||
	if r == nil {
 | 
			
		||||
		return nil, fmt.Errorf("nil source for group-formatted data")
 | 
			
		||||
		return nil, errors.New("nil source for group-formatted data")
 | 
			
		||||
	}
 | 
			
		||||
	rd := bufio.NewReader(r)
 | 
			
		||||
	out := []Group{}
 | 
			
		||||
@@ -339,7 +339,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) (
 | 
			
		||||
		if userArg == "" {
 | 
			
		||||
			userArg = strconv.Itoa(user.Uid)
 | 
			
		||||
		}
 | 
			
		||||
		return nil, fmt.Errorf("unable to find user %s: %v", userArg, err)
 | 
			
		||||
		return nil, fmt.Errorf("unable to find user %s: %w", userArg, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var matchedUserName string
 | 
			
		||||
@@ -355,7 +355,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) (
 | 
			
		||||
 | 
			
		||||
		if uidErr != nil {
 | 
			
		||||
			// Not numeric.
 | 
			
		||||
			return nil, fmt.Errorf("unable to find user %s: %v", userArg, ErrNoPasswdEntries)
 | 
			
		||||
			return nil, fmt.Errorf("unable to find user %s: %w", userArg, ErrNoPasswdEntries)
 | 
			
		||||
		}
 | 
			
		||||
		user.Uid = uidArg
 | 
			
		||||
 | 
			
		||||
@@ -390,7 +390,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) (
 | 
			
		||||
			return g.Name == groupArg
 | 
			
		||||
		})
 | 
			
		||||
		if err != nil && group != nil {
 | 
			
		||||
			return nil, fmt.Errorf("unable to find groups for spec %v: %v", matchedUserName, err)
 | 
			
		||||
			return nil, fmt.Errorf("unable to find groups for spec %v: %w", matchedUserName, err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Only start modifying user.Gid if it is in explicit form.
 | 
			
		||||
@@ -404,7 +404,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) (
 | 
			
		||||
 | 
			
		||||
				if gidErr != nil {
 | 
			
		||||
					// Not numeric.
 | 
			
		||||
					return nil, fmt.Errorf("unable to find group %s: %v", groupArg, ErrNoGroupEntries)
 | 
			
		||||
					return nil, fmt.Errorf("unable to find group %s: %w", groupArg, ErrNoGroupEntries)
 | 
			
		||||
				}
 | 
			
		||||
				user.Gid = gidArg
 | 
			
		||||
 | 
			
		||||
@@ -445,7 +445,7 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err
 | 
			
		||||
			return false
 | 
			
		||||
		})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, fmt.Errorf("Unable to find additional groups %v: %v", additionalGroups, err)
 | 
			
		||||
			return nil, fmt.Errorf("Unable to find additional groups %v: %w", additionalGroups, err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -468,7 +468,8 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err
 | 
			
		||||
		if !found {
 | 
			
		||||
			gid, err := strconv.ParseInt(ag, 10, 64)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, fmt.Errorf("Unable to find group %s", ag)
 | 
			
		||||
				// Not a numeric ID either.
 | 
			
		||||
				return nil, fmt.Errorf("Unable to find group %s: %w", ag, ErrNoGroupEntries)
 | 
			
		||||
			}
 | 
			
		||||
			// Ensure gid is inside gid range.
 | 
			
		||||
			if gid < minID || gid > maxID {
 | 
			
		||||
@@ -521,7 +522,7 @@ func ParseSubIDFileFilter(path string, filter func(SubID) bool) ([]SubID, error)
 | 
			
		||||
 | 
			
		||||
func ParseSubIDFilter(r io.Reader, filter func(SubID) bool) ([]SubID, error) {
 | 
			
		||||
	if r == nil {
 | 
			
		||||
		return nil, fmt.Errorf("nil source for subid-formatted data")
 | 
			
		||||
		return nil, errors.New("nil source for subid-formatted data")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var (
 | 
			
		||||
@@ -574,7 +575,7 @@ func ParseIDMapFileFilter(path string, filter func(IDMap) bool) ([]IDMap, error)
 | 
			
		||||
 | 
			
		||||
func ParseIDMapFilter(r io.Reader, filter func(IDMap) bool) ([]IDMap, error) {
 | 
			
		||||
	if r == nil {
 | 
			
		||||
		return nil, fmt.Errorf("nil source for idmap-formatted data")
 | 
			
		||||
		return nil, errors.New("nil source for idmap-formatted data")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var (
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user