[EXIM] Exim-1.92: Macro expansion bug with `domain=' in rout…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jim Knoble
Dátum:  
Címzett: Exim Users
Tárgy: [EXIM] Exim-1.92: Macro expansion bug with `domain=' in routers
Hi, folks.

Using exim-1.92 on Linux (Red Hat 4.2 with libc5). Glanced through the
mailing list archives and couldn't find anything related to this
problem.

Trying to use the domainlist router to perform somewhat similarly to
smail's `smart-host' router, while still using lookuphost for certain
domains. Here's the general idea from /etc/exim.conf:

    # Host to use as default `smart host'.
    SMART_HOST = zax.earth


    # Domain list pattern for remote domains which need to be forwarded
    # to a smart host.
    SMART_DOMAINS = *


    # Domain list pattern for remote domains which don't need to be
    # forwarded to a smart host.
    SMART_DOMAINS_EXCEPT = *.earth


    # ... zip over to ROUTER CONFIGURATION section ...


    # smart host router; the `smart_smtp' transport doesn't appear
    # to be relevant to what's going on, so we'll defer discussion
    # of that.
    smart_host:
            driver = domainlist
                # <<< Here's the spot where things get interesting
            domains = SMART_DOMAINS
            except_domains = SMART_DOMAINS_EXCEPT
                # >>>
            transport = smart_smtp
            route_list = "* SMART_HOST"


    # default lookuphost router
    lookuphost:
            driver = lookuphost
            transport = remote_smtp


The intent here is for most domains (*) to get routed through the
domainlist router to the `smart host', with a few domains (*.earth)
passing on to the lookuphost router. If i use `exim -v -bt' to test an
address in the .earth domain, here's what i get:

    #[root@quipu:~]# exim -v -bt jmknoble@???
    jmknoble@???
      deliver to jmknoble@??? via domain zax.earth
                        /^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~~\
       this should match *.earth ... but it gets routed via the smart host


      router = lookuphost, transport = remote_smtp
      host zax.earth [10.0.15.4] 
    #[root@quipu:~]# 


Oops. So, to make sure i'm doing this right, i replace the macros with
their actual values in the smart_host router:

    # smart host router with macros pre-expanded
    smart_host:
            driver = domainlist
                # <<< 
            domains = *
            except_domains = *.earth
                # >>>
            transport = smart_smtp
            route_list = "* SMART_HOST"


Now, the address test:

    #[root@quipu:~]# exim -v -bt jmknoble@???
    jmknoble@???
      deliver to jmknoble@???
                          ^^^^^^^^^^\
                                works this time


      router = lookuphost, transport = remote_smtp
      host jink.earth [10.0.15.6] 
    #[root@quipu:~]# 


Hmmm ... that works. Putting the macros back in, it fails again. Odd.
The funny thing is that, when i did this first, i forgot to replace the
SMART_HOST macro with its value, and it worked anyway:

    #[root@quipu:~]# exim -v -bt jmknoble@??? 
    jmknoble@???
      deliver to jmknoble@??? via domain zax.earth
                                              /^^^^^^^^^
                        this macro got replaced.


      router = lookuphost, transport = remote_smtp
      host zax.earth [10.0.15.4] 
    #[root@quipu:~]# 


Looks like the domainlist router isn't expanding macros properly in the
`domain' and `except_domain' configuration directives for the
domainlist routers. But there's more. Let's try them in a lookuphost
router, commenting out the smart_host router:

    # lookuphost router with `domain' directive with macro
    lookuphost:
            except_domain = SMART_DOMAINS_EXCEPT
            driver = lookuphost
            transport = remote_smtp


That should skip the lookuphost router for a domain that matches
`*.earth'. Testing an address gives us:

    #[root@quipu:~]# exim -v -bt jmknoble@???
    jmknoble@???
      deliver to jmknoble@???
      router = lookuphost, transport = remote_smtp
      host jink.earth [10.0.15.6] 
    #[root@quipu:~]# 


Hmmm ... it didn't get skipped. Replacing the macro with its
expansion, and testing the same address, we get:

    #[root@quipu:~]# exim -v -bt jmknoble@???
    jmknoble@??? is undeliverable:
      unrouteable mail domain "jink.earth"


Which is what we ought to get.

It actually looks like macros aren't getting expanded for the
`except_domain' directive in other routers besides domainlist.

So now, i told you that to ask you this: I'd love to help find the spot
in the code that's doing this. I've glanced through the sources, and
i've tried to get there from main() downward and from the stuff in
route.c upward, and i get lost before i get there. Is there anything
resembling a design document that could give me a better idea about the
code organization? Or perhaps someone familiar with the area of the
code could help me out a bit.... Of course, if someone knows what the
problem is and can fix it without me that would be fine too. :)

Thanks.

--jim

%%%%%%%%%%%%%%% jim knoble %%%%%%%% jmknoble@??? %%%%%%%%%%%%%%%%%


--
*** Exim information can be found at http://www.exim.org/ ***