mirror of
https://github.com/curl/curl.git
synced 2026-04-23 22:52:13 +03:00
libssh: fix readdir issues
Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com> Closes #17856
This commit is contained in:
parent
b270fec68d
commit
ac8271d020
1 changed files with 11 additions and 3 deletions
|
|
@ -648,7 +648,7 @@ static int myssh_in_SFTP_READDIR(struct Curl_easy *data,
|
|||
myssh_to(data, sshc, SSH_SFTP_READDIR_DONE);
|
||||
}
|
||||
else {
|
||||
failf(data, "Could not open remote file for reading: %s",
|
||||
failf(data, "Could not open remote directory for reading: %s",
|
||||
ssh_get_error(sshc->ssh_session));
|
||||
return myssh_to_SFTP_CLOSE(data, sshc);
|
||||
}
|
||||
|
|
@ -663,7 +663,7 @@ static int myssh_in_SFTP_READDIR_LINK(struct Curl_easy *data,
|
|||
|
||||
sshc->readdir_link_attrs = sftp_lstat(sshc->sftp_session,
|
||||
sshc->readdir_linkPath);
|
||||
if(sshc->readdir_link_attrs == 0) {
|
||||
if(!sshc->readdir_link_attrs) {
|
||||
failf(data, "Could not read symlink for reading: %s",
|
||||
ssh_get_error(sshc->ssh_session));
|
||||
return myssh_to_SFTP_CLOSE(data, sshc);
|
||||
|
|
@ -672,7 +672,7 @@ static int myssh_in_SFTP_READDIR_LINK(struct Curl_easy *data,
|
|||
if(!sshc->readdir_link_attrs->name) {
|
||||
sshc->readdir_tmp = sftp_readlink(sshc->sftp_session,
|
||||
sshc->readdir_linkPath);
|
||||
if(!sshc->readdir_filename)
|
||||
if(!sshc->readdir_tmp)
|
||||
sshc->readdir_len = 0;
|
||||
else
|
||||
sshc->readdir_len = strlen(sshc->readdir_tmp);
|
||||
|
|
@ -689,6 +689,14 @@ static int myssh_in_SFTP_READDIR_LINK(struct Curl_easy *data,
|
|||
|
||||
if(curlx_dyn_addf(&sshc->readdir_buf, " -> %s",
|
||||
sshc->readdir_filename)) {
|
||||
/* Not using:
|
||||
* return myssh_to_SFTP_CLOSE(data, sshc);
|
||||
*
|
||||
* as that assumes an sftp related error while
|
||||
* assigning sshc->actualcode whereas the current
|
||||
* error is curlx_dyn_addf() related.
|
||||
*/
|
||||
myssh_to(data, sshc, SSH_SFTP_CLOSE);
|
||||
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue