On 2007-12-09 at 12:40 +0000, Phil White wrote:
> I'm trying to store the DECIMAL IP address of a connecting host in
> $acl_c*. Do do this, I'm using the following:
>
> set acl_c5 = ${eval10: \
> (${extract {1}{.}{$sender_host_address}}<<24) \
> + (${extract {2}{.}{$sender_host_address}}<<16) \
> + (${extract {3}{.}{$sender_host_address}}<<8) \
> + ${extract {4}{.}{$sender_host_address}} \
> }
>
> Which, sadly, doesn't work quite as expected:
> dotquad addr = 131.111.8.192
> decimal addr = -2089875264
> which means approximately 50% of my mail is not being flagged correctly.
32-bit arithmetic, signed. I suspect you knew that ...
> Is there another way I can achieve the desired effect?
Use an embedded Perl interpreter, returning a string? I don't see that
you'll be using the result directly within Exim, so a string should be
fine, right? Math::BigInt, perhaps via Net::IP.
A bit heavyweight though. What do you need this value in decimal for?
If you really can't modify the external thingy which has an interface
requirement of a pure number (not even via a sh shim script?) and the
Perl interpreter is too heavyweight for you, then AFAIK you're stuck
writing the converter in C and using ${dlfunc}.
-Phil