Philip,
Thanks for the reply. I am trying to use readsocket in an ACL (below).
This code snippet is from an example way of implementing SPF within Exim.
With your example, does the expansion result in "Failed: ..." or is that
just an error message output somewhere? Are the exact failure messages
documented somewhere? Basically, the reason I'm trying to track this all
down is about 1% of the readsocket calls are failing for some reason,
usually in bursts. It's working great for a time and then it gets 6 - 8
(sometimes more) failures in a row, and then continues working good again.
Would using an inet socket would better?
spf_check:
warn set acl_m9 = ${readsocket{/tmp/spfd}\
{\
ip_address=$sender_host_address\n\
helo_identity=${if
def:sender_helo_name{$sender_helo_name}{NOHELO}}\n\
identity=$acl_m8\n\
scope=$acl_m7\n\
\n\
}\
{60s}{\n}{socket failure}}
# Defer on socket error
defer condition = ${if eq{$acl_m9}{socket failure}{yes}{no}}
message = Cannot connect to spfd
# Prepare answer and get results
warn set acl_m9 = ${sg{$acl_m9}{\N=(.*)\n\N}{=\"\$1\" }}
set acl_m8 = ${extract{result}{$acl_m9}{$value}{unknown}}
set acl_m7 = ${extract{header_comment}{$acl_m9}{$value}{}}
# Check for fail
deny condition = ${if eq{$acl_m8}{fail}{yes}{no}}
message = ${extract{smtp_comment}{$acl_m9}{$value}{}}
log_message = Not authorized by SPF
accept
Please respond to exim-users@???
To: Dan_Mitton@???
cc: exim-users@???
Subject: Re: [exim] readsocket
LSN: Not Relevant
User Filed as: Not a Record
On Tue, 16 Jan 2007, Dan_Mitton@??? wrote:
> Is there a way to determine which error 'readsocket' is getting??
There should be an error message for the failure of the expansion in
which you use readsocket. The message contains the error information.
For example:
$ exim -be
> ${readsocket{/non/exist}{abcd}}
Failed: failed to connect to socket /non/exist: No such file or directory
How the error is recorded depends on the circumstances in which you are
using readsocket. So you'll have to tell us some more details about when
you are not seeing the error information.
--
Philip Hazel University of Cambridge Computing Service
Get the Exim 4 book: http://www.uit.co.uk/exim-book