Re: [Exim] log_incoming_port

Etusivu
Poista viesti
Vastaa
Lähettäjä: Philip Hazel
Päiväys:  
Vastaanottaja: Christopher Tromans
Kopio: exim-users
Aihe: Re: [Exim] log_incoming_port
On Wed, 7 Aug 2002, Christopher Tromans wrote:

> On Wed, 7 Aug 2002, Philip Hazel wrote:
>
> > That's a byte-ordering problem. 34002 = 0x84d2; 53892 = 0xd284. Which
> > release of Exim? Which operating system?
>
> Sorry, should have said that. Redhat Linux 7.1, Exim 3.35 RPM from the
> ftp.exim.org site.


Looking at the sources, it looks like a bug was fixed during the Exim 3
to Exim 4 transition, though there is nothing in the ChangeLog (but I
didn't record every single change during that big upheaval).

I can give you a source patch for Exim 3, but that will require you to
rebuild Exim from source. In the file src/host.c you will see several
lines of the form:

    if (portptr != NULL) *portptr = sk->sin6_port;


There are 3 such lines (2 exactly like that, one slightly different).
The should all be changed along the following lines:

    if (portptr != NULL) *portptr = ntohs(sk->sin6_port);


That is, the value should be passed through the ntohs() function, which
converts short integer values from network byte order to host byte
order.

Looks like nobody has tried to use this on Exim 3 on a little-endian
host. Needless to say, the bug arose because I develop and test
(currently) on a big-endian host. Sorry about that.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.