Pick up fix for CVE-2019-16884 in opencontainers/selinux
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
		
							
								
								
									
										18
									
								
								vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,11 +13,12 @@ import (
 | 
			
		||||
 | 
			
		||||
// Valid Label Options
 | 
			
		||||
var validOptions = map[string]bool{
 | 
			
		||||
	"disable": true,
 | 
			
		||||
	"type":    true,
 | 
			
		||||
	"user":    true,
 | 
			
		||||
	"role":    true,
 | 
			
		||||
	"level":   true,
 | 
			
		||||
	"disable":  true,
 | 
			
		||||
	"type":     true,
 | 
			
		||||
	"filetype": true,
 | 
			
		||||
	"user":     true,
 | 
			
		||||
	"role":     true,
 | 
			
		||||
	"level":    true,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var ErrIncompatibleLabel = fmt.Errorf("Bad SELinux option z and Z can not be used together")
 | 
			
		||||
@@ -51,13 +52,16 @@ func InitLabels(options []string) (plabel string, mlabel string, Err error) {
 | 
			
		||||
				return "", mountLabel, nil
 | 
			
		||||
			}
 | 
			
		||||
			if i := strings.Index(opt, ":"); i == -1 {
 | 
			
		||||
				return "", "", fmt.Errorf("Bad label option %q, valid options 'disable' or \n'user, role, level, type' followed by ':' and a value", opt)
 | 
			
		||||
				return "", "", fmt.Errorf("Bad label option %q, valid options 'disable' or \n'user, role, level, type, filetype' followed by ':' and a value", opt)
 | 
			
		||||
			}
 | 
			
		||||
			con := strings.SplitN(opt, ":", 2)
 | 
			
		||||
			if !validOptions[con[0]] {
 | 
			
		||||
				return "", "", fmt.Errorf("Bad label option %q, valid options 'disable, user, role, level, type'", con[0])
 | 
			
		||||
				return "", "", fmt.Errorf("Bad label option %q, valid options 'disable, user, role, level, type, filetype'", con[0])
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
			if con[0] == "filetype" {
 | 
			
		||||
				mcon["type"] = con[1]
 | 
			
		||||
			}
 | 
			
		||||
			pcon[con[0]] = con[1]
 | 
			
		||||
			if con[0] == "level" || con[0] == "user" {
 | 
			
		||||
				mcon[con[0]] = con[1]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user