[612] in Pthreads mailing list archive
Bug Report
daemon@ATHENA.MIT.EDU (Josip Gracin)
Wed Mar 19 18:00:57 1997
Date: Wed, 19 Mar 1997 23:44:02 -0100 (GMT)
From: Josip Gracin <jg32676@pinus.cc.fer.hr>
To: pthreads@MIT.EDU
Hello!
I _think_ I've found a bug in pthreads-1.60_beta6. I don't know if
this has already been reported. If so, sorry for the redundancy.
Bug:
****
The function gethostbyname does not recognize aliases for hosts. If
gethostbyname is called with an alias hostname as a parameter instead
of a full hostname, the function returns error value.
How to repeat the bug:
**********************
In my /etc/hosts there is a line
192.168.1.1 genoveva.fer.hr genoveva
If I call gethostbyname("genoveva") error value is returned.
If I call gethostbyname("genoveva.fer.hr") everything works all right.
$SOURCE_ROOT/tests/test_netdb was used to check this and it FAILED.
Elaboration:
************
From what I can say, the bug is in function file_find_name() which is
located in file $SOURCE_ROOT/net/gethostbyname.c.
Here is a code excerpt.
static struct hostent *file_find_name(const char *name, ...
{
.......
while ((result = gethostent_r(result, .......)) ) {
/* Check the entry's name and aliases against the
given name. */
if (strcasecmp(result->h_name, name) == 0)
break;
for (alias = result->h_aliases; *alias; alias++) {
if (strcasecmp(*alias, name) == 0)
break;
/* !!!!! HERE !!!!! That 'break' should probably exit the 'while'
loop, but it of course exits only 'for' loop. */
}
}
.......
}
Evidently, this is very easy to correct. After I did the necessery
modifications, everything worked all right (tests/test_netdb PASSED).
That's about it. Keep up a good work!
Regards,
Josip
______________________________________
/____________________________________ /|
| | |
| Josip Gracin | |
| Faculty of EE and CS | |
| Zagreb, CROATIA | |
| Email: grac@fly.cc.fer.hr | |
| Home: http://fly.cc.fer.hr/~grac | |
|_____________________________________|/