On Sun, Aug 18, 2024, at 11:57 PM, Paul Gilmartin wrote:
> What states result from:
>     cd /-   (server) and

The sftp protocol doesn't have a cd command.   A "stat" command(packet) for 
"/-" would return the status of the root file or directory named "-".    If the 
response to stat is a directory, then the client keeps track of "-" as the 
remote cwd.

>     lcd //   (client)?

Which client implementation of sftp?  l(ocal) commands are client-only 
implementations.
For the Co:Z SFTP client, this returns an error, since we don't allow you to 
change to the dataset filesystem root; you need at minimum a HLQ.

> In those states, what do pwd, lpwd, ! pwd, ls, ! ls,  ...
> variously show?
> 
> In particular, it appears on my desktop system, lcd //
> causes the client to do a chdir(), and the following ! ls
> causes a shell escape listing the root contents.
> 

The sftp protocol doesn't have a "pwd" packet.   I can't answer what your 
particular client is doing for l(ocal) commands, but it probably cleans the 
path with "realpath()".    That is what OpenSSH sftp client does.   But:  the 
OpenSSH sftp client does not touch "//foo" when it sends it through the sftp 
protocol to the server, which is consistent with the spec.   

https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02

FWIW, on my linux desktop:

$ cd '//'
$ pwd
//
$ realpath '//'
/

Kirk Wolf
Dovetailed Technologies
http://coztoolkit.com


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to