[ 
https://issues.apache.org/jira/browse/SSHD-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022139#comment-13022139
 ] 

Otto Frost commented on SSHD-120:
---------------------------------

Correction implemented, really ugly, but the job gets done

in the SftpSubsystem class

                case SSH_FXP_READDIR: {
                        System.out.println("SftpSybsystem.process 
SSH_FXP_READDIR");
                        String handle = buffer.getString();
                        try {
                                Handle p = handles.get(handle);
                                if (!(p instanceof DirectoryHandle)) {
                                        sendStatus(id, SSH_FX_INVALID_HANDLE, 
handle);
                                } else if (((DirectoryHandle) p).isDone()) {
                                        sendStatus(id, SSH_FX_EOF, "", "");
                                } else if (!p.getFile().doesExist()) {
                                        sendStatus(id, SSH_FX_NO_SUCH_FILE, 
p.getFile()
                                                        .getAbsolutePath());
                                } else if (!p.getFile().isDirectory()) {
                                        sendStatus(id, SSH_FX_NOT_A_DIRECTORY, 
p.getFile()
                                                        .getAbsolutePath());
                                } else if (!p.getFile().isReadable()) {
                                        sendStatus(id, 
SSH_FX_PERMISSION_DENIED, p.getFile()
                                                        .getAbsolutePath());
                                } else {
                                        DirectoryHandle dh = (DirectoryHandle) 
p;
                                        List<SshFile> listSshFiles = 
dh.getFile().listSshFiles();                                        

                                        SshFile[] virtualFiles = new SshFile[1];
                                        for (int i = 0; i < 1; ++i) {
                                                virtualFiles[i] = 
listSshFiles.get(dh.getCurrentFile());
                                                dh.increaseCurrentFile();
                                        }
                                        List<SshFile> listSshFiles2 = 
Collections.unmodifiableList(Arrays.asList(virtualFiles));                      
                                                          
                                        
                                        //listSshFiles.get(index);
                                        //sendName(id, 
p.getFile().listSshFiles());
                                        sendName(id, listSshFiles2);
                                        
                                        if(dh.getCurrentFile()>= 
listSshFiles.size()){
                                          ((DirectoryHandle) p).setDone(true);
                                          //sendStatus(id,SSH_FX_EOF,"" );
                                        }
                                }
                        } catch (IOException e) {
                                sendStatus(id, SSH_FX_FAILURE, e.getMessage());
                        }
                        break;
                }




protected static class DirectoryHandle extends Handle {
                boolean done;
        int currentFile = 0;
                public DirectoryHandle(SshFile file) {
                        super(file);
                }

                public boolean isDone() {
                        return done;
                }

                public void setDone(boolean done) {
                        this.done = done;
                }
                public int getCurrentFile(){                    
                        return currentFile;
                }
                public void increaseCurrentFile(){                      
                        currentFile++;
                }
                
        }


> list 1500 files in one directory not working for mindterm sftp client
> ---------------------------------------------------------------------
>
>                 Key: SSHD-120
>                 URL: https://issues.apache.org/jira/browse/SSHD-120
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.5.0
>         Environment: windows xp professional sun jre 1.5
> windows 2003 server sun jre 1.5
> mindterm 3.4 ftp2sftp
>            Reporter: Otto Frost
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> mindterm is used in ftp2sftp mode
> trying to list files in a directory "manyfiles" with  > 1500 files doesn't 
> work on the "apache mina sshd"
> when doing the following operation it doesn't work. In the "manyfiles" dir 
> there are >1500 files.
> mindterm can list files in a directory with < 50 files
> mindterm can list files on a opensshd server with a directory with > 1500 
> files, therefore we think the error is in the "apache mina sshd" and not in 
> mindterm, at least there is some incompatibility...
> ftp> o localhost 2120
> Connected to WKE198515.u-dom1.u-ssi.net.
> 220 FTPToSFTPProxy use 'ssh2-user@ssh2-host[:port]' as your username or 
> ;ssh2-us
> er;keyfile;10@ssh2-host[:port]
> User (WKE198515.u-dom1.u-ssi.net:(none)): a@localhost:2222
> 331 Password required for a@localhost:2222.
> Password:
> 230 User a@localhost:2222 logged in.
> ftp> cd ../../../tst/manyfiles
> 250 CWD command successful.
> ftp> ls
> 200 PORT command successful.
> 150 Opening ASCII mode data connection for nlst.
> Connection closed by remote host.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to