aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-04-28 21:29:17 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-04-28 21:29:17 +0000
commit7a6cff4b3a28d828d344b80c74ab2e28ee2c8cdf (patch)
tree3b4741f8872d2007eb9f6fc47365c677edaf8935 /lib
parentc3ba2198b18fd54537accf02f4d0816c2ea1e504 (diff)
- Norbert Frese filed bug report #1951588: "Problem with curlftpfs and
libcurl" (http://curl.haxx.se/bug/view.cgi?id=1951588) which seems to be an identical report to what Denis Golovan reported in http://curl.haxx.se/mail/lib-2008-02/0108.html The FTP code didn't reset the user/password pointers properly even though there might've been a new struct/cconnection getting used.
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 02f9a2ac8..649da81d6 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3006,20 +3006,22 @@ static CURLcode ftp_easy_statemach(struct connectdata *conn)
static CURLcode ftp_init(struct connectdata *conn)
{
struct SessionHandle *data = conn->data;
- struct FTP *ftp;
- if(data->state.proto.ftp)
- return CURLE_OK;
-
- ftp = (struct FTP *)calloc(sizeof(struct FTP), 1);
- if(!ftp)
- return CURLE_OUT_OF_MEMORY;
+ struct FTP *ftp = data->state.proto.ftp;
+ if(!ftp) {
+ ftp = (struct FTP *)calloc(sizeof(struct FTP), 1);
+ if(!ftp)
+ return CURLE_OUT_OF_MEMORY;
- data->state.proto.ftp = ftp;
+ data->state.proto.ftp = ftp;
+ }
/* get some initial data into the ftp struct */
ftp->bytecountp = &data->req.bytecount;
- /* no need to duplicate them, this connectdata struct won't change */
+ /* No need to duplicate user+password, the connectdata struct won't change
+ during a session, but we re-init them here since on subsequent inits
+ since the conn struct may have changed or been replaced.
+ */
ftp->user = conn->user;
ftp->passwd = conn->passwd;
if(isBadFtpString(ftp->user) || isBadFtpString(ftp->passwd))