aboutsummaryrefslogtreecommitdiffstats
path: root/nanoftp.c
diff options
context:
space:
mode:
authorakirilov <akirilov@google.com>2018-06-01 13:46:04 -0700
committersyphyr <syphyr@gmail.com>2018-09-06 04:08:09 +0200
commit126c3993d2ad55db2abfe80e3d671bf584e7b13b (patch)
treef4464c225863c997e3f99d9897131f9f28df76fe /nanoftp.c
parent521b88fbb6d18312923f0df653d045384b500ffc (diff)
downloadandroid_external_libxml2-cm-13.0.tar.gz
android_external_libxml2-cm-13.0.tar.bz2
android_external_libxml2-cm-13.0.zip
Merge to pi-dev and restore Android.mk Bug: 79662501 Bug: 36809766 Bug: 36810305 Bug: 62151041 Test: manually verify functionality for regression Change-Id: Ife351c91c932eb92992656f8ea5c08724a220306 (cherry picked from commit 4e91cfdbb1a8624e5cd5a850d6e17da11d1e34a8)
Diffstat (limited to 'nanoftp.c')
-rw-r--r--nanoftp.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/nanoftp.c b/nanoftp.c
index 2135ab9b..54fa026d 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -12,8 +12,6 @@
#define HAVE_NETINET_IN_H
#define HAVE_NETDB_H
#define HAVE_SYS_TIME_H
-#else /* TESTING */
-#define NEED_SOCKETS
#endif /* TESTING */
#define IN_LIBXML
@@ -77,14 +75,8 @@
#endif
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <wsockcompat.h>
-#include <winsock2.h>
-#undef XML_SOCKLEN_T
-#define XML_SOCKLEN_T unsigned int
#endif
/**
@@ -511,6 +503,8 @@ xmlNanoFTPFreeCtxt(void * ctx) {
if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
if (ctxt->path != NULL) xmlFree(ctxt->path);
+ if (ctxt->user != NULL) xmlFree(ctxt->user);
+ if (ctxt->passwd != NULL) xmlFree(ctxt->passwd);
ctxt->passive = 1;
if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd);
ctxt->controlFd = INVALID_SOCKET;
@@ -907,7 +901,7 @@ xmlNanoFTPConnect(void *ctx) {
__xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed");
return (-1);
}
- if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
+ if ((size_t)tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
if (result)
freeaddrinfo (result);
__xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch");
@@ -1042,6 +1036,7 @@ xmlNanoFTPConnect(void *ctx) {
case 2:
if (proxyPasswd == NULL)
break;
+ /* Falls through. */
case 3:
if (proxyPasswd != NULL)
snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
@@ -1111,6 +1106,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = INVALID_SOCKET;
return(-1);
}
+ /* Falls through. */
case 2:
/* USER user@host command */
if (ctxt->user == NULL)
@@ -1164,6 +1160,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = INVALID_SOCKET;
return(-1);
}
+ /* Falls through. */
case 3:
/*
* If you need support for other Proxy authentication scheme
@@ -1212,6 +1209,7 @@ xmlNanoFTPConnect(void *ctx) {
case 3:
__xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
"FTP server asking for ACCNT on anonymous\n");
+ /* Falls through. */
case 1:
case 4:
case 5: