Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file names are not represented correctly in SFTP subsystem #48

Closed
terrafrost opened this issue Dec 9, 2015 · 2 comments
Closed

file names are not represented correctly in SFTP subsystem #48

terrafrost opened this issue Dec 9, 2015 · 2 comments
Assignees

Comments

@terrafrost
Copy link

I installed this on my local machine and then SSH'd into it. I initialized the SFTP subsystem and then tried to get the canonicalized absolute pathname for the current working directory (.) by sending a SSH_FXP_REALPATH packet. I got C:/Users/My Username back. This path is malformed per the SFTP specs. Quoting http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.2 ,

   This protocol represents file names as strings.  File names are
   assumed to use the slash ('/') character as a directory separator.

   File names starting with a slash are "absolute", and are relative to
   the root of the file system.  Names starting with any other character
   are relative to the user's default directory (home directory).  Note
   that identifying the user is assumed to take place outside of this
   protocol.

C:/Users/My Username does not start with a slash and so it is not, per the SFTP specs, absolute to the root of the file system.

Among other problems this causes is that WinSCP can't open up any subdirectory in the C:/Users/My Username directory.

Here's a copy of the SFTP logs:

-> NET_SFTP_INIT (0.0002s)
00000000  00:00:00:03                                      ....

<- NET_SFTP_VERSION (0.0118s)
00000000  00:00:00:03:00:00:00:18:70:6f:73:69:78:2d:72:65  ........posix-re
00000010  6e:61:6d:65:40:6f:70:65:6e:73:73:68:2e:63:6f:6d  name@openssh.com
00000020  00:00:00:01:31:00:00:00:13:73:74:61:74:76:66:73  ....1....statvfs
00000030  40:6f:70:65:6e:73:73:68:2e:63:6f:6d:00:00:00:01  @openssh.com....
00000040  32:00:00:00:14:66:73:74:61:74:76:66:73:40:6f:70  2....fstatvfs@op
00000050  65:6e:73:73:68:2e:63:6f:6d:00:00:00:01:32:00:00  enssh.com....2..
00000060  00:14:68:61:72:64:6c:69:6e:6b:40:6f:70:65:6e:73  ..hardlink@opens
00000070  73:68:2e:63:6f:6d:00:00:00:01:31:00:00:00:11:66  sh.com....1....f
00000080  73:79:6e:63:40:6f:70:65:6e:73:73:68:2e:63:6f:6d  sync@openssh.com
00000090  00:00:00:01:31                                   ....1

-> NET_SFTP_REALPATH (0.0001s)
00000000  00:00:00:01:2e                                   .....

<- NET_SFTP_NAME (0.0006s)
00000000  00:00:00:01:00:00:00:14:43:3a:2f:55:73:65:72:73  ........C:/Users
00000010  2f:4d:79:20:55:73:65:72:6e:61:6d:65:00:00:00:14  /My Username....
00000020  43:3a:2f:55:73:65:72:73:2f:4d:79:20:55:73:65:72  C:/Users/My User
00000030  6e:61:6d:65:00:00:00:00                          name....

Maybe what ya'll could do is return something like /C/Users/My Username or something.

@terrafrost terrafrost changed the title file names are not represented correctly file names are not represented correctly in SFTP subsystem Dec 9, 2015
@quamrulmina
Copy link
Contributor

Fixed to meet SFTP spec by having all paths start with a slash '/'. Win32 sftp-server now sends paths with a slash at the start. /C:/Users/John will be transmitted as the path to sftp clients when a typical user John directory is at C:/Users/John .

@quamrulmina
Copy link
Contributor

Fixed to meet SFTP spec by having all paths start with a slash '/' .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants