1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

John Hartnup reports that Apache SSHD's SFTP server responds to

FXP_READDIR on an empty directory by returning a zero-length list of
filenames, instead of the more common response of a list containing
just "." and "..". Stop PSFTP failing an assertion when that happens.

[originally from svn r9569]
This commit is contained in:
Simon Tatham 2012-06-20 17:39:32 +00:00
parent 72640ff615
commit a580c22c24

12
psftp.c
View File

@ -830,7 +830,17 @@ char *sftp_wildcard_get_filename(SftpWildcardMatcher *swcm)
printf("%s: reading directory: %s\n", swcm->prefix,
fxp_error());
return NULL;
}
} else if (swcm->names->nnames == 0) {
/*
* Another failure mode which we treat as EOF is if
* the server reports success from FXP_READDIR but
* returns no actual names. This is unusual, since
* from most servers you'd expect at least "." and
* "..", but there's nothing forbidding a server from
* omitting those if it wants to.
*/
return NULL;
}
swcm->namepos = 0;
}