Error reported from libssh on empty directory

Please post here if you have problems in using Wing FTP Server.
Post Reply
devmassey
Posts: 3
Joined: Fri May 22, 2020 10:02 pm

Error reported from libssh on empty directory

Post 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?
FTP
Site Admin
Posts: 1917
Joined: Tue Sep 29, 2009 6:09 am

Re: Error reported from libssh on empty directory

Post by FTP »

Sorry, I don't know about your meaning, which version of WingFTP are you using?
devmassey
Posts: 3
Joined: Fri May 22, 2020 10:02 pm

Re: Error reported from libssh on empty directory

Post 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?
FTP
Site Admin
Posts: 1917
Joined: Tue Sep 29, 2009 6:09 am

Re: Error reported from libssh on empty directory

Post 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.
devmassey
Posts: 3
Joined: Fri May 22, 2020 10:02 pm

Re: Error reported from libssh on empty directory

Post 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
Post Reply