mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
ipv4-fixes for the new Curl_dns_entry struct and Curl_resolv() proto
This commit is contained in:
parent
2cff251863
commit
0ff1ca30c3
@ -576,7 +576,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
/*
|
||||
* Connecting with IPv4-only support
|
||||
*/
|
||||
if(!remotehost->h_addr_list[0]) {
|
||||
if(!remotehost->addr->h_addr_list[0]) {
|
||||
/* If there is no addresses in the address list, then we return
|
||||
error right away */
|
||||
failf(data, "no address available");
|
||||
@ -603,16 +603,16 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
/* This is the loop that attempts to connect to all IP-addresses we
|
||||
know for the given host. One by one. */
|
||||
for(rc=-1, aliasindex=0;
|
||||
rc && (struct in_addr *)remotehost->h_addr_list[aliasindex];
|
||||
rc && (struct in_addr *)remotehost->addr->h_addr_list[aliasindex];
|
||||
aliasindex++) {
|
||||
struct sockaddr_in serv_addr;
|
||||
|
||||
/* do this nasty work to do the connect */
|
||||
memset((char *) &serv_addr, '\0', sizeof(serv_addr));
|
||||
memcpy((char *)&(serv_addr.sin_addr),
|
||||
(struct in_addr *)remotehost->h_addr_list[aliasindex],
|
||||
(struct in_addr *)remotehost->addr->h_addr_list[aliasindex],
|
||||
sizeof(struct in_addr));
|
||||
serv_addr.sin_family = remotehost->h_addrtype;
|
||||
serv_addr.sin_family = remotehost->addr->h_addrtype;
|
||||
serv_addr.sin_port = htons((unsigned short)port);
|
||||
|
||||
rc = connect(sockfd, (struct sockaddr *)&serv_addr,
|
||||
@ -688,7 +688,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
|
||||
if(addr)
|
||||
/* this is the address we've connected to */
|
||||
*addr = (struct in_addr *)remotehost->h_addr_list[aliasindex];
|
||||
*addr = (struct in_addr *)remotehost->addr->h_addr_list[aliasindex];
|
||||
#endif
|
||||
|
||||
/* allow NULL-pointers to get passed in */
|
||||
|
@ -1183,7 +1183,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
*
|
||||
*/
|
||||
struct sockaddr_in sa;
|
||||
struct hostent *h=NULL;
|
||||
struct Curl_dns_entry *h=NULL;
|
||||
unsigned short porttouse;
|
||||
char myhost[256] = "";
|
||||
bool sa_filled_in = FALSE;
|
||||
@ -1229,8 +1229,8 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
if(!sa_filled_in) {
|
||||
memset((char *)&sa, 0, sizeof(sa));
|
||||
memcpy((char *)&sa.sin_addr,
|
||||
h->h_addr,
|
||||
h->h_length);
|
||||
h->addr->h_addr,
|
||||
h->addr->h_length);
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
@ -1276,7 +1276,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
struct in_addr in;
|
||||
unsigned short ip[5];
|
||||
(void) memcpy(&in.s_addr,
|
||||
h?*h->h_addr_list:(char *)&sa.sin_addr.s_addr,
|
||||
h?*h->addr->h_addr_list:(char *)&sa.sin_addr.s_addr,
|
||||
sizeof (in.s_addr));
|
||||
|
||||
#ifdef HAVE_INET_NTOA_R
|
||||
|
@ -1580,7 +1580,7 @@ static CURLcode ConnectPlease(struct connectdata *conn,
|
||||
memset((char *) &conn->serv_addr, '\0', sizeof(conn->serv_addr));
|
||||
memcpy((char *)&(conn->serv_addr.sin_addr),
|
||||
(struct in_addr *)addr, sizeof(struct in_addr));
|
||||
conn->serv_addr.sin_family = hostaddr->h_addrtype;
|
||||
conn->serv_addr.sin_family = hostaddr->addr->h_addrtype;
|
||||
conn->serv_addr.sin_port = htons((unsigned short)conn->port);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user