- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
struct hostent *rc_gethostbyname(const char *hostname)
{
struct hostent *hp;
#ifdef GETHOSTBYNAME_R
#if defined (GETHOSTBYNAMERSTYLE_SYSV) || defined (GETHOSTBYNAMERSTYLE_GNU)
struct hostent hostbuf;
size_t hostbuflen;
char *tmphostbuf;
int res;
int herr;
hostbuflen = 1024;
tmphostbuf = malloc(hostbuflen);
#endif
#endif
#ifdef GETHOSTBYNAME_R
#if defined (GETHOSTBYNAMERSTYLE_GNU)
while ((res = gethostbyname_r(hostname, &hostbuf, tmphostbuf, hostbuflen, &hp, &herr)) == ERANGE)
{
/* Enlarge the buffer */
hostbuflen *= 2;
tmphostbuf = realloc(tmphostbuf, hostbuflen);
}
free(tmphostbuf);
#elif defined (GETHOSTBYNAMERSTYLE_SYSV)
hp = gethostbyname_r(hostname, &hostbuf, tmphostbuf, hostbuflen, &herr);
free(tmphostbuf);
#else
hp = gethostbyname(hostname);
#endif
#else
hp = gethostbyname(hostname);
#endif
if (hp == NULL) {
return NULL;
}
return hp;
}
freeradius-client 1.1.6, казалось бы серьезная либа... Говно мамонта, конечно, но оно валяется в репе бубунты 14.10... Неужели никто еще не заметил? :)