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




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

Reply via email to