[Bug 581] SFTP "ls" listings never end

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Sat May 31 20:52:17 EST 2003


http://bugzilla.mindrot.org/show_bug.cgi?id=581

           Summary: SFTP "ls" listings never end
           Product: Portable OpenSSH
           Version: -current
          Platform: Alpha
        OS/Version: OSF/1
            Status: NEW
          Severity: major
          Priority: P2
         Component: sftp-server
        AssignedTo: openssh-bugs at mindrot.org
        ReportedBy: from-bugzilla at geek-central.gen.nz


When the OpenSSH SFTP server running on Compaq/HP Tru64 UNIX 5.1 
is sent an "ls" command for a directory on an NFS-mounted volume, it 
either returns an endlessly-repeating directory listing, or seems to hang 
without returning anything.

The problem has to do with the semantics of the readdir call, as used in 
the process_readdir routine in sftp-server.c. readdir returns NULL to 
indicate the end of the directory listing. However, process_readdir may 
then later call readdir again on the same directory handle. For a local 
volume, it will continue returning NULL. However, for an NFS-mounted 
volume, after returning NULL once, on Tru64 it will start returning the 
entire directory listing again.

Solution: add a separate Boolean flag to the Handle structure. This flag is 
initialized to false when a new directory context is created (it is not needed 
for file contexts). It is set to true when a readdir call returns NULL. Once it 
is true, no subsequent calls to readdir are to be made on that context; 
instead the next call to process_readdir will immediately return a 
SSH2_FX_EOF status.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.




More information about the openssh-bugs mailing list