symlink-order@rjk.greenend.org.uk

Specification

This is an SFTP extension that may be included in the SSH_FXP_VERSION response. It has the following format:

string "symlink-order@rjk.greenend.org.uk"
string argument-order

argument-order MUST be one of the strings linkpath-targetpath or targetpath-linkpath.

If it is linkpath-targetpath then the server MUST implement SSH_FXP_SYMLINK as specified in the SFTP drafts. The first argument, called linkpath, is the path to the newly created file to be created and the second argument, called targetpath, is the contents of the symbolic link. Note that this is the opposite order to the POSIX symlink() function and ln command.

If on the other hand the value is targetpath-linkpath then the server MUST use the opposite argument order. The first argument will be targetpath and will be the contents of the newly created link while the second argument will be linkpath and will be the path of the newly created file. This is the same order as the POSIX symlink() function and ln command.

This extension does not apply to the SSH_FXP_LINK command. Instead the alternative extension link-order@rjk.greenend.org.uk may be sent but it is suggested that implementors take the opportunity of the transition to the new SSH_FXP_LINK command to correct their code.

Note however that it is worth including both extensions in v6 responses, since the client may then use version-select to downgrade to an earlier protocol version.

Rationale

At the time of writing, deployed clients expect both possible behaviours from servers. This represents a puzzle for server implementors: which set of clients should they support? It also represents a barrier to existing servers switching to the specified argument ordering if they have it the other way round: deployed clients that formerly worked will then break.

By allowing servers to document their behaviour to clients, it becomes possible for clients to function with both flavours of server with a relatively simple modification. While this still requires servers and clients to be upgraded in order to reach a point where it's possible to reliably create symbolic links over SFTP, it does mean that the upgrades won't break deployed software.

SFTP Versions | RJK | Contents