mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
gethostbyname isn't reentrant, who knew...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1925,7 +1925,7 @@ static struct iax2_user *mysql_user(char *user)
|
||||
|
||||
static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, int *maxtime, char *peer, char *context, int *trunk, int *notransfer, char *secret, int seclen)
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct ast_hostent ahp; struct hostent *hp;
|
||||
struct iax2_peer *p;
|
||||
int found=0;
|
||||
if (sendani)
|
||||
@@ -1980,7 +1980,7 @@ static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, i
|
||||
}
|
||||
}
|
||||
if (!p && !found) {
|
||||
hp = gethostbyname(peer);
|
||||
hp = ast_gethostbyname(peer, &ahp);
|
||||
if (hp) {
|
||||
memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
|
||||
sin->sin_port = htons(IAX_DEFAULT_PORTNO);
|
||||
@@ -3860,7 +3860,7 @@ static int iax2_register(char *value, int lineno)
|
||||
char *porta;
|
||||
char *stringp=NULL;
|
||||
|
||||
struct hostent *hp;
|
||||
struct ast_hostent ahp; struct hostent *hp;
|
||||
if (!value)
|
||||
return -1;
|
||||
strncpy(copy, value, sizeof(copy)-1);
|
||||
@@ -3882,7 +3882,7 @@ static int iax2_register(char *value, int lineno)
|
||||
ast_log(LOG_WARNING, "%s is not a valid port number at line %d\n", porta, lineno);
|
||||
return -1;
|
||||
}
|
||||
hp = gethostbyname(hostname);
|
||||
hp = ast_gethostbyname(hostname, &ahp);
|
||||
if (!hp) {
|
||||
ast_log(LOG_WARNING, "Host '%s' not found at line %d\n", hostname, lineno);
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user