On Tue, 25 Jan 2000, Dave Lewney wrote:
> I need to check whether a message has been sent from one of our
> own networks which are of form
>
> a.b.c.d/19
> e.f.g.h/20
> j.k.l.m/21
>
> Is there an easier way than a long-winded check on $sender_host_address
> with net19-lsearch;/my/networks
> net20-lsearch;/my/networks and then
> net21-lsearch;/my/networks
If you have enough of them to need to put them in a file, and you are
testing the variable in some expanded string, then the answer is no. If
there are only three of them, you can of course do the test in-line:
${if or {
{eq {${mask:$sender_host_address/19}} {10.9.8.7/19}}
{eq {${mask:$sender_host_address/20}} {10.9.8.8/20}}
{eq {${mask:$sender_host_address/21}} {10.9.8.9/21}}
} {yes-string}{no-string}}
but it's still rather tedious.
If you are testing these in a host list like host_accept_relay, and I
suspect you are since your syntax looks like that, then you can either
(a) Put them inline
host_accept_relay = 192.168.3.4/19 : 192.168.323.54/20 : 192.168.34.12/21
(b) Put them in an interpolated file (i.e. *not* lsearch)
host_accept_relay = /some/file
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.