Re: [exim] lsearch

Top Page
Delete this message
Reply to this message
Author: Sergei
Date:  
To: exim-users
Subject: Re: [exim] lsearch
This is yet another follow-up. I felt adventurous enough to go into the
Exim source code. And what I found was this:

/* Not a query-style lookup; must ensure the host name is present, and
then we do a check on the name and all its aliases. */

if (sender_host_name == NULL)
  {
  HDEBUG(D_host_lookup)
    debug_printf("sender host name required, to match against %s\n",
ss);
  if (host_lookup_failed || host_name_lookup() != OK)
    {
    *error = string_sprintf("failed to find host name for %s",
      sender_host_address);;
    return ERROR;
    }
  host_build_sender_fullhost();
}


That is the answer. I kept trying exim_checkaccess -bh 127.0.0.1
some_email_address (having put 127.0.0.1 in "spam_hosts"). Exim would do
a reverse lookup on that address and try to lookup the word "localhost"
instead of 127.0.0.1!

I tried other addresses too but they failed for another reason -- none
of them had a reverse lookup. Once a reverse lookup was unsuccessful, no
lookup took place at all!

Now, I must say, I didn't come across a description of that behavior in
the many parts of the documentation I read through, including Chapter 9,
which deals with lookups.

What makes it at least slightly confusing is that if the IP address (not
the host name) is mentioned in the "hosts" option directly, it will work
just fine, but when you put the same address in a file...

And as you know reverse lookups on a lot of hosts will not work because
the DNS will not be properly set up. All I want to do is block some
annoying hosts by the IP address using a file. Is there a reliable
solution for this? I guess a string expansion on the host IP could be
done using the file and then "condition" could be used on the result of
the expansion.

Thoughts?

Thanks!


=================================================================

On Fri, 2006-02-17 at 16:51 -0500, Sergei Gerasenko wrote:
> This is a follow-up to my previous message about lsearch. Running exim
> with -d+all, I came across this piece:
>
> ...
> 16:42:18  3171 check hosts = lsearch;/etc/spam_hosts
> 16:42:18  3171 ---0 Get 0x80f9940    40       string.c  349
> 16:42:18  3171 sender host name required, to match against lsearch;/etc/spam_hosts
> ...

>
> For what it's worth...
>
>
>
> =================================================================
>
> Hi,
>
> I'm running the current stable version of Debian and the packaged
> version of Exim 4. I'm switching from 3 and I have this problem with
> lsearch that I just can't figure out.
>
> It's a very simple scenario. I want to block hosts that are
> listed in a file. The file is in /etc/spam_hosts and has the following
> kinds of entries:
>
> IP1:
> IP2:
> ...
>
> In the ACL for receiving messages, one of the first rules I added was:
>
> deny    message       = Message rejected
>         hosts         = lsearch;/etc/spam_hosts

>
>
> That doesn't work for some reason. However, if I use a literal IP
> instead of the lsearch line, the rule works.
>
> What am I missing?
>
> Sorry if this is an FAQ -- I did check the archives and the docs, but didn't find
> what I looking for...
>
> Thanks for any ideas!
>
> Sergei
>