@@ -1077,8 +1077,10 @@ public function configure_postfix($options = '') {
10771077 }
10781078
10791079 $ reject_sender_login_mismatch = '' ;
1080+ $ reject_authenticated_sender_login_mismatch = '' ;
10801081 if (isset ($ server_ini_array ['mail ' ]['reject_sender_login_mismatch ' ]) && ($ server_ini_array ['mail ' ]['reject_sender_login_mismatch ' ] == 'y ' )) {
10811082 $ reject_sender_login_mismatch = ',reject_sender_login_mismatch, ' ;
1083+ $ reject_authenticated_sender_login_mismatch = 'reject_authenticated_sender_login_mismatch, ' ;
10821084 }
10831085
10841086 # placeholder includes comment char
@@ -1095,8 +1097,8 @@ public function configure_postfix($options = '') {
10951097 }
10961098
10971099 unset($ server_ini_array );
1098-
1099- $ tmp = str_replace ('. ' ,'\. ' ,$ conf ['hostname ' ]);
1100+
1101+ $ myhostname = str_replace ('. ' ,'\. ' ,$ conf ['hostname ' ]);
11001102
11011103 $ postconf_placeholders = array ('{config_dir} ' => $ config_dir ,
11021104 '{vmail_mailbox_base} ' => $ cf ['vmail_mailbox_base ' ],
@@ -1105,7 +1107,8 @@ public function configure_postfix($options = '') {
11051107 '{rbl_list} ' => $ rbl_list ,
11061108 '{greylisting} ' => $ greylisting ,
11071109 '{reject_slm} ' => $ reject_sender_login_mismatch ,
1108- '{myhostname} ' => $ tmp ,
1110+ '{reject_aslm} ' => $ reject_authenticated_sender_login_mismatch ,
1111+ '{myhostname} ' => $ myhostname ,
11091112 $ stress_adaptive_placeholder => $ stress_adaptive ,
11101113 '{reject_unknown_client_hostname} ' => $ reject_unknown_client_hostname ,
11111114 '{reject_unknown_helo_hostname} ' => $ reject_unknown_helo_hostname ,
@@ -1692,24 +1695,30 @@ public function configure_rspamd() {
16921695 if (! isset ($ mail_config ['reject_sender_login_mismatch ' ])) {
16931696 $ mail_config ['reject_sender_login_mismatch ' ] = 'n ' ;
16941697 }
1695- $ options = explode (", " , exec ("postconf -h smtpd_sender_restrictions " ));
1698+ $ options = explode (", " , exec ("postconf -h smtpd_sender_restrictions " ));
16961699 $ new_options = array ();
16971700 foreach ($ options as $ key => $ value ) {
1698- if (trim ($ value ) == '' ) continue ;
1701+ if (( $ value = trim ($ value) ) == '' ) continue ;
16991702 if (preg_match ('/tag_as_(originating|foreign)\.re/ ' , $ value )) {
17001703 continue ;
17011704 }
1702- if (! preg_match ('/reject_(authenticated_)?sender_login_mismatch/ ' , $ value )) {
1703- $ new_options [] = trim ( $ value ) ;
1705+ if (preg_match ('/reject_(authenticated_)?sender_login_mismatch/ ' , $ value )) {
1706+ continue ;
17041707 }
1708+ $ new_options [] = $ value ;
17051709 }
17061710 if ($ mail_config ['reject_sender_login_mismatch ' ] == 'y ' ) {
1707- reset ($ new_options );
1708- array_splice ($ new_options , 0 , 0 , array ('reject_sender_login_mismatch ' ));
1711+ array_splice ($ new_options , 0 , 0 , array ('reject_authenticated_sender_login_mismatch ' ));
1712+
1713+ for ($ i = 0 ; isset ($ new_options [$ i ]); $ i ++) {
1714+ if ($ new_options [$ i ] == 'permit_mynetworks ' ) {
1715+ array_splice ($ new_options , $ i +1 , 0 , array ('reject_sender_login_mismatch ' ));
1716+ break ;
1717+ }
1718+ }
17091719 }
17101720 exec ("postconf -e 'smtpd_sender_restrictions = " .implode (", " , $ new_options )."' " );
17111721
1712-
17131722 $ options = preg_split ("/,\s*/ " , exec ("postconf -h smtpd_recipient_restrictions " ));
17141723 $ new_options = array ();
17151724 foreach ($ options as $ value ) {
0 commit comments