I think I got it to work a little better by changing the code in
SftpSubsystem.sendAbsoluteName to as follows:

line 743:

        buffer.putString("/" + file.getPath().replace('\\', '/'));

In order to make it work correctly on *NIX systems, we might need a
check to determine whether or not we should prepend another "/" to the
path. Also, the currently checked in code puts the path into the
buffer twice. I'm not sure if that is needed.


Regards,
Sai Pullabhotla





On Wed, May 5, 2010 at 8:18 AM, Sai Pullabhotla
<sai.pullabho...@jmethods.com> wrote:
> Okay, I got the fix and was able to see the directory listing using
> FileZilla. However, a couple of issues:
>
> 1. Date/time on the files returned by the list are incorrect. Looks
> like SSHD is always sending "Jan 01 00:00" for the date times.
> 2. I could not download or upload a file. Below is the trace info from
> FileZilla. Basically, when I try to download a file, FileZilla is
> requesting the incorrect path for what so ever reason. The path it
> requests is 
> C:\Users\sai\opensource\sshd/C:\Users\sai\opensource\sshd\LICENSE.txt.
> As you can see, it is prepending the working directory to the selected
> file. I'm thinking it is due to the fact that we are sending "\" as
> the path separator instead of "/".
>
> Status: Connecting to localhost:2222...
> Trace:  Going to execute "C:\Program Files (x86)\FileZilla FTP 
> Client\fzsftp.exe"
> Response:       fzSftp started
> Trace:  CSftpControlSocket::ConnectParseResponse(fzSftp started)
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ConnectSend()
> Command:        keyfile "C:\Users\sai\temp\filezilla.ppk"
> Trace:  CSftpControlSocket::ConnectParseResponse()
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ConnectSend()
> Command:        open "p...@localhost" 2222
> Trace:  Looking up host "localhost"
> Trace:  Connecting to 127.0.0.1 port 2222
> Trace:  Server version: SSH-2.0-${POM.ARTIFACTID}-${POM.VERSION}
> Trace:  Using SSH protocol version 2
> Trace:  We claim version: SSH-2.0-PuTTY_Local:_Oct_10_2009_18:54:23
> Trace:  Using Diffie-Hellman with standard group "group14"
> Trace:  Doing Diffie-Hellman key exchange with hash SHA-1
> Command:        Trust new Hostkey: Once
> Trace:  Host key fingerprint is:
> Trace:  ssh-dss 1024 90:c8:10:01:dd:81:97:00:65:ec:c3:f9:d9:16:2d:b1
> Trace:  Initialised AES-256 CBC client->server encryption
> Trace:  Initialised HMAC-SHA1 client->server MAC algorithm
> Trace:  Initialised AES-256 CBC server->client encryption
> Trace:  Initialised HMAC-SHA1 server->client MAC algorithm
> Trace:  Successfully loaded 1 key pair from file
> Trace:  Offered public key from "C:\Users\sai\temp\filezilla.ppk"
> Trace:  Offer of public key accepted, trying to authenticate using it.
> Trace:  Access granted
> Trace:  Opened channel for session
> Trace:  Started a shell/command
> Status: Connected to SAI
> Trace:  CSftpControlSocket::ConnectParseResponse()
> Trace:  CSftpControlSocket::ResetOperation(0)
> Trace:  CControlSocket::ResetOperation(0)
> Status: Retrieving directory listing...
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ChangeDirSend()
> Command:        pwd
> Response:       Current directory is: "C:\Users\sai\opensource\sshd"
> Trace:  CSftpControlSocket::ResetOperation(0)
> Trace:  CControlSocket::ResetOperation(0)
> Trace:  CSftpControlSocket::ParseSubcommandResult(0)
> Trace:  CSftpControlSocket::ListSubcommandResult()
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ListSend()
> Command:        ls
> Status: Listing directory C:\Users\sai\opensource\sshd
> Listing:        -rw-rw-rw-   1 psai     psai          734 Jan 01 00:00 
> .classpath
> Listing:        -rw-rw-rw-   1 psai     psai           55 Jan 01 00:00 
> .gitignore
> Listing:        -rw-rw-rw-   1 psai     psai          558 Jan 01 00:00 
> .project
> Listing:        drw-rw-rw-   1 psai     psai            0 Jan 01 00:00 
> .settings
> Listing:        drw-rw-rw-   1 psai     psai         4096 Jan 01 00:00 .svn
> Listing:        drw-rw-rw-   1 psai     psai            0 Jan 01 00:00 
> assembly
> Listing:        drw-rw-rw-   1 psai     psai         4096 Jan 01 00:00 classes
> Listing:        -rw-rw-rw-   1 psai     psai          680 Jan 01 00:00 key.pem
> Listing:        -rw-rw-rw-   1 psai     psai        11359 Jan 01 00:00 
> LICENSE.txt
> Listing:        -rw-rw-rw-   1 psai     psai         3090 Jan 01 00:00 
> NOTICE.txt
> Listing:        -rw-rw-rw-   1 psai     psai         8786 Jan 01 00:00 pom.xml
> Listing:        drw-rw-rw-   1 psai     psai            0 Jan 01 00:00 src
> Listing:        drw-rw-rw-   1 psai     psai            0 Jan 01 00:00 
> sshd-core
> Listing:        drw-rw-rw-   1 psai     psai            0 Jan 01 00:00 
> sshd-pam
> Trace:  CSftpControlSocket::ListParseResponse()
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ListSend()
> Status: Calculating timezone offset of server...
> Command:        mtime ".classpath"
> Error:  get attrs for C:\Users\sai\opensource\sshd\.classpath: mtime not 
> provided
> Trace:  CSftpControlSocket::ListParseResponse()
> Trace:  CSftpControlSocket::ResetOperation(0)
> Trace:  CControlSocket::ResetOperation(0)
> Status: Directory listing successful
> Status: Connecting to localhost:2222...
> Trace:  Going to execute "C:\Program Files (x86)\FileZilla FTP 
> Client\fzsftp.exe"
> Response:       fzSftp started
> Trace:  CSftpControlSocket::ConnectParseResponse(fzSftp started)
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ConnectSend()
> Command:        keyfile "C:\Users\sai\temp\filezilla.ppk"
> Trace:  CSftpControlSocket::ConnectParseResponse()
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ConnectSend()
> Command:        open "p...@localhost" 2222
> Trace:  Looking up host "localhost"
> Trace:  Connecting to 127.0.0.1 port 2222
> Trace:  Server version: SSH-2.0-${POM.ARTIFACTID}-${POM.VERSION}
> Trace:  Using SSH protocol version 2
> Trace:  We claim version: SSH-2.0-PuTTY_Local:_Oct_10_2009_18:54:23
> Trace:  Using Diffie-Hellman with standard group "group14"
> Trace:  Doing Diffie-Hellman key exchange with hash SHA-1
> Command:        Trust new Hostkey: Once
> Trace:  Host key fingerprint is:
> Trace:  ssh-dss 1024 90:c8:10:01:dd:81:97:00:65:ec:c3:f9:d9:16:2d:b1
> Trace:  Initialised AES-256 CBC client->server encryption
> Trace:  Initialised HMAC-SHA1 client->server MAC algorithm
> Trace:  Initialised AES-256 CBC server->client encryption
> Trace:  Initialised HMAC-SHA1 server->client MAC algorithm
> Trace:  Successfully loaded 1 key pair from file
> Trace:  Offered public key from "C:\Users\sai\temp\filezilla.ppk"
> Trace:  Offer of public key accepted, trying to authenticate using it.
> Trace:  Access granted
> Trace:  Opened channel for session
> Trace:  Started a shell/command
> Status: Connected to SAI
> Trace:  CSftpControlSocket::ConnectParseResponse()
> Trace:  CSftpControlSocket::ResetOperation(0)
> Trace:  CControlSocket::ResetOperation(0)
> Trace:  CSftpControlSocket::FileTransfer(...)
> Status: Starting download of C:\Users\sai\opensource\sshd\LICENSE.txt
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  CSftpControlSocket::ChangeDirSend()
> Command:        cd "C:\Users\sai\opensource\sshd"
> Error:  Directory
> C:\Users\sai\opensource\sshd/C:\Users\sai\opensource\sshd: no such
> file or directory
> Trace:  CSftpControlSocket::ResetOperation(2)
> Trace:  CControlSocket::ResetOperation(2)
> Trace:  CSftpControlSocket::ParseSubcommandResult(2)
> Trace:  CSftpControlSocket::FileTransferSubcommandResult()
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  FileTransferSend()
> Command:        mtime "C:\Users\sai\opensource\sshd\LICENSE.txt"
> Error:  get attrs for
> C:\Users\sai\opensource\sshd/C:\Users\sai\opensource\sshd\LICENSE.txt:
> no such file or directory
> Trace:  FileTransferParseResponse()
> Trace:  CSftpControlSocket::SendNextCommand()
> Trace:  FileTransferSend()
> Command:        get "C:\Users\sai\opensource\sshd\LICENSE.txt"
> "C:\users\sai\temp\LICENSE.txt"
> Error:  C:\Users\sai\opensource\sshd/C:\Users\sai\opensource\sshd\LICENSE.txt:
> open for read: failure
> Trace:  FileTransferParseResponse()
> Trace:  CSftpControlSocket::ResetOperation(2)
> Trace:  CControlSocket::ResetOperation(2)
>
>
> Regards,
> Sai Pullabhotla
>
>
>
>
>
> On Wed, May 5, 2010 at 8:03 AM, Guillaume Nodet <gno...@gmail.com> wrote:
>> Committed at rev 941273.  Could you give it a try asap please ?  I'll wait
>> for your input before recutting the release.
>>
>> On Wed, May 5, 2010 at 15:02, Guillaume Nodet <gno...@gmail.com> wrote:
>>
>>> Argh, I committed to my git repo and forgot to push the change.
>>>
>>>
>>> On Wed, May 5, 2010 at 14:53, Sai Pullabhotla <
>>> sai.pullabho...@jmethods.com> wrote:
>>>
>>>> Is this SFTP fix checked into trunk or 0.4 tag? I do not see any
>>>> changes to the SVN.
>>>>
>>>> Regards,
>>>> Sai Pullabhotla
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, May 5, 2010 at 4:52 AM, Guillaume Nodet <gno...@gmail.com> wrote:
>>>> > I've uploaded a RC for SSHD 0.4.0 at
>>>> >  https://repository.apache.org/content/repositories/orgapachemina-008/
>>>> >
>>>> > The release notes are available at
>>>> >  https://cwiki.apache.org/SSHD/sshd-040.html
>>>> >
>>>> > Please review and vote.
>>>> >
>>>> > --
>>>> > Cheers,
>>>> > Guillaume Nodet
>>>> > ------------------------
>>>> > Blog: http://gnodet.blogspot.com/
>>>> > ------------------------
>>>> > Open Source SOA
>>>> > http://fusesource.com
>>>> >
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>> ------------------------
>>> Open Source SOA
>>> http://fusesource.com
>>>
>>>
>>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>

Reply via email to