MailWatch icon indicating copy to clipboard operation
MailWatch copied to clipboard

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

Open RobinR1 opened this issue 4 years ago • 1 comments

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

  • MailWatch Version: stable 1.2.18
  • Install type: GitHub checkout
  • Updated from an older MailWatch or fresh install: Fresh install

Server configuration

  • Operation System: openSuse Leap 15.3
  • PHP version: 7.4
  • Database: MariaDB 10.5.13
  • Mail Server: Postfix
  • Used web server: Apache version 2.4.43

Client configuration

  • Operation System: openSuse Tumbleweed
  • Browser: Firefox 95.0.2

RobinR1 avatar Jan 18 '22 08:01 RobinR1

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.

shawniverson avatar Jan 18 '22 10:01 shawniverson