diff options
author | Aron Xu <aron@debian.org> | 2015-09-21 22:55:55 +0800 |
---|---|---|
committer | Aron Xu <aron@debian.org> | 2015-09-21 22:55:55 +0800 |
commit | e85cf827a804d9abf4cbf48af6394c49331de322 (patch) | |
tree | aab761b5168447ea51ad1a64c9e1594e48f84b12 /nanoftp.c | |
parent | 4b692ee8530176868e4832e30bdc4ba5bc145948 (diff) | |
download | libxml2-e85cf827a804d9abf4cbf48af6394c49331de322.tar.gz |
Revert "Merge tag 'upstream/2.9.1+dfsg1'"
This reverts commit 21ee18bdbc9a9d4500e12a1399d51c593b8b31d4, reversing
changes made to de338c1adfa336ddb5177ceb5c63bcd868a0ebc7.
Diffstat (limited to 'nanoftp.c')
-rw-r--r-- | nanoftp.c | 46 |
1 files changed, 27 insertions, 19 deletions
@@ -775,7 +775,7 @@ xmlNanoFTPSendUser(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -803,7 +803,7 @@ xmlNanoFTPSendPasswd(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -834,7 +834,7 @@ xmlNanoFTPQuit(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); /* Just to be consistent, even though we know it can't have a % in it */ #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -908,6 +908,8 @@ xmlNanoFTPConnect(void *ctx) { return (-1); } if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) { + if (result) + freeaddrinfo (result); __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch"); return (-1); } @@ -928,9 +930,9 @@ xmlNanoFTPConnect(void *ctx) { #endif { if (proxy) - hp = gethostbyname (proxy); + hp = gethostbyname (GETHOSTBYNAME_ARG_CAST proxy); else - hp = gethostbyname (ctxt->hostname); + hp = gethostbyname (GETHOSTBYNAME_ARG_CAST ctxt->hostname); if (hp == NULL) { __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname failed"); return (-1); @@ -1028,7 +1030,7 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); @@ -1050,7 +1052,7 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); @@ -1091,7 +1093,7 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; @@ -1122,7 +1124,7 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; @@ -1144,7 +1146,7 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; @@ -1244,7 +1246,13 @@ xmlNanoFTPConnectTo(const char *server, int port) { if (port <= 0) return(NULL); ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL); + if (ctxt == NULL) + return(NULL); ctxt->hostname = xmlMemStrdup(server); + if (ctxt->hostname == NULL) { + xmlNanoFTPFreeCtxt(ctxt); + return(NULL); + } if (port != 0) ctxt->port = port; res = xmlNanoFTPConnect(ctxt); @@ -1288,7 +1296,7 @@ xmlNanoFTPCwd(void *ctx, const char *directory) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -1321,8 +1329,8 @@ xmlNanoFTPDele(void *ctx, const char *file) { int len; int res; - if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || (file == NULL)) return(-1); - if (file == NULL) return (0); + if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || + (file == NULL)) return(-1); /* * Expected response code for DELE: @@ -1339,7 +1347,7 @@ xmlNanoFTPDele(void *ctx, const char *file) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -1411,7 +1419,7 @@ xmlNanoFTPGetConnection(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; @@ -1512,7 +1520,7 @@ xmlNanoFTPGetConnection(void *ctx) { xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; @@ -1749,7 +1757,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; @@ -1844,7 +1852,7 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; @@ -1864,7 +1872,7 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; |