summaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-04-15 13:49:18 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-04-26 18:17:10 +0200
commitd5ec44ca4cca9bbe6c21a1d2a94b37cba77661ff (patch)
tree7d4f6429f80bacd0a314726572bdddbc265f7c72 /lib/ssh.c
parent9c941e92c4bd3d2a5dbe243f7517b6a6029afc6e (diff)
downloadcurl-d5ec44ca4cca9bbe6c21a1d2a94b37cba77661ff.tar.gz
INFILESIZE: fields in UserDefined must not be changed run-time
set.infilesize in this case was modified in several places, which could lead to repeated requests using the same handle to get unintendent/wrong consequences based on what the previous request did!
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index ad6d3226e..5e18ca722 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -1717,17 +1717,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
/* now, decrease the size of the read */
- if(data->set.infilesize > 0) {
- data->set.infilesize -= data->state.resume_from;
- data->req.size = data->set.infilesize;
- Curl_pgrsSetUploadSize(data, data->set.infilesize);
+ if(data->state.infilesize > 0) {
+ data->state.infilesize -= data->state.resume_from;
+ data->req.size = data->state.infilesize;
+ Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
}
- if(data->set.infilesize > 0) {
- data->req.size = data->set.infilesize;
- Curl_pgrsSetUploadSize(data, data->set.infilesize);
+ if(data->state.infilesize > 0) {
+ data->req.size = data->state.infilesize;
+ Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
/* upload data */
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);
@@ -2256,7 +2256,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
if(data->set.upload) {
- if(data->set.infilesize < 0) {
+ if(data->state.infilesize < 0) {
failf(data, "SCP requires a known file size for upload");
sshc->actualcode = CURLE_UPLOAD_FAILED;
state(conn, SSH_SCP_CHANNEL_FREE);
@@ -2278,7 +2278,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
sshc->ssh_channel =
SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,
- data->set.infilesize);
+ data->state.infilesize);
if(!sshc->ssh_channel) {
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {