Skip to content

Commit 99e9b6b

Browse files
fix: allow nested FirewallAlias entries for host and network type
Before we were only allowing nested aliases if the type matched which isn't necessary.
1 parent e981d1b commit 99e9b6b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/FirewallAlias.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@ class FirewallAlias extends Model {
108108
}
109109

110110
# Ensure value is an IP, FQDN or alias when `type` is `host`
111-
$host_alias_q = $aliases->query(name: $address, type: 'host');
111+
$host_alias_q = $aliases->query(name: $address, type__except: 'port');
112112
if ($type === 'host' and !is_ipaddr($address) and !is_fqdn($address) and !$host_alias_q->exists()) {
113113
throw new ValidationError(
114114
message: "Host alias 'address' value '$address' is not a valid IP, FQDN, or alias.",
115115
response_id: 'INVALID_HOST_ALIAS_ADDRESS',
116116
);
117117
}
118118

119-
# Ensure value is a CIDR, FQDN or alias when `type` is `network`
120-
$network_alias_q = $aliases->query(name: $address, type: 'network');
119+
# Ensure value is a CIDR, FQDN or non-port alias when `type` is `network`
120+
$network_alias_q = $aliases->query(name: $address, type__except: 'port');
121121
if ($type === 'network' and !is_subnet($address) and !is_fqdn($address) and !$network_alias_q->exists()) {
122122
throw new ValidationError(
123123
message: "Network alias 'address' value '$address' is not a valid CIDR, FQDN, or alias.",

0 commit comments

Comments
 (0)