Commit 5f082498 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Fix some status callbacks to return a string instead of a sockaddr structure.

Spotted by Juan Lang.
parent e7906026
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
...@@ -2440,6 +2443,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, ...@@ -2440,6 +2443,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
ftp_session_t *lpwfs = NULL; ftp_session_t *lpwfs = NULL;
HINTERNET handle = NULL; HINTERNET handle = NULL;
char szaddr[INET_ADDRSTRLEN];
TRACE("%p Server(%s) Port(%d) User(%s) Paswd(%s)\n", TRACE("%p Server(%s) Port(%d) User(%s) Paswd(%s)\n",
hIC, debugstr_w(lpszServerName), hIC, debugstr_w(lpszServerName),
...@@ -2544,15 +2548,17 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, ...@@ -2544,15 +2548,17 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
goto lerror; goto lerror;
} }
SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_NAME_RESOLVED,
(LPWSTR) lpszServerName, strlenW(lpszServerName));
if (socketAddr.sin_family != AF_INET) if (socketAddr.sin_family != AF_INET)
{ {
WARN("unsupported address family %d\n", socketAddr.sin_family); WARN("unsupported address family %d\n", socketAddr.sin_family);
INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT); INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT);
goto lerror; goto lerror;
} }
inet_ntop(socketAddr.sin_family, &socketAddr.sin_addr, szaddr, sizeof(szaddr));
SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_NAME_RESOLVED,
szaddr, strlen(szaddr)+1);
nsocket = socket(AF_INET,SOCK_STREAM,0); nsocket = socket(AF_INET,SOCK_STREAM,0);
if (nsocket == -1) if (nsocket == -1)
{ {
...@@ -2561,7 +2567,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, ...@@ -2561,7 +2567,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
} }
SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_CONNECTING_TO_SERVER, SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_CONNECTING_TO_SERVER,
&socketAddr, sock_namelen); szaddr, strlen(szaddr)+1);
if (connect(nsocket, (struct sockaddr *)&socketAddr, sock_namelen) < 0) if (connect(nsocket, (struct sockaddr *)&socketAddr, sock_namelen) < 0)
{ {
...@@ -2574,7 +2580,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, ...@@ -2574,7 +2580,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
TRACE("Connected to server\n"); TRACE("Connected to server\n");
lpwfs->sndSocket = nsocket; lpwfs->sndSocket = nsocket;
SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_CONNECTED_TO_SERVER, SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_CONNECTED_TO_SERVER,
&socketAddr, sock_namelen); szaddr, strlen(szaddr)+1);
sock_namelen = sizeof(lpwfs->socketAddress); sock_namelen = sizeof(lpwfs->socketAddress);
getsockname(nsocket, (struct sockaddr *) &lpwfs->socketAddress, &sock_namelen); getsockname(nsocket, (struct sockaddr *) &lpwfs->socketAddress, &sock_namelen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment