Bug 859

Summary: getaddrinfo(host, "0", &hints, &res) may take extra cycles
Product: Portable OpenSSH Reporter: YOSHIFUJI Hideaki <yoshfuji>
Component: sshdAssignee: OpenSSH Bugzilla mailing list <openssh-bugs>
Status: CLOSED FIXED    
Severity: normal CC: dtucker
Priority: P2 Keywords: openbsd, patch
Version: -current   
Hardware: All   
OS: Other   
Bug Depends on:    
Bug Blocks: 1452    
Attachments:
Description Flags
eliminate use of getaddrinfo(host, "0", &hints, &res) where getaddrinfo(host, NULL, &hints, &res) is appricable none

Description YOSHIFUJI Hideaki 2004-05-02 15:31:42 AEST
On some system(s), getaddrinfo() may take extra cycles when we use "0" for the
second argument. We probably may use NULL instead if the first argument is non-NULL.

(This problem is originally reported by John Devitofranceschi <jdvf@optonline.net>.)
Comment 1 YOSHIFUJI Hideaki 2004-05-02 15:35:45 AEST
Created attachment 622 [details]
eliminate use of getaddrinfo(host, "0", &hints, &res) where getaddrinfo(host, NULL, &hints, &res) is appricable
Comment 2 Darren Tucker 2004-05-12 13:09:03 AEST
I think the patch is correct, but I'm not sure if there was a reason for it
being changed.  The CVS entry for the change was:

- markus@cvs.openbsd.org 2003/06/02 09:17:34
  deprecate VerifyReverseMapping since it's dangerous if combined
  with IP based access control as noted by Mike Harding; replace with
  a UseDNS option, UseDNS is on by default and includes the
  VerifyReverseMapping check; with itojun@, provos@, jakob@ and deraadt@
  ok deraadt@, djm@

Also, this issue is mentioned in bug #689, but it's not exactly the same issue
so I'm keeping them as separate bugs for now.
Comment 3 Darren Tucker 2005-03-07 16:12:54 AEDT
Unfortunately this won't be changed in 4.0.
Comment 4 Darren Tucker 2008-06-12 08:42:08 AEST
Apparently the reason for the "0" was to make sure that at least one of (host, port) was a non-null value.  I have verified that it is not possible for the host parameters to be NULL in these cases.
Comment 5 Darren Tucker 2008-06-12 10:23:22 AEST
A modified version of your patch has been applied and will be in the next release.  Thanks.
Comment 6 Damien Miller 2008-07-22 12:07:02 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1