mailwatch / MailWatch

MailWatch for MailScanner is a web-based front-end to MailScanner
http://mailwatch.org/
GNU General Public License v2.0
117 stars 66 forks source link

%-variables defined in main MS config are not expanded in conf.d config files #1245

Open RobinR1 opened 2 years ago

RobinR1 commented 2 years ago

Issue summary

%-variables defined in main MS config are not expanded in conf.d config files by MailWatch functions. MailScanner allows to use %-variables defined in main MailScanner.conf file to be used in conf.d-config files. But MailWatch requires %-variables to be defined within the same file where they are used.

Steps to reproduce

  1. Make sure some %-variables are defined in MailScanner.conf
  2. some of those %variables in conf.d config files
  3. Run MailWatch cron job of use web interface

Expected result

No errors

Actual result

Both apache access-log and cron system logging are full of messages like this:

PHP Notice:  Undefined index: %org-name% in /opt/mailwatch/mailscanner/functions.php on line 1894
PHP Notice:  Undefined index: %org-name% in /opt/mailwatch/mailscanner/functions.php on line 1894
PHP Notice:  Undefined index: %etc-dir% in /opt/mailwatch/mailscanner/functions.php on line 1894
PHP Notice:  Undefined index: %etc-dir% in /opt/mailwatch/mailscanner/functions.php on line 1894
PHP Notice:  Undefined index: %rules-dir% in /opt/mailwatch/mailscanner/functions.php on line 1894

Installation

Version and method

Server configuration

Client configuration

shawniverson commented 2 years ago

This is expected behavior the way MailWatch currently is written, but I agree it would be proper to parse the main and conf.d counterparts in their entirety and populate those values, even if they aren't in the same file.