summaryrefslogtreecommitdiff
path: root/nanoftp.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-10-11 22:55:55 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-10-11 22:55:55 +0000
commitb44025c72b7472971a061b022cfe422adc42715d (patch)
tree8286242ccaba46dbede84aa092cce816cbc1f5aa /nanoftp.c
parent75b96824bccaeadd9e71eba9be7fab1bd88ac814 (diff)
downloadlibxml2-b44025c72b7472971a061b022cfe422adc42715d.tar.gz
started integrating the non-controversial parts of Gary Pennington
* HTMLtree.c catalog.c debugXML.c entities.c nanoftp.c parser.c valid.c xmlmemory.c xpath.c xpointer.c: started integrating the non-controversial parts of Gary Pennington multithread patches * catalog.c: corrected a small bug introduced Daniel
Diffstat (limited to 'nanoftp.c')
-rw-r--r--nanoftp.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/nanoftp.c b/nanoftp.c
index 1080e6d1..1d078fda 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -74,8 +74,6 @@
#define SOCKET int
#endif
-static char hostname[100];
-
#define FTP_COMMAND_OK 200
#define FTP_SYNTAX_ERROR 500
#define FTP_GET_PASSWD 331
@@ -99,6 +97,7 @@ typedef struct xmlNanoFTPCtxt {
int controlBufIndex;
int controlBufUsed;
int controlBufAnswer;
+ char localhostname[100];
} xmlNanoFTPCtxt, *xmlNanoFTPCtxtPtr;
static int initialized = 0;
@@ -131,8 +130,6 @@ xmlNanoFTPInit(void) {
return;
#endif
- gethostname(hostname, sizeof(hostname));
-
proxyPort = 21;
env = getenv("no_proxy");
if (env != NULL)
@@ -177,7 +174,6 @@ xmlNanoFTPCleanup(void) {
xmlFree(proxyPasswd);
proxyPasswd = NULL;
}
- hostname[0] = 0;
#ifdef _WINSOCKAPI_
if (initialized)
WSACleanup();
@@ -480,6 +476,7 @@ xmlNanoFTPNewCtxt(const char *URL) {
ret->returnValue = 0;
ret->controlBufIndex = 0;
ret->controlBufUsed = 0;
+ gethostname(ret->localhostname, sizeof(ret->localhostname));
if (URL != NULL)
xmlNanoFTPScanURL(ret, URL);
@@ -778,7 +775,7 @@ xmlNanoFTPSendPasswd(void *ctx) {
int res;
if (ctxt->passwd == NULL)
- snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", hostname);
+ snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", ctxt->localhostname);
else
snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
buf[sizeof(buf) - 1] = 0;
@@ -951,7 +948,7 @@ xmlNanoFTPConnect(void *ctx) {
snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
else
snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n",
- hostname);
+ ctxt->localhostname);
buf[sizeof(buf) - 1] = 0;
len = strlen(buf);
#ifdef DEBUG_FTP
@@ -1040,7 +1037,8 @@ xmlNanoFTPConnect(void *ctx) {
return(0);
}
if (ctxt->passwd == NULL)
- snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", hostname);
+ snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n",
+ ctxt->localhostname);
else
snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
buf[sizeof(buf) - 1] = 0;