- Brian Ulm figured out that if you did an SFTP upload with
CURLOPT_FTP_CREATE_MISSING_DIRS to create a directory, and then re-used the handle and uploaded another file to another directory that needed to be created, the second upload would fail. Another case of a state variable that wasn't properly reset between requests.
This commit is contained in:
parent
553ed99e3b
commit
ad4a9955c5
@ -1226,10 +1226,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err = libssh2_sftp_last_error(sshc->sftp_session);
|
err = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
failf(data, "Upload failed: %s", sftp_libssh2_strerror(err));
|
|
||||||
if(sshc->secondCreateDirs) {
|
if(sshc->secondCreateDirs) {
|
||||||
state(conn, SSH_SFTP_CLOSE);
|
state(conn, SSH_SFTP_CLOSE);
|
||||||
sshc->actualcode = sftp_libssh2_error_to_CURLE(err);
|
sshc->actualcode = sftp_libssh2_error_to_CURLE(err);
|
||||||
|
failf(data, "Creating the dir/file failed: %s",
|
||||||
|
sftp_libssh2_strerror(err));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
|
else if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
|
||||||
@ -1244,6 +1245,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
state(conn, SSH_SFTP_CLOSE);
|
state(conn, SSH_SFTP_CLOSE);
|
||||||
sshc->actualcode = sftp_libssh2_error_to_CURLE(err);
|
sshc->actualcode = sftp_libssh2_error_to_CURLE(err);
|
||||||
|
failf(data, "Upload failed: %s", sftp_libssh2_strerror(err));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1966,8 +1968,10 @@ static CURLcode ssh_init(struct connectdata *conn)
|
|||||||
{
|
{
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
struct SSHPROTO *ssh;
|
struct SSHPROTO *ssh;
|
||||||
|
struct ssh_conn *sshc = &conn->proto.sshc;
|
||||||
|
|
||||||
conn->proto.sshc.actualcode = CURLE_OK; /* reset error code */
|
sshc->actualcode = CURLE_OK; /* reset error code */
|
||||||
|
sshc->secondCreateDirs =0; /* reset the create dir attempt state variable */
|
||||||
|
|
||||||
if(data->state.proto.ssh)
|
if(data->state.proto.ssh)
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user