mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
sftp: improved checks for create dir failures
Since negative values are errors and not only -1. This makes SFTP upload with --create-dirs work (again). Closes #1269
This commit is contained in:
parent
f77dabefd8
commit
af30f1152d
10
lib/ssh.c
10
lib/ssh.c
@ -918,6 +918,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
&err_msg, NULL, 0);
|
&err_msg, NULL, 0);
|
||||||
infof(data, "SSH public key authentication failed: %s\n", err_msg);
|
infof(data, "SSH public key authentication failed: %s\n", err_msg);
|
||||||
state(conn, SSH_AUTH_PASS_INIT);
|
state(conn, SSH_AUTH_PASS_INIT);
|
||||||
|
rc = 0; /* clear rc and continue */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -928,6 +929,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state(conn, SSH_AUTH_HOST_INIT);
|
state(conn, SSH_AUTH_HOST_INIT);
|
||||||
|
rc = 0; /* clear rc and continue */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -989,6 +991,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
infof(data, "Failure connecting to agent\n");
|
infof(data, "Failure connecting to agent\n");
|
||||||
state(conn, SSH_AUTH_KEY_INIT);
|
state(conn, SSH_AUTH_KEY_INIT);
|
||||||
|
rc = 0; /* clear rc and continue */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state(conn, SSH_AUTH_AGENT_LIST);
|
state(conn, SSH_AUTH_AGENT_LIST);
|
||||||
@ -1008,6 +1011,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
infof(data, "Failure requesting identities to agent\n");
|
infof(data, "Failure requesting identities to agent\n");
|
||||||
state(conn, SSH_AUTH_KEY_INIT);
|
state(conn, SSH_AUTH_KEY_INIT);
|
||||||
|
rc = 0; /* clear rc and continue */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state(conn, SSH_AUTH_AGENT);
|
state(conn, SSH_AUTH_AGENT);
|
||||||
@ -1800,6 +1804,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
(data->set.ftp_create_missing_dirs &&
|
(data->set.ftp_create_missing_dirs &&
|
||||||
(strlen(sftp_scp->path) > 1))) {
|
(strlen(sftp_scp->path) > 1))) {
|
||||||
/* try to create the path remotely */
|
/* try to create the path remotely */
|
||||||
|
rc = 0; /* clear rc and continue */
|
||||||
sshc->secondCreateDirs = 1;
|
sshc->secondCreateDirs = 1;
|
||||||
state(conn, SSH_SFTP_CREATE_DIRS_INIT);
|
state(conn, SSH_SFTP_CREATE_DIRS_INIT);
|
||||||
break;
|
break;
|
||||||
@ -1936,7 +1941,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
}
|
}
|
||||||
*sshc->slash_pos = '/';
|
*sshc->slash_pos = '/';
|
||||||
++sshc->slash_pos;
|
++sshc->slash_pos;
|
||||||
if(rc == -1) {
|
if(rc < 0) {
|
||||||
/*
|
/*
|
||||||
* Abort if failure wasn't that the dir already exists or the
|
* Abort if failure wasn't that the dir already exists or the
|
||||||
* permission was denied (creation might succeed further down the
|
* permission was denied (creation might succeed further down the
|
||||||
@ -1951,6 +1956,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
sshc->actualcode = result?result:CURLE_SSH;
|
sshc->actualcode = result?result:CURLE_SSH;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
rc = 0; /* clear rc and continue */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
state(conn, SSH_SFTP_CREATE_DIRS);
|
state(conn, SSH_SFTP_CREATE_DIRS);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user