[Bug 1375] New: sftp-client leaks handles on failure to open local file

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Tue Oct 16 04:20:06 EST 2007


https://bugzilla.mindrot.org/show_bug.cgi?id=1375

           Summary: sftp-client leaks handles on failure to open local file
    Classification: Unclassified
           Product: Portable OpenSSH
           Version: 4.7p1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: sftp
        AssignedTo: bitbucket at mindrot.org
        ReportedBy: sworley at chkno.net


Created an attachment (id=1362)
 --> (http://bugzilla.mindrot.org/attachment.cgi?id=1362)
do_close(handle) on local file open failure

I get "Couldn't get handle: Failure" after N failures to open local
files for writing where N = 100 on OpenBSD and N = 200 on GNU/Linux.


To reproduce:
bash-3.2$ ssh otherhost
otherhost$ mkdir test
otherhost$ cd test
otherhost$ touch {1000..1120}
otherhost$ logout
Connection to otherhost closed.
bash-3.2$ mkdir test
bash-3.2$ cd test
bash-3.2$ touch {1000..1110}
bash-3.2$ chmod 400 *
bash-3.2$ sftp otherhost
Connecting to otherhost...
sftp> cd test
sftp> get *
Fetching /home/user/test/1000 to 1000
Couldn't open local file "1000" for writing: Permission denied
Fetching /home/user/test/1001 to 1001
Couldn't open local file "1001" for writing: Permission denied
...
Fetching /home/user/test/1099 to 1099
Couldn't open local file "1099" for writing: Permission denied
Fetching /home/user/test/1100 to 1100
Couldn't get handle: Failure
Fetching /home/user/test/1101 to 1101
Couldn't get handle: Failure
...
Fetching /home/user/test/1120 to 1120
Couldn't get handle: Failure
sftp> ls
Couldn't get handle: Failure




The attached patch seems to fix the problem.

-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list