Page 1 of 1

Error reported from libssh on empty directory

Posted: Fri May 22, 2020 10:24 pm
by devmassey
I am seeing the error message "Count of files sent by the server is zero, which is invalid, or libsftp bug" when listing an empty directory using libssh v0.8.3

I downloaded and installed WingFTPServer and created a simple installation, no special settings. I created two User accounts; one without any content in the HOME folder the other with a single folder. Then I connect to the server and list the contents of the base directory.

If there are files or directories in the HOME folder, then they are reported by libssh. However, if the HOME folder is empty then libssh indicates a processing error and sets the error message to the above.

Is there a server setting I can change to at least get "." returned from an empty directory?

Re: Error reported from libssh on empty directory

Posted: Sat May 23, 2020 3:20 am
by FTP
Sorry, I don't know about your meaning, which version of WingFTP are you using?

Re: Error reported from libssh on empty directory

Posted: Mon May 25, 2020 6:53 pm
by devmassey
I am seeing this behavior with both Wing FTP v6.3.5 and v6.2.8.

Reading the source code for libssh, it appears that when the SFTP client sends a directory listing query (packet type 12) the server responds with a name response (packet type 104) which contains 0 names.

If I understand the error string, libssh considers this an invalid response.

So my question is if there is a server setting I can change to have the server generate more than 0 responses is if directory is empty. Or is this an error in Wing FTP or libssh?

Re: Error reported from libssh on empty directory

Posted: Tue May 26, 2020 1:46 am
by FTP
Which SFTP client are you using? There is no problem if the requested folder is empty.
The server will always return the packet type 104 for the directory request, it means the SSH_FXP_NAME packet, not "invalid response" you thought about.

Re: Error reported from libssh on empty directory

Posted: Tue May 26, 2020 5:48 pm
by devmassey
I'm sorry, I meant that the "zero entries" reported within the SSH_FXP_NAME packet are considered an invalid response.

Using current libssh as the client

https://git.libssh.org/projects/libssh. ... tp.c#n1613" rel="nofollow