Mailing List Archive

message_filter_directory_transport problem
Hello,

Using Exim 3.36 I am trying to get the system filter to save certain
messages as individual files in a specific directory. In configure I have:

message_filter_directory_transport = saved_dhcp
...
saved_dhcp: (as the transport)
driver = appendfile
directory = /usr/local/exim/spool/dhcp-saved
user = exim

In the system filter file I have:

if $sender_host_name matches "dhcp\\\\.plym(outh)?\\\\.ac\\\\.uk\\$" then
logfile /usr/local/exim/logs/dhcp.log
logwrite "$tod_log: Subject: $h_Subject:\n\
\t Sender: $sender_fullhost\n\
\t From: $sender_address\n\
\t To: $h_To:"
save spool/dhcp-saved/
endif

This basically just saves messages coming from dhcp'ing workstations. Now,
this works fine :-)

However, I need to add another entry to the system filter to store spam
messages as individual messages in a different directory. But the
'message_filter_directory_transport' is set to a specific directory (exim
doesn't seem to like it if I remove the 'directory' option :-)).


Any ideas as to how I can do this? I'm sure I'm missing soemthing obvious.


Thanks,

John.

------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: jhorne@plymouth.ac.uk
PGP key available from public key servers
Re: message_filter_directory_transport problem [ In reply to ]
On Wed, 22 May 2002, John Horne wrote:

> saved_dhcp: (as the transport)
> driver = appendfile
> directory = /usr/local/exim/spool/dhcp-saved
> user = exim
>
> In the system filter file I have:
>
> if $sender_host_name matches "dhcp\\\\.plym(outh)?\\\\.ac\\\\.uk\\$" then
> logfile /usr/local/exim/logs/dhcp.log
> logwrite "$tod_log: Subject: $h_Subject:\n\
> \t Sender: $sender_fullhost\n\
> \t From: $sender_address\n\
> \t To: $h_To:"
> save spool/dhcp-saved/
> endif

> However, I need to add another entry to the system filter to store spam
> messages as individual messages in a different directory. But the
> 'message_filter_directory_transport' is set to a specific directory (exim
> doesn't seem to like it if I remove the 'directory' option :-)).

You have used a non-absolute path in the system filter. Due to a buglet
in Exim, this is making it ignore that value, and use the value of
"directory" in the transport.

If you use an absolute path in the filter, you should not need
"directory" in the transport.

[.I'll fix the bug, of course. It should be complaining about the lack of
an absolute path.]

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: message_filter_directory_transport problem [ In reply to ]
On 22-May-2002 at 14:36:29 Philip Hazel wrote:
> On Wed, 22 May 2002, John Horne wrote:
>> saved_dhcp: (as the transport)
>> driver = appendfile
>> directory = /usr/local/exim/spool/dhcp-saved
>> user = exim
>>
>> In the system filter file I have:
>>
>> if $sender_host_name matches "dhcp\\\\.plym(outh)?\\\\.ac\\\\.uk\\$"
>> then
>> logfile /usr/local/exim/logs/dhcp.log
>> logwrite "$tod_log: Subject: $h_Subject:\n\
>> \t Sender: $sender_fullhost\n\
>> \t From: $sender_address\n\
>> \t To: $h_To:"
>> save spool/dhcp-saved/
>> endif
>
> You have used a non-absolute path in the system filter. Due to a buglet
> in Exim, this is making it ignore that value, and use the value of
> "directory" in the transport.
>
> If you use an absolute path in the filter, you should not need
> "directory" in the transport.
>
Okay, but...

In 'Exim's interface to mail filtering' (for exim 3.36) it says:

If the file name does not start with a / character, then the contents of
the $home variable are prepended.

The use of 'save' I have above works fine. Surely if its an absolute
pathname then that's okay, and if it's not an absolute pathname then it
should just prepend $home (the $home of the user running the system filter)?
In that case any check of an absolute path name should not be required.


John.

------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: jhorne@plymouth.ac.uk
PGP key available from public key servers
Re: message_filter_directory_transport problem [ In reply to ]
On Wed, 22 May 2002, John Horne wrote:

> In 'Exim's interface to mail filtering' (for exim 3.36) it says:
>
> If the file name does not start with a / character, then the contents of
> the $home variable are prepended.

Not in a *system* filter! That refers to user filters, where a home
directory makes sense.

> The use of 'save' I have above works fine. Surely if its an absolute
> pathname then that's okay, and if it's not an absolute pathname then it
> should just prepend $home (the $home of the user running the system filter)?
> In that case any check of an absolute path name should not be required.

No, sorry, it doesn't work like that. $home isn't set in a system
filter. I'd never thought of that. I'm not sure it is sensible anyway,
because system filters tend to be run as "exim" or another non-human
user, where there may not be a "home" directory.

I don't think the 'save' you have works fine. Try changing the contents
of the "directory" option in your transport. I would expect that to take
effect, whereas if you change the contents of 'save', it will have no
effect (while it remains a non-absolute path). That is because of the
buglet I found.


--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: message_filter_directory_transport problem [ In reply to ]
On 22-May-2002 at 15:53:11 Philip Hazel wrote:
> On Wed, 22 May 2002, John Horne wrote:
> No, sorry, it doesn't work like that. $home isn't set in a system
> filter. I'd never thought of that. I'm not sure it is sensible anyway,
> because system filters tend to be run as "exim" or another non-human
> user, where there may not be a "home" directory.
>
That makes sense. I assumed, however, that $home was set to the home
directory of the exim process. (In our case it does have a valid home
directory).

> I don't think the 'save' you have works fine. Try changing the contents
> of the "directory" option in your transport. I would expect that to take
> effect, whereas if you change the contents of 'save', it will have no
> effect (while it remains a non-absolute path). That is because of the
> buglet I found.
>
This is true. The save worked in as much as it didn't need to be an absolute
path, and I assumed this was because $home was prepended to it. Obviously it
'worked' because it was ignored :-)

Many thanks for your help, is the fix going to be for exim 3 or 4 (or both)?


Regards,

John.

------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: jhorne@plymouth.ac.uk
PGP key available from public key servers
Re: message_filter_directory_transport problem [ In reply to ]
On Wed, 22 May 2002, John Horne wrote:

> Many thanks for your help, is the fix going to be for exim 3 or 4 (or both)?

4. I'm not even sure it's the same in 3, 'cause things have changed in
that area.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.