Your message dated Sat, 13 Mar 2004 20:33:22 -0500
with message-id <[EMAIL PROTECTED]>
and subject line Bug#237765: libc6: getaddrinfo() fails to get right port number for 
all service
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 13 Mar 2004 12:12:46 +0000
>From [EMAIL PROTECTED] Sat Mar 13 04:12:46 2004
Return-path: <[EMAIL PROTECTED]>
Received: from chimpanzee.school.ioffe.ru (school.ioffe.ru) [194.85.238.98] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1B280T-0003nH-00; Sat, 13 Mar 2004 04:12:46 -0800
Received: from chimpanzee (localhost [127.0.0.1])
        by chimpanzee (Postfix) with SMTP
        id 2BDA96AEBF; Sat, 13 Mar 2004 15:12:40 +0300 (MSK)
Received: from macaca.school.ioffe.ru (macaca.school.ioffe.ru [192.168.5.4])
        by school.ioffe.ru (Postfix) with ESMTP
        id 060FC6AEAE; Sat, 13 Mar 2004 15:12:40 +0300 (MSK)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Dmitry Baryshkov <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: libc6: getaddrinfo() fails to get right port number for all service
X-Mailer: reportbug 2.48
Date: Sat, 13 Mar 2004 15:12:39 +0300
Message-Id: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_12 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-7.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2004_03_12
X-Spam-Level: 

Package: libc6
Version: 2.3.2.ds1-11
Severity: normal


getaddrinfo() fails to get service port.
Here is nsswitch.conf:
===
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
===

And test program, that can demonstrate this effect:
===
#include <stdio.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

int main(int argc, char **argv)
{
        struct addrinfo *addr_list;
        int ret;

        if (argc != 2)
        {
                fprintf(stderr, "Usage: %s <service>\n", argv[0]);
                return 1;
        }

        ret = getaddrinfo("127.0.0.1", argv[1], NULL, &addr_list);

        if (ret != 0)
        {
                fprintf(stderr, "Error at getaddrinfo: %s\n", gai_strerror(ret));
                return 2;
        }
        
        if (addr_list->ai_family == PF_INET)
                fprintf(stdout, "For IPv4 service '%s' port is %u\n", argv[1], 
                                ((struct sockaddr_in*)(addr_list->ai_addr))->sin_port);
        else
                fprintf(stdout, "For IPv6 service '%s' port is %u\n", argv[1], 
                                ((struct sockaddr_in*)(addr_list->ai_addr))->sin_port);

        return 0;
}
===

Example:
$./getaddrinfo echo
For IPv4 service 'echo' port is 1792
$

Tell me if I have to provide more info.
-- 
With best wishes
Dmitry Baryshkov


-- System Information:
Found unknown policy: ('500', 'testing-proposed-updates')Found unknown policy: ('500', 
'testing-proposed-updates')Found unknown policy: ('500', 
'testing-proposed-updates')Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i586)
Kernel: Linux 2.6.3
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information



---------------------------------------
Received: (at 237765-done) by bugs.debian.org; 14 Mar 2004 01:33:29 +0000
>From [EMAIL PROTECTED] Sat Mar 13 17:33:29 2004
Return-path: <[EMAIL PROTECTED]>
Received: from nevyn.them.org [66.93.172.17] (Debian-exim)
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1B2KVM-0001cU-00; Sat, 13 Mar 2004 17:33:29 -0800
Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian))
        id 1B2KVG-0000MK-Rr; Sat, 13 Mar 2004 20:33:22 -0500
Date: Sat, 13 Mar 2004 20:33:22 -0500
From: Daniel Jacobowitz <[EMAIL PROTECTED]>
To: Dmitry Baryshkov <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: Re: Bug#237765: libc6: getaddrinfo() fails to get right port number for all 
service
Message-ID: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <[EMAIL PROTECTED]>
User-Agent: Mutt/1.5.1i
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_12 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-5.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2004_03_12
X-Spam-Level: 

On Sat, Mar 13, 2004 at 03:12:39PM +0300, Dmitry Baryshkov wrote:
>       if (addr_list->ai_family == PF_INET)
>               fprintf(stdout, "For IPv4 service '%s' port is %u\n", argv[1], 
>                               ((struct sockaddr_in*)(addr_list->ai_addr))->sin_port);
>       else
>               fprintf(stdout, "For IPv6 service '%s' port is %u\n", argv[1], 
>                               ((struct sockaddr_in*)(addr_list->ai_addr))->sin_port);

Try using ntohs if you want to look at the value of sin_port.  The port
is in network byte order.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to