On Thu, 15 Jan 2004, I wrote:

> I have obtained the latest qpopper (4.0.5) and built it
> successfully on a Solaris 9 system.  All the hosts show up as
> unverfiable 0.0.0.0.  So I read the FAQ and this tells me:
        [...]
Having had no reply to this I decided to see if this was something I
could patch myself.

My logs look like
Jan 22 11:20:31 brains qpopper[24014]: [ID 702911 mail.notice]
(v4.0.5) POP login by user "<elided>" at (0.0.0.0) 0.0.0.0
Jan 22 11:20:31 brains qpopper[24014]: [ID 702911 mail.notice]
Stats: <elided> 0 0 1555 33963919 0.0.0.0 0.0.0.0
Jan 22 11:20:56 brains qpopper[24070]: [ID 702911 mail.debug]
(v4.0.5) Unable to get canonical name of client 0.0.0.0: Authoritive
answer: Host not found (1)

Examining the source of popper/pop_init.c  I see that the canonical
name comes from gethostbyaddr, which nees -lnsl, which it has (it is
already in CFLAGS in my popper/Makefile)..
gethostbyaddr is called with an address p-ipaddr, which comes from

   1072     p->ipaddr = (char *) strdup ( inet_ntoa ( cs.sin_addr ) );

And cs gets set at:

   1060     len = sizeof(cs);
   1061     if ( getpeername ( sp, (struct sockaddr *) &cs, &len ) < 0 ) {
   1062         pop_log ( p, POP_PRIORITY, HERE,
   1063                   "Unable to obtain socket and address of client: %s (%d       
 )",
   1064                   STRERROR(errno), errno );
   1065         EXIT ( 1 );
   1066     }

and I don't get "Unable to obtain socket and address of client" in my logs,
so cs ought to be fairly sensible..

cs is a struct sockaddr_in, so its size is known, but getpeername says

     [...] The int pointed to by the namelen parameter should
     be initialized to indicate the amount of space pointed to by
     name.  On  return  it  contains  the actual size of the name
     returned (in bytes), prior to any truncation.  The  name  is
     truncated if the buffer provided is too small.

The value of len is not checked before p->ipaddr is assigned.
Thia may have no bearing on my problem as such, but it seems worth
poinitg out.

        Hugh

Reply via email to