From owner-freebsd-bugs Mon Jan 28 15:10:12 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B39AA37B417 for ; Mon, 28 Jan 2002 15:10:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0SNA1063081; Mon, 28 Jan 2002 15:10:01 -0800 (PST) (envelope-from gnats) Received: from skynet.stack.nl (insgate.stack.nl [131.155.140.2]) by hub.freebsd.org (Postfix) with ESMTP id 1986337B400 for ; Mon, 28 Jan 2002 15:06:38 -0800 (PST) Received: from toad.stack.nl (toad.stack.nl [2001:610:1108:5010:202:b3ff:fe17:9e1a]) by skynet.stack.nl (Postfix) with ESMTP id A92CC9B15 for ; Tue, 29 Jan 2002 00:06:36 +0100 (CET) Received: by toad.stack.nl (Postfix, from userid 1106) id 775A7969B; Tue, 29 Jan 2002 00:06:36 +0100 (CET) Message-Id: <20020128230636.775A7969B@toad.stack.nl> Date: Tue, 29 Jan 2002 00:06:36 +0100 (CET) From: Serge van den Boom Reply-To: Serge van den Boom To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: misc/34390: incorrect error with getaddrinfo with hostname+AI_NUMERICHOST Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 34390 >Category: misc >Synopsis: incorrect error with getaddrinfo with hostname+AI_NUMERICHOST >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 28 15:10:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Serge van den Boom >Release: FreeBSD 4.5-RC i386 >Organization: M.C.G.V. Stack >Environment: System: FreeBSD toad.stack.nl 4.5-RC FreeBSD 4.5-RC #0: Fri Jan 25 01:23:40 CET 2002 dean@toad.stack.nl:/toad.mnt/sources/4.x/sys/compile/toad_vwww i386 >Description: When using getaddrinfo with AI_NUMERICHOST set in the options field of the hints structure, and passing a non-numeric host name, EAI_NODATA is returned. RFC 2553 requires an error code of EAI_NONAME in that case though, and this is what the getaddrinfo man page also says (in fact it's the same text). >How-To-Repeat: #include #include #include #include #include #include int main(int argc, char *argv[]) { struct addrinfo ai_hints; struct addrinfo *ai_res; int ai_retval; memset(&ai_hints, 0, sizeof ai_hints); ai_hints.ai_family = PF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; ai_hints.ai_protocol = IPPROTO_TCP; ai_hints.ai_flags = AI_NUMERICHOST; ai_retval = getaddrinfo("host.example.net", "9", &ai_hints, &ai_res); printf("getaddrinfo returned %d, should be %d (EAI_NONAME).\n", ai_retval, EAI_NONAME); (void) argc; (void) argv; return EXIT_SUCCESS; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message