RE: [Exim] How do the $header_ ($h_, etc..) variables work i…

Top Page
Delete this message
Reply to this message
Author: Eli
Date:  
To: exim-users
Subject: RE: [Exim] How do the $header_ ($h_, etc..) variables work in the source code?
Thanks Tony! I didn't think of searching for read_header_name, which
ultimately brought me to find_variable which had exactly what I wanted
(which was I think line 2347).

I made my little environment variable thing, and I've tested it and it seems
to work perfectly! However, since my C is kinda rusty, and my brain froze
completely on the idea of allocating more memory to do some changes to
strings, I'd like the list users to check it out and let me know what
changes/updates should be done.

Right now, I have tested it with this in my acl_non_smtp:

        warn    message         = X-CGI-User: $env_USER
        warn    message         = X-CGI-Client: $env_REMOTE_ADDR
        warn    message         = X-CGI-Server: $env_SERVER_NAME
($env_SERVER_ADDR)
        warn    message         = X-CGI-Script: $env_SCRIPT_NAME


It seems to work just fine (* - see below). Note that environment variables
are case sensitive - I do not change lowercase to upper case since you can
actually have lower case environment variables.

(*) I created this to try and track spammers that use PHP (since I don't use
it as a CGI), however it has failed at working because it seems to get the
Apache environment, but not any of the CGI variables. I assume this is
because PHP is running as a module inside Apache, so Apache sees no need to
export the CGI variables to its environment (also since if it did, it would
contaminate it's environment for the child, since it would also serve other
scripts that may have different values).

So, as useless as it is to me for tracking PHP, it still works and would be
good for CGI tracking, among other stuff as well possibly.

Patches are at:

http://nutbar.chemlab.org/downloads/other/env-exim-4.30.patch     (for Exim
4.30)
http://nutbar.chemlab.org/downloads/other/env-exiscan-4.30.patch  (for Exim
4.30 with exiscan patch already applied, if it makes any difference)


If anyone has any ideas on how to track PHP scripts (I've been thinking of
making a replacement mail() module, but my first attempt failed), please
share your ideas with me :)

Also, any code changes that anyone recommends, please let me know (I'm
concerned about returning the pointer from getenv() and Exim possibly trying
to free() that - not sure if this happens or not)!

Eli.

-----Original Message-----
From: exim-users-admin@??? [mailto:exim-users-admin@exim.org] On Behalf
Of Tony Finch
Sent: Sunday, January 11, 2004 5:02 PM
To: eli@???
Cc: exim-users@???
Subject: Re: [Exim] How do the $header_ ($h_, etc..) variables work in the
source code?

"Eli" <eli@???> wrote:
>
>Can anyone give me some API references or just point me to a file/line so I
>can see what I'd need to do to duplicate this?


Look for references to read_header_name() in expand.c. There are
two calls, one for expanding the variable at line 2347, and one for
implementing the def: expansion condition at line 1340.

Tony.
--
f.a.n.finch <dot@???> http://dotat.at/
CAPE WRATH TO RATTRAY HEAD INCLUDING ORKNEY: SOUTHWEST 5 OR 6, OCCASIONALLY
7.
BLUSTERY SHOWERS. MODERATE OR GOOD. MODERATE OR ROUGH, LOCALLY VERY ROUGH AT
FIRST.

--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
details at http://www.exim.org/ ##

---
[This E-mail scanned for viruses]



---
[This E-mail scanned for viruses]