mirror of
https://github.com/hashicorp/vault.git
synced 2025-12-01 07:31:32 +01:00
Fix ssh tests
This commit is contained in:
parent
47771e7da3
commit
fb2f7f27ba
@ -173,6 +173,7 @@ func (b *backend) pathRoleWrite(req *logical.Request, d *framework.FieldData) (*
|
|||||||
|
|
||||||
// Validate the CIDR blocks
|
// Validate the CIDR blocks
|
||||||
cidrList := d.Get("cidr_list").(string)
|
cidrList := d.Get("cidr_list").(string)
|
||||||
|
if cidrList != "" {
|
||||||
valid, err := cidrutil.ValidateCIDRListString(cidrList, ",")
|
valid, err := cidrutil.ValidateCIDRListString(cidrList, ",")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to validate cidr_list: %v", err)
|
return nil, fmt.Errorf("failed to validate cidr_list: %v", err)
|
||||||
@ -180,16 +181,19 @@ func (b *backend) pathRoleWrite(req *logical.Request, d *framework.FieldData) (*
|
|||||||
if !valid {
|
if !valid {
|
||||||
return logical.ErrorResponse("failed to validate cidr_list"), nil
|
return logical.ErrorResponse("failed to validate cidr_list"), nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Validate the excluded CIDR blocks
|
// Validate the excluded CIDR blocks
|
||||||
excludeCidrList := d.Get("exclude_cidr_list").(string)
|
excludeCidrList := d.Get("exclude_cidr_list").(string)
|
||||||
valid, err = cidrutil.ValidateCIDRListString(excludeCidrList, ",")
|
if excludeCidrList != "" {
|
||||||
|
valid, err := cidrutil.ValidateCIDRListString(excludeCidrList, ",")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to validate exclude_cidr_list entry: %v", err)
|
return nil, fmt.Errorf("failed to validate exclude_cidr_list entry: %v", err)
|
||||||
}
|
}
|
||||||
if !valid {
|
if !valid {
|
||||||
return logical.ErrorResponse(fmt.Sprintf("failed to validate exclude_cidr_list entry: %v", err)), nil
|
return logical.ErrorResponse(fmt.Sprintf("failed to validate exclude_cidr_list entry: %v", err)), nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
port := d.Get("port").(int)
|
port := d.Get("port").(int)
|
||||||
if port == 0 {
|
if port == 0 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user