--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: libc6: Missing funcions in libresolv
- From: Martin Ferrari <martin.ferrari@gmail.com>
- Date: Fri, 21 Jan 2005 17:07:49 -0300
- Message-id: <E1Cs54P-0008Qy-00@asterix.decidir.net>
Package: libc6
Version: 2.3.2.ds1-20
Severity: normal
I'm using functions defined in arpa/nameser.h, undocumented in libc, but
explained in chapter 12 of O'Reilly's DNS & BIND (ISBN: 0-596-00158-4).
I do think that this lack of documentation is also a bug.
They are included in /usr/lib/libresolv.a from libc6-dev package, but
not in libresolv.so. Below is included a small example program to
demonstrate this.
This is the error:
$ gcc -Wall -pedantic test.c -lresolv -o test
/tmp/cc6jU6ZL.o(.text+0xa4): In function `main':
: undefined reference to `__ns_initparse'
/tmp/cc6jU6ZL.o(.text+0x124): In function `main':
: undefined reference to `__ns_parserr'
/tmp/cc6jU6ZL.o(.text+0x190): In function `main':
: undefined reference to `__ns_name_uncompress'
collect2: ld returned 1 exit status
$
But this works:
$ gcc -Wall -pedantic test.c /usr/lib/libresolv.a -o test
$
I have repeated this behaviour in Woody.
Code (test.c)
====================
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <netdb.h>
int main(void) {
char domain[] = "debian.org";
int rlen;
u_char ans[PACKETSZ];
u_char *cp;
ns_msg handle;
ns_rr rr;
int i;
int prio;
char mx[MAXDNAME + 1];
rlen = res_query(domain, C_IN, T_MX, ans, PACKETSZ);
if(rlen < 0) {
herror("resolver");
return 1;
}
if (ns_initparse(ans, rlen, &handle) < 0) {
perror("ns_initparse");
return(1);
}
if(ns_msg_count(handle, ns_s_an) == 0) {
return(1);
}
for(i = 0; i < ns_msg_count(handle, ns_s_an); i++) {
if(ns_parserr(&handle, ns_s_an, i, &rr) < 0) {
perror("ns_parserr");
continue;
}
cp = (u_char *)ns_rr_rdata(rr);
prio = ns_get16(cp);
if(ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
cp + 2, mx, sizeof(mx)) < 0) {
perror("ns_name_uncompress");
continue;
}
printf("prio: %d, mx: %s\n", prio, mx);
}
return 0;
}
=========================
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (900, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-1-686
Locale: LANG=es_AR, LC_CTYPE=es_AR (charmap=ISO-8859-1)
Versions of packages libc6 depends on:
ii libdb1-compat 2.1.3-7 The Berkeley database routines [gl
-- no debconf information
--- End Message ---
--- Begin Message ---
- To: 291609-done@bugs.debian.org
- Subject: Re: libc6: Missing funcions in libresolv
- From: Jonathan Nieder <jrnieder@gmail.com>
- Date: Sat, 4 Jun 2011 04:37:52 -0500
- Message-id: <20110604093752.GA9958@elie>
- In-reply-to: <E1Cs54P-0008Qy-00@asterix.decidir.net>
- References: <E1Cs54P-0008Qy-00@asterix.decidir.net>
Version: 2.9-1
Hi Martin,
Martin Ferrari wrote:
> I'm using functions defined in arpa/nameser.h, undocumented in libc, but
> explained in chapter 12 of O'Reilly's DNS & BIND (ISBN: 0-596-00158-4).
> I do think that this lack of documentation is also a bug.
>
> They are included in /usr/lib/libresolv.a from libc6-dev package, but
> not in libresolv.so. Below is included a small example program to
> demonstrate this.
This seems to have been fixed by cvs/glibc-2_9~113 (Export functions
from <arpa/nameser.h> from libresolv in version GLIBC_2.9,
2008-08-01). Thanks for reporting it.
--- End Message ---