This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: most buggy function in glibc 8)


more debuggineg:


NSCD isn't running and :

ME: before gethostbyname2_r() call in line:

rc = gethostbyname2_r (name,  AF_INET , &th, tmpbuf, tmpbuflen, &h, &herrno);
	  } while (rc == ERANGE && herrno == NETDB_INTERNAL);

ME: I get:
(xxgdb) print name
$1 = 0x80696e8 "test.misiek.eu.org"
(xxgdb) print th
$2 = {
  h_name = 0x0, 
  h_aliases = 0x80695d8, 
  h_addrtype = -1073744244, 
  h_length = 134581987, 
  h_addr_list = 0x0
}
(xxgdb) print tmpbuf
$3 = 0xbffff700 ""
(xxgdb) print tmpbuf
$3 = 0xbffff700 ""
(xxgdb) print tmpbuflen
$4 = 1024
(xxgdb) print h
$5 = (struct hostent *) 0x0
(xxgdb) print herrno
$6 = 1074887484
(xxgdb) 

ME: and after executing gethostbyname2_r() function I checked:
(xxgdb) print name
$17 = 0x80694f8 "test.misiek.eu.org"
(xxgdb) print th
$18 = {
  h_name = 0xbfffef6b "test.misiek.eu.org", 
  h_aliases = 0xbfffedc4, 
  h_addrtype = 10,  /* IMHO here should be 2 (AF_INET) not 10 (AF_INET6) */
  h_length = 16,    /* and here should be 4 (sizeof(struct in_addr)) */
  h_addr_list = 0xbfffee94
}
(xxgdb) print tmpbuf
$19 = 0xbffff614 "Tö˙ż\004"
(xxgdb) print rc
$29 = 0
(xxgdb) print *h
$30 = {
  h_name = 0xbfffef6b "test.misiek.eu.org", 
  h_aliases = 0xbfffedc4, 
  h_addrtype = 10, /* should be 10 */
  h_length = 16,  /* and 4 */
  h_addr_list = 0xbfffee94
}
(xxgdb) print h.h_addr_list[0]
$31 = 0xbfffef88 "" /* and there is no usable data but (was
		       no error (rc=0)) */
(xxgdb) print h.h_addr_list[1]
$32 = 0x0 /* end of list */

and then s_addr is filled with zeros:
		struct sockaddr_in *sinp =
		  (struct sockaddr_in *) (*pai)->ai_addr;

(xxgdb) print sinp
$35 = (struct sockaddr_in *) 0x8069670
(xxgdb) print *sinp
$36 = {
  sin_family = 2, 
  sin_port = 0, 
  sin_addr = {
    s_addr = 0 /* zeros instead of data about test.misiek.eu.org */
  }, 
  sin_zero = "\000\000\000\000\000\000\000"
}
--------------------------------------------------------------------
Now I did that same debugging but with NSCD running.

(xxgdb) print name
$8 = 0x8068470 "test.misiek.eu.org"
(xxgdb) print th
$9 = {
  h_name = 0xbfffedd0 "test.misiek.eu.org", 
  h_aliases = 0xbfffedc4, 
  h_addrtype = 2,
  h_length = 4, 
  h_addr_list = 0xbfffedc8
}
(xxgdb) print tmpbuf
$10 = 0xbffff654 "Đí˙żÄí˙ż\002"
(xxgdb) print rc
$11 = 0
(xxgdb) print *h
$12 = {
  h_name = 0xbfffedd0 "test.misiek.eu.org", 
  h_aliases = 0xbfffedc4, 
  h_addrtype = 2, /* Proper family AF_INET */ 
  h_length = 4,   /* Proper size (sizeof(struct in_adr))
  h_addr_list = 0xbfffedc8
}
(xxgdb) print h.h_addr_list[0]
$16 = 0xbfffede4 "\f\f\f\f\021ě\005\b" /* and we have what we want ! */
(xxgdb) print h.h_addr_list[1]
$17 = 0x0

So gethostbyname2_r() is returning wrong struct hostent (?) ;-(
The main problem is that I can't create test program because
... my testing program always works properly 8) Only in postfix
I can see the problem.

I don't know why that hapends.

One more time: getaddrinfo is called in this way:
static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRING *why)
{
    struct addrinfo hints, *res0, *res;
    int gaierror = -1;

    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    gaierror = getaddrinfo(host, NULL, &hints, &res0);
    if (gaierror)
...


PS. Urlich - please fix this ,,returning ipv4 mapped to ipv6'' bug
    in nscd.

-- 
Arkadiusz Miśkiewicz        http://www.misiek.eu.org/
PLD/Linux [IPv6 enabled]       http://www.pld.org.pl/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]