Skip to content

Commit ea3870d

Browse files
fix: do not allow push_reset and remove_options to both be set
1 parent bf9ef30 commit ea3870d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class OpenVPNClientSpecificOverride extends Model {
152152
'remove_wins',
153153
],
154154
many: true,
155+
conditions: ['push_reset' => false],
155156
help_text: 'Specifies the push-remove options to apply to the client',
156157
);
157158
$this->dns_domain = new StringField(

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APIModelsOpenVPNClientSpecificOverrideTestCase.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class APIModelsOpenVPNClientSpecificOverrideTestCase extends TestCase {
8484
remote_network: ['10.1.2.0/24'],
8585
remote_networkv6: ['1234::/64'],
8686
gwredir: true,
87-
push_reset: true,
87+
push_reset: false,
8888
remove_options: ['remove_route'],
8989
dns_domain: 'example.com',
9090
dns_server1: '127.0.0.1',
@@ -105,7 +105,7 @@ class APIModelsOpenVPNClientSpecificOverrideTestCase extends TestCase {
105105
"/var/etc/openvpn/server{$this->ovpns->vpnid->value}/csc/{$cso->common_name->value}",
106106
);
107107
$this->assert_str_contains($cso_conf, 'disable'); // For `block` field
108-
$this->assert_str_contains($cso_conf, 'push-reset');
108+
$this->assert_str_does_not_contain($cso_conf, 'push-reset');
109109
$this->assert_str_contains($cso_conf, 'push-remove route');
110110
$this->assert_str_contains($cso_conf, 'push "route 10.1.2.0 255.255.255.0"');
111111
$this->assert_str_contains($cso_conf, 'push "route-ipv6 1234::/64"');
@@ -137,7 +137,7 @@ class APIModelsOpenVPNClientSpecificOverrideTestCase extends TestCase {
137137
remote_network: ['10.2.3.0/24'],
138138
remote_networkv6: ['4321::/64'],
139139
gwredir: false,
140-
push_reset: false,
140+
push_reset: true,
141141
remove_options: [],
142142
dns_domain: 'updated.example.com',
143143
dns_server1: '127.0.1.1',
@@ -158,7 +158,7 @@ class APIModelsOpenVPNClientSpecificOverrideTestCase extends TestCase {
158158
"/var/etc/openvpn/server{$this->ovpns->vpnid->value}/csc/{$cso->common_name->value}",
159159
);
160160
$this->assert_str_does_not_contain($cso_conf, 'disable'); // For `block` field
161-
$this->assert_str_does_not_contain($cso_conf, 'push-reset');
161+
$this->assert_str_contains($cso_conf, 'push-reset');
162162
$this->assert_str_does_not_contain($cso_conf, 'push-remove route');
163163
$this->assert_str_contains($cso_conf, 'push "route 10.2.3.0 255.255.255.0"');
164164
$this->assert_str_contains($cso_conf, 'push "route-ipv6 4321::/64"');

0 commit comments

Comments
 (0)