https://bugs.exim.org/show_bug.cgi?id=3139

            Bug ID: 3139
           Summary: Exim’s modern MySQL lookup syntax (servers=) doesn't
                    support dynamic expansions (e.g., ${perl{}}) in server
                    definitions, forcing users to use deprecated syntax.
           Product: Exim
           Version: 4.98
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Lookups
          Assignee: unalloca...@exim.org
          Reporter: maorb...@gmail.com
                CC: exim-dev@lists.exim.org

Exim’s recommended modern syntax for MySQL lookups specifies servers using:

${lookup mysql,servers=SERVER_SPEC {QUERY}}

However, this syntax fails when dynamically expanded macros (e.g.,
${perl{...}}) are used within the server definition, such as dynamically
generated usernames or passwords:

Example of failing configuration:

MYSQL_USER = ${perl{get_mysql_user}}
MYSQL_PASS = ${perl{get_mysql_pass}}
MYSQL_SERVER = localhost(/run/mysqld/mysql.sock)/mail/MYSQL_USER/MYSQL_PASS

domainlist local_domains = ${lookup mysql,servers=MYSQL_SERVER { ... }}
Error received:

failed to expand "${lookup
mysql,servers=localhost(/run/mysqld/mysql.sock)/mail/${perl{get_mysql_user}}/${perl{get_mysql_pass}}
{ ... }}" while checking a list: lookup of "perl{get_mysql_user" gave DEFER: 

The older, deprecated syntax:

${lookup mysql{servers=...; SELECT ...}}

successfully handles these dynamic expansions but logs deprecation warnings,
indicating this method will eventually be removed.


- Expected Behavior:
Exim’s new lookup syntax should support dynamic macro expansions within the
servers= definition.

- Actual Behavior:
Exim attempts incorrect double expansions or misinterprets expanded values as
hostnames, resulting in parsing errors and DEFER failures.

- Impact:
Users relying on dynamic server credentials (e.g., retrieved from external
scripts or secure storage via ${perl{...}}) must use deprecated syntax, facing
log warnings and future incompatibility risks.

- Suggested Resolution:
Adjust the newer syntax (servers=) to allow full dynamic expansions or clearly
document this limitation and suggest alternatives.

- Affected Version: 4.98.1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
##   exim-dev-unsubscr...@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to