Skip to content

Commit 3d74fe2

Browse files
committed
fix issues from MR 1053 review
1 parent 72fbc87 commit 3d74fe2

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

install/lib/installer_base.lib.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ public function configure_dovecot() {
14501450
if ($configure_lmtp) {
14511451
for ($i = 0; isset($new_options[$i]); $i++) {
14521452
if ($new_options[$i] == 'reject_unlisted_recipient') {
1453-
array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${config_dir}/mysql-verify_recipients.cf"));
1453+
array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${quoted_config_dir}/mysql-verify_recipients.cf"));
14541454
break;
14551455
}
14561456
}
@@ -1700,10 +1700,11 @@ public function configure_rspamd() {
17001700
if(! isset($mail_config['reject_sender_login_mismatch'])) {
17011701
$mail_config['reject_sender_login_mismatch'] = 'n';
17021702
}
1703-
$options = explode(",", exec("postconf -h smtpd_sender_restrictions"));
1703+
$options = preg_split("/,\s*/", exec("postconf -h smtpd_sender_restrictions"));
17041704
$new_options = array();
17051705
foreach ($options as $key => $value) {
1706-
if (($value = trim($value)) == '') continue;
1706+
$value = trim($value);
1707+
if ($value == '') continue;
17071708
if (preg_match('/tag_as_(originating|foreign)\.re/', $value)) {
17081709
continue;
17091710
}

server/plugins-available/postfix_server_plugin.inc.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ function update($event_name, $data) {
146146
$options = preg_split("/,\s*/", exec("postconf -h smtpd_sender_restrictions"));
147147
$new_options = array();
148148
foreach ($options as $key => $value) {
149-
if (($value = trim($value)) == '') continue;
149+
$value = trim($value);
150+
if ($value == '') continue;
150151
if (preg_match('/reject_(authenticated_)?sender_login_mismatch/', $value)) {
151152
continue;
152153
}
@@ -169,10 +170,11 @@ function update($event_name, $data) {
169170

170171
if ($mail_config['reject_unknown']) {
171172
if (($mail_config['reject_unknown'] === 'client') || ($mail_config['reject_unknown'] === 'client_helo')) {
172-
$options = explode(",", exec("postconf -h smtpd_client_restrictions"));
173+
$options = preg_split("/,\s*/", exec("postconf -h smtpd_client_restrictions"));
173174
$new_options = array();
174175
foreach ($options as $key => $value) {
175-
if (($value = trim($value)) == '') continue;
176+
$value = trim($value);
177+
if ($value == '') continue;
176178
if (preg_match('/reject_unknown(_client)?_hostname/', $value)) {
177179
continue;
178180
}
@@ -192,10 +194,11 @@ function update($event_name, $data) {
192194

193195
$app->system->exec_safe("postconf -e ?", 'smtpd_client_restrictions = '.implode(", ", $new_options));
194196
} else {
195-
$options = explode(",", exec("postconf -h smtpd_client_restrictions"));
197+
$options = preg_split("/,\s*/", exec("postconf -h smtpd_client_restrictions"));
196198
$new_options = array();
197199
foreach ($options as $key => $value) {
198-
if (($value = trim($value)) == '') continue;
200+
$value = trim($value);
201+
if ($value == '') continue;
199202
if (preg_match('/reject_unknown(_client)?_hostname/', $value)) {
200203
continue;
201204
}
@@ -205,10 +208,11 @@ function update($event_name, $data) {
205208
}
206209

207210
if (($mail_config['reject_unknown'] === 'helo') || ($mail_config['reject_unknown'] === 'client_helo')) {
208-
$options = explode(",", exec("postconf -h smtpd_helo_restrictions"));
211+
$options = preg_split("/,\s*/", exec("postconf -h smtpd_helo_restrictions"));
209212
$new_options = array();
210213
foreach ($options as $key => $value) {
211-
if (($value = trim($value)) == '') continue;
214+
$value = trim($value);
215+
if ($value == '') continue;
212216
if (preg_match('/reject_unknown(_helo)?_hostname/', $value)) {
213217
continue;
214218
}
@@ -228,10 +232,11 @@ function update($event_name, $data) {
228232

229233
$app->system->exec_safe("postconf -e ?", 'smtpd_helo_restrictions = '.implode(", ", $new_options));
230234
} else {
231-
$options = explode(",", exec("postconf -h smtpd_helo_restrictions"));
235+
$options = preg_split("/,\s*/", exec("postconf -h smtpd_helo_restrictions"));
232236
$new_options = array();
233237
foreach ($options as $key => $value) {
234-
if (($value = trim($value)) == '') continue;
238+
$value = trim($value);
239+
if ($value == '') continue;
235240
if (preg_match('/reject_unknown(_helo)?_hostname/', $value)) {
236241
continue;
237242
}
@@ -324,7 +329,7 @@ function update($event_name, $data) {
324329
if (defined($configure_lmtp) && $configure_lmtp) {
325330
for ($i = 0; isset($new_options[$i]); $i++) {
326331
if ($new_options[$i] == 'reject_unlisted_recipient') {
327-
array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${postfix_config_dir}/mysql-verify_recipients.cf"));
332+
array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${quoted_postfix_config_dir}/mysql-verify_recipients.cf"));
328333
break;
329334
}
330335
}

0 commit comments

Comments
 (0)