moved length test to util, tests fine
This commit is contained in:
		
							parent
							
								
									b0780d3bf5
								
							
						
					
					
						commit
						f3d76cf35d
					
				| 
						 | 
				
			
			@ -280,7 +280,7 @@ func UpdateClient(db store.IStore) echo.HandlerFunc {
 | 
			
		|||
			return c.JSON(http.StatusBadRequest, jsonHTTPResponse{false, "Allowed IPs must be in CIDR format"})
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        if len(_client.ExtraAllowedIPs) > 0 && util.ValidateAllowedIPs(_client.ExtraAllowedIPs) == false {
 | 
			
		||||
        if util.ValidateAllowedIPs(_client.ExtraAllowedIPs) == false {
 | 
			
		||||
            log.Warnf("Invalid Allowed IPs input from user: %v", _client.ExtraAllowedIPs)
 | 
			
		||||
            return c.JSON(http.StatusBadRequest, jsonHTTPResponse{false, "Extra Allowed IPs must be in CIDR format"})
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,10 +78,12 @@ func ValidateCIDR(cidr string) bool {
 | 
			
		|||
// ValidateCIDRList to validate a list of network CIDR
 | 
			
		||||
func ValidateCIDRList(cidrs []string) bool {
 | 
			
		||||
	for _, cidr := range cidrs {
 | 
			
		||||
	    if len(cidr) > 0 {
 | 
			
		||||
            if ValidateCIDR(cidr) == false {
 | 
			
		||||
                return false
 | 
			
		||||
            }
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue